Sha256: efc8f21edaf282944eb297c64814247b6334e3cc1daeee0becca9e327ca6596b

Contents?: true

Size: 1.01 KB

Versions: 1

Compression:

Stored size: 1.01 KB

Contents

require "spec_helper"

describe AdaptivePayments::ConvertCurrencyRequest do
  it_behaves_like "a RequestEnvelope"

  subject         { AdaptivePayments::ConvertCurrencyRequest }

  describe '#operation' do
    subject { super().operation }
    it { is_expected.to eq(:ConvertCurrency) }
  end

  let(:request) do
    AdaptivePayments::ConvertCurrencyRequest.new(
      :currencies            => [ { :amount =>  '14.99', :code => 'USD' },
                                  { :amount => '129.99', :code => 'USD' } ],
      :convert_to_currencies => ['JPY'],
      :country_code          => 'JP',
      :conversion_type       => 'SENDER_SIDE'
    )
  end

  let(:json) { JSON.parse(request.to_json) }

  it "maps #currency.first.amount to ['baseAmountList']['currency'][0]['amount']" do
    expect(json["baseAmountList"]["currency"][0]["amount"]).to eq("14.99")
  end

  it "maps #currency.first.amount to ['baseAmountList']['currency'][1]['amount']" do
    expect(json["baseAmountList"]["currency"][1]["amount"]).to eq("129.99")
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
creative-pp-adaptive-1.1.1 spec/public/convert_currency_request_spec.rb