braintree 4.12.0 → 4.14.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,126 +10,6 @@ describe Braintree::Transaction do
10
10
  Braintree::Configuration.private_key = "integration2_private_key"
11
11
  end
12
12
 
13
- context "plaid-verified" do
14
- let(:plaid_nonce) { generate_valid_plaid_us_bank_account_nonce }
15
-
16
- context "nonce" do
17
- # we are temporarily skipping this test until we have a more stable CI env
18
- xit "sale succeeds" do
19
- result = Braintree::Transaction.create(
20
- :type => "sale",
21
- :amount => Braintree::Test::TransactionAmounts::Authorize,
22
- :merchant_account_id => SpecHelper::AnotherUsBankMerchantAccountId,
23
- :payment_method_nonce => plaid_nonce,
24
- :options => {
25
- :submit_for_settlement => true,
26
- },
27
- )
28
- result.success?.should == true
29
- result.transaction.id.should =~ /^\w{6,}$/
30
- result.transaction.type.should == "sale"
31
- result.transaction.payment_instrument_type.should == Braintree::PaymentInstrumentType::UsBankAccount
32
- result.transaction.amount.should == BigDecimal(Braintree::Test::TransactionAmounts::Authorize)
33
- result.transaction.status.should == Braintree::Transaction::Status::SettlementPending
34
- result.transaction.us_bank_account_details.routing_number.should == "011000015"
35
- result.transaction.us_bank_account_details.last_4.should == "0000"
36
- result.transaction.us_bank_account_details.account_type.should == "checking"
37
- result.transaction.us_bank_account_details.account_holder_name.should == "PayPal, Inc."
38
- result.transaction.us_bank_account_details.bank_name.should == "FEDERAL RESERVE BANK"
39
- result.transaction.us_bank_account_details.ach_mandate.text.should == "cl mandate text"
40
- result.transaction.us_bank_account_details.ach_mandate.accepted_at.should be_a Time
41
- end
42
- end
43
-
44
- context "token" do
45
- # we are temporarily skipping this test until we have a more stable CI env
46
- xit "payment_method#create then sale succeeds" do
47
- payment_method = Braintree::PaymentMethod.create(
48
- :payment_method_nonce => plaid_nonce,
49
- :customer_id => Braintree::Customer.create.customer.id,
50
- :options => {
51
- :verification_merchant_account_id => SpecHelper::AnotherUsBankMerchantAccountId,
52
- },
53
- ).payment_method
54
-
55
- payment_method.verifications.count.should == 1
56
- payment_method.verifications.first.status.should == Braintree::UsBankAccountVerification::Status::Verified
57
- payment_method.verifications.first.verification_method.should == Braintree::UsBankAccountVerification::VerificationMethod::TokenizedCheck
58
- payment_method.verifications.first.id.should_not be_empty
59
- payment_method.verifications.first.verification_determined_at.should be_a Time
60
- payment_method.verified.should == true
61
-
62
- result = Braintree::Transaction.create(
63
- :type => "sale",
64
- :amount => Braintree::Test::TransactionAmounts::Authorize,
65
- :merchant_account_id => SpecHelper::AnotherUsBankMerchantAccountId,
66
- :payment_method_token => payment_method.token,
67
- :options => {
68
- :submit_for_settlement => true,
69
- },
70
- )
71
-
72
- result.success?.should == true
73
-
74
- transaction = result.transaction
75
-
76
- transaction.id.should =~ /^\w{6,}$/
77
- transaction.type.should == "sale"
78
- transaction.amount.should == BigDecimal(Braintree::Test::TransactionAmounts::Authorize)
79
- transaction.status.should == Braintree::Transaction::Status::SettlementPending
80
- transaction.us_bank_account_details.routing_number.should == "011000015"
81
- transaction.us_bank_account_details.last_4.should == "0000"
82
- transaction.us_bank_account_details.account_type.should == "checking"
83
- transaction.us_bank_account_details.account_holder_name.should == "PayPal, Inc."
84
- transaction.us_bank_account_details.bank_name.should == "FEDERAL RESERVE BANK"
85
- transaction.us_bank_account_details.ach_mandate.text.should == "cl mandate text"
86
- transaction.us_bank_account_details.ach_mandate.accepted_at.should be_a Time
87
- end
88
-
89
- # we are temporarily skipping this test until we have a more stable CI env
90
- xit "transaction#create store_in_vault then sale succeeds" do
91
- result = Braintree::Transaction.create(
92
- :type => "sale",
93
- :amount => Braintree::Test::TransactionAmounts::Authorize,
94
- :merchant_account_id => SpecHelper::AnotherUsBankMerchantAccountId,
95
- :payment_method_nonce => plaid_nonce,
96
- :options => {
97
- :submit_for_settlement => true,
98
- :store_in_vault => true,
99
- },
100
- )
101
-
102
- result.success?.should == true
103
-
104
- result = Braintree::Transaction.create(
105
- :type => "sale",
106
- :amount => Braintree::Test::TransactionAmounts::Authorize,
107
- :merchant_account_id => SpecHelper::AnotherUsBankMerchantAccountId,
108
- :payment_method_token => result.transaction.us_bank_account_details.token,
109
- :options => {
110
- :submit_for_settlement => true,
111
- },
112
- )
113
-
114
- result.success?.should == true
115
-
116
- transaction = result.transaction
117
-
118
- transaction.id.should =~ /^\w{6,}$/
119
- transaction.type.should == "sale"
120
- transaction.amount.should == BigDecimal(Braintree::Test::TransactionAmounts::Authorize)
121
- transaction.status.should == Braintree::Transaction::Status::SettlementPending
122
- transaction.us_bank_account_details.routing_number.should == "011000015"
123
- transaction.us_bank_account_details.last_4.should == "0000"
124
- transaction.us_bank_account_details.account_type.should == "checking"
125
- transaction.us_bank_account_details.account_holder_name.should == "PayPal, Inc."
126
- transaction.us_bank_account_details.bank_name.should == "FEDERAL RESERVE BANK"
127
- transaction.us_bank_account_details.ach_mandate.text.should == "cl mandate text"
128
- transaction.us_bank_account_details.ach_mandate.accepted_at.should be_a Time
129
- end
130
- end
131
- end
132
-
133
13
  context "not plaid-verified" do
