braintree 3.2.0 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/braintree.gemspec +3 -3
- data/lib/braintree.rb +6 -1
- data/lib/braintree/account_updater_daily_report.rb +1 -1
- data/lib/braintree/address.rb +2 -1
- data/lib/braintree/apple_pay.rb +1 -1
- data/lib/braintree/apple_pay_card.rb +1 -1
- data/lib/braintree/apple_pay_options.rb +1 -1
- data/lib/braintree/authorization_adjustment.rb +1 -1
- data/lib/braintree/client_token.rb +1 -1
- data/lib/braintree/configuration.rb +11 -11
- data/lib/braintree/connected_merchant_paypal_status_changed.rb +1 -1
- data/lib/braintree/connected_merchant_status_transitioned.rb +1 -1
- data/lib/braintree/credit_card.rb +2 -2
- data/lib/braintree/credit_card_gateway.rb +14 -4
- data/lib/braintree/credit_card_verification.rb +5 -5
- data/lib/braintree/credit_card_verification_search.rb +1 -1
- data/lib/braintree/customer.rb +6 -4
- data/lib/braintree/customer_gateway.rb +2 -0
- data/lib/braintree/customer_search.rb +1 -1
- data/lib/braintree/disbursement.rb +1 -1
- data/lib/braintree/dispute.rb +15 -1
- data/lib/braintree/dispute/paypal_message.rb +15 -0
- data/lib/braintree/dispute_gateway.rb +2 -2
- data/lib/braintree/dispute_search.rb +3 -2
- data/lib/braintree/document_upload.rb +1 -1
- data/lib/braintree/error_codes.rb +10 -6
- data/lib/braintree/google_pay_card.rb +1 -1
- data/lib/braintree/granted_payment_instrument_update.rb +1 -1
- data/lib/braintree/graphql_client.rb +7 -7
- data/lib/braintree/http.rb +3 -3
- data/lib/braintree/local_payment_completed.rb +1 -1
- data/lib/braintree/local_payment_reversed.rb +19 -0
- data/lib/braintree/merchant.rb +1 -1
- data/lib/braintree/merchant_account.rb +1 -1
- data/lib/braintree/merchant_account_gateway.rb +1 -1
- data/lib/braintree/merchant_gateway.rb +1 -1
- data/lib/braintree/modification.rb +1 -1
- data/lib/braintree/oauth_credentials.rb +1 -1
- data/lib/braintree/oauth_gateway.rb +5 -5
- data/lib/braintree/payment_instrument_type.rb +10 -10
- data/lib/braintree/payment_method_gateway.rb +10 -7
- data/lib/braintree/payment_method_nonce.rb +7 -4
- data/lib/braintree/payment_method_nonce_details.rb +37 -0
- data/lib/braintree/payment_method_nonce_details_payer_info.rb +32 -0
- data/lib/braintree/payment_method_nonce_gateway.rb +1 -1
- data/lib/braintree/plan.rb +1 -1
- data/lib/braintree/processor_response_types.rb +3 -3
- data/lib/braintree/revoked_payment_method_metadata.rb +1 -1
- data/lib/braintree/risk_data.rb +3 -1
- data/lib/braintree/samsung_pay_card.rb +1 -1
- data/lib/braintree/settlement_batch_summary.rb +2 -2
- data/lib/braintree/subscription.rb +6 -6
- data/lib/braintree/three_d_secure_info.rb +22 -12
- data/lib/braintree/transaction.rb +32 -24
- data/lib/braintree/transaction_gateway.rb +24 -5
- data/lib/braintree/transaction_line_item.rb +1 -1
- data/lib/braintree/transaction_search.rb +3 -1
- data/lib/braintree/unknown_payment_method.rb +1 -1
- data/lib/braintree/us_bank_account.rb +3 -3
- data/lib/braintree/us_bank_account_verification.rb +1 -1
- data/lib/braintree/us_bank_account_verification_gateway.rb +1 -1
- data/lib/braintree/util.rb +4 -4
- data/lib/braintree/venmo_account.rb +1 -1
- data/lib/braintree/version.rb +1 -1
- data/lib/braintree/visa_checkout_card.rb +2 -2
- data/lib/braintree/webhook_notification.rb +30 -20
- data/lib/braintree/webhook_notification_gateway.rb +5 -5
- data/lib/braintree/webhook_testing_gateway.rb +30 -0
- data/lib/braintree/xml/generator.rb +5 -4
- data/lib/braintree/xml/libxml.rb +0 -1
- data/lib/braintree/xml/parser.rb +22 -12
- data/lib/braintree/xml/rexml.rb +70 -0
- data/spec/integration/braintree/add_on_spec.rb +1 -1
- data/spec/integration/braintree/address_spec.rb +28 -24
- data/spec/integration/braintree/advanced_search_spec.rb +45 -45
- data/spec/integration/braintree/apple_pay_spec.rb +3 -3
- data/spec/integration/braintree/braintree_gateway_spec.rb +2 -1
- data/spec/integration/braintree/client_api/client_token_spec.rb +14 -14
- data/spec/integration/braintree/client_api/spec_helper.rb +5 -5
- data/spec/integration/braintree/credit_card_spec.rb +213 -122
- data/spec/integration/braintree/credit_card_verification_search_spec.rb +2 -2
- data/spec/integration/braintree/credit_card_verification_spec.rb +1 -1
- data/spec/integration/braintree/customer_search_spec.rb +8 -8
- data/spec/integration/braintree/customer_spec.rb +282 -165
- data/spec/integration/braintree/dispute_search_spec.rb +28 -3
- data/spec/integration/braintree/dispute_spec.rb +6 -6
- data/spec/integration/braintree/error_codes_spec.rb +1 -1
- data/spec/integration/braintree/http_spec.rb +2 -2
- data/spec/integration/braintree/merchant_account_spec.rb +25 -26
- data/spec/integration/braintree/merchant_spec.rb +14 -14
- data/spec/integration/braintree/oauth_spec.rb +11 -11
- data/spec/integration/braintree/payment_method_nonce_spec.rb +28 -35
- data/spec/integration/braintree/payment_method_spec.rb +269 -165
- data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +9 -9
- data/spec/integration/braintree/paypal_account_spec.rb +28 -28
- data/spec/integration/braintree/samsung_pay_card_spec.rb +9 -9
- data/spec/integration/braintree/settlement_batch_summary_spec.rb +8 -8
- data/spec/integration/braintree/subscription_spec.rb +133 -133
- data/spec/integration/braintree/test/transaction_amounts_spec.rb +2 -2
- data/spec/integration/braintree/test_transaction_spec.rb +10 -10
- data/spec/integration/braintree/transaction_search_spec.rb +93 -67
- data/spec/integration/braintree/transaction_spec.rb +574 -360
- data/spec/integration/braintree/transaction_us_bank_account_spec.rb +20 -20
- data/spec/integration/braintree/us_bank_account_spec.rb +6 -6
- data/spec/integration/braintree/us_bank_account_verification_search_spec.rb +7 -7
- data/spec/integration/braintree/us_bank_account_verification_spec.rb +8 -8
- data/spec/integration/braintree/visa_checkout_card_spec.rb +5 -5
- data/spec/integration/spec_helper.rb +9 -3
- data/spec/oauth_test_helper.rb +1 -1
- data/spec/script/httpsd.rb +6 -6
- data/spec/spec_helper.rb +6 -3
- data/spec/unit/braintree/address_spec.rb +1 -1
- data/spec/unit/braintree/apple_pay_card_spec.rb +1 -1
- data/spec/unit/braintree/client_token_spec.rb +2 -2
- data/spec/unit/braintree/configuration_spec.rb +42 -42
- data/spec/unit/braintree/credit_card_spec.rb +13 -13
- data/spec/unit/braintree/credit_card_verification_search_spec.rb +1 -1
- data/spec/unit/braintree/credit_card_verification_spec.rb +8 -4
- data/spec/unit/braintree/customer_spec.rb +20 -10
- data/spec/unit/braintree/disbursement_spec.rb +7 -7
- data/spec/unit/braintree/dispute_search_spec.rb +1 -0
- data/spec/unit/braintree/dispute_spec.rb +34 -9
- data/spec/unit/braintree/error_result_spec.rb +5 -5
- data/spec/unit/braintree/errors_spec.rb +8 -8
- data/spec/unit/braintree/http_spec.rb +5 -5
- data/spec/unit/braintree/merchant_account_spec.rb +1 -1
- data/spec/unit/braintree/payment_method_nonce_details_payer_info_spec.rb +31 -0
- data/spec/unit/braintree/payment_method_nonce_details_spec.rb +43 -0
- data/spec/unit/braintree/payment_method_nonce_spec.rb +40 -0
- data/spec/unit/braintree/payment_method_spec.rb +1 -1
- data/spec/unit/braintree/paypal_account_spec.rb +2 -2
- data/spec/unit/braintree/resource_collection_spec.rb +9 -9
- data/spec/unit/braintree/risk_data_spec.rb +9 -5
- data/spec/unit/braintree/subscription_search_spec.rb +1 -1
- data/spec/unit/braintree/successful_result_spec.rb +1 -1
- data/spec/unit/braintree/three_d_secure_info_spec.rb +32 -14
- data/spec/unit/braintree/transaction/credit_card_details_spec.rb +3 -3
- data/spec/unit/braintree/transaction/customer_details_spec.rb +1 -1
- data/spec/unit/braintree/transaction/deposit_details_spec.rb +2 -2
- data/spec/unit/braintree/transaction/paypal_details_spec.rb +1 -1
- data/spec/unit/braintree/transaction_search_spec.rb +12 -12
- data/spec/unit/braintree/transaction_spec.rb +25 -17
- data/spec/unit/braintree/util_spec.rb +18 -18
- data/spec/unit/braintree/validation_error_collection_spec.rb +36 -36
- data/spec/unit/braintree/webhook_notification_spec.rb +88 -56
- data/spec/unit/braintree/xml/rexml_spec.rb +51 -0
- data/spec/unit/braintree/xml_spec.rb +31 -31
- metadata +16 -8
- data/lib/braintree/settlement_batch.rb +0 -0
@@ -24,7 +24,7 @@ describe Braintree::Transaction do
|
|
24
24
|
:country_code_alpha2 => "BT",
|
25
25
|
:country_code_alpha3 => "BTN",
|
26
26
|
:country_code_numeric => "064"
|
27
|
-
}
|
27
|
+
},
|
28
28
|
)
|
29
29
|
result.success?.should == true
|
30
30
|
|
@@ -34,7 +34,7 @@ describe Braintree::Transaction do
|
|
34
34
|
:channel => "MyShoppingCartProvider",
|
35
35
|
:options => {
|
36
36
|
:submit_for_settlement => false
|
37
|
-
}
|
37
|
+
},
|
38
38
|
)
|
39
39
|
clone_result.success?.should == true
|
40
40
|
|
@@ -67,7 +67,7 @@ describe Braintree::Transaction do
|
|
67
67
|
:credit_card => {
|
68
68
|
:number => "5105105105105100",
|
69
69
|
:expiration_date => "05/2012"
|
70
|
-
}
|
70
|
+
},
|
71
71
|
)
|
72
72
|
|
73
73
|
result.success?.should be(true)
|
@@ -84,7 +84,7 @@ describe Braintree::Transaction do
|
|
84
84
|
:credit_card => {
|
85
85
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
86
86
|
:expiration_date => "05/2009"
|
87
|
-
}
|
87
|
+
},
|
88
88
|
)
|
89
89
|
result = Braintree::Transaction.clone_transaction(transaction.id, :amount => "112.44")
|
90
90
|
result.success?.should be(false)
|
@@ -100,7 +100,7 @@ describe Braintree::Transaction do
|
|
100
100
|
:credit_card => {
|
101
101
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
102
102
|
:expiration_date => "05/2009"
|
103
|
-
}
|
103
|
+
},
|
104
104
|
)
|
105
105
|
clone_transaction = Braintree::Transaction.clone_transaction!(transaction.id, :amount => "112.44", :options => {:submit_for_settlement => false})
|
106
106
|
clone_transaction.id.should_not == transaction.id
|
@@ -112,7 +112,7 @@ describe Braintree::Transaction do
|
|
112
112
|
:credit_card => {
|
113
113
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
114
114
|
:expiration_date => "05/2009"
|
115
|
-
}
|
115
|
+
},
|
116
116
|
)
|
117
117
|
expect do
|
118
118
|
clone_transaction = Braintree::Transaction.clone_transaction!(transaction.id, :amount => "im not a number")
|
@@ -123,26 +123,28 @@ describe Braintree::Transaction do
|
|
123
123
|
|
124
124
|
describe "self.create" do
|
125
125
|
describe "risk data" do
|
126
|
-
it "returns decision, device_data_captured and
|
127
|
-
|
126
|
+
it "returns decision, device_data_captured, id, transaction_risk_score, and decision_reasons" do
|
127
|
+
with_fraud_protection_enterprise_merchant do
|
128
128
|
result = Braintree::Transaction.create(
|
129
129
|
:type => "sale",
|
130
130
|
:amount => 1_00,
|
131
131
|
:credit_card => {
|
132
132
|
:number => Braintree::Test::CreditCardNumbers::CardTypeIndicators::Prepaid,
|
133
133
|
:expiration_date => "05/2009"
|
134
|
-
}
|
134
|
+
},
|
135
135
|
)
|
136
136
|
result.transaction.risk_data.should be_a(Braintree::RiskData)
|
137
|
-
result.transaction.risk_data.
|
138
|
-
result.transaction.risk_data.
|
139
|
-
result.transaction.risk_data.
|
140
|
-
result.transaction.risk_data.
|
137
|
+
result.transaction.risk_data.id.should_not be_nil
|
138
|
+
result.transaction.risk_data.decision.should_not be_nil
|
139
|
+
result.transaction.risk_data.decision_reasons.should_not be_nil
|
140
|
+
expect(result.transaction.risk_data).to respond_to(:device_data_captured)
|
141
|
+
expect(result.transaction.risk_data).to respond_to(:fraud_service_provider)
|
142
|
+
expect(result.transaction.risk_data).to respond_to(:transaction_risk_score)
|
141
143
|
end
|
142
144
|
end
|
143
145
|
|
144
146
|
it "handles validation errors for invalid risk data attributes" do
|
145
|
-
|
147
|
+
with_advanced_fraud_kount_integration_merchant do
|
146
148
|
result = Braintree::Transaction.create(
|
147
149
|
:type => "sale",
|
148
150
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
@@ -156,7 +158,7 @@ describe Braintree::Transaction do
|
|
156
158
|
:customer_ip => "192.168.0.1",
|
157
159
|
:customer_location_zip => "not-a-$#phone",
|
158
160
|
:customer_tenure => "20#{"0" * 500}"
|
159
|
-
}
|
161
|
+
},
|
160
162
|
)
|
161
163
|
result.success?.should == false
|
162
164
|
result.errors.for(:transaction).for(:risk_data).on(:customer_device_id).map { |e| e.code }.should include Braintree::ErrorCodes::RiskData::CustomerDeviceIdIsTooLong
|
@@ -174,7 +176,7 @@ describe Braintree::Transaction do
|
|
174
176
|
:credit_card => {
|
175
177
|
:number => Braintree::Test::CreditCardNumbers::CardTypeIndicators::Prepaid,
|
176
178
|
:expiration_date => "05/2009"
|
177
|
-
}
|
179
|
+
},
|
178
180
|
)
|
179
181
|
result.transaction.credit_card_details.prepaid.should == Braintree::CreditCard::Prepaid::Yes
|
180
182
|
result.transaction.payment_instrument_type.should == Braintree::PaymentInstrumentType::CreditCard
|
@@ -250,7 +252,7 @@ describe Braintree::Transaction do
|
|
250
252
|
},
|
251
253
|
],
|
252
254
|
}
|
253
|
-
}
|
255
|
+
},
|
254
256
|
)
|
255
257
|
result.success?.should be(true)
|
256
258
|
end
|
@@ -277,15 +279,15 @@ describe Braintree::Transaction do
|
|
277
279
|
},
|
278
280
|
],
|
279
281
|
}
|
280
|
-
}
|
282
|
+
},
|
281
283
|
)
|
282
284
|
result.success?.should be(false)
|
283
285
|
invalid_folio = Braintree::ErrorCodes::Transaction::Industry::Lodging::FolioNumberIsInvalid
|
284
286
|
check_out_date_must_follow_check_in_date = Braintree::ErrorCodes::Transaction::Industry::Lodging::CheckOutDateMustFollowCheckInDate
|
285
287
|
room_rate_format_is_invalid = Braintree::ErrorCodes::Transaction::Industry::Lodging::RoomRateFormatIsInvalid
|
286
288
|
invalid_additional_charge_kind = Braintree::ErrorCodes::Transaction::Industry::AdditionalCharge::KindIsInvalid
|
287
|
-
result.errors.for(:transaction).for(:industry).map { |e| e.code }.sort.should include
|
288
|
-
result.errors.for(:transaction).for(:industry).for(:additional_charges).for(:index_0).on(:kind).map { |e| e.code }.sort.should include
|
289
|
+
result.errors.for(:transaction).for(:industry).map { |e| e.code }.sort.should include(*[invalid_folio, check_out_date_must_follow_check_in_date, room_rate_format_is_invalid])
|
290
|
+
result.errors.for(:transaction).for(:industry).for(:additional_charges).for(:index_0).on(:kind).map { |e| e.code }.sort.should include(*[invalid_additional_charge_kind])
|
289
291
|
end
|
290
292
|
end
|
291
293
|
|
@@ -307,7 +309,7 @@ describe Braintree::Transaction do
|
|
307
309
|
:lodging_check_out_date => "2014-07-07",
|
308
310
|
:lodging_name => "Royal Caribbean",
|
309
311
|
}
|
310
|
-
}
|
312
|
+
},
|
311
313
|
)
|
312
314
|
result.success?.should be(true)
|
313
315
|
end
|
@@ -325,7 +327,7 @@ describe Braintree::Transaction do
|
|
325
327
|
:data => {
|
326
328
|
:lodging_name => "Royal Caribbean"
|
327
329
|
}
|
328
|
-
}
|
330
|
+
},
|
329
331
|
)
|
330
332
|
result.success?.should be(false)
|
331
333
|
result.errors.for(:transaction).for(:industry).map { |e| e.code }.sort.should == [Braintree::ErrorCodes::Transaction::Industry::TravelCruise::TravelPackageIsInvalid]
|
@@ -399,7 +401,7 @@ describe Braintree::Transaction do
|
|
399
401
|
}
|
400
402
|
]
|
401
403
|
}
|
402
|
-
}
|
404
|
+
},
|
403
405
|
)
|
404
406
|
result.success?.should be(true)
|
405
407
|
end
|
@@ -423,7 +425,7 @@ describe Braintree::Transaction do
|
|
423
425
|
}
|
424
426
|
]
|
425
427
|
}
|
426
|
-
}
|
428
|
+
},
|
427
429
|
)
|
428
430
|
result.success?.should be(false)
|
429
431
|
result.errors.for(:transaction).for(:industry).map { |e| e.code }.sort.should == [Braintree::ErrorCodes::Transaction::Industry::TravelFlight::FareAmountCannotBeNegative]
|
@@ -442,7 +444,7 @@ describe Braintree::Transaction do
|
|
442
444
|
:number => Braintree::Test::CreditCardNumbers::Elo,
|
443
445
|
:cvv => "737",
|
444
446
|
:expiration_date => "10/2020"
|
445
|
-
}
|
447
|
+
},
|
446
448
|
)
|
447
449
|
result.success?.should == true
|
448
450
|
result.transaction.id.should =~ /^\w{6,}$/
|
@@ -464,7 +466,7 @@ describe Braintree::Transaction do
|
|
464
466
|
:credit_card => {
|
465
467
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
466
468
|
:expiration_date => "05/2009"
|
467
|
-
}
|
469
|
+
},
|
468
470
|
)
|
469
471
|
result.success?.should == true
|
470
472
|
result.transaction.id.should =~ /^\w{6,}$/
|
@@ -490,7 +492,7 @@ describe Braintree::Transaction do
|
|
490
492
|
:credit_card => {
|
491
493
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
492
494
|
:expiration_date => "05/2009"
|
493
|
-
}
|
495
|
+
},
|
494
496
|
)
|
495
497
|
expect(result.success?).to eq(true)
|
496
498
|
expect(result.transaction.type).to eq("sale")
|
@@ -512,7 +514,7 @@ describe Braintree::Transaction do
|
|
512
514
|
oauth_gateway = Braintree::Gateway.new(
|
513
515
|
:client_id => "client_id$#{Braintree::Configuration.environment}$integration_client_id",
|
514
516
|
:client_secret => "client_secret$#{Braintree::Configuration.environment}$integration_client_secret",
|
515
|
-
:logger => Logger.new("/dev/null")
|
517
|
+
:logger => Logger.new("/dev/null"),
|
516
518
|
)
|
517
519
|
access_token = Braintree::OAuthTestHelper.create_token(oauth_gateway, {
|
518
520
|
:merchant_public_id => "integration_merchant_id",
|
@@ -521,7 +523,7 @@ describe Braintree::Transaction do
|
|
521
523
|
|
522
524
|
gateway = Braintree::Gateway.new(
|
523
525
|
:access_token => access_token,
|
524
|
-
:logger => Logger.new("/dev/null")
|
526
|
+
:logger => Logger.new("/dev/null"),
|
525
527
|
)
|
526
528
|
|
527
529
|
result = gateway.transaction.create(
|
@@ -530,7 +532,7 @@ describe Braintree::Transaction do
|
|
530
532
|
:credit_card => {
|
531
533
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
532
534
|
:expiration_date => "05/2009"
|
533
|
-
}
|
535
|
+
},
|
534
536
|
)
|
535
537
|
|
536
538
|
result.success?.should == true
|
@@ -573,7 +575,7 @@ describe Braintree::Transaction do
|
|
573
575
|
:customer_ip => "192.168.0.1",
|
574
576
|
:customer_location_zip => "91244",
|
575
577
|
:customer_tenure => "20",
|
576
|
-
}
|
578
|
+
},
|
577
579
|
)
|
578
580
|
|
579
581
|
result.success?.should == true
|
@@ -583,7 +585,7 @@ describe Braintree::Transaction do
|
|
583
585
|
result = Braintree::Customer.create()
|
584
586
|
address_result = Braintree::Address.create(
|
585
587
|
:customer_id => result.customer.id,
|
586
|
-
:country_code_alpha2 => "US"
|
588
|
+
:country_code_alpha2 => "US",
|
587
589
|
)
|
588
590
|
|
589
591
|
result = Braintree::Transaction.create(
|
@@ -594,7 +596,7 @@ describe Braintree::Transaction do
|
|
594
596
|
:credit_card => {
|
595
597
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
596
598
|
:expiration_date => "05/2009"
|
597
|
-
}
|
599
|
+
},
|
598
600
|
)
|
599
601
|
|
600
602
|
result.success?.should == true
|
@@ -607,7 +609,7 @@ describe Braintree::Transaction do
|
|
607
609
|
:credit_card => {
|
608
610
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
609
611
|
:expiration_date => "05/2009"
|
610
|
-
}
|
612
|
+
},
|
611
613
|
)
|
612
614
|
result.success?.should == false
|
613
615
|
result.transaction.id.should =~ /^\w{6,}$/
|
@@ -626,7 +628,7 @@ describe Braintree::Transaction do
|
|
626
628
|
:credit_card => {
|
627
629
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
628
630
|
:expiration_date => "05/2009"
|
629
|
-
}
|
631
|
+
},
|
630
632
|
)
|
631
633
|
result.success?.should == false
|
632
634
|
result.transaction.id.should =~ /^\w{6,}$/
|
@@ -663,7 +665,7 @@ describe Braintree::Transaction do
|
|
663
665
|
:options => {
|
664
666
|
:add_billing_address_to_payment_method => true,
|
665
667
|
:store_in_vault => true
|
666
|
-
}
|
668
|
+
},
|
667
669
|
)
|
668
670
|
result.success?.should == true
|
669
671
|
transaction = result.transaction
|
@@ -693,7 +695,7 @@ describe Braintree::Transaction do
|
|
693
695
|
:billing => {
|
694
696
|
:country_name => "Botswana",
|
695
697
|
:country_code_alpha2 => "US",
|
696
|
-
}
|
698
|
+
},
|
697
699
|
)
|
698
700
|
|
699
701
|
result.success?.should == false
|
@@ -709,7 +711,7 @@ describe Braintree::Transaction do
|
|
709
711
|
},
|
710
712
|
:billing => {
|
711
713
|
:country_code_alpha2 => "ZZ"
|
712
|
-
}
|
714
|
+
},
|
713
715
|
)
|
714
716
|
|
715
717
|
result.success?.should == false
|
@@ -726,7 +728,7 @@ describe Braintree::Transaction do
|
|
726
728
|
},
|
727
729
|
:billing => {
|
728
730
|
:country_code_alpha3 => "ZZZ"
|
729
|
-
}
|
731
|
+
},
|
730
732
|
)
|
731
733
|
|
732
734
|
result.success?.should == false
|
@@ -743,7 +745,7 @@ describe Braintree::Transaction do
|
|
743
745
|
},
|
744
746
|
:billing => {
|
745
747
|
:country_code_numeric => "FOO"
|
746
|
-
}
|
748
|
+
},
|
747
749
|
)
|
748
750
|
|
749
751
|
result.success?.should == false
|
@@ -774,7 +776,7 @@ describe Braintree::Transaction do
|
|
774
776
|
},
|
775
777
|
:shipping => {
|
776
778
|
:phone_number => "123-234-3456=098765"
|
777
|
-
}
|
779
|
+
},
|
778
780
|
)
|
779
781
|
|
780
782
|
result.success?.should == false
|
@@ -790,7 +792,7 @@ describe Braintree::Transaction do
|
|
790
792
|
},
|
791
793
|
:shipping => {
|
792
794
|
:shipping_method => "urgent"
|
793
|
-
}
|
795
|
+
},
|
794
796
|
)
|
795
797
|
|
796
798
|
result.success?.should == false
|
@@ -806,7 +808,7 @@ describe Braintree::Transaction do
|
|
806
808
|
},
|
807
809
|
:billing => {
|
808
810
|
:phone_number => "123-234-3456=098765"
|
809
|
-
}
|
811
|
+
},
|
810
812
|
)
|
811
813
|
|
812
814
|
result.success?.should == false
|
@@ -830,7 +832,7 @@ describe Braintree::Transaction do
|
|
830
832
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
831
833
|
:expiration_date => "05/2009",
|
832
834
|
:cvv => "200"
|
833
|
-
}
|
835
|
+
},
|
834
836
|
)
|
835
837
|
result.success?.should == false
|
836
838
|
result.transaction.gateway_rejection_reason.should == Braintree::Transaction::GatewayRejectionReason::CVV
|
@@ -845,17 +847,17 @@ describe Braintree::Transaction do
|
|
845
847
|
gateway = Braintree::Gateway.new(
|
846
848
|
:client_id => "client_id$#{Braintree::Configuration.environment}$integration_client_id",
|
847
849
|
:client_secret => "client_secret$#{Braintree::Configuration.environment}$integration_client_secret",
|
848
|
-
:logger => Logger.new("/dev/null")
|
850
|
+
:logger => Logger.new("/dev/null"),
|
849
851
|
)
|
850
852
|
result = gateway.merchant.create(
|
851
853
|
:email => "name@email.com",
|
852
854
|
:country_code_alpha3 => "USA",
|
853
|
-
:payment_methods => ["credit_card", "paypal"]
|
855
|
+
:payment_methods => ["credit_card", "paypal"],
|
854
856
|
)
|
855
857
|
|
856
858
|
gateway = Braintree::Gateway.new(
|
857
859
|
:access_token => result.credentials.access_token,
|
858
|
-
:logger => Logger.new("/dev/null")
|
860
|
+
:logger => Logger.new("/dev/null"),
|
859
861
|
)
|
860
862
|
|
861
863
|
result = gateway.transaction.create(
|
@@ -864,7 +866,7 @@ describe Braintree::Transaction do
|
|
864
866
|
:credit_card => {
|
865
867
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
866
868
|
:expiration_date => "05/2020"
|
867
|
-
}
|
869
|
+
},
|
868
870
|
)
|
869
871
|
result.success?.should == false
|
870
872
|
result.transaction.gateway_rejection_reason.should == Braintree::Transaction::GatewayRejectionReason::ApplicationIncomplete
|
@@ -888,7 +890,7 @@ describe Braintree::Transaction do
|
|
888
890
|
:credit_card => {
|
889
891
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
890
892
|
:expiration_date => "05/2009"
|
891
|
-
}
|
893
|
+
},
|
892
894
|
)
|
893
895
|
result.success?.should == false
|
894
896
|
result.transaction.gateway_rejection_reason.should == Braintree::Transaction::GatewayRejectionReason::AVS
|
@@ -918,7 +920,7 @@ describe Braintree::Transaction do
|
|
918
920
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
919
921
|
:expiration_date => "05/2009",
|
920
922
|
:cvv => "200"
|
921
|
-
}
|
923
|
+
},
|
922
924
|
)
|
923
925
|
result.success?.should == false
|
924
926
|
result.transaction.gateway_rejection_reason.should == Braintree::Transaction::GatewayRejectionReason::AVSAndCVV
|
@@ -930,14 +932,14 @@ describe Braintree::Transaction do
|
|
930
932
|
end
|
931
933
|
|
932
934
|
it "exposes the fraud gateway rejection reason" do
|
933
|
-
|
935
|
+
with_advanced_fraud_kount_integration_merchant do
|
934
936
|
result = Braintree::Transaction.sale(
|
935
937
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
936
938
|
:credit_card => {
|
937
939
|
:number => Braintree::Test::CreditCardNumbers::Fraud,
|
938
940
|
:expiration_date => "05/2017",
|
939
941
|
:cvv => "333"
|
940
|
-
}
|
942
|
+
},
|
941
943
|
)
|
942
944
|
result.success?.should == false
|
943
945
|
result.transaction.gateway_rejection_reason.should == Braintree::Transaction::GatewayRejectionReason::Fraud
|
@@ -945,14 +947,14 @@ describe Braintree::Transaction do
|
|
945
947
|
end
|
946
948
|
|
947
949
|
it "exposes the risk_threshold gateway rejection reason (via test cc num)" do
|
948
|
-
|
950
|
+
with_advanced_fraud_kount_integration_merchant do
|
949
951
|
result = Braintree::Transaction.sale(
|
950
952
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
951
953
|
:credit_card => {
|
952
954
|
:number => Braintree::Test::CreditCardNumbers::RiskThreshold,
|
953
955
|
:expiration_date => "05/2017",
|
954
956
|
:cvv => "333"
|
955
|
-
}
|
957
|
+
},
|
956
958
|
)
|
957
959
|
result.success?.should == false
|
958
960
|
result.transaction.gateway_rejection_reason.should == Braintree::Transaction::GatewayRejectionReason::RiskThreshold
|
@@ -960,7 +962,7 @@ describe Braintree::Transaction do
|
|
960
962
|
end
|
961
963
|
|
962
964
|
it "exposes the risk_threshold gateway rejection reason (via test test nonce)" do
|
963
|
-
|
965
|
+
with_advanced_fraud_kount_integration_merchant do
|
964
966
|
result = Braintree::Transaction.sale(
|
965
967
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
966
968
|
:payment_method_nonce => Braintree::Test::Nonce::GatewayRejectedRiskThresholds,
|
@@ -989,7 +991,7 @@ describe Braintree::Transaction do
|
|
989
991
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
990
992
|
:expiration_month => "05",
|
991
993
|
:expiration_year => "2011"
|
992
|
-
}
|
994
|
+
},
|
993
995
|
)
|
994
996
|
result.success?.should == true
|
995
997
|
result.transaction.credit_card_details.expiration_month.should == "05"
|
@@ -1001,7 +1003,7 @@ describe Braintree::Transaction do
|
|
1001
1003
|
result = Braintree::Transaction.create(
|
1002
1004
|
:type => "sale",
|
1003
1005
|
:amount => Braintree::Test::TransactionAmounts::Decline,
|
1004
|
-
:customer_id => 123456789
|
1006
|
+
:customer_id => 123456789,
|
1005
1007
|
)
|
1006
1008
|
result.success?.should == false
|
1007
1009
|
result.errors.for(:transaction).on(:customer_id)[0].code.should == "91510"
|
@@ -1018,7 +1020,7 @@ describe Braintree::Transaction do
|
|
1018
1020
|
},
|
1019
1021
|
:custom_fields => {
|
1020
1022
|
:store_me => "custom value"
|
1021
|
-
}
|
1023
|
+
},
|
1022
1024
|
)
|
1023
1025
|
result.success?.should == true
|
1024
1026
|
result.transaction.custom_fields.should == {:store_me => "custom value"}
|
@@ -1033,7 +1035,7 @@ describe Braintree::Transaction do
|
|
1033
1035
|
},
|
1034
1036
|
:custom_fields => {
|
1035
1037
|
:store_me => ""
|
1036
|
-
}
|
1038
|
+
},
|
1037
1039
|
)
|
1038
1040
|
|
1039
1041
|
result = Braintree::Transaction.find(create_result.transaction.id)
|
@@ -1051,7 +1053,7 @@ describe Braintree::Transaction do
|
|
1051
1053
|
},
|
1052
1054
|
:custom_fields => {
|
1053
1055
|
:invalid_key => "custom value"
|
1054
|
-
}
|
1056
|
+
},
|
1055
1057
|
)
|
1056
1058
|
result.success?.should == false
|
1057
1059
|
result.errors.for(:transaction).on(:custom_fields)[0].message.should == "Custom field is invalid: invalid_key."
|
@@ -1070,7 +1072,7 @@ describe Braintree::Transaction do
|
|
1070
1072
|
}
|
1071
1073
|
result = Braintree::Transaction.create(params[:transaction])
|
1072
1074
|
result.success?.should == false
|
1073
|
-
result.params.should == {:transaction => {:type =>
|
1075
|
+
result.params.should == {:transaction => {:type => "sale", :amount => nil, :credit_card => {:expiration_date => "05/2009"}}}
|
1074
1076
|
end
|
1075
1077
|
|
1076
1078
|
it "returns errors if validations fail (tests many errors at once for spec speed)" do
|
@@ -1090,7 +1092,7 @@ describe Braintree::Transaction do
|
|
1090
1092
|
}
|
1091
1093
|
result = Braintree::Transaction.create(params[:transaction])
|
1092
1094
|
result.success?.should == false
|
1093
|
-
result.errors.for(:transaction).on(:base).map{|error| error.code}.should include(Braintree::ErrorCodes::Transaction::PaymentMethodDoesNotBelongToCustomer)
|
1095
|
+
result.errors.for(:transaction).on(:base).map { |error| error.code }.should include(Braintree::ErrorCodes::Transaction::PaymentMethodDoesNotBelongToCustomer)
|
1094
1096
|
result.errors.for(:transaction).on(:customer_id)[0].code.should == Braintree::ErrorCodes::Transaction::CustomerIdIsInvalid
|
1095
1097
|
result.errors.for(:transaction).on(:payment_method_token)[0].code.should == Braintree::ErrorCodes::Transaction::PaymentMethodTokenIsInvalid
|
1096
1098
|
result.errors.for(:transaction).on(:type)[0].code.should == Braintree::ErrorCodes::Transaction::TypeIsInvalid
|
@@ -1121,7 +1123,7 @@ describe Braintree::Transaction do
|
|
1121
1123
|
:credit_card => {
|
1122
1124
|
:account_type => "credit",
|
1123
1125
|
}
|
1124
|
-
}
|
1126
|
+
},
|
1125
1127
|
)
|
1126
1128
|
result.success?.should == false
|
1127
1129
|
result.errors.for(:transaction).on(:amount)[0].code.should == Braintree::ErrorCodes::Transaction::AmountNotSupportedByProcessor
|
@@ -1165,13 +1167,13 @@ describe Braintree::Transaction do
|
|
1165
1167
|
:credit_card => {
|
1166
1168
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1167
1169
|
:expiration_date => "05/2010"
|
1168
|
-
}
|
1170
|
+
},
|
1169
1171
|
)
|
1170
1172
|
result = Braintree::Transaction.create(
|
1171
1173
|
:type => "sale",
|
1172
1174
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
1173
1175
|
:customer_id => customer.id,
|
1174
|
-
:payment_method_token => customer.credit_cards[0].token + "x"
|
1176
|
+
:payment_method_token => customer.credit_cards[0].token + "x",
|
1175
1177
|
)
|
1176
1178
|
result.success?.should == false
|
1177
1179
|
result.errors.for(:transaction).on(:base)[0].code.should == Braintree::ErrorCodes::Transaction::PaymentMethodDoesNotBelongToCustomer
|
@@ -1183,7 +1185,7 @@ describe Braintree::Transaction do
|
|
1183
1185
|
:credit_card => {
|
1184
1186
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1185
1187
|
:expiration_date => "05/2010"
|
1186
|
-
}
|
1188
|
+
},
|
1187
1189
|
)
|
1188
1190
|
result = Braintree::Transaction.create(
|
1189
1191
|
:type => "sale",
|
@@ -1192,7 +1194,7 @@ describe Braintree::Transaction do
|
|
1192
1194
|
:credit_card => {
|
1193
1195
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1194
1196
|
:expiration_date => "12/12"
|
1195
|
-
}
|
1197
|
+
},
|
1196
1198
|
)
|
1197
1199
|
result.success?.should == true
|
1198
1200
|
result.transaction.credit_card_details.masked_number.should == "401288******1881"
|
@@ -1204,7 +1206,7 @@ describe Braintree::Transaction do
|
|
1204
1206
|
:credit_card => {
|
1205
1207
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1206
1208
|
:expiration_date => "05/2010"
|
1207
|
-
}
|
1209
|
+
},
|
1208
1210
|
)
|
1209
1211
|
result = Braintree::Transaction.create(
|
1210
1212
|
:type => "sale",
|
@@ -1214,7 +1216,7 @@ describe Braintree::Transaction do
|
|
1214
1216
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1215
1217
|
:expiration_date => "12/12",
|
1216
1218
|
},
|
1217
|
-
:options => {
|
1219
|
+
:options => {:store_in_vault => true},
|
1218
1220
|
)
|
1219
1221
|
result.success?.should == true
|
1220
1222
|
result.transaction.credit_card_details.masked_number.should == "401288******1881"
|
@@ -1228,7 +1230,7 @@ describe Braintree::Transaction do
|
|
1228
1230
|
:credit_card => {
|
1229
1231
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1230
1232
|
:expiration_date => "05/2010"
|
1231
|
-
}
|
1233
|
+
},
|
1232
1234
|
)
|
1233
1235
|
|
1234
1236
|
result = Braintree::Subscription.create(
|
@@ -1259,7 +1261,7 @@ describe Braintree::Transaction do
|
|
1259
1261
|
:never_expires => true
|
1260
1262
|
}
|
1261
1263
|
]
|
1262
|
-
}
|
1264
|
+
},
|
1263
1265
|
)
|
1264
1266
|
|
1265
1267
|
result.success?.should be(true)
|
@@ -1300,15 +1302,15 @@ describe Braintree::Transaction do
|
|
1300
1302
|
:expiration_date => "05/2009"
|
1301
1303
|
},
|
1302
1304
|
:descriptor => {
|
1303
|
-
:name =>
|
1304
|
-
:phone =>
|
1305
|
+
:name => "123*123456789012345678",
|
1306
|
+
:phone => "3334445555",
|
1305
1307
|
:url => "ebay.com"
|
1306
|
-
}
|
1308
|
+
},
|
1307
1309
|
)
|
1308
1310
|
result.success?.should == true
|
1309
|
-
result.transaction.descriptor.name.should ==
|
1310
|
-
result.transaction.descriptor.phone.should ==
|
1311
|
-
result.transaction.descriptor.url.should ==
|
1311
|
+
result.transaction.descriptor.name.should == "123*123456789012345678"
|
1312
|
+
result.transaction.descriptor.phone.should == "3334445555"
|
1313
|
+
result.transaction.descriptor.url.should == "ebay.com"
|
1312
1314
|
end
|
1313
1315
|
|
1314
1316
|
it "has validation errors if format is invalid" do
|
@@ -1319,10 +1321,10 @@ describe Braintree::Transaction do
|
|
1319
1321
|
:expiration_date => "05/2009"
|
1320
1322
|
},
|
1321
1323
|
:descriptor => {
|
1322
|
-
:name =>
|
1323
|
-
:phone =>
|
1324
|
-
:url =>
|
1325
|
-
}
|
1324
|
+
:name => "badcompanyname12*badproduct12",
|
1325
|
+
:phone => "%bad4445555",
|
1326
|
+
:url => "12345678901234"
|
1327
|
+
},
|
1326
1328
|
)
|
1327
1329
|
result.success?.should == false
|
1328
1330
|
result.errors.for(:transaction).for(:descriptor).on(:name)[0].code.should == Braintree::ErrorCodes::Descriptor::NameFormatIsInvalid
|
@@ -1339,14 +1341,14 @@ describe Braintree::Transaction do
|
|
1339
1341
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1340
1342
|
:expiration_date => "05/2009"
|
1341
1343
|
},
|
1342
|
-
:tax_amount =>
|
1344
|
+
:tax_amount => "0.05",
|
1343
1345
|
:tax_exempt => false,
|
1344
|
-
:purchase_order_number =>
|
1346
|
+
:purchase_order_number => "12345678901234567",
|
1345
1347
|
)
|
1346
1348
|
result.success?.should == true
|
1347
1349
|
result.transaction.tax_amount.should == BigDecimal("0.05")
|
1348
1350
|
result.transaction.tax_exempt.should == false
|
1349
|
-
result.transaction.purchase_order_number.should ==
|
1351
|
+
result.transaction.purchase_order_number.should == "12345678901234567"
|
1350
1352
|
end
|
1351
1353
|
|
1352
1354
|
it "accepts tax_amount as a BigDecimal" do
|
@@ -1356,8 +1358,8 @@ describe Braintree::Transaction do
|
|
1356
1358
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1357
1359
|
:expiration_date => "05/2009"
|
1358
1360
|
},
|
1359
|
-
:tax_amount => BigDecimal(
|
1360
|
-
:tax_exempt => true
|
1361
|
+
:tax_amount => BigDecimal("1.99"),
|
1362
|
+
:tax_exempt => true,
|
1361
1363
|
)
|
1362
1364
|
result.success?.should == true
|
1363
1365
|
result.transaction.tax_amount.should == BigDecimal("1.99")
|
@@ -1373,7 +1375,7 @@ describe Braintree::Transaction do
|
|
1373
1375
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1374
1376
|
:expiration_date => "05/2009"
|
1375
1377
|
},
|
1376
|
-
:tax_amount =>
|
1378
|
+
:tax_amount => "abcd",
|
1377
1379
|
)
|
1378
1380
|
result.success?.should == false
|
1379
1381
|
result.errors.for(:transaction).on(:tax_amount)[0].code.should == Braintree::ErrorCodes::Transaction::TaxAmountFormatIsInvalid
|
@@ -1386,7 +1388,7 @@ describe Braintree::Transaction do
|
|
1386
1388
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1387
1389
|
:expiration_date => "05/2009"
|
1388
1390
|
},
|
1389
|
-
:purchase_order_number =>
|
1391
|
+
:purchase_order_number => "a" * 18,
|
1390
1392
|
)
|
1391
1393
|
result.success?.should == false
|
1392
1394
|
result.errors.for(:transaction).on(:purchase_order_number)[0].code.should == Braintree::ErrorCodes::Transaction::PurchaseOrderNumberIsTooLong
|
@@ -1399,7 +1401,7 @@ describe Braintree::Transaction do
|
|
1399
1401
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1400
1402
|
:expiration_date => "05/2009"
|
1401
1403
|
},
|
1402
|
-
:purchase_order_number => "\303\237\303\245\342\210\202"
|
1404
|
+
:purchase_order_number => "\303\237\303\245\342\210\202",
|
1403
1405
|
)
|
1404
1406
|
result.success?.should == false
|
1405
1407
|
result.errors.for(:transaction).on(:purchase_order_number)[0].code.should == Braintree::ErrorCodes::Transaction::PurchaseOrderNumberIsInvalid
|
@@ -1416,7 +1418,7 @@ describe Braintree::Transaction do
|
|
1416
1418
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1417
1419
|
:expiration_date => "12/12",
|
1418
1420
|
},
|
1419
|
-
:transaction_source => "recurring_first"
|
1421
|
+
:transaction_source => "recurring_first",
|
1420
1422
|
)
|
1421
1423
|
result.success?.should == true
|
1422
1424
|
result.transaction.recurring.should == true
|
@@ -1430,7 +1432,7 @@ describe Braintree::Transaction do
|
|
1430
1432
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1431
1433
|
:expiration_date => "12/12",
|
1432
1434
|
},
|
1433
|
-
:transaction_source => "recurring"
|
1435
|
+
:transaction_source => "recurring",
|
1434
1436
|
)
|
1435
1437
|
result.success?.should == true
|
1436
1438
|
result.transaction.recurring.should == true
|
@@ -1444,7 +1446,7 @@ describe Braintree::Transaction do
|
|
1444
1446
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1445
1447
|
:expiration_date => "12/12",
|
1446
1448
|
},
|
1447
|
-
:transaction_source => "merchant"
|
1449
|
+
:transaction_source => "merchant",
|
1448
1450
|
)
|
1449
1451
|
result.success?.should == true
|
1450
1452
|
result.transaction.recurring.should == false
|
@@ -1458,7 +1460,7 @@ describe Braintree::Transaction do
|
|
1458
1460
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1459
1461
|
:expiration_date => "12/12",
|
1460
1462
|
},
|
1461
|
-
:transaction_source => "moto"
|
1463
|
+
:transaction_source => "moto",
|
1462
1464
|
)
|
1463
1465
|
result.success?.should == true
|
1464
1466
|
result.transaction.recurring.should == false
|
@@ -1472,7 +1474,7 @@ describe Braintree::Transaction do
|
|
1472
1474
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1473
1475
|
:expiration_date => "12/12",
|
1474
1476
|
},
|
1475
|
-
:transaction_source => "invalid_value"
|
1477
|
+
:transaction_source => "invalid_value",
|
1476
1478
|
)
|
1477
1479
|
result.success?.should == false
|
1478
1480
|
result.errors.for(:transaction).on(:transaction_source)[0].code.should == Braintree::ErrorCodes::Transaction::TransactionSourceIsInvalid
|
@@ -1492,7 +1494,7 @@ describe Braintree::Transaction do
|
|
1492
1494
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1493
1495
|
:expiration_date => "12/12",
|
1494
1496
|
},
|
1495
|
-
:options => {
|
1497
|
+
:options => {:store_in_vault_on_success => true},
|
1496
1498
|
)
|
1497
1499
|
result.success?.should == true
|
1498
1500
|
result.transaction.vault_customer.last_name.should == "Doe"
|
@@ -1511,7 +1513,7 @@ describe Braintree::Transaction do
|
|
1511
1513
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1512
1514
|
:expiration_date => "12/12",
|
1513
1515
|
},
|
1514
|
-
:options => {
|
1516
|
+
:options => {:store_in_vault_on_success => true},
|
1515
1517
|
)
|
1516
1518
|
result.success?.should == false
|
1517
1519
|
result.transaction.vault_customer.should be_nil
|
@@ -1531,7 +1533,7 @@ describe Braintree::Transaction do
|
|
1531
1533
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1532
1534
|
:expiration_date => "12/12",
|
1533
1535
|
},
|
1534
|
-
:options => {
|
1536
|
+
:options => {:store_in_vault_on_success => false},
|
1535
1537
|
)
|
1536
1538
|
result.success?.should == true
|
1537
1539
|
result.transaction.vault_customer.should be_nil
|
@@ -1549,7 +1551,7 @@ describe Braintree::Transaction do
|
|
1549
1551
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1550
1552
|
:expiration_date => "12/12",
|
1551
1553
|
},
|
1552
|
-
:options => {
|
1554
|
+
:options => {:store_in_vault_on_success => false},
|
1553
1555
|
)
|
1554
1556
|
result.success?.should == false
|
1555
1557
|
result.transaction.vault_customer.should be_nil
|
@@ -1568,7 +1570,7 @@ describe Braintree::Transaction do
|
|
1568
1570
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1569
1571
|
:expiration_date => "12/12",
|
1570
1572
|
},
|
1571
|
-
:service_fee_amount => "1.00"
|
1573
|
+
:service_fee_amount => "1.00",
|
1572
1574
|
)
|
1573
1575
|
result.success?.should == true
|
1574
1576
|
result.transaction.service_fee_amount.should == BigDecimal("1.00")
|
@@ -1583,7 +1585,7 @@ describe Braintree::Transaction do
|
|
1583
1585
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1584
1586
|
:expiration_date => "12/12",
|
1585
1587
|
},
|
1586
|
-
:service_fee_amount => "1.00"
|
1588
|
+
:service_fee_amount => "1.00",
|
1587
1589
|
)
|
1588
1590
|
result.success?.should == false
|
1589
1591
|
expected_error_code = Braintree::ErrorCodes::Transaction::ServiceFeeAmountNotAllowedOnMasterMerchantAccount
|
@@ -1598,7 +1600,7 @@ describe Braintree::Transaction do
|
|
1598
1600
|
:credit_card => {
|
1599
1601
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1600
1602
|
:expiration_date => "12/12",
|
1601
|
-
}
|
1603
|
+
},
|
1602
1604
|
)
|
1603
1605
|
result.success?.should == false
|
1604
1606
|
expected_error_code = Braintree::ErrorCodes::Transaction::SubMerchantAccountRequiresServiceFeeAmount
|
@@ -1608,7 +1610,7 @@ describe Braintree::Transaction do
|
|
1608
1610
|
it "raises an error if service fee amount is negative" do
|
1609
1611
|
result = Braintree::Transaction.create(
|
1610
1612
|
:merchant_account_id => SpecHelper::NonDefaultSubMerchantAccountId,
|
1611
|
-
:service_fee_amount => "-1.00"
|
1613
|
+
:service_fee_amount => "-1.00",
|
1612
1614
|
)
|
1613
1615
|
result.success?.should == false
|
1614
1616
|
result.errors.for(:transaction).on(:service_fee_amount)[0].code.should == Braintree::ErrorCodes::Transaction::ServiceFeeAmountCannotBeNegative
|
@@ -1617,7 +1619,7 @@ describe Braintree::Transaction do
|
|
1617
1619
|
it "raises an error if service fee amount is invalid" do
|
1618
1620
|
result = Braintree::Transaction.create(
|
1619
1621
|
:merchant_account_id => SpecHelper::NonDefaultSubMerchantAccountId,
|
1620
|
-
:service_fee_amount => "invalid amount"
|
1622
|
+
:service_fee_amount => "invalid amount",
|
1621
1623
|
)
|
1622
1624
|
result.success?.should == false
|
1623
1625
|
result.errors.for(:transaction).on(:service_fee_amount)[0].code.should == Braintree::ErrorCodes::Transaction::ServiceFeeAmountFormatIsInvalid
|
@@ -1635,7 +1637,7 @@ describe Braintree::Transaction do
|
|
1635
1637
|
:expiration_date => "12/12",
|
1636
1638
|
},
|
1637
1639
|
:service_fee_amount => "10.00",
|
1638
|
-
:options => {:hold_in_escrow => true}
|
1640
|
+
:options => {:hold_in_escrow => true},
|
1639
1641
|
)
|
1640
1642
|
|
1641
1643
|
result.success?.should == true
|
@@ -1652,7 +1654,7 @@ describe Braintree::Transaction do
|
|
1652
1654
|
:expiration_date => "12/12",
|
1653
1655
|
},
|
1654
1656
|
:service_fee_amount => "1.00",
|
1655
|
-
:options => {:hold_in_escrow => true}
|
1657
|
+
:options => {:hold_in_escrow => true},
|
1656
1658
|
)
|
1657
1659
|
result.success?.should == false
|
1658
1660
|
expected_error_code = Braintree::ErrorCodes::Transaction::CannotHoldInEscrow
|
@@ -1665,7 +1667,7 @@ describe Braintree::Transaction do
|
|
1665
1667
|
result = Braintree::Transaction.create(
|
1666
1668
|
:type => "sale",
|
1667
1669
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
1668
|
-
:venmo_sdk_payment_method_code => Braintree::Test::VenmoSDK::VisaPaymentMethodCode
|
1670
|
+
:venmo_sdk_payment_method_code => Braintree::Test::VenmoSDK::VisaPaymentMethodCode,
|
1669
1671
|
)
|
1670
1672
|
result.success?.should == true
|
1671
1673
|
result.transaction.credit_card_details.bin.should == "400934"
|
@@ -1682,7 +1684,7 @@ describe Braintree::Transaction do
|
|
1682
1684
|
},
|
1683
1685
|
:options => {
|
1684
1686
|
:venmo_sdk_session => Braintree::Test::VenmoSDK::Session
|
1685
|
-
}
|
1687
|
+
},
|
1686
1688
|
)
|
1687
1689
|
result.success?.should == true
|
1688
1690
|
result.transaction.credit_card_details.venmo_sdk?.should == false
|
@@ -1697,14 +1699,14 @@ describe Braintree::Transaction do
|
|
1697
1699
|
:expiration_month => "11",
|
1698
1700
|
:expiration_year => "2099",
|
1699
1701
|
},
|
1700
|
-
:share => true
|
1702
|
+
:share => true,
|
1701
1703
|
)
|
1702
1704
|
nonce.should_not be_nil
|
1703
1705
|
|
1704
1706
|
result = Braintree::Transaction.create(
|
1705
1707
|
:type => "sale",
|
1706
1708
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
1707
|
-
:payment_method_nonce => nonce
|
1709
|
+
:payment_method_nonce => nonce,
|
1708
1710
|
)
|
1709
1711
|
result.success?.should == true
|
1710
1712
|
end
|
@@ -1719,14 +1721,14 @@ describe Braintree::Transaction do
|
|
1719
1721
|
},
|
1720
1722
|
:client_token_options => {
|
1721
1723
|
:customer_id => customer.id,
|
1722
|
-
}
|
1724
|
+
},
|
1723
1725
|
)
|
1724
1726
|
nonce.should_not be_nil
|
1725
1727
|
|
1726
1728
|
result = Braintree::Transaction.create(
|
1727
1729
|
:type => "sale",
|
1728
1730
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
1729
|
-
:payment_method_nonce => nonce
|
1731
|
+
:payment_method_nonce => nonce,
|
1730
1732
|
)
|
1731
1733
|
result.success?.should == true
|
1732
1734
|
end
|
@@ -1739,14 +1741,14 @@ describe Braintree::Transaction do
|
|
1739
1741
|
},
|
1740
1742
|
:client_token_options => {
|
1741
1743
|
:customer_id => customer.id,
|
1742
|
-
}
|
1744
|
+
},
|
1743
1745
|
)
|
1744
1746
|
nonce.should_not be_nil
|
1745
1747
|
|
1746
1748
|
result = Braintree::Transaction.create(
|
1747
1749
|
:type => "sale",
|
1748
1750
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
1749
|
-
:payment_method_nonce => nonce
|
1751
|
+
:payment_method_nonce => nonce,
|
1750
1752
|
)
|
1751
1753
|
result.success?.should == true
|
1752
1754
|
result.transaction.paypal_details.should_not be_nil
|
@@ -1758,14 +1760,14 @@ describe Braintree::Transaction do
|
|
1758
1760
|
nonce = nonce_for_new_payment_method(
|
1759
1761
|
:paypal_account => {
|
1760
1762
|
:consent_code => "PAYPAL_CONSENT_CODE",
|
1761
|
-
}
|
1763
|
+
},
|
1762
1764
|
)
|
1763
1765
|
nonce.should_not be_nil
|
1764
1766
|
|
1765
1767
|
result = Braintree::Transaction.create(
|
1766
1768
|
:type => "sale",
|
1767
1769
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
1768
|
-
:payment_method_nonce => nonce
|
1770
|
+
:payment_method_nonce => nonce,
|
1769
1771
|
)
|
1770
1772
|
result.success?.should == true
|
1771
1773
|
result.transaction.paypal_details.should_not be_nil
|
@@ -1777,7 +1779,7 @@ describe Braintree::Transaction do
|
|
1777
1779
|
result = Braintree::Transaction.create(
|
1778
1780
|
:type => "sale",
|
1779
1781
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
1780
|
-
:payment_method_nonce => Braintree::Test::Nonce::ApplePayVisa
|
1782
|
+
:payment_method_nonce => Braintree::Test::Nonce::ApplePayVisa,
|
1781
1783
|
)
|
1782
1784
|
result.success?.should == true
|
1783
1785
|
result.transaction.should_not be_nil
|
@@ -1807,7 +1809,7 @@ describe Braintree::Transaction do
|
|
1807
1809
|
:type => "sale",
|
1808
1810
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
1809
1811
|
:payment_method_nonce => Braintree::Test::Nonce::ApplePayVisa,
|
1810
|
-
:options => {
|
1812
|
+
:options => {:store_in_vault_on_success => true},
|
1811
1813
|
)
|
1812
1814
|
result.success?.should == true
|
1813
1815
|
result.transaction.should_not be_nil
|
@@ -1828,7 +1830,7 @@ describe Braintree::Transaction do
|
|
1828
1830
|
result = Braintree::Transaction.create(
|
1829
1831
|
:type => "sale",
|
1830
1832
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
1831
|
-
:payment_method_nonce => Braintree::Test::Nonce::GooglePayDiscover
|
1833
|
+
:payment_method_nonce => Braintree::Test::Nonce::GooglePayDiscover,
|
1832
1834
|
)
|
1833
1835
|
result.success?.should == true
|
1834
1836
|
result.transaction.should_not be_nil
|
@@ -1861,7 +1863,7 @@ describe Braintree::Transaction do
|
|
1861
1863
|
:type => "sale",
|
1862
1864
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
1863
1865
|
:payment_method_nonce => Braintree::Test::Nonce::GooglePayDiscover,
|
1864
|
-
:options => {
|
1866
|
+
:options => {:store_in_vault_on_success => true},
|
1865
1867
|
)
|
1866
1868
|
result.success?.should == true
|
1867
1869
|
result.transaction.should_not be_nil
|
@@ -1885,7 +1887,7 @@ describe Braintree::Transaction do
|
|
1885
1887
|
result = Braintree::Transaction.create(
|
1886
1888
|
:type => "sale",
|
1887
1889
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
1888
|
-
:payment_method_nonce => Braintree::Test::Nonce::GooglePayMasterCard
|
1890
|
+
:payment_method_nonce => Braintree::Test::Nonce::GooglePayMasterCard,
|
1889
1891
|
)
|
1890
1892
|
result.success?.should == true
|
1891
1893
|
result.transaction.should_not be_nil
|
@@ -1908,7 +1910,7 @@ describe Braintree::Transaction do
|
|
1908
1910
|
:merchant_account_id => SpecHelper::FakeVenmoAccountMerchantAccountId,
|
1909
1911
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
1910
1912
|
:payment_method_nonce => Braintree::Test::Nonce::VenmoAccount,
|
1911
|
-
:options => {:store_in_vault => true}
|
1913
|
+
:options => {:store_in_vault => true},
|
1912
1914
|
)
|
1913
1915
|
result.should be_success
|
1914
1916
|
|
@@ -1928,7 +1930,7 @@ describe Braintree::Transaction do
|
|
1928
1930
|
:merchant_account_id => SpecHelper::FakeVenmoAccountMerchantAccountId,
|
1929
1931
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
1930
1932
|
:payment_method_nonce => Braintree::Test::Nonce::VenmoAccount,
|
1931
|
-
:options => {:store_in_vault => true, :venmo => {:profile_id => "integration_venmo_merchant_public_id"
|
1933
|
+
:options => {:store_in_vault => true, :venmo => {:profile_id => "integration_venmo_merchant_public_id"}},
|
1932
1934
|
)
|
1933
1935
|
result.should be_success
|
1934
1936
|
end
|
@@ -1938,7 +1940,7 @@ describe Braintree::Transaction do
|
|
1938
1940
|
result = Braintree::Transaction.create(
|
1939
1941
|
:type => "sale",
|
1940
1942
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
1941
|
-
:payment_method_nonce => Braintree::Test::Nonce::AbstractTransactable
|
1943
|
+
:payment_method_nonce => Braintree::Test::Nonce::AbstractTransactable,
|
1942
1944
|
)
|
1943
1945
|
result.success?.should == true
|
1944
1946
|
result.transaction.should_not be_nil
|
@@ -1953,7 +1955,7 @@ describe Braintree::Transaction do
|
|
1953
1955
|
:paypal_account => {
|
1954
1956
|
:payer_id => "PAYER-1234",
|
1955
1957
|
:payment_id => "PAY-5678",
|
1956
|
-
}
|
1958
|
+
},
|
1957
1959
|
)
|
1958
1960
|
|
1959
1961
|
result.success?.should == true
|
@@ -1967,7 +1969,7 @@ describe Braintree::Transaction do
|
|
1967
1969
|
nonce = nonce_for_new_payment_method(
|
1968
1970
|
:paypal_account => {
|
1969
1971
|
:consent_code => "PAYPAL_CONSENT_CODE",
|
1970
|
-
}
|
1972
|
+
},
|
1971
1973
|
)
|
1972
1974
|
nonce.should_not be_nil
|
1973
1975
|
|
@@ -1977,7 +1979,7 @@ describe Braintree::Transaction do
|
|
1977
1979
|
:payment_method_nonce => nonce,
|
1978
1980
|
:paypal_account => {
|
1979
1981
|
:payee_id => "fake-payee-id"
|
1980
|
-
}
|
1982
|
+
},
|
1981
1983
|
)
|
1982
1984
|
|
1983
1985
|
result.success?.should == true
|
@@ -1991,7 +1993,7 @@ describe Braintree::Transaction do
|
|
1991
1993
|
nonce = nonce_for_new_payment_method(
|
1992
1994
|
:paypal_account => {
|
1993
1995
|
:consent_code => "PAYPAL_CONSENT_CODE",
|
1994
|
-
}
|
1996
|
+
},
|
1995
1997
|
)
|
1996
1998
|
nonce.should_not be_nil
|
1997
1999
|
|
@@ -2002,7 +2004,7 @@ describe Braintree::Transaction do
|
|
2002
2004
|
:paypal_account => {},
|
2003
2005
|
:options => {
|
2004
2006
|
:payee_id => "fake-payee-id"
|
2005
|
-
}
|
2007
|
+
},
|
2006
2008
|
)
|
2007
2009
|
|
2008
2010
|
result.success?.should == true
|
@@ -2016,7 +2018,7 @@ describe Braintree::Transaction do
|
|
2016
2018
|
nonce = nonce_for_new_payment_method(
|
2017
2019
|
:paypal_account => {
|
2018
2020
|
:consent_code => "PAYPAL_CONSENT_CODE",
|
2019
|
-
}
|
2021
|
+
},
|
2020
2022
|
)
|
2021
2023
|
nonce.should_not be_nil
|
2022
2024
|
|
@@ -2028,7 +2030,7 @@ describe Braintree::Transaction do
|
|
2028
2030
|
:paypal => {
|
2029
2031
|
:payee_id => "fake-payee-id"
|
2030
2032
|
}
|
2031
|
-
}
|
2033
|
+
},
|
2032
2034
|
)
|
2033
2035
|
|
2034
2036
|
result.success?.should == true
|
@@ -2042,7 +2044,7 @@ describe Braintree::Transaction do
|
|
2042
2044
|
nonce = nonce_for_new_payment_method(
|
2043
2045
|
:paypal_account => {
|
2044
2046
|
:consent_code => "PAYPAL_CONSENT_CODE",
|
2045
|
-
}
|
2047
|
+
},
|
2046
2048
|
)
|
2047
2049
|
nonce.should_not be_nil
|
2048
2050
|
|
@@ -2052,7 +2054,7 @@ describe Braintree::Transaction do
|
|
2052
2054
|
:payment_method_nonce => nonce,
|
2053
2055
|
:paypal_account => {
|
2054
2056
|
:payee_email => "bt_seller_us@paypal.com"
|
2055
|
-
}
|
2057
|
+
},
|
2056
2058
|
)
|
2057
2059
|
|
2058
2060
|
result.success?.should == true
|
@@ -2066,7 +2068,7 @@ describe Braintree::Transaction do
|
|
2066
2068
|
nonce = nonce_for_new_payment_method(
|
2067
2069
|
:paypal_account => {
|
2068
2070
|
:consent_code => "PAYPAL_CONSENT_CODE",
|
2069
|
-
}
|
2071
|
+
},
|
2070
2072
|
)
|
2071
2073
|
nonce.should_not be_nil
|
2072
2074
|
|
@@ -2077,7 +2079,7 @@ describe Braintree::Transaction do
|
|
2077
2079
|
:paypal_account => {},
|
2078
2080
|
:options => {
|
2079
2081
|
:payee_email => "bt_seller_us@paypal.com"
|
2080
|
-
}
|
2082
|
+
},
|
2081
2083
|
)
|
2082
2084
|
|
2083
2085
|
result.success?.should == true
|
@@ -2091,7 +2093,7 @@ describe Braintree::Transaction do
|
|
2091
2093
|
nonce = nonce_for_new_payment_method(
|
2092
2094
|
:paypal_account => {
|
2093
2095
|
:consent_code => "PAYPAL_CONSENT_CODE",
|
2094
|
-
}
|
2096
|
+
},
|
2095
2097
|
)
|
2096
2098
|
nonce.should_not be_nil
|
2097
2099
|
|
@@ -2103,7 +2105,7 @@ describe Braintree::Transaction do
|
|
2103
2105
|
:paypal => {
|
2104
2106
|
:payee_email => "bt_seller_us@paypal.com"
|
2105
2107
|
}
|
2106
|
-
}
|
2108
|
+
},
|
2107
2109
|
)
|
2108
2110
|
|
2109
2111
|
result.success?.should == true
|
@@ -2117,7 +2119,7 @@ describe Braintree::Transaction do
|
|
2117
2119
|
nonce = nonce_for_new_payment_method(
|
2118
2120
|
:paypal_account => {
|
2119
2121
|
:consent_code => "PAYPAL_CONSENT_CODE",
|
2120
|
-
}
|
2122
|
+
},
|
2121
2123
|
)
|
2122
2124
|
nonce.should_not be_nil
|
2123
2125
|
|
@@ -2129,7 +2131,7 @@ describe Braintree::Transaction do
|
|
2129
2131
|
:paypal => {
|
2130
2132
|
:custom_field => "Additional info"
|
2131
2133
|
}
|
2132
|
-
}
|
2134
|
+
},
|
2133
2135
|
)
|
2134
2136
|
|
2135
2137
|
result.success?.should == true
|
@@ -2143,7 +2145,7 @@ describe Braintree::Transaction do
|
|
2143
2145
|
nonce = nonce_for_new_payment_method(
|
2144
2146
|
:paypal_account => {
|
2145
2147
|
:consent_code => "PAYPAL_CONSENT_CODE",
|
2146
|
-
}
|
2148
|
+
},
|
2147
2149
|
)
|
2148
2150
|
nonce.should_not be_nil
|
2149
2151
|
|
@@ -2155,7 +2157,7 @@ describe Braintree::Transaction do
|
|
2155
2157
|
:paypal => {
|
2156
2158
|
:description => "A great product"
|
2157
2159
|
}
|
2158
|
-
}
|
2160
|
+
},
|
2159
2161
|
)
|
2160
2162
|
|
2161
2163
|
result.success?.should == true
|
@@ -2169,7 +2171,7 @@ describe Braintree::Transaction do
|
|
2169
2171
|
nonce = nonce_for_new_payment_method(
|
2170
2172
|
:paypal_account => {
|
2171
2173
|
:consent_code => "PAYPAL_CONSENT_CODE",
|
2172
|
-
}
|
2174
|
+
},
|
2173
2175
|
)
|
2174
2176
|
nonce.should_not be_nil
|
2175
2177
|
|
@@ -2184,7 +2186,7 @@ describe Braintree::Transaction do
|
|
2184
2186
|
:key2 => "value2",
|
2185
2187
|
}
|
2186
2188
|
}
|
2187
|
-
}
|
2189
|
+
},
|
2188
2190
|
)
|
2189
2191
|
|
2190
2192
|
# note - supplementary data is not returned in response
|
@@ -2198,7 +2200,7 @@ describe Braintree::Transaction do
|
|
2198
2200
|
SpecHelper::ThreeDSecureMerchantAccountId,
|
2199
2201
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
2200
2202
|
:expiration_month => "12",
|
2201
|
-
:expiration_year => "2012"
|
2203
|
+
:expiration_year => "2012",
|
2202
2204
|
)
|
2203
2205
|
|
2204
2206
|
result = Braintree::Transaction.create(
|
@@ -2209,7 +2211,7 @@ describe Braintree::Transaction do
|
|
2209
2211
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
2210
2212
|
:expiration_date => "12/12",
|
2211
2213
|
},
|
2212
|
-
:three_d_secure_token => three_d_secure_token
|
2214
|
+
:three_d_secure_token => three_d_secure_token,
|
2213
2215
|
)
|
2214
2216
|
|
2215
2217
|
result.success?.should == true
|
@@ -2221,7 +2223,7 @@ describe Braintree::Transaction do
|
|
2221
2223
|
:number => "4111111111111111",
|
2222
2224
|
:expiration_month => "11",
|
2223
2225
|
:expiration_year => "2099",
|
2224
|
-
}
|
2226
|
+
},
|
2225
2227
|
)
|
2226
2228
|
nonce.should_not be_nil
|
2227
2229
|
result = Braintree::Transaction.create(
|
@@ -2233,7 +2235,7 @@ describe Braintree::Transaction do
|
|
2233
2235
|
:three_d_secure => {
|
2234
2236
|
:required => true,
|
2235
2237
|
}
|
2236
|
-
}
|
2238
|
+
},
|
2237
2239
|
)
|
2238
2240
|
|
2239
2241
|
result.success?.should == false
|
@@ -2249,7 +2251,7 @@ describe Braintree::Transaction do
|
|
2249
2251
|
:credit_card => {
|
2250
2252
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
2251
2253
|
:expiration_date => "12/12",
|
2252
|
-
}
|
2254
|
+
},
|
2253
2255
|
)
|
2254
2256
|
result.success?.should == true
|
2255
2257
|
end
|
@@ -2260,7 +2262,7 @@ describe Braintree::Transaction do
|
|
2260
2262
|
SpecHelper::ThreeDSecureMerchantAccountId,
|
2261
2263
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
2262
2264
|
:expiration_month => "12",
|
2263
|
-
:expiration_year => "2022"
|
2265
|
+
:expiration_year => "2022",
|
2264
2266
|
)
|
2265
2267
|
|
2266
2268
|
result = Braintree::Transaction.create(
|
@@ -2271,7 +2273,7 @@ describe Braintree::Transaction do
|
|
2271
2273
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
2272
2274
|
:expiration_date => "12/22",
|
2273
2275
|
},
|
2274
|
-
:three_d_secure_authentication_id => three_d_secure_authentication_id
|
2276
|
+
:three_d_secure_authentication_id => three_d_secure_authentication_id,
|
2275
2277
|
)
|
2276
2278
|
|
2277
2279
|
result.success?.should == true
|
@@ -2285,7 +2287,7 @@ describe Braintree::Transaction do
|
|
2285
2287
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
2286
2288
|
:expiration_date => "12/12",
|
2287
2289
|
},
|
2288
|
-
:three_d_secure_authentication_id => nil
|
2290
|
+
:three_d_secure_authentication_id => nil,
|
2289
2291
|
)
|
2290
2292
|
result.success?.should == false
|
2291
2293
|
result.errors.for(:transaction).on(:three_d_secure_authentication_id)[0].code.should == Braintree::ErrorCodes::Transaction::ThreeDSecureAuthenticationIdIsInvalid
|
@@ -2295,7 +2297,7 @@ describe Braintree::Transaction do
|
|
2295
2297
|
SpecHelper::ThreeDSecureMerchantAccountId,
|
2296
2298
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
2297
2299
|
:expiration_month => "12",
|
2298
|
-
:expiration_year => "2012"
|
2300
|
+
:expiration_year => "2012",
|
2299
2301
|
)
|
2300
2302
|
|
2301
2303
|
result = Braintree::Transaction.create(
|
@@ -2305,7 +2307,7 @@ describe Braintree::Transaction do
|
|
2305
2307
|
:number => Braintree::Test::CreditCardNumbers::MasterCard,
|
2306
2308
|
:expiration_date => "12/12",
|
2307
2309
|
},
|
2308
|
-
:three_d_secure_authentication_id => three_d_secure_authentication_id
|
2310
|
+
:three_d_secure_authentication_id => three_d_secure_authentication_id,
|
2309
2311
|
)
|
2310
2312
|
result.success?.should == false
|
2311
2313
|
result.errors.for(:transaction).on(:three_d_secure_authentication_id)[0].code.should == Braintree::ErrorCodes::Transaction::ThreeDSecureTransactionPaymentMethodDoesntMatchThreeDSecureAuthenticationPaymentMethod
|
@@ -2315,7 +2317,7 @@ describe Braintree::Transaction do
|
|
2315
2317
|
SpecHelper::ThreeDSecureMerchantAccountId,
|
2316
2318
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
2317
2319
|
:expiration_month => "12",
|
2318
|
-
:expiration_year => "2012"
|
2320
|
+
:expiration_year => "2012",
|
2319
2321
|
)
|
2320
2322
|
|
2321
2323
|
result = Braintree::Transaction.create(
|
@@ -2326,7 +2328,7 @@ describe Braintree::Transaction do
|
|
2326
2328
|
:number => Braintree::Test::CreditCardNumbers::MasterCard,
|
2327
2329
|
:expiration_date => "12/12",
|
2328
2330
|
},
|
2329
|
-
:three_d_secure_authentication_id => three_d_secure_authentication_id
|
2331
|
+
:three_d_secure_authentication_id => three_d_secure_authentication_id,
|
2330
2332
|
)
|
2331
2333
|
result.success?.should == false
|
2332
2334
|
result.errors.for(:transaction).on(:three_d_secure_authentication_id)[0].code.should == Braintree::ErrorCodes::Transaction::ThreeDSecureTransactionPaymentMethodDoesntMatchThreeDSecureAuthenticationPaymentMethod
|
@@ -2336,7 +2338,7 @@ describe Braintree::Transaction do
|
|
2336
2338
|
SpecHelper::ThreeDSecureMerchantAccountId,
|
2337
2339
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
2338
2340
|
:expiration_month => "12",
|
2339
|
-
:expiration_year => "2012"
|
2341
|
+
:expiration_year => "2012",
|
2340
2342
|
)
|
2341
2343
|
result = Braintree::Transaction.create(
|
2342
2344
|
:merchant_account_id => SpecHelper::ThreeDSecureMerchantAccountId,
|
@@ -2356,7 +2358,7 @@ describe Braintree::Transaction do
|
|
2356
2358
|
:directory_response => "Y",
|
2357
2359
|
:cavv_algorithm => "2",
|
2358
2360
|
:ds_transaction_id => "some_ds_id",
|
2359
|
-
}
|
2361
|
+
},
|
2360
2362
|
)
|
2361
2363
|
result.success?.should == false
|
2362
2364
|
result.errors.for(:transaction).on(:three_d_secure_authentication_id)[0].code.should == Braintree::ErrorCodes::Transaction::ThreeDSecureAuthenticationIdWithThreeDSecurePassThruIsInvalid
|
@@ -2369,7 +2371,7 @@ describe Braintree::Transaction do
|
|
2369
2371
|
SpecHelper::ThreeDSecureMerchantAccountId,
|
2370
2372
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
2371
2373
|
:expiration_month => "12",
|
2372
|
-
:expiration_year => "2012"
|
2374
|
+
:expiration_year => "2012",
|
2373
2375
|
)
|
2374
2376
|
|
2375
2377
|
result = Braintree::Transaction.create(
|
@@ -2380,7 +2382,7 @@ describe Braintree::Transaction do
|
|
2380
2382
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
2381
2383
|
:expiration_date => "12/12",
|
2382
2384
|
},
|
2383
|
-
:three_d_secure_token => three_d_secure_token
|
2385
|
+
:three_d_secure_token => three_d_secure_token,
|
2384
2386
|
)
|
2385
2387
|
|
2386
2388
|
result.success?.should == true
|
@@ -2395,7 +2397,7 @@ describe Braintree::Transaction do
|
|
2395
2397
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
2396
2398
|
:expiration_date => "12/12",
|
2397
2399
|
},
|
2398
|
-
:three_d_secure_token => nil
|
2400
|
+
:three_d_secure_token => nil,
|
2399
2401
|
)
|
2400
2402
|
result.success?.should == false
|
2401
2403
|
result.errors.for(:transaction).on(:three_d_secure_token)[0].code.should == Braintree::ErrorCodes::Transaction::ThreeDSecureTokenIsInvalid
|
@@ -2406,7 +2408,7 @@ describe Braintree::Transaction do
|
|
2406
2408
|
SpecHelper::ThreeDSecureMerchantAccountId,
|
2407
2409
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
2408
2410
|
:expiration_month => "12",
|
2409
|
-
:expiration_year => "2012"
|
2411
|
+
:expiration_year => "2012",
|
2410
2412
|
)
|
2411
2413
|
|
2412
2414
|
result = Braintree::Transaction.create(
|
@@ -2417,7 +2419,7 @@ describe Braintree::Transaction do
|
|
2417
2419
|
:number => Braintree::Test::CreditCardNumbers::MasterCard,
|
2418
2420
|
:expiration_date => "12/12",
|
2419
2421
|
},
|
2420
|
-
:three_d_secure_token => three_d_secure_token
|
2422
|
+
:three_d_secure_token => three_d_secure_token,
|
2421
2423
|
)
|
2422
2424
|
result.success?.should == false
|
2423
2425
|
result.errors.for(:transaction).on(:three_d_secure_token)[0].code.should == Braintree::ErrorCodes::Transaction::ThreeDSecureTransactionDataDoesntMatchVerify
|
@@ -2441,7 +2443,7 @@ describe Braintree::Transaction do
|
|
2441
2443
|
:directory_response => "Y",
|
2442
2444
|
:cavv_algorithm => "2",
|
2443
2445
|
:ds_transaction_id => "some_ds_id",
|
2444
|
-
}
|
2446
|
+
},
|
2445
2447
|
)
|
2446
2448
|
|
2447
2449
|
result.success?.should == true
|
@@ -2466,7 +2468,7 @@ describe Braintree::Transaction do
|
|
2466
2468
|
:directory_response => "Y",
|
2467
2469
|
:cavv_algorithm => "2",
|
2468
2470
|
:ds_transaction_id => "some_ds_id",
|
2469
|
-
}
|
2471
|
+
},
|
2470
2472
|
)
|
2471
2473
|
result.success?.should == false
|
2472
2474
|
result.errors.for(:transaction).on(:merchant_account_id)[0].code.should == Braintree::ErrorCodes::Transaction::ThreeDSecureMerchantAccountDoesNotSupportCardType
|
@@ -2484,7 +2486,7 @@ describe Braintree::Transaction do
|
|
2484
2486
|
:eci_flag => "",
|
2485
2487
|
:cavv => "some_cavv",
|
2486
2488
|
:xid => "some_xid",
|
2487
|
-
}
|
2489
|
+
},
|
2488
2490
|
)
|
2489
2491
|
result.success?.should == false
|
2490
2492
|
result.errors.for(:transaction).for(:three_d_secure_pass_thru).on(:eci_flag)[0].code.should == Braintree::ErrorCodes::Transaction::ThreeDSecureEciFlagIsRequired
|
@@ -2507,7 +2509,7 @@ describe Braintree::Transaction do
|
|
2507
2509
|
:directory_response => "Y",
|
2508
2510
|
:cavv_algorithm => "2",
|
2509
2511
|
:ds_transaction_id => "some_ds_id",
|
2510
|
-
}
|
2512
|
+
},
|
2511
2513
|
)
|
2512
2514
|
result.success?.should == false
|
2513
2515
|
result.errors.for(:transaction).for(:three_d_secure_pass_thru).on(:cavv)[0].code.should == Braintree::ErrorCodes::Transaction::ThreeDSecureCavvIsRequired
|
@@ -2530,7 +2532,7 @@ describe Braintree::Transaction do
|
|
2530
2532
|
:directory_response => "Y",
|
2531
2533
|
:cavv_algorithm => "2",
|
2532
2534
|
:ds_transaction_id => "some_ds_id",
|
2533
|
-
}
|
2535
|
+
},
|
2534
2536
|
)
|
2535
2537
|
result.success?.should == false
|
2536
2538
|
result.errors.for(:transaction).for(:three_d_secure_pass_thru).on(:eci_flag)[0].code.should == Braintree::ErrorCodes::Transaction::ThreeDSecureEciFlagIsInvalid
|
@@ -2553,7 +2555,7 @@ describe Braintree::Transaction do
|
|
2553
2555
|
:directory_response => "Y",
|
2554
2556
|
:cavv_algorithm => "2",
|
2555
2557
|
:ds_transaction_id => "some_ds_id",
|
2556
|
-
}
|
2558
|
+
},
|
2557
2559
|
)
|
2558
2560
|
result.success?.should == false
|
2559
2561
|
result.errors.for(:transaction).for(:three_d_secure_pass_thru).on(:three_d_secure_version)[0].code.should == Braintree::ErrorCodes::Transaction::ThreeDSecureThreeDSecureVersionIsInvalid
|
@@ -2577,7 +2579,7 @@ describe Braintree::Transaction do
|
|
2577
2579
|
:directory_response => "Y",
|
2578
2580
|
:cavv_algorithm => "2",
|
2579
2581
|
:ds_transaction_id => "some_ds_id",
|
2580
|
-
}
|
2582
|
+
},
|
2581
2583
|
)
|
2582
2584
|
result.success?.should == false
|
2583
2585
|
result.errors.for(:transaction).for(:three_d_secure_pass_thru).on(:authentication_response)[0].code.should == Braintree::ErrorCodes::Transaction::ThreeDSecureAuthenticationResponseIsInvalid
|
@@ -2601,7 +2603,7 @@ describe Braintree::Transaction do
|
|
2601
2603
|
:directory_response => "abc",
|
2602
2604
|
:cavv_algorithm => "2",
|
2603
2605
|
:ds_transaction_id => "some_ds_id",
|
2604
|
-
}
|
2606
|
+
},
|
2605
2607
|
)
|
2606
2608
|
result.success?.should == false
|
2607
2609
|
result.errors.for(:transaction).for(:three_d_secure_pass_thru).on(:directory_response)[0].code.should == Braintree::ErrorCodes::Transaction::ThreeDSecureDirectoryResponseIsInvalid
|
@@ -2625,7 +2627,7 @@ describe Braintree::Transaction do
|
|
2625
2627
|
:directory_response => "Y",
|
2626
2628
|
:cavv_algorithm => "bad_alg",
|
2627
2629
|
:ds_transaction_id => "some_ds_id",
|
2628
|
-
}
|
2630
|
+
},
|
2629
2631
|
)
|
2630
2632
|
result.success?.should == false
|
2631
2633
|
result.errors.for(:transaction).for(:three_d_secure_pass_thru).on(:cavv_algorithm)[0].code.should == Braintree::ErrorCodes::Transaction::ThreeDSecureCavvAlgorithmIsInvalid
|
@@ -2637,12 +2639,12 @@ describe Braintree::Transaction do
|
|
2637
2639
|
it "can create a transaction" do
|
2638
2640
|
payment_method_result = Braintree::PaymentMethod.create(
|
2639
2641
|
:customer_id => Braintree::Customer.create.customer.id,
|
2640
|
-
:payment_method_nonce => Braintree::Test::Nonce::PayPalFuturePayment
|
2642
|
+
:payment_method_nonce => Braintree::Test::Nonce::PayPalFuturePayment,
|
2641
2643
|
)
|
2642
2644
|
result = Braintree::Transaction.create(
|
2643
2645
|
:type => "sale",
|
2644
2646
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
2645
|
-
:payment_method_token => payment_method_result.payment_method.token
|
2647
|
+
:payment_method_token => payment_method_result.payment_method.token,
|
2646
2648
|
)
|
2647
2649
|
|
2648
2650
|
result.should be_success
|
@@ -2657,13 +2659,13 @@ describe Braintree::Transaction do
|
|
2657
2659
|
payment_method_token = rand(36**3).to_s(36)
|
2658
2660
|
nonce = nonce_for_paypal_account(
|
2659
2661
|
:consent_code => "PAYPAL_CONSENT_CODE",
|
2660
|
-
:token => payment_method_token
|
2662
|
+
:token => payment_method_token,
|
2661
2663
|
)
|
2662
2664
|
|
2663
2665
|
result = Braintree::Transaction.create(
|
2664
2666
|
:type => "sale",
|
2665
2667
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
2666
|
-
:payment_method_nonce => nonce
|
2668
|
+
:payment_method_nonce => nonce,
|
2667
2669
|
)
|
2668
2670
|
|
2669
2671
|
result.should be_success
|
@@ -2679,14 +2681,14 @@ describe Braintree::Transaction do
|
|
2679
2681
|
payment_method_token = rand(36**3).to_s(36)
|
2680
2682
|
nonce = nonce_for_paypal_account(
|
2681
2683
|
:consent_code => "PAYPAL_CONSENT_CODE",
|
2682
|
-
:token => payment_method_token
|
2684
|
+
:token => payment_method_token,
|
2683
2685
|
)
|
2684
2686
|
|
2685
2687
|
result = Braintree::Transaction.create(
|
2686
2688
|
:type => "sale",
|
2687
2689
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
2688
2690
|
:payment_method_nonce => nonce,
|
2689
|
-
:options => {:store_in_vault => true}
|
2691
|
+
:options => {:store_in_vault => true},
|
2690
2692
|
)
|
2691
2693
|
|
2692
2694
|
result.success?.should == true
|
@@ -2705,7 +2707,7 @@ describe Braintree::Transaction do
|
|
2705
2707
|
:type => "sale",
|
2706
2708
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
2707
2709
|
:payment_method_nonce => Braintree::Test::Nonce::PayPalBillingAgreement,
|
2708
|
-
:options => {:store_in_vault => true}
|
2710
|
+
:options => {:store_in_vault => true},
|
2709
2711
|
)
|
2710
2712
|
|
2711
2713
|
result.should be_success
|
@@ -2720,7 +2722,7 @@ describe Braintree::Transaction do
|
|
2720
2722
|
result = Braintree::Transaction.create(
|
2721
2723
|
:type => "sale",
|
2722
2724
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
2723
|
-
:payment_method_nonce => Braintree::Test::Nonce::LocalPayment
|
2725
|
+
:payment_method_nonce => Braintree::Test::Nonce::LocalPayment,
|
2724
2726
|
)
|
2725
2727
|
|
2726
2728
|
result.should be_success
|
@@ -2738,7 +2740,7 @@ describe Braintree::Transaction do
|
|
2738
2740
|
result = Braintree::Transaction.create(
|
2739
2741
|
:type => "sale",
|
2740
2742
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
2741
|
-
:payment_method_nonce => Braintree::Test::Nonce::PayPalOneTimePayment
|
2743
|
+
:payment_method_nonce => Braintree::Test::Nonce::PayPalOneTimePayment,
|
2742
2744
|
)
|
2743
2745
|
|
2744
2746
|
result.should be_success
|
@@ -2750,14 +2752,14 @@ describe Braintree::Transaction do
|
|
2750
2752
|
payment_method_token = rand(36**3).to_s(36)
|
2751
2753
|
nonce = nonce_for_paypal_account(
|
2752
2754
|
:access_token => "PAYPAL_ACCESS_TOKEN",
|
2753
|
-
:token => payment_method_token
|
2755
|
+
:token => payment_method_token,
|
2754
2756
|
)
|
2755
2757
|
|
2756
2758
|
result = Braintree::Transaction.create(
|
2757
2759
|
:type => "sale",
|
2758
2760
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
2759
2761
|
:payment_method_nonce => nonce,
|
2760
|
-
:options => {:store_in_vault => true}
|
2762
|
+
:options => {:store_in_vault => true},
|
2761
2763
|
)
|
2762
2764
|
|
2763
2765
|
result.success?.should == true
|
@@ -2777,7 +2779,7 @@ describe Braintree::Transaction do
|
|
2777
2779
|
:payment_method_nonce => Braintree::Test::Nonce::PayPalOneTimePayment,
|
2778
2780
|
:options => {
|
2779
2781
|
:submit_for_settlement => true
|
2780
|
-
}
|
2782
|
+
},
|
2781
2783
|
)
|
2782
2784
|
result.success?.should == true
|
2783
2785
|
result.transaction.status.should == Braintree::Transaction::Status::Settling
|
@@ -2788,7 +2790,7 @@ describe Braintree::Transaction do
|
|
2788
2790
|
it "successfully voids a paypal transaction that's been authorized" do
|
2789
2791
|
sale_transaction = Braintree::Transaction.sale!(
|
2790
2792
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
2791
|
-
:payment_method_nonce => Braintree::Test::Nonce::PayPalOneTimePayment
|
2793
|
+
:payment_method_nonce => Braintree::Test::Nonce::PayPalOneTimePayment,
|
2792
2794
|
)
|
2793
2795
|
|
2794
2796
|
void_transaction = Braintree::Transaction.void!(sale_transaction.id)
|
@@ -2799,7 +2801,7 @@ describe Braintree::Transaction do
|
|
2799
2801
|
it "fails to void a paypal transaction that's been declined" do
|
2800
2802
|
sale_transaction = Braintree::Transaction.sale(
|
2801
2803
|
:amount => Braintree::Test::TransactionAmounts::Decline,
|
2802
|
-
:payment_method_nonce => Braintree::Test::Nonce::PayPalOneTimePayment
|
2804
|
+
:payment_method_nonce => Braintree::Test::Nonce::PayPalOneTimePayment,
|
2803
2805
|
).transaction
|
2804
2806
|
|
2805
2807
|
expect do
|
@@ -2869,6 +2871,19 @@ describe Braintree::Transaction do
|
|
2869
2871
|
result.transaction.amount.should == transaction.amount/2
|
2870
2872
|
end
|
2871
2873
|
|
2874
|
+
it "allows merchant_account_id to be passed for the refund" do
|
2875
|
+
transaction = create_transaction_to_refund
|
2876
|
+
|
2877
|
+
result = Braintree::Transaction.refund(
|
2878
|
+
transaction.id,
|
2879
|
+
:merchant_account_id => SpecHelper::NonDefaultMerchantAccountId,
|
2880
|
+
)
|
2881
|
+
|
2882
|
+
result.success?.should == true
|
2883
|
+
result.transaction.type.should == "credit"
|
2884
|
+
result.transaction.merchant_account_id.should == SpecHelper::NonDefaultMerchantAccountId
|
2885
|
+
end
|
2886
|
+
|
2872
2887
|
it "does not allow arbitrary options to be passed" do
|
2873
2888
|
transaction = create_paypal_transaction_for_refund
|
2874
2889
|
|
@@ -2887,7 +2902,7 @@ describe Braintree::Transaction do
|
|
2887
2902
|
it "returns an error result if unsettled" do
|
2888
2903
|
transaction = Braintree::Transaction.sale!(
|
2889
2904
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
2890
|
-
:payment_method_nonce => Braintree::Test::Nonce::PayPalOneTimePayment
|
2905
|
+
:payment_method_nonce => Braintree::Test::Nonce::PayPalOneTimePayment,
|
2891
2906
|
)
|
2892
2907
|
result = Braintree::Transaction.refund(transaction.id)
|
2893
2908
|
result.success?.should == false
|
@@ -2900,7 +2915,7 @@ describe Braintree::Transaction do
|
|
2900
2915
|
:payment_method_nonce => Braintree::Test::Nonce::Transactable,
|
2901
2916
|
:options => {
|
2902
2917
|
:submit_for_settlement => true
|
2903
|
-
}
|
2918
|
+
},
|
2904
2919
|
)
|
2905
2920
|
config = Braintree::Configuration.instantiate
|
2906
2921
|
response = config.http.put("#{config.base_merchant_path}/transactions/#{transaction.id}/settle")
|
@@ -2921,7 +2936,7 @@ describe Braintree::Transaction do
|
|
2921
2936
|
:payment_method_nonce => Braintree::Test::Nonce::Transactable,
|
2922
2937
|
:options => {
|
2923
2938
|
:submit_for_settlement => true
|
2924
|
-
}
|
2939
|
+
},
|
2925
2940
|
)
|
2926
2941
|
config = Braintree::Configuration.instantiate
|
2927
2942
|
response = config.http.put("#{config.base_merchant_path}/transactions/#{transaction.id}/settle")
|
@@ -2941,13 +2956,13 @@ describe Braintree::Transaction do
|
|
2941
2956
|
it "handles bad unvalidated nonces" do
|
2942
2957
|
nonce = nonce_for_paypal_account(
|
2943
2958
|
:access_token => "PAYPAL_ACCESS_TOKEN",
|
2944
|
-
:consent_code => "PAYPAL_CONSENT_CODE"
|
2959
|
+
:consent_code => "PAYPAL_CONSENT_CODE",
|
2945
2960
|
)
|
2946
2961
|
|
2947
2962
|
result = Braintree::Transaction.create(
|
2948
2963
|
:type => "sale",
|
2949
2964
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
2950
|
-
:payment_method_nonce => nonce
|
2965
|
+
:payment_method_nonce => nonce,
|
2951
2966
|
)
|
2952
2967
|
|
2953
2968
|
result.should_not be_success
|
@@ -2958,7 +2973,7 @@ describe Braintree::Transaction do
|
|
2958
2973
|
result = Braintree::Transaction.create(
|
2959
2974
|
:type => "sale",
|
2960
2975
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
2961
|
-
:payment_method_nonce => "NON_EXISTENT_NONCE"
|
2976
|
+
:payment_method_nonce => "NON_EXISTENT_NONCE",
|
2962
2977
|
)
|
2963
2978
|
|
2964
2979
|
result.should_not be_success
|
@@ -4086,7 +4101,7 @@ describe Braintree::Transaction do
|
|
4086
4101
|
:unit_of_measure => "gallon",
|
4087
4102
|
:total_amount => "10.1",
|
4088
4103
|
},
|
4089
|
-
[
|
4104
|
+
["Name #2"],
|
4090
4105
|
{
|
4091
4106
|
:quantity => "2.02",
|
4092
4107
|
:name => "Name #3",
|
@@ -4272,7 +4287,7 @@ describe Braintree::Transaction do
|
|
4272
4287
|
customer = Braintree::Customer.create!
|
4273
4288
|
result = Braintree::PaymentMethod.create(
|
4274
4289
|
:payment_method_nonce => Braintree::Test::Nonce::PayPalFuturePayment,
|
4275
|
-
:customer_id => customer.id
|
4290
|
+
:customer_id => customer.id,
|
4276
4291
|
)
|
4277
4292
|
payment_method_token = result.payment_method.token
|
4278
4293
|
|
@@ -4371,7 +4386,7 @@ describe Braintree::Transaction do
|
|
4371
4386
|
:amount => "10.00",
|
4372
4387
|
)
|
4373
4388
|
result.success?.should == true
|
4374
|
-
result.transaction.network_transaction_id.
|
4389
|
+
result.transaction.network_transaction_id.should_not be_nil
|
4375
4390
|
end
|
4376
4391
|
|
4377
4392
|
it "accepts blank previous_network_transaction_id" do
|
@@ -4388,7 +4403,7 @@ describe Braintree::Transaction do
|
|
4388
4403
|
:amount => "10.00",
|
4389
4404
|
)
|
4390
4405
|
result.success?.should == true
|
4391
|
-
result.transaction.network_transaction_id.
|
4406
|
+
result.transaction.network_transaction_id.should_not be_nil
|
4392
4407
|
end
|
4393
4408
|
end
|
4394
4409
|
end
|
@@ -4407,7 +4422,7 @@ describe Braintree::Transaction do
|
|
4407
4422
|
:credit_card => {
|
4408
4423
|
:account_type => "credit",
|
4409
4424
|
}
|
4410
|
-
}
|
4425
|
+
},
|
4411
4426
|
)
|
4412
4427
|
result.success?.should == true
|
4413
4428
|
result.transaction.credit_card_details.account_type.should == "credit"
|
@@ -4426,7 +4441,7 @@ describe Braintree::Transaction do
|
|
4426
4441
|
:credit_card => {
|
4427
4442
|
:account_type => "credit",
|
4428
4443
|
}
|
4429
|
-
}
|
4444
|
+
},
|
4430
4445
|
)
|
4431
4446
|
result.success?.should == true
|
4432
4447
|
result.transaction.credit_card_details.account_type.should == "credit"
|
@@ -4446,7 +4461,7 @@ describe Braintree::Transaction do
|
|
4446
4461
|
:account_type => "debit",
|
4447
4462
|
},
|
4448
4463
|
:submit_for_settlement => true,
|
4449
|
-
}
|
4464
|
+
},
|
4450
4465
|
)
|
4451
4466
|
result.success?.should == true
|
4452
4467
|
result.transaction.credit_card_details.account_type.should == "debit"
|
@@ -4465,7 +4480,7 @@ describe Braintree::Transaction do
|
|
4465
4480
|
:credit_card => {
|
4466
4481
|
:account_type => "debit",
|
4467
4482
|
},
|
4468
|
-
}
|
4483
|
+
},
|
4469
4484
|
)
|
4470
4485
|
result.success?.should == false
|
4471
4486
|
result.errors.for(:transaction).for(:options).for(:credit_card).on(:account_type)[0].code.should == Braintree::ErrorCodes::Transaction::Options::CreditCard::AccountTypeDebitDoesNotSupportAuths
|
@@ -4484,7 +4499,7 @@ describe Braintree::Transaction do
|
|
4484
4499
|
:credit_card => {
|
4485
4500
|
:account_type => "ach",
|
4486
4501
|
},
|
4487
|
-
}
|
4502
|
+
},
|
4488
4503
|
)
|
4489
4504
|
result.success?.should == false
|
4490
4505
|
result.errors.for(:transaction).for(:options).for(:credit_card).on(:account_type)[0].code.should == Braintree::ErrorCodes::Transaction::Options::CreditCard::AccountTypeIsInvalid
|
@@ -4502,7 +4517,7 @@ describe Braintree::Transaction do
|
|
4502
4517
|
:credit_card => {
|
4503
4518
|
:account_type => "credit",
|
4504
4519
|
},
|
4505
|
-
}
|
4520
|
+
},
|
4506
4521
|
)
|
4507
4522
|
result.success?.should == false
|
4508
4523
|
result.errors.for(:transaction).for(:options).for(:credit_card).on(:account_type)[0].code.should == Braintree::ErrorCodes::Transaction::Options::CreditCard::AccountTypeNotSupported
|
@@ -4518,7 +4533,7 @@ describe Braintree::Transaction do
|
|
4518
4533
|
:credit_card => {
|
4519
4534
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
4520
4535
|
:expiration_date => "05/2009"
|
4521
|
-
}
|
4536
|
+
},
|
4522
4537
|
)
|
4523
4538
|
transaction.id.should =~ /^\w{6,}$/
|
4524
4539
|
transaction.type.should == "sale"
|
@@ -4536,7 +4551,7 @@ describe Braintree::Transaction do
|
|
4536
4551
|
:credit_card => {
|
4537
4552
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
4538
4553
|
:expiration_date => "05/2009"
|
4539
|
-
}
|
4554
|
+
},
|
4540
4555
|
)
|
4541
4556
|
end.to raise_error(Braintree::ValidationsFailed)
|
4542
4557
|
end
|
@@ -4592,7 +4607,7 @@ describe Braintree::Transaction do
|
|
4592
4607
|
:credit_card => {
|
4593
4608
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
4594
4609
|
:expiration_date => "05/2009"
|
4595
|
-
}
|
4610
|
+
},
|
4596
4611
|
)
|
4597
4612
|
result = Braintree::Transaction.refund(transaction.id)
|
4598
4613
|
result.success?.should == false
|
@@ -4629,7 +4644,7 @@ describe Braintree::Transaction do
|
|
4629
4644
|
:credit_card => {
|
4630
4645
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
4631
4646
|
:expiration_date => "05/2009"
|
4632
|
-
}
|
4647
|
+
},
|
4633
4648
|
)
|
4634
4649
|
result.success?.should == true
|
4635
4650
|
result.transaction.id.should =~ /^\w{6,}$/
|
@@ -4685,7 +4700,7 @@ describe Braintree::Transaction do
|
|
4685
4700
|
:postal_code => "60103",
|
4686
4701
|
:country_name => "United States of America",
|
4687
4702
|
:shipping_method => Braintree::Transaction::AddressDetails::ShippingMethod::Electronic
|
4688
|
-
}
|
4703
|
+
},
|
4689
4704
|
)
|
4690
4705
|
result.success?.should == true
|
4691
4706
|
transaction = result.transaction
|
@@ -4749,7 +4764,7 @@ describe Braintree::Transaction do
|
|
4749
4764
|
:credit_card => {
|
4750
4765
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
4751
4766
|
:expiration_date => "05/2009"
|
4752
|
-
}
|
4767
|
+
},
|
4753
4768
|
)
|
4754
4769
|
result.success?.should == true
|
4755
4770
|
result.transaction.merchant_account_id.should == SpecHelper::NonDefaultMerchantAccountId
|
@@ -4761,7 +4776,7 @@ describe Braintree::Transaction do
|
|
4761
4776
|
:credit_card => {
|
4762
4777
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
4763
4778
|
:expiration_date => "05/2009"
|
4764
|
-
}
|
4779
|
+
},
|
4765
4780
|
)
|
4766
4781
|
result.success?.should == true
|
4767
4782
|
result.transaction.merchant_account_id.should == SpecHelper::DefaultMerchantAccountId
|
@@ -4780,7 +4795,7 @@ describe Braintree::Transaction do
|
|
4780
4795
|
},
|
4781
4796
|
:options => {
|
4782
4797
|
:store_in_vault => true
|
4783
|
-
}
|
4798
|
+
},
|
4784
4799
|
)
|
4785
4800
|
result.success?.should == true
|
4786
4801
|
transaction = result.transaction
|
@@ -4815,7 +4830,7 @@ describe Braintree::Transaction do
|
|
4815
4830
|
:options => {
|
4816
4831
|
:store_in_vault => true,
|
4817
4832
|
:add_billing_address_to_payment_method => true,
|
4818
|
-
}
|
4833
|
+
},
|
4819
4834
|
)
|
4820
4835
|
result.success?.should == true
|
4821
4836
|
transaction = result.transaction
|
@@ -4860,7 +4875,7 @@ describe Braintree::Transaction do
|
|
4860
4875
|
:options => {
|
4861
4876
|
:store_in_vault => true,
|
4862
4877
|
:store_shipping_address_in_vault => true,
|
4863
|
-
}
|
4878
|
+
},
|
4864
4879
|
)
|
4865
4880
|
result.success?.should == true
|
4866
4881
|
transaction = result.transaction
|
@@ -4886,7 +4901,7 @@ describe Braintree::Transaction do
|
|
4886
4901
|
:number => "5105105105105100",
|
4887
4902
|
:expiration_date => "05/2012"
|
4888
4903
|
},
|
4889
|
-
:options => {
|
4904
|
+
:options => {:store_in_vault => true},
|
4890
4905
|
)
|
4891
4906
|
|
4892
4907
|
result.success?.should == true
|
@@ -4904,7 +4919,7 @@ describe Braintree::Transaction do
|
|
4904
4919
|
},
|
4905
4920
|
:options => {
|
4906
4921
|
:submit_for_settlement => true
|
4907
|
-
}
|
4922
|
+
},
|
4908
4923
|
)
|
4909
4924
|
result.success?.should == true
|
4910
4925
|
result.transaction.status.should == Braintree::Transaction::Status::SubmittedForSettlement
|
@@ -4927,7 +4942,7 @@ describe Braintree::Transaction do
|
|
4927
4942
|
},
|
4928
4943
|
:options => {
|
4929
4944
|
:store_in_vault => true
|
4930
|
-
}
|
4945
|
+
},
|
4931
4946
|
)
|
4932
4947
|
result.success?.should == true
|
4933
4948
|
transaction = result.transaction
|
@@ -4942,20 +4957,20 @@ describe Braintree::Transaction do
|
|
4942
4957
|
:credit_card => {
|
4943
4958
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
4944
4959
|
:expiration_date => "05/2010"
|
4945
|
-
}
|
4960
|
+
},
|
4946
4961
|
)
|
4947
4962
|
address = Braintree::Address.create!(
|
4948
4963
|
:customer_id => customer.id,
|
4949
|
-
:street_address =>
|
4964
|
+
:street_address => "123 Fake St.",
|
4950
4965
|
)
|
4951
4966
|
result = Braintree::Transaction.sale(
|
4952
4967
|
:amount => "100",
|
4953
4968
|
:customer_id => customer.id,
|
4954
|
-
:shipping_address_id => address.id
|
4969
|
+
:shipping_address_id => address.id,
|
4955
4970
|
)
|
4956
4971
|
result.success?.should == true
|
4957
4972
|
transaction = result.transaction
|
4958
|
-
transaction.shipping_details.street_address.should ==
|
4973
|
+
transaction.shipping_details.street_address.should == "123 Fake St."
|
4959
4974
|
transaction.customer_details.id.should == customer.id
|
4960
4975
|
transaction.shipping_details.id.should == address.id
|
4961
4976
|
end
|
@@ -4972,7 +4987,7 @@ describe Braintree::Transaction do
|
|
4972
4987
|
}
|
4973
4988
|
result = Braintree::Transaction.sale(params[:transaction])
|
4974
4989
|
result.success?.should == false
|
4975
|
-
result.params.should == {:transaction => {:type =>
|
4990
|
+
result.params.should == {:transaction => {:type => "sale", :amount => nil, :credit_card => {:expiration_date => "05/2009"}}}
|
4976
4991
|
result.errors.for(:transaction).on(:amount)[0].code.should == Braintree::ErrorCodes::Transaction::AmountIsRequired
|
4977
4992
|
end
|
4978
4993
|
|
@@ -5043,8 +5058,24 @@ describe Braintree::Transaction do
|
|
5043
5058
|
result.errors.for(:transaction).on(:currency_iso_code)[0].code.should == Braintree::ErrorCodes::Transaction::CurrencyCodeNotSupportedByMerchantAccount
|
5044
5059
|
end
|
5045
5060
|
|
5061
|
+
it "validates tax_amount for Aib domestic sweden transaction and returns error" do
|
5062
|
+
params = {
|
5063
|
+
:transaction => {
|
5064
|
+
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
5065
|
+
:merchant_account_id => SpecHelper::AibSwedenMaMerchantAccountId,
|
5066
|
+
:credit_card => {
|
5067
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
5068
|
+
:expiration_date => "05/2030"
|
5069
|
+
}
|
5070
|
+
}
|
5071
|
+
}
|
5072
|
+
result = Braintree::Transaction.sale(params[:transaction])
|
5073
|
+
result.success?.should == false
|
5074
|
+
result.errors.for(:transaction).on(:tax_amount)[0].code.should == Braintree::ErrorCodes::Transaction::TaxAmountIsRequiredForAibSwedish
|
5075
|
+
end
|
5076
|
+
|
5046
5077
|
it "skips advanced fraud checking if transaction[options][skip_advanced_fraud_checking] is set to true" do
|
5047
|
-
|
5078
|
+
with_advanced_fraud_kount_integration_merchant do
|
5048
5079
|
result = Braintree::Transaction.sale(
|
5049
5080
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
5050
5081
|
:credit_card => {
|
@@ -5053,7 +5084,7 @@ describe Braintree::Transaction do
|
|
5053
5084
|
},
|
5054
5085
|
:options => {
|
5055
5086
|
:skip_advanced_fraud_checking => true
|
5056
|
-
}
|
5087
|
+
},
|
5057
5088
|
)
|
5058
5089
|
result.success?.should == true
|
5059
5090
|
result.transaction.risk_data.should be_nil
|
@@ -5147,7 +5178,7 @@ describe Braintree::Transaction do
|
|
5147
5178
|
:currency_amount => "10.00",
|
5148
5179
|
:currency_iso_code => "USD"
|
5149
5180
|
}
|
5150
|
-
}
|
5181
|
+
},
|
5151
5182
|
)
|
5152
5183
|
result.success?.should == true
|
5153
5184
|
result.transaction.status.should == Braintree::Transaction::Status::SubmittedForSettlement
|
@@ -5169,7 +5200,7 @@ describe Braintree::Transaction do
|
|
5169
5200
|
:currency_amount => "10.00",
|
5170
5201
|
:currency_iso_code => "USD"
|
5171
5202
|
}
|
5172
|
-
}
|
5203
|
+
},
|
5173
5204
|
)
|
5174
5205
|
result.success?.should == true
|
5175
5206
|
result.transaction.status.should == Braintree::Transaction::Status::SubmittedForSettlement
|
@@ -5191,7 +5222,7 @@ describe Braintree::Transaction do
|
|
5191
5222
|
:currency_amount => "10.00",
|
5192
5223
|
:currency_iso_code => "USD"
|
5193
5224
|
}
|
5194
|
-
}
|
5225
|
+
},
|
5195
5226
|
)
|
5196
5227
|
result.success?.should == true
|
5197
5228
|
result.transaction.status.should == Braintree::Transaction::Status::SubmittedForSettlement
|
@@ -5214,7 +5245,7 @@ describe Braintree::Transaction do
|
|
5214
5245
|
:currency_amount => "10.00",
|
5215
5246
|
:currency_iso_code => "USD"
|
5216
5247
|
}
|
5217
|
-
}
|
5248
|
+
},
|
5218
5249
|
)
|
5219
5250
|
result.success?.should == true
|
5220
5251
|
|
@@ -5238,7 +5269,7 @@ describe Braintree::Transaction do
|
|
5238
5269
|
:currency_amount => "10.00",
|
5239
5270
|
:currency_iso_code => "USD"
|
5240
5271
|
}
|
5241
|
-
}
|
5272
|
+
},
|
5242
5273
|
)
|
5243
5274
|
result.success?.should == true
|
5244
5275
|
result.transaction.status.should == Braintree::Transaction::Status::Authorized
|
@@ -5263,7 +5294,7 @@ describe Braintree::Transaction do
|
|
5263
5294
|
:currency_amount => "10.00",
|
5264
5295
|
:currency_iso_code => "USD"
|
5265
5296
|
}
|
5266
|
-
}
|
5297
|
+
},
|
5267
5298
|
)
|
5268
5299
|
result.success?.should == true
|
5269
5300
|
result.transaction.status.should == Braintree::Transaction::Status::Authorized
|
@@ -5283,7 +5314,7 @@ describe Braintree::Transaction do
|
|
5283
5314
|
:credit_card => {
|
5284
5315
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
5285
5316
|
:expiration_date => "05/2009"
|
5286
|
-
}
|
5317
|
+
},
|
5287
5318
|
)
|
5288
5319
|
transaction.id.should =~ /^\w{6,}$/
|
5289
5320
|
transaction.type.should == "sale"
|
@@ -5300,7 +5331,7 @@ describe Braintree::Transaction do
|
|
5300
5331
|
:credit_card => {
|
5301
5332
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
5302
5333
|
:expiration_date => "05/2009"
|
5303
|
-
}
|
5334
|
+
},
|
5304
5335
|
)
|
5305
5336
|
end.to raise_error(Braintree::ValidationsFailed)
|
5306
5337
|
end
|
@@ -5313,7 +5344,7 @@ describe Braintree::Transaction do
|
|
5313
5344
|
:credit_card => {
|
5314
5345
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
5315
5346
|
:expiration_date => "06/2009"
|
5316
|
-
}
|
5347
|
+
},
|
5317
5348
|
)
|
5318
5349
|
result = Braintree::Transaction.submit_for_settlement(transaction.id)
|
5319
5350
|
result.success?.should == true
|
@@ -5325,7 +5356,7 @@ describe Braintree::Transaction do
|
|
5325
5356
|
:credit_card => {
|
5326
5357
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
5327
5358
|
:expiration_date => "06/2009"
|
5328
|
-
}
|
5359
|
+
},
|
5329
5360
|
)
|
5330
5361
|
transaction.amount.should == BigDecimal("1000.00")
|
5331
5362
|
result = Braintree::Transaction.submit_for_settlement(transaction.id, "999.99")
|
@@ -5341,9 +5372,9 @@ describe Braintree::Transaction do
|
|
5341
5372
|
:credit_card => {
|
5342
5373
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
5343
5374
|
:expiration_date => "06/2009"
|
5344
|
-
}
|
5375
|
+
},
|
5345
5376
|
)
|
5346
|
-
options = {
|
5377
|
+
options = {:order_id => "ABC123"}
|
5347
5378
|
result = Braintree::Transaction.submit_for_settlement(transaction.id, nil, options)
|
5348
5379
|
result.success?.should == true
|
5349
5380
|
result.transaction.order_id.should == "ABC123"
|
@@ -5356,13 +5387,13 @@ describe Braintree::Transaction do
|
|
5356
5387
|
:credit_card => {
|
5357
5388
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
5358
5389
|
:expiration_date => "06/2009"
|
5359
|
-
}
|
5390
|
+
},
|
5360
5391
|
)
|
5361
5392
|
|
5362
5393
|
options = {
|
5363
5394
|
:descriptor => {
|
5364
|
-
:name =>
|
5365
|
-
:phone =>
|
5395
|
+
:name => "123*123456789012345678",
|
5396
|
+
:phone => "3334445555",
|
5366
5397
|
:url => "ebay.com"
|
5367
5398
|
}
|
5368
5399
|
}
|
@@ -5370,9 +5401,9 @@ describe Braintree::Transaction do
|
|
5370
5401
|
result = Braintree::Transaction.submit_for_settlement(transaction.id, nil, options)
|
5371
5402
|
result.success?.should == true
|
5372
5403
|
result.transaction.status.should == Braintree::Transaction::Status::SubmittedForSettlement
|
5373
|
-
result.transaction.descriptor.name.should ==
|
5374
|
-
result.transaction.descriptor.phone.should ==
|
5375
|
-
result.transaction.descriptor.url.should ==
|
5404
|
+
result.transaction.descriptor.name.should == "123*123456789012345678"
|
5405
|
+
result.transaction.descriptor.phone.should == "3334445555"
|
5406
|
+
result.transaction.descriptor.url.should == "ebay.com"
|
5376
5407
|
end
|
5377
5408
|
|
5378
5409
|
it "raises an error if an invalid option is passed in" do
|
@@ -5381,10 +5412,10 @@ describe Braintree::Transaction do
|
|
5381
5412
|
:credit_card => {
|
5382
5413
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
5383
5414
|
:expiration_date => "06/2009"
|
5384
|
-
}
|
5415
|
+
},
|
5385
5416
|
)
|
5386
5417
|
|
5387
|
-
options = {
|
5418
|
+
options = {:order_id => "ABC123", :invalid_option => "i'm invalid"}
|
5388
5419
|
|
5389
5420
|
expect do
|
5390
5421
|
Braintree::Transaction.submit_for_settlement(transaction.id, nil, options)
|
@@ -5394,10 +5425,11 @@ describe Braintree::Transaction do
|
|
5394
5425
|
it "returns an error result if settlement is too large" do
|
5395
5426
|
transaction = Braintree::Transaction.sale!(
|
5396
5427
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
5428
|
+
:merchant_account_id => SpecHelper::CardProcessorBRLMerchantAccountId,
|
5397
5429
|
:credit_card => {
|
5398
5430
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
5399
5431
|
:expiration_date => "06/2009"
|
5400
|
-
}
|
5432
|
+
},
|
5401
5433
|
)
|
5402
5434
|
transaction.amount.should == BigDecimal("1000.00")
|
5403
5435
|
result = Braintree::Transaction.submit_for_settlement(transaction.id, "1000.01")
|
@@ -5412,7 +5444,7 @@ describe Braintree::Transaction do
|
|
5412
5444
|
:credit_card => {
|
5413
5445
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
5414
5446
|
:expiration_date => "06/2009"
|
5415
|
-
}
|
5447
|
+
},
|
5416
5448
|
).transaction
|
5417
5449
|
result = Braintree::Transaction.submit_for_settlement(transaction.id)
|
5418
5450
|
result.success?.should == false
|
@@ -5429,7 +5461,7 @@ describe Braintree::Transaction do
|
|
5429
5461
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
5430
5462
|
:expiration_date => "06/2009"
|
5431
5463
|
},
|
5432
|
-
:service_fee_amount => "1.00"
|
5464
|
+
:service_fee_amount => "1.00",
|
5433
5465
|
).transaction
|
5434
5466
|
result = Braintree::Transaction.submit_for_settlement(transaction.id, "0.01")
|
5435
5467
|
result.success?.should == false
|
@@ -5452,7 +5484,7 @@ describe Braintree::Transaction do
|
|
5452
5484
|
:currency_amount => "10.00",
|
5453
5485
|
:currency_iso_code => "USD"
|
5454
5486
|
}
|
5455
|
-
}
|
5487
|
+
},
|
5456
5488
|
)
|
5457
5489
|
result.success?.should == true
|
5458
5490
|
|
@@ -5476,7 +5508,7 @@ describe Braintree::Transaction do
|
|
5476
5508
|
:currency_amount => "10.00",
|
5477
5509
|
:currency_iso_code => "USD"
|
5478
5510
|
}
|
5479
|
-
}
|
5511
|
+
},
|
5480
5512
|
)
|
5481
5513
|
result.success?.should == true
|
5482
5514
|
|
@@ -5496,7 +5528,7 @@ describe Braintree::Transaction do
|
|
5496
5528
|
:discount_amount => "12.00",
|
5497
5529
|
:tax_amount => "0",
|
5498
5530
|
},
|
5499
|
-
]
|
5531
|
+
],
|
5500
5532
|
)
|
5501
5533
|
result.success?.should == true
|
5502
5534
|
result.transaction.status.should == Braintree::Transaction::Status::SubmittedForSettlement
|
@@ -5510,9 +5542,9 @@ describe Braintree::Transaction do
|
|
5510
5542
|
:credit_card => {
|
5511
5543
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
5512
5544
|
:expiration_date => "06/2009"
|
5513
|
-
}
|
5545
|
+
},
|
5514
5546
|
)
|
5515
|
-
options = {
|
5547
|
+
options = {:order_id => "ABC123"}
|
5516
5548
|
transaction = Braintree::Transaction.submit_for_settlement!(original_transaction.id, "0.01", options)
|
5517
5549
|
transaction.status.should == Braintree::Transaction::Status::SubmittedForSettlement
|
5518
5550
|
transaction.id.should == original_transaction.id
|
@@ -5522,10 +5554,11 @@ describe Braintree::Transaction do
|
|
5522
5554
|
it "raises a ValidationsFailed if unsuccessful" do
|
5523
5555
|
transaction = Braintree::Transaction.sale!(
|
5524
5556
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
5557
|
+
:merchant_account_id => SpecHelper::CardProcessorBRLMerchantAccountId,
|
5525
5558
|
:credit_card => {
|
5526
5559
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
5527
5560
|
:expiration_date => "06/2009"
|
5528
|
-
}
|
5561
|
+
},
|
5529
5562
|
)
|
5530
5563
|
transaction.amount.should == BigDecimal("1000.00")
|
5531
5564
|
expect do
|
@@ -5541,18 +5574,18 @@ describe Braintree::Transaction do
|
|
5541
5574
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
5542
5575
|
:merchant_account_id => SpecHelper::DefaultMerchantAccountId,
|
5543
5576
|
:descriptor => {
|
5544
|
-
:name =>
|
5545
|
-
:phone =>
|
5577
|
+
:name => "123*123456789012345678",
|
5578
|
+
:phone => "3334445555",
|
5546
5579
|
:url => "ebay.com"
|
5547
5580
|
},
|
5548
|
-
:order_id =>
|
5581
|
+
:order_id => "123",
|
5549
5582
|
:credit_card => {
|
5550
5583
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
5551
5584
|
:expiration_date => "06/2009"
|
5552
5585
|
},
|
5553
5586
|
:options => {
|
5554
5587
|
:submit_for_settlement => true
|
5555
|
-
}
|
5588
|
+
},
|
5556
5589
|
)
|
5557
5590
|
end
|
5558
5591
|
|
@@ -5560,16 +5593,16 @@ describe Braintree::Transaction do
|
|
5560
5593
|
result = Braintree::Transaction.update_details(transaction.id, {
|
5561
5594
|
:amount => Braintree::Test::TransactionAmounts::Authorize.to_f - 1,
|
5562
5595
|
:descriptor => {
|
5563
|
-
:name =>
|
5564
|
-
:phone =>
|
5596
|
+
:name => "456*123456789012345678",
|
5597
|
+
:phone => "3334445555",
|
5565
5598
|
:url => "ebay.com",
|
5566
5599
|
},
|
5567
|
-
:order_id =>
|
5600
|
+
:order_id => "456"
|
5568
5601
|
})
|
5569
5602
|
result.success?.should == true
|
5570
5603
|
result.transaction.amount.should == BigDecimal(Braintree::Test::TransactionAmounts::Authorize) - 1
|
5571
|
-
result.transaction.order_id.should ==
|
5572
|
-
result.transaction.descriptor.name.should ==
|
5604
|
+
result.transaction.order_id.should == "456"
|
5605
|
+
result.transaction.descriptor.name.should == "456*123456789012345678"
|
5573
5606
|
end
|
5574
5607
|
|
5575
5608
|
it "raises an error when a key is invalid" do
|
@@ -5577,11 +5610,11 @@ describe Braintree::Transaction do
|
|
5577
5610
|
Braintree::Transaction.update_details(transaction.id, {
|
5578
5611
|
:invalid_key => Braintree::Test::TransactionAmounts::Authorize.to_f - 1,
|
5579
5612
|
:descriptor => {
|
5580
|
-
:name =>
|
5581
|
-
:phone =>
|
5613
|
+
:name => "456*123456789012345678",
|
5614
|
+
:phone => "3334445555",
|
5582
5615
|
:url => "ebay.com",
|
5583
5616
|
},
|
5584
|
-
:order_id =>
|
5617
|
+
:order_id => "456"
|
5585
5618
|
})
|
5586
5619
|
end.to raise_error(ArgumentError)
|
5587
5620
|
end
|
@@ -5591,11 +5624,11 @@ describe Braintree::Transaction do
|
|
5591
5624
|
result = Braintree::Transaction.update_details(transaction.id, {
|
5592
5625
|
:amount => "10000",
|
5593
5626
|
:descriptor => {
|
5594
|
-
:name =>
|
5595
|
-
:phone =>
|
5627
|
+
:name => "456*123456789012345678",
|
5628
|
+
:phone => "3334445555",
|
5596
5629
|
:url => "ebay.com",
|
5597
5630
|
},
|
5598
|
-
:order_id =>
|
5631
|
+
:order_id => "456"
|
5599
5632
|
})
|
5600
5633
|
result.success?.should == false
|
5601
5634
|
result.errors.for(:transaction).on(:amount)[0].code.should == Braintree::ErrorCodes::Transaction::SettlementAmountIsTooLarge
|
@@ -5605,11 +5638,11 @@ describe Braintree::Transaction do
|
|
5605
5638
|
result = Braintree::Transaction.update_details(transaction.id, {
|
5606
5639
|
:amount => Braintree::Test::TransactionAmounts::Authorize.to_f - 1,
|
5607
5640
|
:descriptor => {
|
5608
|
-
:name =>
|
5609
|
-
:phone =>
|
5610
|
-
:url =>
|
5641
|
+
:name => "invalid descriptor name",
|
5642
|
+
:phone => "invalid phone",
|
5643
|
+
:url => "12345678901234"
|
5611
5644
|
},
|
5612
|
-
:order_id =>
|
5645
|
+
:order_id => "456"
|
5613
5646
|
})
|
5614
5647
|
result.success?.should == false
|
5615
5648
|
result.errors.for(:transaction).for(:descriptor).on(:name)[0].code.should == Braintree::ErrorCodes::Descriptor::NameFormatIsInvalid
|
@@ -5621,11 +5654,11 @@ describe Braintree::Transaction do
|
|
5621
5654
|
result = Braintree::Transaction.update_details(transaction.id, {
|
5622
5655
|
:amount => Braintree::Test::TransactionAmounts::Authorize.to_f - 1,
|
5623
5656
|
:descriptor => {
|
5624
|
-
:name =>
|
5625
|
-
:phone =>
|
5657
|
+
:name => "456*123456789012345678",
|
5658
|
+
:phone => "3334445555",
|
5626
5659
|
:url => "ebay.com",
|
5627
5660
|
},
|
5628
|
-
:order_id =>
|
5661
|
+
:order_id => "x" * 256
|
5629
5662
|
})
|
5630
5663
|
result.success?.should == false
|
5631
5664
|
result.errors.for(:transaction).on(:order_id)[0].code.should == Braintree::ErrorCodes::Transaction::OrderIdIsTooLong
|
@@ -5636,27 +5669,27 @@ describe Braintree::Transaction do
|
|
5636
5669
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
5637
5670
|
:merchant_account_id => SpecHelper::FakeAmexDirectMerchantAccountId,
|
5638
5671
|
:descriptor => {
|
5639
|
-
:name =>
|
5640
|
-
:phone =>
|
5672
|
+
:name => "123*123456789012345678",
|
5673
|
+
:phone => "3334445555",
|
5641
5674
|
:url => "ebay.com"
|
5642
5675
|
},
|
5643
|
-
:order_id =>
|
5676
|
+
:order_id => "123",
|
5644
5677
|
:credit_card => {
|
5645
5678
|
:number => Braintree::Test::CreditCardNumbers::AmexPayWithPoints::Success,
|
5646
5679
|
:expiration_date => "05/2009"
|
5647
5680
|
},
|
5648
5681
|
:options => {
|
5649
5682
|
:submit_for_settlement => true
|
5650
|
-
}
|
5683
|
+
},
|
5651
5684
|
)
|
5652
5685
|
result = Braintree::Transaction.update_details(transaction.id, {
|
5653
5686
|
:amount => Braintree::Test::TransactionAmounts::Authorize.to_f - 1,
|
5654
5687
|
:descriptor => {
|
5655
|
-
:name =>
|
5656
|
-
:phone =>
|
5688
|
+
:name => "456*123456789012345678",
|
5689
|
+
:phone => "3334445555",
|
5657
5690
|
:url => "ebay.com",
|
5658
5691
|
},
|
5659
|
-
:order_id =>
|
5692
|
+
:order_id => "456"
|
5660
5693
|
})
|
5661
5694
|
result.success?.should == false
|
5662
5695
|
result.errors.for(:transaction).on(:base)[0].code.should == Braintree::ErrorCodes::Transaction::ProcessorDoesNotSupportUpdatingTransactionDetails
|
@@ -5670,24 +5703,24 @@ describe Braintree::Transaction do
|
|
5670
5703
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
5671
5704
|
:merchant_account_id => SpecHelper::DefaultMerchantAccountId,
|
5672
5705
|
:descriptor => {
|
5673
|
-
:name =>
|
5674
|
-
:phone =>
|
5706
|
+
:name => "123*123456789012345678",
|
5707
|
+
:phone => "3334445555",
|
5675
5708
|
:url => "ebay.com"
|
5676
5709
|
},
|
5677
|
-
:order_id =>
|
5710
|
+
:order_id => "123",
|
5678
5711
|
:credit_card => {
|
5679
5712
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
5680
5713
|
:expiration_date => "06/2009"
|
5681
|
-
}
|
5714
|
+
},
|
5682
5715
|
)
|
5683
5716
|
result = Braintree::Transaction.update_details(transaction.id, {
|
5684
5717
|
:amount => Braintree::Test::TransactionAmounts::Authorize.to_f - 1,
|
5685
5718
|
:descriptor => {
|
5686
|
-
:name =>
|
5687
|
-
:phone =>
|
5719
|
+
:name => "456*123456789012345678",
|
5720
|
+
:phone => "3334445555",
|
5688
5721
|
:url => "ebay.com",
|
5689
5722
|
},
|
5690
|
-
:order_id =>
|
5723
|
+
:order_id => "456"
|
5691
5724
|
})
|
5692
5725
|
result.success?.should == false
|
5693
5726
|
result.errors.for(:transaction).on(:base)[0].code.should == Braintree::ErrorCodes::Transaction::CannotUpdateTransactionDetailsNotSubmittedForSettlement
|
@@ -5704,7 +5737,7 @@ describe Braintree::Transaction do
|
|
5704
5737
|
:credit_card => {
|
5705
5738
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
5706
5739
|
:expiration_date => "06/2009"
|
5707
|
-
}
|
5740
|
+
},
|
5708
5741
|
)
|
5709
5742
|
|
5710
5743
|
result = Braintree::Transaction.submit_for_partial_settlement(authorized_transaction.id, 100)
|
@@ -5739,7 +5772,7 @@ describe Braintree::Transaction do
|
|
5739
5772
|
:credit_card => {
|
5740
5773
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
5741
5774
|
:expiration_date => "05/2009"
|
5742
|
-
}
|
5775
|
+
},
|
5743
5776
|
)
|
5744
5777
|
|
5745
5778
|
result = Braintree::Transaction.submit_for_partial_settlement(authorized_transaction.id, 100, :order_id => 1234)
|
@@ -5755,7 +5788,7 @@ describe Braintree::Transaction do
|
|
5755
5788
|
:credit_card => {
|
5756
5789
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
5757
5790
|
:expiration_date => "05/2009"
|
5758
|
-
}
|
5791
|
+
},
|
5759
5792
|
)
|
5760
5793
|
|
5761
5794
|
result = Braintree::Transaction.submit_for_partial_settlement(authorized_transaction.id, 100, :order_id => "1"*256)
|
@@ -5770,13 +5803,13 @@ describe Braintree::Transaction do
|
|
5770
5803
|
:credit_card => {
|
5771
5804
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
5772
5805
|
:expiration_date => "05/2009"
|
5773
|
-
}
|
5806
|
+
},
|
5774
5807
|
)
|
5775
5808
|
|
5776
5809
|
result = Braintree::Transaction.submit_for_partial_settlement(
|
5777
5810
|
authorized_transaction.id,
|
5778
5811
|
100,
|
5779
|
-
:descriptor => {
|
5812
|
+
:descriptor => {:name => "123*123456789012345678", :phone => "5555551234", :url => "url.com"},
|
5780
5813
|
)
|
5781
5814
|
result.success?.should == true
|
5782
5815
|
partial_settlement_transaction = result.transaction
|
@@ -5792,7 +5825,7 @@ describe Braintree::Transaction do
|
|
5792
5825
|
:credit_card => {
|
5793
5826
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
5794
5827
|
:expiration_date => "05/2009"
|
5795
|
-
}
|
5828
|
+
},
|
5796
5829
|
)
|
5797
5830
|
|
5798
5831
|
result = Braintree::Transaction.submit_for_partial_settlement(
|
@@ -5800,9 +5833,9 @@ describe Braintree::Transaction do
|
|
5800
5833
|
100,
|
5801
5834
|
:descriptor => {
|
5802
5835
|
:name => "invalid_format",
|
5803
|
-
:phone =>
|
5804
|
-
:url =>
|
5805
|
-
}
|
5836
|
+
:phone => "%bad4445555",
|
5837
|
+
:url => "12345678901234"
|
5838
|
+
},
|
5806
5839
|
)
|
5807
5840
|
result.success?.should == false
|
5808
5841
|
result.errors.for(:transaction).for(:descriptor).on(:name)[0].code.should == Braintree::ErrorCodes::Descriptor::NameFormatIsInvalid
|
@@ -5817,7 +5850,7 @@ describe Braintree::Transaction do
|
|
5817
5850
|
:credit_card => {
|
5818
5851
|
:number => Braintree::Test::CreditCardNumbers::AmexPayWithPoints::Success,
|
5819
5852
|
:expiration_date => "05/2009"
|
5820
|
-
}
|
5853
|
+
},
|
5821
5854
|
)
|
5822
5855
|
|
5823
5856
|
result = Braintree::Transaction.submit_for_partial_settlement(authorized_transaction.id, 100)
|
@@ -5829,7 +5862,7 @@ describe Braintree::Transaction do
|
|
5829
5862
|
authorized_transaction = Braintree::Transaction.sale!(
|
5830
5863
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
5831
5864
|
:merchant_account_id => SpecHelper::FakeVenmoAccountMerchantAccountId,
|
5832
|
-
:payment_method_nonce => Braintree::Test::Nonce::VenmoAccount
|
5865
|
+
:payment_method_nonce => Braintree::Test::Nonce::VenmoAccount,
|
5833
5866
|
)
|
5834
5867
|
|
5835
5868
|
result = Braintree::Transaction.submit_for_partial_settlement(authorized_transaction.id, 100)
|
@@ -5844,7 +5877,7 @@ describe Braintree::Transaction do
|
|
5844
5877
|
:credit_card => {
|
5845
5878
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
5846
5879
|
:expiration_date => "06/2009"
|
5847
|
-
}
|
5880
|
+
},
|
5848
5881
|
)
|
5849
5882
|
|
5850
5883
|
result = Braintree::Transaction.submit_for_partial_settlement(authorized_transaction.id, 100)
|
@@ -5862,7 +5895,7 @@ describe Braintree::Transaction do
|
|
5862
5895
|
:credit_card => {
|
5863
5896
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
5864
5897
|
:expiration_date => "06/2009"
|
5865
|
-
}
|
5898
|
+
},
|
5866
5899
|
)
|
5867
5900
|
|
5868
5901
|
result = Braintree::Transaction.void(authorized_transaction.id)
|
@@ -5881,9 +5914,9 @@ describe Braintree::Transaction do
|
|
5881
5914
|
:credit_card => {
|
5882
5915
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
5883
5916
|
:expiration_date => "06/2009"
|
5884
|
-
}
|
5917
|
+
},
|
5885
5918
|
)
|
5886
|
-
options = {
|
5919
|
+
options = {:order_id => "ABC123"}
|
5887
5920
|
transaction = Braintree::Transaction.submit_for_partial_settlement!(original_transaction.id, "0.01", options)
|
5888
5921
|
transaction.status.should == Braintree::Transaction::Status::SubmittedForSettlement
|
5889
5922
|
transaction.order_id.should == options[:order_id]
|
@@ -5895,7 +5928,7 @@ describe Braintree::Transaction do
|
|
5895
5928
|
:credit_card => {
|
5896
5929
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
5897
5930
|
:expiration_date => "06/2009"
|
5898
|
-
}
|
5931
|
+
},
|
5899
5932
|
)
|
5900
5933
|
transaction.amount.should == BigDecimal("1000.00")
|
5901
5934
|
expect do
|
@@ -5920,7 +5953,7 @@ describe Braintree::Transaction do
|
|
5920
5953
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
5921
5954
|
:expiration_date => "05/2009"
|
5922
5955
|
},
|
5923
|
-
:service_fee_amount =>
|
5956
|
+
:service_fee_amount => "1.00",
|
5924
5957
|
)
|
5925
5958
|
|
5926
5959
|
transaction.escrow_status.should be_nil
|
@@ -5946,7 +5979,7 @@ describe Braintree::Transaction do
|
|
5946
5979
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
5947
5980
|
:expiration_date => "05/2009"
|
5948
5981
|
},
|
5949
|
-
:service_fee_amount =>
|
5982
|
+
:service_fee_amount => "1.00",
|
5950
5983
|
)
|
5951
5984
|
|
5952
5985
|
transaction.escrow_status.should be_nil
|
@@ -6006,7 +6039,7 @@ describe Braintree::Transaction do
|
|
6006
6039
|
:credit_card => {
|
6007
6040
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
6008
6041
|
:expiration_date => "05/2009"
|
6009
|
-
}
|
6042
|
+
},
|
6010
6043
|
)
|
6011
6044
|
result.success?.should == true
|
6012
6045
|
result.transaction.id.should =~ /^\w{6,}$/
|
@@ -6029,7 +6062,7 @@ describe Braintree::Transaction do
|
|
6029
6062
|
}
|
6030
6063
|
result = Braintree::Transaction.credit(params[:transaction])
|
6031
6064
|
result.success?.should == false
|
6032
|
-
result.params.should == {:transaction => {:type =>
|
6065
|
+
result.params.should == {:transaction => {:type => "credit", :amount => nil, :credit_card => {:expiration_date => "05/2009"}}}
|
6033
6066
|
result.errors.for(:transaction).on(:amount)[0].code.should == Braintree::ErrorCodes::Transaction::AmountIsRequired
|
6034
6067
|
end
|
6035
6068
|
|
@@ -6040,7 +6073,7 @@ describe Braintree::Transaction do
|
|
6040
6073
|
:credit_card => {
|
6041
6074
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
6042
6075
|
:expiration_date => "05/2009"
|
6043
|
-
}
|
6076
|
+
},
|
6044
6077
|
)
|
6045
6078
|
result.success?.should == true
|
6046
6079
|
result.transaction.merchant_account_id.should == SpecHelper::NonDefaultMerchantAccountId
|
@@ -6052,7 +6085,7 @@ describe Braintree::Transaction do
|
|
6052
6085
|
:credit_card => {
|
6053
6086
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
6054
6087
|
:expiration_date => "05/2009"
|
6055
|
-
}
|
6088
|
+
},
|
6056
6089
|
)
|
6057
6090
|
result.success?.should == true
|
6058
6091
|
result.transaction.merchant_account_id.should == SpecHelper::DefaultMerchantAccountId
|
@@ -6082,7 +6115,7 @@ describe Braintree::Transaction do
|
|
6082
6115
|
:credit_card => {
|
6083
6116
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
6084
6117
|
:expiration_date => "05/2009"
|
6085
|
-
}
|
6118
|
+
},
|
6086
6119
|
)
|
6087
6120
|
transaction.id.should =~ /^\w{6,}$/
|
6088
6121
|
transaction.type.should == "credit"
|
@@ -6099,7 +6132,7 @@ describe Braintree::Transaction do
|
|
6099
6132
|
:credit_card => {
|
6100
6133
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
6101
6134
|
:expiration_date => "05/2009"
|
6102
|
-
}
|
6135
|
+
},
|
6103
6136
|
)
|
6104
6137
|
end.to raise_error(Braintree::ValidationsFailed)
|
6105
6138
|
end
|
@@ -6113,7 +6146,7 @@ describe Braintree::Transaction do
|
|
6113
6146
|
:credit_card => {
|
6114
6147
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
6115
6148
|
:expiration_date => "05/2009"
|
6116
|
-
}
|
6149
|
+
},
|
6117
6150
|
)
|
6118
6151
|
result.success?.should == true
|
6119
6152
|
created_transaction = result.transaction
|
@@ -6130,7 +6163,7 @@ describe Braintree::Transaction do
|
|
6130
6163
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
6131
6164
|
:expiration_date => "05/2009"
|
6132
6165
|
},
|
6133
|
-
:options => {
|
6166
|
+
:options => {:store_in_vault => true},
|
6134
6167
|
)
|
6135
6168
|
result.success?.should == true
|
6136
6169
|
created_transaction = result.transaction
|
@@ -6175,7 +6208,7 @@ describe Braintree::Transaction do
|
|
6175
6208
|
:credit_card => {
|
6176
6209
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
6177
6210
|
:expiration_date => "05/2009"
|
6178
|
-
}
|
6211
|
+
},
|
6179
6212
|
)
|
6180
6213
|
result.success?.should == true
|
6181
6214
|
created_transaction = result.transaction
|
@@ -6225,7 +6258,7 @@ describe Braintree::Transaction do
|
|
6225
6258
|
:credit_card => {
|
6226
6259
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
6227
6260
|
:expiration_date => "05/2009"
|
6228
|
-
}
|
6261
|
+
},
|
6229
6262
|
)
|
6230
6263
|
result.success?.should == true
|
6231
6264
|
created_transaction = result.transaction
|
@@ -6238,15 +6271,21 @@ describe Braintree::Transaction do
|
|
6238
6271
|
it "returns all the three_d_secure_info" do
|
6239
6272
|
transaction = Braintree::Transaction.find("threedsecuredtransaction")
|
6240
6273
|
|
6274
|
+
expect(transaction.three_d_secure_info.authentication).to have_key(:trans_status)
|
6275
|
+
expect(transaction.three_d_secure_info.authentication).to have_key(:trans_status_reason)
|
6276
|
+
expect(transaction.three_d_secure_info.lookup).to have_key(:trans_status)
|
6277
|
+
expect(transaction.three_d_secure_info.lookup).to have_key(:trans_status_reason)
|
6278
|
+
transaction.three_d_secure_info.cavv.should == "somebase64value"
|
6279
|
+
transaction.three_d_secure_info.ds_transaction_id.should == "dstxnid"
|
6280
|
+
transaction.three_d_secure_info.eci_flag.should == "07"
|
6241
6281
|
transaction.three_d_secure_info.enrolled.should == "Y"
|
6242
|
-
transaction.three_d_secure_info.should
|
6282
|
+
transaction.three_d_secure_info.pares_status.should == "Y"
|
6243
6283
|
transaction.three_d_secure_info.should be_liability_shift_possible
|
6284
|
+
transaction.three_d_secure_info.should be_liability_shifted
|
6244
6285
|
transaction.three_d_secure_info.status.should == "authenticate_successful"
|
6245
|
-
transaction.three_d_secure_info.
|
6246
|
-
transaction.three_d_secure_info.xid.should == "xidvalue"
|
6247
|
-
transaction.three_d_secure_info.eci_flag.should == "07"
|
6286
|
+
expect(transaction.three_d_secure_info.three_d_secure_authentication_id).to be
|
6248
6287
|
transaction.three_d_secure_info.three_d_secure_version.should == "1.0.2"
|
6249
|
-
transaction.three_d_secure_info.
|
6288
|
+
transaction.three_d_secure_info.xid.should == "xidvalue"
|
6250
6289
|
end
|
6251
6290
|
|
6252
6291
|
it "is nil if the transaction wasn't 3d secured" do
|
@@ -6288,7 +6327,7 @@ describe Braintree::Transaction do
|
|
6288
6327
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
6289
6328
|
:expiration_date => "12/12",
|
6290
6329
|
},
|
6291
|
-
:service_fee_amount => "10.00"
|
6330
|
+
:service_fee_amount => "10.00",
|
6292
6331
|
)
|
6293
6332
|
|
6294
6333
|
result.transaction.escrow_status.should be_nil
|
@@ -6305,7 +6344,7 @@ describe Braintree::Transaction do
|
|
6305
6344
|
:credit_card => {
|
6306
6345
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
6307
6346
|
:expiration_date => "05/2009"
|
6308
|
-
}
|
6347
|
+
},
|
6309
6348
|
)
|
6310
6349
|
|
6311
6350
|
result = Braintree::Transaction.hold_in_escrow(transaction.id)
|
@@ -6323,7 +6362,7 @@ describe Braintree::Transaction do
|
|
6323
6362
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
6324
6363
|
:expiration_date => "12/12",
|
6325
6364
|
},
|
6326
|
-
:service_fee_amount => "10.00"
|
6365
|
+
:service_fee_amount => "10.00",
|
6327
6366
|
)
|
6328
6367
|
|
6329
6368
|
result.transaction.escrow_status.should be_nil
|
@@ -6339,7 +6378,7 @@ describe Braintree::Transaction do
|
|
6339
6378
|
:credit_card => {
|
6340
6379
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
6341
6380
|
:expiration_date => "05/2009"
|
6342
|
-
}
|
6381
|
+
},
|
6343
6382
|
)
|
6344
6383
|
|
6345
6384
|
expect do
|
@@ -6355,7 +6394,7 @@ describe Braintree::Transaction do
|
|
6355
6394
|
:credit_card => {
|
6356
6395
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
6357
6396
|
:expiration_date => "05/2009"
|
6358
|
-
}
|
6397
|
+
},
|
6359
6398
|
)
|
6360
6399
|
result = Braintree::Transaction.void(transaction.id)
|
6361
6400
|
result.success?.should == true
|
@@ -6369,7 +6408,7 @@ describe Braintree::Transaction do
|
|
6369
6408
|
:credit_card => {
|
6370
6409
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
6371
6410
|
:expiration_date => "05/2009"
|
6372
|
-
}
|
6411
|
+
},
|
6373
6412
|
).transaction
|
6374
6413
|
result = Braintree::Transaction.void(transaction.id)
|
6375
6414
|
result.success?.should == false
|
@@ -6384,7 +6423,7 @@ describe Braintree::Transaction do
|
|
6384
6423
|
:credit_card => {
|
6385
6424
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
6386
6425
|
:expiration_date => "05/2009"
|
6387
|
-
}
|
6426
|
+
},
|
6388
6427
|
)
|
6389
6428
|
returned_transaction = Braintree::Transaction.void!(transaction.id)
|
6390
6429
|
returned_transaction.should == transaction
|
@@ -6397,7 +6436,7 @@ describe Braintree::Transaction do
|
|
6397
6436
|
:credit_card => {
|
6398
6437
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
6399
6438
|
:expiration_date => "05/2009"
|
6400
|
-
}
|
6439
|
+
},
|
6401
6440
|
).transaction
|
6402
6441
|
expect do
|
6403
6442
|
Braintree::Transaction.void!(transaction.id)
|
@@ -6412,7 +6451,7 @@ describe Braintree::Transaction do
|
|
6412
6451
|
:credit_card => {
|
6413
6452
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
6414
6453
|
:expiration_date => "05/2009"
|
6415
|
-
}
|
6454
|
+
},
|
6416
6455
|
)
|
6417
6456
|
result = Braintree::Transaction.submit_for_settlement!(transaction.id)
|
6418
6457
|
result.status_history.size.should == 2
|
@@ -6470,7 +6509,7 @@ describe Braintree::Transaction do
|
|
6470
6509
|
:credit_card => {
|
6471
6510
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
6472
6511
|
:expiration_date => "05/2010"
|
6473
|
-
}
|
6512
|
+
},
|
6474
6513
|
)
|
6475
6514
|
transaction = Braintree::CreditCard.sale(customer.credit_cards[0].token, {:amount => "100.00"}).transaction
|
6476
6515
|
transaction.vault_credit_card.should == customer.credit_cards[0]
|
@@ -6483,7 +6522,7 @@ describe Braintree::Transaction do
|
|
6483
6522
|
:credit_card => {
|
6484
6523
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
6485
6524
|
:expiration_date => "05/2010"
|
6486
|
-
}
|
6525
|
+
},
|
6487
6526
|
)
|
6488
6527
|
transaction.vault_credit_card.should == nil
|
6489
6528
|
end
|
@@ -6495,7 +6534,7 @@ describe Braintree::Transaction do
|
|
6495
6534
|
:credit_card => {
|
6496
6535
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
6497
6536
|
:expiration_date => "05/2010"
|
6498
|
-
}
|
6537
|
+
},
|
6499
6538
|
)
|
6500
6539
|
transaction = Braintree::CreditCard.sale(customer.credit_cards[0].token, :amount => "100.00").transaction
|
6501
6540
|
transaction.vault_customer.should == customer
|
@@ -6508,7 +6547,7 @@ describe Braintree::Transaction do
|
|
6508
6547
|
:credit_card => {
|
6509
6548
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
6510
6549
|
:expiration_date => "05/2010"
|
6511
|
-
}
|
6550
|
+
},
|
6512
6551
|
)
|
6513
6552
|
transaction.vault_customer.should == nil
|
6514
6553
|
end
|
@@ -6523,7 +6562,7 @@ describe Braintree::Transaction do
|
|
6523
6562
|
},
|
6524
6563
|
:options => {
|
6525
6564
|
:submit_for_settlement => true
|
6526
|
-
}
|
6565
|
+
},
|
6527
6566
|
)
|
6528
6567
|
|
6529
6568
|
config = Braintree::Configuration.instantiate
|
@@ -6537,7 +6576,7 @@ describe Braintree::Transaction do
|
|
6537
6576
|
:payment_method_nonce => Braintree::Test::Nonce::PayPalOneTimePayment,
|
6538
6577
|
:options => {
|
6539
6578
|
:submit_for_settlement => true
|
6540
|
-
}
|
6579
|
+
},
|
6541
6580
|
)
|
6542
6581
|
|
6543
6582
|
config = Braintree::Configuration.instantiate
|
@@ -6553,8 +6592,8 @@ describe Braintree::Transaction do
|
|
6553
6592
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
6554
6593
|
:expiration_date => "05/2009"
|
6555
6594
|
},
|
6556
|
-
:service_fee_amount =>
|
6557
|
-
:options => {
|
6595
|
+
:service_fee_amount => "1.00",
|
6596
|
+
:options => {:hold_in_escrow => true},
|
6558
6597
|
)
|
6559
6598
|
|
6560
6599
|
config = Braintree::Configuration.instantiate
|
@@ -6568,7 +6607,7 @@ describe Braintree::Transaction do
|
|
6568
6607
|
it "can create a transaction with venmo_sdk_payment_method_code" do
|
6569
6608
|
result = Braintree::Transaction.sale(
|
6570
6609
|
:amount => "10.00",
|
6571
|
-
:venmo_sdk_payment_method_code => Braintree::Test::VenmoSDK.generate_test_payment_method_code(Braintree::Test::CreditCardNumbers::Visa)
|
6610
|
+
:venmo_sdk_payment_method_code => Braintree::Test::VenmoSDK.generate_test_payment_method_code(Braintree::Test::CreditCardNumbers::Visa),
|
6572
6611
|
)
|
6573
6612
|
result.success?.should == true
|
6574
6613
|
result.transaction.credit_card_details.venmo_sdk?.should == false
|
@@ -6577,7 +6616,7 @@ describe Braintree::Transaction do
|
|
6577
6616
|
it "errors when an invalid payment method code is passed" do
|
6578
6617
|
result = Braintree::Transaction.sale(
|
6579
6618
|
:amount => "10.00",
|
6580
|
-
:venmo_sdk_payment_method_code => Braintree::Test::VenmoSDK::InvalidPaymentMethodCode
|
6619
|
+
:venmo_sdk_payment_method_code => Braintree::Test::VenmoSDK::InvalidPaymentMethodCode,
|
6581
6620
|
)
|
6582
6621
|
result.success?.should == false
|
6583
6622
|
result.message.should include("Invalid VenmoSDK payment method code")
|
@@ -6595,7 +6634,7 @@ describe Braintree::Transaction do
|
|
6595
6634
|
},
|
6596
6635
|
:options => {
|
6597
6636
|
:venmo_sdk_session => Braintree::Test::VenmoSDK::Session
|
6598
|
-
}
|
6637
|
+
},
|
6599
6638
|
)
|
6600
6639
|
result.success?.should == true
|
6601
6640
|
result.transaction.credit_card_details.venmo_sdk?.should == false
|
@@ -6610,7 +6649,7 @@ describe Braintree::Transaction do
|
|
6610
6649
|
},
|
6611
6650
|
:options => {
|
6612
6651
|
:venmo_sdk_session => Braintree::Test::VenmoSDK::InvalidSession
|
6613
|
-
}
|
6652
|
+
},
|
6614
6653
|
)
|
6615
6654
|
result.success?.should == true
|
6616
6655
|
result.transaction.credit_card_details.venmo_sdk?.should == false
|
@@ -6622,7 +6661,7 @@ describe Braintree::Transaction do
|
|
6622
6661
|
it "can create a transaction for a paypal account" do
|
6623
6662
|
result = Braintree::Transaction.sale(
|
6624
6663
|
:amount => "10.00",
|
6625
|
-
:payment_method_nonce => Braintree::Test::Nonce::PayPalFuturePayment
|
6664
|
+
:payment_method_nonce => Braintree::Test::Nonce::PayPalFuturePayment,
|
6626
6665
|
)
|
6627
6666
|
result.success?.should == true
|
6628
6667
|
result.transaction.paypal_details.payer_email.should == "payer@example.com"
|
@@ -6637,7 +6676,7 @@ describe Braintree::Transaction do
|
|
6637
6676
|
:payment_method_nonce => Braintree::Test::Nonce::PayPalFuturePayment,
|
6638
6677
|
:options => {
|
6639
6678
|
:store_in_vault => true
|
6640
|
-
}
|
6679
|
+
},
|
6641
6680
|
)
|
6642
6681
|
result.success?.should == true
|
6643
6682
|
result.transaction.paypal_details.token.should_not be_nil
|
@@ -6650,7 +6689,7 @@ describe Braintree::Transaction do
|
|
6650
6689
|
customer = Braintree::Customer.create!
|
6651
6690
|
result = Braintree::PaymentMethod.create(
|
6652
6691
|
:payment_method_nonce => Braintree::Test::Nonce::PayPalFuturePayment,
|
6653
|
-
:customer_id => customer.id
|
6692
|
+
:customer_id => customer.id,
|
6654
6693
|
)
|
6655
6694
|
|
6656
6695
|
result.should be_success
|
@@ -6660,7 +6699,7 @@ describe Braintree::Transaction do
|
|
6660
6699
|
result = Braintree::Transaction.sale(
|
6661
6700
|
:amount => "100",
|
6662
6701
|
:customer_id => customer.id,
|
6663
|
-
:payment_method_token => payment_method_token
|
6702
|
+
:payment_method_token => payment_method_token,
|
6664
6703
|
)
|
6665
6704
|
|
6666
6705
|
result.should be_success
|
@@ -6675,7 +6714,7 @@ describe Braintree::Transaction do
|
|
6675
6714
|
nonce = nonce_for_paypal_account(:token => "TOKEN")
|
6676
6715
|
result = Braintree::Transaction.sale(
|
6677
6716
|
:amount => "10.00",
|
6678
|
-
:payment_method_nonce => nonce
|
6717
|
+
:payment_method_nonce => nonce,
|
6679
6718
|
)
|
6680
6719
|
result.should_not be_success
|
6681
6720
|
result.errors.for(:transaction).for(:paypal_account).first.code.should == Braintree::ErrorCodes::PayPalAccount::IncompletePayPalAccount
|
@@ -6690,7 +6729,7 @@ describe Braintree::Transaction do
|
|
6690
6729
|
:public_key => "oauth_app_partner_user_public_key",
|
6691
6730
|
:private_key => "oauth_app_partner_user_private_key",
|
6692
6731
|
:environment => Braintree::Configuration.environment,
|
6693
|
-
:logger => Logger.new("/dev/null")
|
6732
|
+
:logger => Logger.new("/dev/null"),
|
6694
6733
|
)
|
6695
6734
|
@customer = @partner_merchant_gateway.customer.create(
|
6696
6735
|
:first_name => "Joe",
|
@@ -6699,12 +6738,12 @@ describe Braintree::Transaction do
|
|
6699
6738
|
:email => "joe@example.com",
|
6700
6739
|
:phone => "312.555.1234",
|
6701
6740
|
:fax => "614.555.5678",
|
6702
|
-
:website => "www.example.com"
|
6741
|
+
:website => "www.example.com",
|
6703
6742
|
).customer
|
6704
6743
|
@address = @partner_merchant_gateway.address.create(
|
6705
6744
|
:customer_id => @customer.id,
|
6706
6745
|
:first_name => "Testy",
|
6707
|
-
:last_name => "McTesterson"
|
6746
|
+
:last_name => "McTesterson",
|
6708
6747
|
).address
|
6709
6748
|
@credit_card = @partner_merchant_gateway.credit_card.create(
|
6710
6749
|
:customer_id => @customer.id,
|
@@ -6715,13 +6754,13 @@ describe Braintree::Transaction do
|
|
6715
6754
|
:first_name => "Adam",
|
6716
6755
|
:last_name => "Davis",
|
6717
6756
|
:postal_code => "95131"
|
6718
|
-
}
|
6757
|
+
},
|
6719
6758
|
).credit_card
|
6720
6759
|
|
6721
6760
|
oauth_gateway = Braintree::Gateway.new(
|
6722
6761
|
:client_id => "client_id$#{Braintree::Configuration.environment}$integration_client_id",
|
6723
6762
|
:client_secret => "client_secret$#{Braintree::Configuration.environment}$integration_client_secret",
|
6724
|
-
:logger => Logger.new("/dev/null")
|
6763
|
+
:logger => Logger.new("/dev/null"),
|
6725
6764
|
)
|
6726
6765
|
access_token = Braintree::OAuthTestHelper.create_token(oauth_gateway, {
|
6727
6766
|
:merchant_public_id => "integration_merchant_id",
|
@@ -6730,7 +6769,7 @@ describe Braintree::Transaction do
|
|
6730
6769
|
|
6731
6770
|
@granting_gateway = Braintree::Gateway.new(
|
6732
6771
|
:access_token => access_token,
|
6733
|
-
:logger => Logger.new("/dev/null")
|
6772
|
+
:logger => Logger.new("/dev/null"),
|
6734
6773
|
)
|
6735
6774
|
|
6736
6775
|
end
|
@@ -6740,7 +6779,7 @@ describe Braintree::Transaction do
|
|
6740
6779
|
|
6741
6780
|
result = Braintree::Transaction.sale(
|
6742
6781
|
:payment_method_nonce => grant_result.payment_method_nonce.nonce,
|
6743
|
-
:amount => Braintree::Test::TransactionAmounts::Authorize
|
6782
|
+
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
6744
6783
|
)
|
6745
6784
|
result.transaction.facilitated_details.merchant_id.should == "integration_merchant_id"
|
6746
6785
|
result.transaction.facilitated_details.merchant_name.should == "14ladders"
|
@@ -6756,7 +6795,7 @@ describe Braintree::Transaction do
|
|
6756
6795
|
|
6757
6796
|
result = Braintree::Transaction.sale(
|
6758
6797
|
:payment_method_nonce => grant_result.payment_method_nonce.nonce,
|
6759
|
-
:amount => Braintree::Test::TransactionAmounts::Authorize
|
6798
|
+
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
6760
6799
|
)
|
6761
6800
|
|
6762
6801
|
result.transaction.billing_details.postal_code == "95131"
|
@@ -6768,7 +6807,7 @@ describe Braintree::Transaction do
|
|
6768
6807
|
:shared_customer_id => @customer.id,
|
6769
6808
|
:shared_shipping_address_id => @address.id,
|
6770
6809
|
:shared_billing_address_id => @address.id,
|
6771
|
-
:amount => Braintree::Test::TransactionAmounts::Authorize
|
6810
|
+
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
6772
6811
|
)
|
6773
6812
|
result.success?.should == true
|
6774
6813
|
result.transaction.shipping_details.first_name.should == @address.first_name
|
@@ -6778,7 +6817,7 @@ describe Braintree::Transaction do
|
|
6778
6817
|
it "facilitated details are returned on transaction created via a shared_payment_method_token" do
|
6779
6818
|
result = @granting_gateway.transaction.sale(
|
6780
6819
|
:shared_payment_method_token => @credit_card.token,
|
6781
|
-
:amount => Braintree::Test::TransactionAmounts::Authorize
|
6820
|
+
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
6782
6821
|
)
|
6783
6822
|
result.transaction.facilitated_details.merchant_id.should == "integration_merchant_id"
|
6784
6823
|
result.transaction.facilitated_details.merchant_name.should == "14ladders"
|
@@ -6790,12 +6829,12 @@ describe Braintree::Transaction do
|
|
6790
6829
|
|
6791
6830
|
it "facilitated details are returned on transaction created via a shared_payment_method_nonce" do
|
6792
6831
|
shared_nonce = @partner_merchant_gateway.payment_method_nonce.create(
|
6793
|
-
@credit_card.token
|
6832
|
+
@credit_card.token,
|
6794
6833
|
).payment_method_nonce.nonce
|
6795
6834
|
|
6796
6835
|
result = @granting_gateway.transaction.sale(
|
6797
6836
|
:shared_payment_method_nonce => shared_nonce,
|
6798
|
-
:amount => Braintree::Test::TransactionAmounts::Authorize
|
6837
|
+
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
6799
6838
|
)
|
6800
6839
|
result.transaction.facilitated_details.merchant_id.should == "integration_merchant_id"
|
6801
6840
|
result.transaction.facilitated_details.merchant_name.should == "14ladders"
|
@@ -6808,7 +6847,7 @@ describe Braintree::Transaction do
|
|
6808
6847
|
|
6809
6848
|
context "paypal here" do
|
6810
6849
|
it "gets the details of an auth/capture transaction" do
|
6811
|
-
result = Braintree::Transaction.find(
|
6850
|
+
result = Braintree::Transaction.find("paypal_here_auth_capture_id")
|
6812
6851
|
result.payment_instrument_type.should eq(Braintree::PaymentInstrumentType::PayPalHere)
|
6813
6852
|
result.paypal_here_details.should_not be_nil
|
6814
6853
|
|
@@ -6825,7 +6864,7 @@ describe Braintree::Transaction do
|
|
6825
6864
|
end
|
6826
6865
|
|
6827
6866
|
it "gets the details of a sale transaction" do
|
6828
|
-
result = Braintree::Transaction.find(
|
6867
|
+
result = Braintree::Transaction.find("paypal_here_sale_id")
|
6829
6868
|
result.paypal_here_details.should_not be_nil
|
6830
6869
|
|
6831
6870
|
details = result.paypal_here_details
|
@@ -6833,7 +6872,7 @@ describe Braintree::Transaction do
|
|
6833
6872
|
end
|
6834
6873
|
|
6835
6874
|
it "gets the details of a refunded sale transaction" do
|
6836
|
-
result = Braintree::Transaction.find(
|
6875
|
+
result = Braintree::Transaction.find("paypal_here_refund_id")
|
6837
6876
|
result.paypal_here_details.should_not be_nil
|
6838
6877
|
|
6839
6878
|
details = result.paypal_here_details
|
@@ -6858,7 +6897,7 @@ describe Braintree::Transaction do
|
|
6858
6897
|
customer = Braintree::Customer.create!
|
6859
6898
|
result = Braintree::PaymentMethod.create(
|
6860
6899
|
:payment_method_nonce => Braintree::Test::Nonce::TransactableVisa,
|
6861
|
-
:customer_id => customer.id
|
6900
|
+
:customer_id => customer.id,
|
6862
6901
|
)
|
6863
6902
|
payment_method_token = result.payment_method.token
|
6864
6903
|
|
@@ -6960,4 +6999,179 @@ describe Braintree::Transaction do
|
|
6960
6999
|
expect(installment.adjustments.map(&:kind)).to match_array([Braintree::Transaction::Installment::Adjustment::Kind::Refund])
|
6961
7000
|
end
|
6962
7001
|
end
|
7002
|
+
|
7003
|
+
describe "Manual Key Entry" do
|
7004
|
+
context "with correct encrypted payment reader card details" do
|
7005
|
+
it "returns a success response" do
|
7006
|
+
result = Braintree::Transaction.sale(
|
7007
|
+
:amount => "10.00",
|
7008
|
+
:credit_card => {
|
7009
|
+
:payment_reader_card_details => {
|
7010
|
+
:encrypted_card_data => "8F34DFB312DC79C24FD5320622F3E11682D79E6B0C0FD881",
|
7011
|
+
:key_serial_number => "FFFFFF02000572A00005",
|
7012
|
+
},
|
7013
|
+
},
|
7014
|
+
)
|
7015
|
+
|
7016
|
+
expect(result).to be_success
|
7017
|
+
end
|
7018
|
+
end
|
7019
|
+
|
7020
|
+
context "with invalid encrypted payment reader card details" do
|
7021
|
+
it "returns a failure response" do
|
7022
|
+
result = Braintree::Transaction.sale(
|
7023
|
+
:amount => "10.00",
|
7024
|
+
:credit_card => {
|
7025
|
+
:payment_reader_card_details => {
|
7026
|
+
:encrypted_card_data => "invalid",
|
7027
|
+
:key_serial_number => "invalid",
|
7028
|
+
},
|
7029
|
+
},
|
7030
|
+
)
|
7031
|
+
|
7032
|
+
expect(result).not_to be_success
|
7033
|
+
expect(result.errors.for(:transaction).first.code)
|
7034
|
+
.to eq(Braintree::ErrorCodes::Transaction::PaymentInstrumentNotSupportedByMerchantAccount)
|
7035
|
+
end
|
7036
|
+
end
|
7037
|
+
end
|
7038
|
+
|
7039
|
+
describe "Adjust Authorization" do
|
7040
|
+
let(:first_data_master_transaction_params) do
|
7041
|
+
{
|
7042
|
+
:merchant_account_id => SpecHelper::FakeFirstDataMerchantAccountId,
|
7043
|
+
:amount => "75.50",
|
7044
|
+
:credit_card => {
|
7045
|
+
:number => "5105105105105100",
|
7046
|
+
:expiration_date => "05/2012"
|
7047
|
+
}
|
7048
|
+
}
|
7049
|
+
end
|
7050
|
+
let(:first_data_visa_transaction_params) do
|
7051
|
+
{
|
7052
|
+
:merchant_account_id => SpecHelper::FakeFirstDataMerchantAccountId,
|
7053
|
+
:amount => "75.50",
|
7054
|
+
:credit_card => {
|
7055
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
7056
|
+
:expiration_date => "06/2009"
|
7057
|
+
}
|
7058
|
+
}
|
7059
|
+
end
|
7060
|
+
context "successful authorization" do
|
7061
|
+
it "returns success response" do
|
7062
|
+
initial_transaction = Braintree::Transaction.sale(first_data_master_transaction_params)
|
7063
|
+
expect(initial_transaction.success?).to eq(true)
|
7064
|
+
|
7065
|
+
adjustment_transaction = Braintree::Transaction.adjust_authorization(
|
7066
|
+
initial_transaction.transaction.id, "85.50"
|
7067
|
+
)
|
7068
|
+
|
7069
|
+
expect(adjustment_transaction.success?).to eq(true)
|
7070
|
+
expect(adjustment_transaction.transaction.amount.should).to eq(BigDecimal("85.50"))
|
7071
|
+
end
|
7072
|
+
end
|
7073
|
+
|
7074
|
+
context "unsuccessful authorization" do
|
7075
|
+
it "returns failure, when processor does not support multi auth adjustment" do
|
7076
|
+
initial_transaction = Braintree::Transaction.sale(
|
7077
|
+
:merchant_account_id => SpecHelper::DefaultMerchantAccountId,
|
7078
|
+
:amount => "75.50",
|
7079
|
+
:credit_card => {
|
7080
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
7081
|
+
:expiration_date => "06/2009"
|
7082
|
+
},
|
7083
|
+
)
|
7084
|
+
expect(initial_transaction.success?).to eq(true)
|
7085
|
+
|
7086
|
+
adjustment_transaction = Braintree::Transaction.adjust_authorization(
|
7087
|
+
initial_transaction.transaction.id, "85.50"
|
7088
|
+
)
|
7089
|
+
|
7090
|
+
|
7091
|
+
expect(adjustment_transaction.success?).to eq(false)
|
7092
|
+
expect(adjustment_transaction.transaction.amount.should).to eq(BigDecimal("75.50"))
|
7093
|
+
expect(adjustment_transaction.errors.for(:transaction).on(:base).first.code).to eq(Braintree::ErrorCodes::Transaction::ProcessorDoesNotSupportAuthAdjustment)
|
7094
|
+
end
|
7095
|
+
|
7096
|
+
it "returns failure response, when adjusted amount submitted is zero" do
|
7097
|
+
initial_transaction = Braintree::Transaction.sale(first_data_master_transaction_params)
|
7098
|
+
expect(initial_transaction.success?).to eq(true)
|
7099
|
+
|
7100
|
+
adjustment_transaction = Braintree::Transaction.adjust_authorization(
|
7101
|
+
initial_transaction.transaction.id, "0.0"
|
7102
|
+
)
|
7103
|
+
|
7104
|
+
expect(adjustment_transaction.success?).to eq(false)
|
7105
|
+
expect(adjustment_transaction.transaction.amount.should).to eq(BigDecimal("75.50"))
|
7106
|
+
expect(adjustment_transaction.errors.for(:authorization_adjustment).on(:amount).first.code).to eq(Braintree::ErrorCodes::Transaction::AdjustmentAmountMustBeGreaterThanZero)
|
7107
|
+
end
|
7108
|
+
|
7109
|
+
it "returns failure response, when adjusted amount submitted same as authorized amount" do
|
7110
|
+
initial_transaction = Braintree::Transaction.sale(first_data_master_transaction_params)
|
7111
|
+
expect(initial_transaction.success?).to eq(true)
|
7112
|
+
|
7113
|
+
adjustment_transaction = Braintree::Transaction.adjust_authorization(
|
7114
|
+
initial_transaction.transaction.id, "75.50"
|
7115
|
+
)
|
7116
|
+
|
7117
|
+
expect(adjustment_transaction.success?).to eq(false)
|
7118
|
+
expect(adjustment_transaction.transaction.amount.should).to eq(BigDecimal("75.50"))
|
7119
|
+
expect(adjustment_transaction.errors.for(:authorization_adjustment).on(:base).first.code).to eq(Braintree::ErrorCodes::Transaction::NoNetAmountToPerformAuthAdjustment)
|
7120
|
+
end
|
7121
|
+
|
7122
|
+
it "returns failure, when transaction status is not authorized" do
|
7123
|
+
additional_params = {:options => {:submit_for_settlement => true}}
|
7124
|
+
initial_transaction = Braintree::Transaction.sale(first_data_master_transaction_params.merge(additional_params))
|
7125
|
+
expect(initial_transaction.success?).to eq(true)
|
7126
|
+
|
7127
|
+
adjustment_transaction = Braintree::Transaction.adjust_authorization(
|
7128
|
+
initial_transaction.transaction.id, "85.50"
|
7129
|
+
)
|
7130
|
+
|
7131
|
+
expect(adjustment_transaction.success?).to eq(false)
|
7132
|
+
expect(adjustment_transaction.transaction.amount.should).to eq(BigDecimal("75.50"))
|
7133
|
+
expect(adjustment_transaction.errors.for(:transaction).on(:base).first.code).to eq(Braintree::ErrorCodes::Transaction::TransactionMustBeInStateAuthorized)
|
7134
|
+
end
|
7135
|
+
|
7136
|
+
it "returns failure, when transaction authorization type final or undefined" do
|
7137
|
+
additional_params = {:transaction_source => "recurring_first"}
|
7138
|
+
initial_transaction = Braintree::Transaction.sale(first_data_master_transaction_params.merge(additional_params))
|
7139
|
+
expect(initial_transaction.success?).to eq(true)
|
7140
|
+
|
7141
|
+
adjustment_transaction = Braintree::Transaction.adjust_authorization(
|
7142
|
+
initial_transaction.transaction.id, "85.50"
|
7143
|
+
)
|
7144
|
+
|
7145
|
+
expect(adjustment_transaction.success?).to eq(false)
|
7146
|
+
expect(adjustment_transaction.transaction.amount.should).to eq(BigDecimal("75.50"))
|
7147
|
+
expect(adjustment_transaction.errors.for(:transaction).on(:base).first.code).to eq(Braintree::ErrorCodes::Transaction::TransactionIsNotEligibleForAdjustment)
|
7148
|
+
end
|
7149
|
+
|
7150
|
+
it "returns failure, when processor does not support incremental auth" do
|
7151
|
+
initial_transaction = Braintree::Transaction.sale(first_data_visa_transaction_params)
|
7152
|
+
expect(initial_transaction.success?).to eq(true)
|
7153
|
+
|
7154
|
+
adjustment_transaction = Braintree::Transaction.adjust_authorization(
|
7155
|
+
initial_transaction.transaction.id, "85.50"
|
7156
|
+
)
|
7157
|
+
|
7158
|
+
expect(adjustment_transaction.success?).to eq(false)
|
7159
|
+
expect(adjustment_transaction.transaction.amount.should).to eq(BigDecimal("75.50"))
|
7160
|
+
expect(adjustment_transaction.errors.for(:transaction).on(:base).first.code).to eq(Braintree::ErrorCodes::Transaction::ProcessorDoesNotSupportIncrementalAuth)
|
7161
|
+
end
|
7162
|
+
|
7163
|
+
it "returns failure, when processor does not support auth reversal" do
|
7164
|
+
initial_transaction = Braintree::Transaction.sale(first_data_visa_transaction_params)
|
7165
|
+
expect(initial_transaction.success?).to eq(true)
|
7166
|
+
|
7167
|
+
adjustment_transaction = Braintree::Transaction.adjust_authorization(
|
7168
|
+
initial_transaction.transaction.id, "65.50"
|
7169
|
+
)
|
7170
|
+
|
7171
|
+
expect(adjustment_transaction.success?).to eq(false)
|
7172
|
+
expect(adjustment_transaction.transaction.amount.should).to eq(BigDecimal("75.50"))
|
7173
|
+
expect(adjustment_transaction.errors.for(:transaction).on(:base).first.code).to eq(Braintree::ErrorCodes::Transaction::ProcessorDoesNotSupportPartialAuthReversal)
|
7174
|
+
end
|
7175
|
+
end
|
7176
|
+
end
|
6963
7177
|
end
|