spec/paypal/payment/request_spec.rb in paypal-express-0.2.6 vs spec/paypal/payment/request_spec.rb in paypal-express-0.2.7
- old
+ new
@@ -1,11 +1,13 @@
require 'spec_helper.rb'
describe Paypal::Payment::Request do
let :instant_request do
Paypal::Payment::Request.new(
- :amount => 23.8,
+ :amount => 25.7,
+ :tax_amount => 0.4,
+ :shipping_amount => 1.5,
:currency_code => :JPY,
:description => 'Instant Payment Request',
:notify_url => 'http://merchant.example.com/notify',
:items => [{
:quantity => 2,
@@ -14,11 +16,11 @@
:amount => 10.25
}, {
:quantity => 3,
:name => 'Item2',
:description => 'Awesome Item 2!',
- :amount => 1.1
+ :amount => 1.1
}]
)
end
let :recurring_request do
@@ -29,11 +31,13 @@
)
end
describe '.new' do
it 'should handle Instant Payment parameters' do
- instant_request.amount.should == 23.8
+ instant_request.amount.total.should == 25.7
+ instant_request.amount.tax.should == 0.4
+ instant_request.amount.shipping.should == 1.5
instant_request.currency_code.should == :JPY
instant_request.description.should == 'Instant Payment Request'
instant_request.notify_url.should == 'http://merchant.example.com/notify'
end
@@ -45,11 +49,13 @@
end
describe '#to_params' do
it 'should handle Instant Payment parameters' do
instant_request.to_params.should == {
- :PAYMENTREQUEST_0_AMT => "23.80",
+ :PAYMENTREQUEST_0_AMT => "25.70",
+ :PAYMENTREQUEST_0_TAXAMT => "0.40",
+ :PAYMENTREQUEST_0_SHIPPINGAMT => "1.50",
:PAYMENTREQUEST_0_CURRENCYCODE => :JPY,
:PAYMENTREQUEST_0_DESC => "Instant Payment Request",
:PAYMENTREQUEST_0_NOTIFYURL => "http://merchant.example.com/notify",
:PAYMENTREQUEST_0_ITEMAMT => "23.80",
:L_PAYMENTREQUEST_0_NAME0 => "Item1",
@@ -64,9 +70,11 @@
end
it 'should handle Recurring Payment parameters' do
recurring_request.to_params.should == {
:PAYMENTREQUEST_0_AMT => "0.00",
+ :PAYMENTREQUEST_0_TAXAMT => "0.00",
+ :PAYMENTREQUEST_0_SHIPPINGAMT => "0.00",
:PAYMENTREQUEST_0_CURRENCYCODE => :JPY,
:L_BILLINGTYPE0 => :RecurringPayments,
:L_BILLINGAGREEMENTDESCRIPTION0 => "Recurring Payment Request"
}
end