134
14
  let(:non_plaid_nonce) { generate_non_plaid_us_bank_account_nonce }
135
15
  let(:invalid_nonce) { generate_invalid_us_bank_account_nonce }
@@ -232,128 +112,6 @@ describe Braintree::Transaction do
232
112
  Braintree::Configuration.private_key = "integration_private_key"
233
113
  end
234
114
 
235
- context "plaid-verified" do
236
- let(:plaid_nonce) { generate_valid_plaid_us_bank_account_nonce }
237
-
238
- context "nonce" do
239
- # we are temporarily skipping this test until we have a more stable CI env
240
- xit "sale succeeds" do
241
- result = Braintree::Transaction.create(
242
- :type => "sale",
243
- :amount => Braintree::Test::TransactionAmounts::Authorize,
244
- :merchant_account_id => SpecHelper::UsBankMerchantAccountId,
245
- :payment_method_nonce => plaid_nonce,
246
- :options => {
247
- :submit_for_settlement => true,
248
- },
249
- )
250
- result.success?.should == true
251
- result.transaction.id.should =~ /^\w{6,}$/
252
- result.transaction.type.should == "sale"
253
- result.transaction.payment_instrument_type.should == Braintree::PaymentInstrumentType::UsBankAccount
254
- result.transaction.amount.should == BigDecimal(Braintree::Test::TransactionAmounts::Authorize)
255
- result.transaction.status.should == Braintree::Transaction::Status::SettlementPending
256
- result.transaction.us_bank_account_details.routing_number.should == "011000015"
257
- result.transaction.us_bank_account_details.last_4.should == "0000"
258
- result.transaction.us_bank_account_details.account_type.should == "checking"
259
- result.transaction.us_bank_account_details.account_holder_name.should == "PayPal, Inc."
260
- result.transaction.us_bank_account_details.bank_name.should == "FEDERAL RESERVE BANK"
261
- result.transaction.us_bank_account_details.ach_mandate.text.should == "cl mandate text"
262
- result.transaction.us_bank_account_details.ach_mandate.accepted_at.should be_a Time
263
- end
264
- end
265
-
266
- context "token" do
267
- # we are temporarily skipping this test until we have a more stable CI env
268
- xit "payment_method#create then sale succeeds" do
269
- result = Braintree::PaymentMethod.create(
270
- :payment_method_nonce => plaid_nonce,
271
- :customer_id => Braintree::Customer.create.customer.id,
272
- :options => {
273
- :verification_merchant_account_id => SpecHelper::UsBankMerchantAccountId,
274
- },
275
- )
276
-
277
- payment_method = result.payment_method
278
-
279
- payment_method.verifications.count.should == 1
280
- payment_method.verifications.first.status.should == Braintree::UsBankAccountVerification::Status::Verified
281
- payment_method.verifications.first.verification_method.should == Braintree::UsBankAccountVerification::VerificationMethod::TokenizedCheck
282
- payment_method.verifications.first.id.should_not be_empty
283
- payment_method.verifications.first.verification_determined_at.should be_a Time
284
- payment_method.verified.should == true
285
-
286
- result = Braintree::Transaction.create(
287
- :type => "sale",
288
- :amount => Braintree::Test::TransactionAmounts::Authorize,
289
- :merchant_account_id => SpecHelper::UsBankMerchantAccountId,
290
- :payment_method_token => payment_method.token,
291
- :options => {
292
- :submit_for_settlement => true,
293
- },
294
- )
295
-
296
- result.success?.should == true
297
-
298
- transaction = result.transaction
299
-
300
- transaction.id.should =~ /^\w{6,}$/
301
- transaction.type.should == "sale"
302
- transaction.amount.should == BigDecimal(Braintree::Test::TransactionAmounts::Authorize)
303
- transaction.status.should == Braintree::Transaction::Status::SettlementPending
304
- transaction.us_bank_account_details.routing_number.should == "011000015"
305
- transaction.us_bank_account_details.last_4.should == "0000"
306
- transaction.us_bank_account_details.account_type.should == "checking"
307
- transaction.us_bank_account_details.account_holder_name.should == "PayPal, Inc."
308
- transaction.us_bank_account_details.bank_name.should == "FEDERAL RESERVE BANK"
309
- transaction.us_bank_account_details.ach_mandate.text.should == "cl mandate text"
310
- transaction.us_bank_account_details.ach_mandate.accepted_at.should be_a Time
311
- end
312
-
313
- # we are temporarily skipping this test until we have a more stable CI env
314
- xit "transaction#create store_in_vault then sale succeeds" do
315
- result = Braintree::Transaction.create(
316
- :type => "sale",
317
- :amount => Braintree::Test::TransactionAmounts::Authorize,
318
- :merchant_account_id => SpecHelper::UsBankMerchantAccountId,
319
- :payment_method_nonce => plaid_nonce,
320
- :options => {
321
- :submit_for_settlement => true,
322
- :store_in_vault => true,
323
- },
324
- )
325
-
326
- result.success?.should == true
327
-
328
- result = Braintree::Transaction.create(
329
- :type => "sale",
330
- :amount => Braintree::Test::TransactionAmounts::Authorize,
331
- :merchant_account_id => SpecHelper::UsBankMerchantAccountId,
332
- :payment_method_token => result.transaction.us_bank_account_details.token,
333
- :options => {
334
- :submit_for_settlement => true,
335
- },
336
- )
337
-
338
- result.success?.should == true
339
-
340
- transaction = result.transaction
341
-
342
- transaction.id.should =~ /^\w{6,}$/
343
- transaction.type.should == "sale"
344
- transaction.amount.should == BigDecimal(Braintree::Test::TransactionAmounts::Authorize)
345
- transaction.status.should == Braintree::Transaction::Status::SettlementPending
346
- transaction.us_bank_account_details.routing_number.should == "011000015"
347
- transaction.us_bank_account_details.last_4.should == "0000"
348
- transaction.us_bank_account_details.account_type.should == "checking"
349
- transaction.us_bank_account_details.account_holder_name.should == "PayPal, Inc."
350
- transaction.us_bank_account_details.bank_name.should == "FEDERAL RESERVE BANK"
351
- transaction.us_bank_account_details.ach_mandate.text.should == "cl mandate text"
352
- transaction.us_bank_account_details.ach_mandate.accepted_at.should be_a Time
353
- end
354
- end
355
- end
356
-
357
115
  context "not plaid-verified" do
