spec/api/recurring_service_spec.rb in adyen-1.2.0 vs spec/api/recurring_service_spec.rb in adyen-1.3.0
- old
+ new
@@ -25,10 +25,18 @@
:cvc => '737',
# Maestro UK/Solo only
#:issue_number => ,
#:start_month => ,
#:start_year => ,
+ },
+ # German's Direct Debit (Elektronisches Lastschriftverfahren)
+ :elv => {
+ :holder_name => 'Simon わくわく Hopper',
+ :number => '1234567890',
+ :bank_location => 'Berlin',
+ :bank_location_id => '12345678',
+ :bank_name => 'TestBank',
}
}
@recurring = @object = Adyen::API::RecurringService.new(@params)
end
@@ -65,17 +73,17 @@
:variant => 'mc',
:creation_date => DateTime.parse('2009-10-27T11:50:12.178+01:00')
},
{
:bank => {
- :bank_account_number => '123456789',
+ :number => '123456789',
:bank_location_id => 'bank-location-id',
:bank_name => 'AnyBank',
:bic => 'BBBBCCLLbbb',
:country_code => 'NL',
:iban => 'NL69PSTB0001234567',
- :owner_name => 'S. Hopper'
+ :holder_name => 'S. Hopper'
},
:recurring_detail_reference => 'RecurringDetailReference2',
:variant => 'IDEAL',
:creation_date => DateTime.parse('2009-10-27T11:26:22.216+01:00')
},
@@ -153,9 +161,41 @@
end
it "formats the creditcard’s expiry month as a two digit number" do
@recurring.params[:card][:expiry_month] = 6
text('./recurring:card/payment:expiryMonth').should == '06'
+ end
+
+ it "includes the necessary recurring and one-click contract info if the `:recurring' param is truthful" do
+ text('./recurring:recurring/payment:contract').should == 'RECURRING'
+ end
+ end
+
+ describe_request_body_of :store_token, '//recurring:storeToken/recurring:request' do
+ it_should_validate_request_parameters :merchant_account,
+ :shopper => [:email, :reference]
+
+ it "includes the merchant account handle" do
+ text('./recurring:merchantAccount').should == 'SuperShopper'
+ end
+
+ it "includes the shopper’s reference" do
+ text('./recurring:shopperReference').should == 'user-id'
+ end
+
+ it "includes the shopper’s email" do
+ text('./recurring:shopperEmail').should == 's.hopper@example.com'
+ end
+
+ it "includes the ELV details" do
+ xpath('./recurring:elv') do |elv|
+ # there's no reason why Nokogiri should escape these characters, but as long as they're correct
+ elv.text('./payment:accountHolderName').should == 'Simon わくわく Hopper'
+ elv.text('./payment:bankAccountNumber').should == '1234567890'
+ elv.text('./payment:bankLocation').should == 'Berlin'
+ elv.text('./payment:bankLocationId').should == '12345678'
+ elv.text('./payment:bankName').should == 'TestBank'
+ end
end
it "includes the necessary recurring and one-click contract info if the `:recurring' param is truthful" do
text('./recurring:recurring/payment:contract').should == 'RECURRING'
end