Sha256: df418db01ad28a7e3168a75be5e023e25d8c8142059471aa91ee31aae0674d2c

Contents?: true

Size: 962 Bytes

Versions: 6

Compression:

Stored size: 962 Bytes

Contents

require "spec_helper"

describe AdaptivePayments::ConvertCurrencyRequest do
  it_behaves_like "a RequestEnvelope"

  subject         { AdaptivePayments::ConvertCurrencyRequest }
  its(:operation) { should == :ConvertCurrency }

  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
    json["baseAmountList"]["currency"][0]["amount"].should == "14.99"
  end

  it "maps #currency.first.amount to ['baseAmountList']['currency'][1]['amount']" do
    json["baseAmountList"]["currency"][1]["amount"].should == "129.99"
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
pp-adaptive-1.0.0 spec/public/convert_currency_request_spec.rb
pp-adaptive-0.0.6 spec/public/convert_currency_request_spec.rb
pp-adaptive-0.0.5 spec/public/convert_currency_request_spec.rb
pp-adaptive-0.0.4 spec/public/convert_currency_request_spec.rb
pp-adaptive-0.0.3 spec/public/convert_currency_request_spec.rb
pp-adaptive-0.0.2 spec/public/convert_currency_request_spec.rb