spec/api/payment_service_spec.rb in adyen-1.3.2 vs spec/api/payment_service_spec.rb in adyen-1.4.0

- old
+ new

@@ -21,10 +21,19 @@ text('./payment:shopperReference').should == 'user-id' text('./payment:shopperEmail').should == 's.hopper@example.com' text('./payment:shopperIP').should == '61.294.12.12' text('./payment:shopperStatement').should == 'invoice number 123456' end + + it "includes the fraud offset" do + text('./payment:fraudOffset').should == '30' + end + + it "does not include the fraud offset if none is given" do + @payment.params.delete(:fraud_offset) + xpath('./payment:fraudOffset').should be_empty + end it "only includes shopper details for given parameters" do # TODO pretty lame, but for now it will do unless @method == "authorise_one_click_payment_request_body" || @method == "authorise_recurring_payment_request_body" @payment.params[:shopper].delete(:reference) @@ -84,11 +93,12 @@ # Maestro UK/Solo only #:issue_number => , #:start_month => , #:start_year => , }, - :recurring_detail_reference => 'RecurringDetailReference1' + :recurring_detail_reference => 'RecurringDetailReference1', + :fraud_offset => 30 } @payment = @object = Adyen::API::PaymentService.new(@params) end describe_request_body_of :authorise_payment do @@ -101,10 +111,14 @@ it_should_validate_request_param(:shopper) do @payment.params[:recurring] = true @payment.params[:shopper] = nil end + + it_should_validate_request_param(:fraud_offset) do + @payment.params[:fraud_offset] = '' + end [:reference, :email].each do |attr| it_should_validate_request_param(:shopper) do @payment.params[:recurring] = true @payment.params[:shopper][attr] = '' @@ -231,10 +245,11 @@ describe_request_body_of :authorise_recurring_payment do it_should_behave_like "recurring payment requests" it_should_validate_request_parameters :merchant_account, :reference, + :fraud_offset, :amount => [:currency, :value], :shopper => [:reference, :email] it "includes the contract type, which is `RECURRING'" do text('./payment:recurring/payment:contract').should == 'RECURRING' @@ -267,9 +282,10 @@ it_should_behave_like "recurring payment requests" it_should_validate_request_parameters :merchant_account, :reference, :recurring_detail_reference, + :fraud_offset, :amount => [:currency, :value], :shopper => [:reference, :email], :card => [:cvc] it "includes the contract type, which is `ONECLICK'" do