358
116
  let(:non_plaid_nonce) { generate_non_plaid_us_bank_account_nonce }
359
117
  let(:invalid_nonce) { generate_invalid_us_bank_account_nonce }
@@ -35,10 +35,12 @@ describe Braintree::ApplePayCard do
35
35
  :image_url => nil,
36
36
  :issuing_bank => "Big Bad Bank",
37
37
  :last_4 => "9876",
38
+ :merchant_token_identifier => "merchant-token-123",
38
39
  :payment_instrument_name => nil,
39
40
  :payroll => "No",
40
41
  :prepaid => "No",
41
42
  :product_id => "MAC",
43
+ :source_card_last4 => "1234",
42
44
  :source_description => "blah",
43
45
  :subscriptions => [
44
46
  {
@@ -81,6 +83,13 @@ describe Braintree::ApplePayCard do
81
83
 
82
84
  expect(card.subscriptions).to be_empty
83
85
  end
86
+
87
+ it "handles mpan attributes" do
88
+ card = Braintree::ApplePayCard._new(:gateway, attributes)
89
+
90
+ expect(card.merchant_token_identifier).to_not be_nil
91
+ expect(card.source_card_last4).to_not be_nil
92
+ end
84
93
  end
85
94
 
86
95
  describe "default?" do
@@ -0,0 +1,73 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper")
2
+
3
+ describe Braintree::Transaction::PaymentReceipt do
4
+ describe "inspect" do
5
+ it "assigns all fields" do
6
+ details = Braintree::Transaction::PaymentReceipt.new(
7
+ :account_balance => "2.00",
8
+ :amount => "10.00",
9
+ :card_last_4 => "1111",
10
+ :card_present_data => {
11
+ :application_cryptogram => "application-cryptogram",
12
+ :application_identifier => "application-id",
13
+ :application_interchange_profile => "application-interchange",
14
+ :application_name => "application-name",
15
+ :application_transaction_counter => "application-transaction-counter",
16
+ :application_usage_control => "application-usage-control",
17
+ :authorization_mode => "Issuer",
18
+ :authorization_response_code => "auth-response-code",
19
+ :card_entry_method => "card-entry-method",
20
+ :card_sequence_number => "card-sequence-number",
21
+ :cardholder_verification_method_results => "cardholder-verification-method-results",
22
+ :cashback_amount => "20.00",
23
+ :cryptogram_information_data => "cryptogram-information-data",
24
+ :issuer_action_code_default => "issuer-action-code-default",
25
+ :issuer_action_code_denial => "issuer-action-code-denial",
26
+ :issuer_action_code_online => "issuer-action-code-online",
27
+ :issuer_authentication_data => "issuer-authentication-data",
28
+ :terminal_country_code => "USA",
29
+ :terminal_transaction_date => "2023-04-03",
30
+ :terminal_transaction_type => "terminal-transaction-type",
31
+ :terminal_verification_result => "terminal-verification-result",
32
+ :unpredictable_number => "unpredictable-number",
33
+ },
34
+ :card_type => "VISA",
35
+ :currency_iso_code => "USD",
36
+ :global_id => "global-id",
37
+ :id => "id",
38
+ :merchant_address => {
39
+ :locality => "Chicago",
40
+ :phone => "7708675309",
41
+ :postal_code => "60652",
42
+ :region => "IL",
43
+ :street_address => "123 Sesame St",
44
+ },
45
+ :merchant_identification_number => "merchant-id-number",
46
+ :merchant_name => "merchant-name",
47
+ :pin_verified => true,
48
+ :processor_authorization_code => "processor-auth-code",
49
+ :processor_response_code => "processor-response-code",
50
+ :processor_response_text => "processor-response-text",
51
+ :terminal_identification_number => "terminal-id",
52
+ :type => "sale",
53
+ )
54
+
55
+ expect(details.account_balance).to eq("2.00")
56
+ expect(details.amount).to eq("10.00")
57
+ expect(details.card_last_4).to eq("1111")
58
+ expect(details.card_present_data).to eq({application_cryptogram: "application-cryptogram", application_identifier: "application-id", application_interchange_profile: "application-interchange", application_name: "application-name", application_transaction_counter: "application-transaction-counter", application_usage_control: "application-usage-control", authorization_mode: "Issuer", authorization_response_code: "auth-response-code", card_entry_method: "card-entry-method", card_sequence_number: "card-sequence-number", cardholder_verification_method_results: "cardholder-verification-method-results", cashback_amount: "20.00", cryptogram_information_data: "cryptogram-information-data", issuer_action_code_default: "issuer-action-code-default", issuer_action_code_denial: "issuer-action-code-denial", issuer_action_code_online: "issuer-action-code-online", issuer_authentication_data: "issuer-authentication-data", terminal_country_code: "USA", terminal_transaction_date: "2023-04-03", terminal_transaction_type: "terminal-transaction-type", terminal_verification_result: "terminal-verification-result", unpredictable_number: "unpredictable-number"})
59
+ expect(details.card_type).to eq("VISA")
60
+ expect(details.currency_iso_code).to eq("USD")
61
+ expect(details.global_id).to eq("global-id")
62
+ expect(details.id).to eq("id")
63
+ expect(details.merchant_address).to eq({locality: "Chicago", phone: "7708675309", postal_code: "60652", region: "IL", street_address: "123 Sesame St"})
64
+ expect(details.merchant_identification_number).to eq("merchant-id-number")
65
+ expect(details.merchant_name).to eq("merchant-name")
66
+ expect(details.pin_verified).to be_truthy
67
+ expect(details.processor_authorization_code).to be("processor-auth-code")
68
+ expect(details.processor_response_text).to be("processor-response-text")
69
+ expect(details.terminal_identification_number).to be("terminal-id")
70
+ expect(details.type).to be("sale")
71
+ end
72
+ end
73
+ end
@@ -74,6 +74,7 @@ describe Braintree::TransactionGateway do
74
74
  :skip_avs,
75
75
  :skip_cvv,
76
76
  {:paypal => [:custom_field, :payee_id, :payee_email, :description, {:supplementary_data => :_any_key_}]},
77
+ {:processing_overrides => [:customer_email, :customer_first_name, :customer_last_name, :customer_tax_identifier]},
77
78
  {:three_d_secure => [:required]},
78
79
  {:amex_rewards => [:request_id, :points, :currency_amount, :currency_iso_code]},
79
80
  {:venmo => [:profile_id]},
@@ -92,7 +93,7 @@ describe Braintree::TransactionGateway do
92
93
  {:data => [
93
94
  :folio_number, :check_in_date, :check_out_date, :travel_package, :lodging_check_in_date, :lodging_check_out_date, :departure_date, :lodging_name, :room_rate, :room_tax,
94
95
  :passenger_first_name, :passenger_last_name, :passenger_middle_initial, :passenger_title, :issued_date, :travel_agency_name, :travel_agency_code, :ticket_number,
95
- :issuing_carrier_code, :customer_code, :fare_amount, :fee_amount, :tax_amount, :restricted_ticket, :no_show, :advanced_deposit, :fire_safe, :property_phone,
96
+ :issuing_carrier_code, :customer_code, :fare_amount, :fee_amount, :tax_amount, :restricted_ticket, :no_show, :advanced_deposit, :fire_safe, :property_phone, :ticket_issuer_address, :arrival_date,
96
97
  {:legs => [
97
98
  :conjunction_ticket, :exchange_ticket, :coupon_number, :service_class, :carrier_code, :fare_basis_code, :flight_number, :departure_date, :departure_airport_code, :departure_time,
98
99
  :arrival_airport_code, :arrival_time, :stopover_permitted, :fare_amount, :fee_amount, :tax_amount, :endorsement_or_restrictions,
@@ -246,6 +246,17 @@ describe Braintree::Transaction do
246
246
  transaction.authorization_adjustments[1].processor_response_text.should == "Processor Network Unavailable - Try Again"
247
247
  end
248
248
 
249
+ it "accepts retry_ids and retried_transaction_id attributes in a transactions" do
250
+ transaction = Braintree::Transaction._new(
251
+ :gateway,
252
+ :retry_ids => ["retry_id_1"],
253
+ :retried_transaction_id => "original_retried_tranction_id",
254
+ )
255
+ transaction.retry_ids.count.should == 1
256
+ transaction.retry_ids[0].should == "retry_id_1"
257
+ transaction.retried_transaction_id.should == "original_retried_tranction_id"
258
+ end
259
+
249
260
  it "handles receiving custom as an empty string" do
250
261
  transaction = Braintree::Transaction._new(
251
262
  :gateway,
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: braintree
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.12.0
4
+ version: 4.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Braintree
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-31 00:00:00.000000000 Z
11
+ date: 2023-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: builder
@@ -177,6 +177,9 @@ files:
177
177
  - lib/braintree/transaction/installment.rb
178
178
  - lib/braintree/transaction/installment/adjustment.rb
179
179
  - lib/braintree/transaction/local_payment_details.rb
180
+ - lib/braintree/transaction/payment_receipt.rb
181
+ - lib/braintree/transaction/payment_receipt/card_present_data.rb
182
+ - lib/braintree/transaction/payment_receipt/merchant_address.rb
180
183
  - lib/braintree/transaction/paypal_details.rb
181
184
  - lib/braintree/transaction/paypal_here_details.rb
182
185
  - lib/braintree/transaction/samsung_pay_card_details.rb
@@ -321,6 +324,7 @@ files:
321
324
  - spec/unit/braintree/transaction/customer_details_spec.rb
322
325
  - spec/unit/braintree/transaction/deposit_details_spec.rb
323
326
  - spec/unit/braintree/transaction/installment_spec.rb
327
+ - spec/unit/braintree/transaction/payment_receipt_spec.rb
324
328
  - spec/unit/braintree/transaction/paypal_details_spec.rb
325
329
  - spec/unit/braintree/transaction/sepa_direct_debit_account_details_spec.rb
326
330
  - spec/unit/braintree/transaction_gateway_spec.rb
@@ -364,7 +368,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
364
368
  - !ruby/object:Gem::Version
365
369
  version: '0'
366
370
  requirements: []
367
- rubygems_version: 3.4.13
371
+ rubygems_version: 3.2.5
368
372
  signing_key:
369
373
  specification_version: 4
370
374
  summary: Braintree Ruby Server SDK