braintree 4.25.0 → 4.27.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.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/lib/braintree/apple_pay_card.rb +1 -0
  3. data/lib/braintree/bin_data.rb +2 -1
  4. data/lib/braintree/configuration.rb +1 -1
  5. data/lib/braintree/credit_card.rb +6 -5
  6. data/lib/braintree/error_codes.rb +46 -104
  7. data/lib/braintree/gateway.rb +4 -0
  8. data/lib/braintree/google_pay_card.rb +1 -0
  9. data/lib/braintree/merchant_account.rb +1 -25
  10. data/lib/braintree/merchant_account_gateway.rb +0 -81
  11. data/lib/braintree/meta_checkout_card.rb +6 -5
  12. data/lib/braintree/meta_checkout_token.rb +6 -5
  13. data/lib/braintree/paypal_payment_resource.rb +22 -0
  14. data/lib/braintree/paypal_payment_resource_gateway.rb +36 -0
  15. data/lib/braintree/test/credit_card.rb +1 -0
  16. data/lib/braintree/transaction/apple_pay_details.rb +1 -0
  17. data/lib/braintree/transaction/credit_card_details.rb +12 -10
  18. data/lib/braintree/transaction/google_pay_details.rb +11 -10
  19. data/lib/braintree/transaction/meta_checkout_card_details.rb +5 -2
  20. data/lib/braintree/transaction/meta_checkout_token_details.rb +6 -2
  21. data/lib/braintree/transaction/visa_checkout_card_details.rb +5 -2
  22. data/lib/braintree/transaction.rb +0 -26
  23. data/lib/braintree/transaction_gateway.rb +9 -20
  24. data/lib/braintree/version.rb +1 -1
  25. data/lib/braintree/visa_checkout_card.rb +5 -5
  26. data/lib/braintree/webhook_notification.rb +0 -4
  27. data/lib/braintree/webhook_testing_gateway.rb +0 -33
  28. data/lib/braintree.rb +2 -3
  29. data/spec/integration/braintree/credit_card_spec.rb +12 -0
  30. data/spec/integration/braintree/credit_card_verification_spec.rb +24 -0
  31. data/spec/integration/braintree/customer_spec.rb +22 -6
  32. data/spec/integration/braintree/disbursement_spec.rb +1 -1
  33. data/spec/integration/braintree/merchant_account_spec.rb +0 -342
  34. data/spec/integration/braintree/payment_method_nonce_spec.rb +11 -0
  35. data/spec/integration/braintree/payment_method_spec.rb +3 -3
  36. data/spec/integration/braintree/paypal_payment_resource_spec.rb +141 -0
  37. data/spec/integration/braintree/transaction_payment_facilitator_spec.rb +119 -0
  38. data/spec/integration/braintree/transaction_spec.rb +16 -305
  39. data/spec/spec_helper.rb +1 -1
  40. data/spec/unit/braintree/apple_pay_card_spec.rb +1 -0
  41. data/spec/unit/braintree/configuration_spec.rb +1 -1
  42. data/spec/unit/braintree/credit_card_spec.rb +5 -0
  43. data/spec/unit/braintree/google_pay_card_spec.rb +8 -0
  44. data/spec/unit/braintree/meta_checkout_card_spec.rb +53 -51
  45. data/spec/unit/braintree/meta_checkout_token_spec.rb +3 -1
  46. data/spec/unit/braintree/payment_method_nonce_spec.rb +4 -1
  47. data/spec/unit/braintree/paypal_payment_resource_spec.rb +125 -0
  48. data/spec/unit/braintree/transaction/apple_pay_details_spec.rb +8 -0
  49. data/spec/unit/braintree/transaction/credit_card_details_spec.rb +2 -1
  50. data/spec/unit/braintree/transaction/google_pay_details_spec.rb +8 -0
  51. data/spec/unit/braintree/transaction/meta_checkout_card_details_spec.rb +8 -0
  52. data/spec/unit/braintree/transaction/meta_checkout_token_details_spec.rb +8 -0
  53. data/spec/unit/braintree/transaction/visa_checkout_card_details_spec.rb +8 -0
  54. data/spec/unit/braintree/transaction_gateway_spec.rb +19 -0
  55. data/spec/unit/braintree/transaction_spec.rb +2 -0
  56. data/spec/unit/braintree/visa_checkout_card_spec.rb +8 -0
  57. data/spec/unit/braintree/webhook_notification_spec.rb +0 -53
  58. data/spec/unit/credit_card_details_spec.rb +8 -0
  59. metadata +15 -7
  60. data/lib/braintree/merchant_account/business_details.rb +0 -17
  61. data/lib/braintree/merchant_account/funding_details.rb +0 -18
  62. data/lib/braintree/merchant_account/individual_details.rb +0 -20
  63. data/spec/unit/braintree/disbursement_spec.rb +0 -131
  64. data/spec/unit/braintree/merchant_account_spec.rb +0 -33
@@ -0,0 +1,125 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
+
3
+ describe Braintree::PayPalPaymentResource do
4
+
5
+ describe "#update" do
6
+ it "successfully updates a paypal payment request" do
7
+ paypal_payment_resource_request = {
8
+ :amount => 55.00,
9
+ :amount_breakdown => {
10
+ :discount => 15_00,
11
+ :handling => 0,
12
+ :insurance => 5_00,
13
+ :item_total => 45_00,
14
+ :shipping => 10_00,
15
+ :shipping_discount => 0,
16
+ :tax_total => 10_00
17
+ },
18
+ :currency_iso_code => "USD",
19
+ :description => "This is a test",
20
+ :custom_field => "0437",
21
+ :line_items => [{
22
+ :description => "Shoes",
23
+ :image_url => "https://example.com/products/23434/pic.png",
24
+ :kind => "debit",
25
+ :name => "Name #1",
26
+ :product_code => "23434",
27
+ :quantity => 1_00,
28
+ :total_amount => 45_00,
29
+ :unit_amount => 45_00,
30
+ :unit_tax_amount => 10_00,
31
+ :url => "https://example.com/products/23434",
32
+ }],
33
+ :order_id => "order-123456789",
34
+ :payee_email => "bt_buyer_us@paypal.com",
35
+ :payment_method_nonce => "1234",
36
+ :shipping => {
37
+ :country_name => "United States",
38
+ :country_code_alpha2 => "US",
39
+ :country_code_alpha3 => "USA",
40
+ :country_code_numeric => "484",
41
+ :extended_address => "Apt. #1",
42
+ :first_name => "John",
43
+ :international_phone => {
44
+ :country_code => "1",
45
+ :national_number => "4081111111",
46
+ },
47
+ :last_name => "Doe",
48
+ :locality => "Chicago",
49
+ :postal_code => "60618",
50
+ :region => "IL",
51
+ :street_address => "123 Division Street",
52
+ },
53
+ :shipping_options => [{
54
+ :amount => "10.00",
55
+ :id => "option1",
56
+ :label => "fast",
57
+ :selected => true,
58
+ :type => "SHIPPING"
59
+ }]
60
+ }
61
+
62
+ unknown_response = {:payment_method_nonce => {}}
63
+ http_instance = double(:put => unknown_response)
64
+ allow(Braintree::Http).to receive(:new).and_return(http_instance)
65
+ result = Braintree::PayPalPaymentResource.update(paypal_payment_resource_request)
66
+ expect(result).to be_success
67
+ end
68
+ it "should match the update signature" do
69
+ expect(Braintree::PayPalPaymentResourceGateway._update_signature).to match([
70
+ :amount,
71
+ {:amount_breakdown => [
72
+ :discount,
73
+ :handling,
74
+ :insurance,
75
+ :item_total,
76
+ :shipping,
77
+ :shipping_discount,
78
+ :tax_total
79
+ ]},
80
+ :currency_iso_code,
81
+ :custom_field,
82
+ :description,
83
+ {:line_items => [
84
+ :description,
85
+ :image_url,
86
+ :kind,
87
+ :name,
88
+ :product_code,
89
+ :quantity,
90
+ :total_amount,
91
+ :unit_amount,
92
+ :unit_tax_amount,
93
+ :url,
94
+ ]},
95
+ :order_id,
96
+ :payee_email,
97
+ :payment_method_nonce,
98
+ {:shipping => [
99
+ :country_name,
100
+ :country_code_alpha2,
101
+ :country_code_alpha3,
102
+ :country_code_numeric,
103
+ :extended_address,
104
+ :first_name,
105
+ {:international_phone => [
106
+ :country_code,
107
+ :national_number]},
108
+ :last_name,
109
+ :locality,
110
+ :postal_code,
111
+ :region,
112
+ :street_address,
113
+ ]},
114
+ {:shipping_options => [
115
+ :amount,
116
+ :id,
117
+ :label,
118
+ :selected,
119
+ :type
120
+ ]},
121
+ ],
122
+ )
123
+ end
124
+ end
125
+ end
@@ -0,0 +1,8 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
+
3
+ describe Braintree::ApplePayDetails do
4
+ it "initializes prepaid reloadable correctly" do
5
+ card = Braintree::ApplePayDetails._new(:gateway, {:prepaid_reloadable => "No"})
6
+ expect(card.prepaid_reloadable).to eq("No")
7
+ end
8
+ end
@@ -24,6 +24,7 @@ describe Braintree::Transaction::CreditCardDetails do
24
24
  :customer_location => "US",
25
25
  :healthcare => "No",
26
26
  :prepaid => "Yes",
27
+ :prepaid_reloadable => "Yes",
27
28
  :durbin_regulated => "No",
28
29
  :debit => "Yes",
29
30
  :commercial => "Unknown",
@@ -34,7 +35,7 @@ describe Braintree::Transaction::CreditCardDetails do
34
35
  :image_url => "example.com/visa.png",
35
36
  :unique_number_identifier => "abc123",
36
37
  )
37
- expect(details.inspect).to eq(%(#<token: "token", bin: "123456", last_4: "6789", card_type: "Visa", expiration_date: "05/2012", cardholder_name: "The Cardholder", customer_location: "US", prepaid: "Yes", healthcare: "No", durbin_regulated: "No", debit: "Yes", commercial: "Unknown", payroll: "Unknown", product_id: "Unknown", country_of_issuance: "Lilliput", issuing_bank: "Gulliver Bank", image_url: "example.com/visa.png", unique_number_identifier: "abc123">))
38
+ expect(details.inspect).to eq(%(#<token: "token", bin: "123456", last_4: "6789", card_type: "Visa", commercial: "Unknown", country_of_issuance: "Lilliput", customer_location: "US", debit: "Yes", durbin_regulated: "No", expiration_date: "05/2012", healthcare: "No", image_url: "example.com/visa.png", issuing_bank: "Gulliver Bank", payroll: "Unknown", prepaid: "Yes", prepaid_reloadable: "Yes", product_id: "Unknown", cardholder_name: "The Cardholder", unique_number_identifier: "abc123">))
38
39
  end
39
40
  end
40
41
 
@@ -0,0 +1,8 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
+
3
+ describe Braintree::GooglePayDetails do
4
+ it "initializes prepaid reloadable correctly" do
5
+ card = Braintree::GooglePayDetails._new(:gateway, {:prepaid_reloadable => "No"})
6
+ expect(card.prepaid_reloadable).to eq("No")
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
+
3
+ describe Braintree::MetaCheckoutCardDetails do
4
+ it "initializes prepaid reloadable correctly" do
5
+ card = Braintree::MetaCheckoutCardDetails._new(:gateway, {:prepaid_reloadable => "No"})
6
+ expect(card.prepaid_reloadable).to eq("No")
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
+
3
+ describe Braintree::MetaCheckoutTokenDetails do
4
+ it "initializes prepaid reloadable correctly" do
5
+ card = Braintree::MetaCheckoutTokenDetails._new(:gateway, {:prepaid_reloadable => "No"})
6
+ expect(card.prepaid_reloadable).to eq("No")
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
+
3
+ describe Braintree::VisaCheckoutCardDetails do
4
+ it "initializes prepaid reloadable correctly" do
5
+ card = Braintree::VisaCheckoutCardDetails._new(:gateway, {:prepaid_reloadable => "No"})
6
+ expect(card.prepaid_reloadable).to eq("No")
7
+ end
8
+ end
@@ -94,6 +94,25 @@ describe Braintree::TransactionGateway do
94
94
  ]
95
95
  },
96
96
  {:paypal_account => [:email, :token, :paypal_data, :payee_id, :payee_email, :payer_id, :payment_id]},
97
+ {:payment_facilitator => [
98
+ :payment_facilitator_id,
99
+ {:sub_merchant => [
100
+ :reference_number,
101
+ :tax_id,
102
+ :legal_name,
103
+ {:address => [
104
+ :street_address,
105
+ :locality,
106
+ :region,
107
+ :country_code_alpha2,
108
+ :postal_code,
109
+ {:international_phone => [
110
+ :country_code,
111
+ :national_number
112
+ ]}
113
+ ]}
114
+ ]}
115
+ ]},
97
116
  {:risk_data => [:customer_browser, :customer_device_id, :customer_ip, :customer_location_zip, :customer_tenure]},
98
117
  {
99
118
  :shipping => Braintree::AddressGateway._shared_signature + [:shipping_method],
@@ -119,6 +119,7 @@ describe Braintree::Transaction do
119
119
  :expiration_year => "2009",
120
120
  :customer_location => "US",
121
121
  :prepaid => "Yes",
122
+ :prepaid_reloadable => "Yes",
122
123
  :healthcare => "Yes",
123
124
  :durbin_regulated => "Yes",
124
125
  :debit => "Yes",
@@ -137,6 +138,7 @@ describe Braintree::Transaction do
137
138
  expect(transaction.credit_card_details.expiration_year).to eq("2009")
138
139
  expect(transaction.credit_card_details.customer_location).to eq("US")
139
140
  expect(transaction.credit_card_details.prepaid).to eq(Braintree::CreditCard::Prepaid::Yes)
141
+ expect(transaction.credit_card_details.prepaid_reloadable).to eq(Braintree::CreditCard::PrepaidReloadable::Yes)
140
142
  expect(transaction.credit_card_details.healthcare).to eq(Braintree::CreditCard::Healthcare::Yes)
141
143
  expect(transaction.credit_card_details.durbin_regulated).to eq(Braintree::CreditCard::DurbinRegulated::Yes)
142
144
  expect(transaction.credit_card_details.debit).to eq(Braintree::CreditCard::Debit::Yes)
@@ -0,0 +1,8 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
+
3
+ describe Braintree::VisaCheckoutCard do
4
+ it "initializes prepaid reloadable correctly" do
5
+ card = Braintree::VisaCheckoutCard._new(:gateway, {:prepaid_reloadable => "No"})
6
+ expect(card.prepaid_reloadable).to eq("No")
7
+ end
8
+ end
@@ -310,25 +310,6 @@ describe Braintree::WebhookNotification do
310
310
  expect(notification.transaction.disbursement_details.disbursement_date).to eq(Date.parse("2013-07-09"))
311
311
  end
312
312
 
313
- it "builds a sample notification for a disbursement_exception webhook" do
314
- sample_notification = Braintree::WebhookTesting.sample_notification(
315
- Braintree::WebhookNotification::Kind::DisbursementException,
316
- "my_id",
317
- )
318
-
319
- notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload])
320
-
321
- expect(notification.kind).to eq(Braintree::WebhookNotification::Kind::DisbursementException)
322
- expect(notification.disbursement.id).to eq("my_id")
323
- expect(notification.disbursement.transaction_ids).to eq(%W{ afv56j kj8hjk })
324
- expect(notification.disbursement.retry).to be(false)
325
- expect(notification.disbursement.success).to be(false)
326
- expect(notification.disbursement.exception_message).to eq("bank_rejected")
327
- expect(notification.disbursement.disbursement_date).to eq(Date.parse("2014-02-10"))
328
- expect(notification.disbursement.follow_up_action).to eq("update_funding_information")
329
- expect(notification.disbursement.merchant_account.id).to eq("merchant_account_token")
330
- end
331
-
332
313
  it "builds a sample notification for a disbursement webhook" do
333
314
  sample_notification = Braintree::WebhookTesting.sample_notification(
334
315
  Braintree::WebhookNotification::Kind::Disbursement,
@@ -403,40 +384,6 @@ describe Braintree::WebhookNotification do
403
384
  end
404
385
  end
405
386
 
406
- context "merchant account" do
407
- it "builds a sample notification for a merchant account approved webhook" do
408
- sample_notification = Braintree::WebhookTesting.sample_notification(
409
- Braintree::WebhookNotification::Kind::SubMerchantAccountApproved,
410
- "my_id",
411
- )
412
-
413
- notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload])
414
-
415
- expect(notification.kind).to eq(Braintree::WebhookNotification::Kind::SubMerchantAccountApproved)
416
- expect(notification.merchant_account.id).to eq("my_id")
417
- expect(notification.merchant_account.status).to eq(Braintree::MerchantAccount::Status::Active)
418
- expect(notification.merchant_account.master_merchant_account.id).to eq("master_ma_for_my_id")
419
- expect(notification.merchant_account.master_merchant_account.status).to eq(Braintree::MerchantAccount::Status::Active)
420
- end
421
-
422
- it "builds a sample notification for a merchant account declined webhook" do
423
- sample_notification = Braintree::WebhookTesting.sample_notification(
424
- Braintree::WebhookNotification::Kind::SubMerchantAccountDeclined,
425
- "my_id",
426
- )
427
-
428
- notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload])
429
-
430
- expect(notification.kind).to eq(Braintree::WebhookNotification::Kind::SubMerchantAccountDeclined)
431
- expect(notification.merchant_account.id).to eq("my_id")
432
- expect(notification.merchant_account.status).to eq(Braintree::MerchantAccount::Status::Suspended)
433
- expect(notification.merchant_account.master_merchant_account.id).to eq("master_ma_for_my_id")
434
- expect(notification.merchant_account.master_merchant_account.status).to eq(Braintree::MerchantAccount::Status::Suspended)
435
- expect(notification.message).to eq("Credit score is too low")
436
- expect(notification.errors.for(:merchant_account).on(:base).first.code).to eq(Braintree::ErrorCodes::MerchantAccount::DeclinedOFAC)
437
- end
438
- end
439
-
440
387
  context "subscription" do
441
388
  it "builds a sample notification for a subscription billing skipped webhook" do
442
389
  sample_notification = Braintree::WebhookTesting.sample_notification(
@@ -0,0 +1,8 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
+
3
+ describe Braintree::CreditCardDetails do
4
+ it "initializes prepaid reloadable correctly" do
5
+ card = Braintree::CreditCardDetails._new(:gateway, {:prepaid_reloadable => "No"})
6
+ expect(card.prepaid_reloadable).to eq("No")
7
+ end
8
+ end
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.25.0
4
+ version: 4.27.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Braintree
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-01-29 00:00:00.000000000 Z
11
+ date: 2025-05-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: builder
@@ -129,9 +129,6 @@ files:
129
129
  - lib/braintree/merchant.rb
130
130
  - lib/braintree/merchant_account.rb
131
131
  - lib/braintree/merchant_account/address_details.rb
132
- - lib/braintree/merchant_account/business_details.rb
133
- - lib/braintree/merchant_account/funding_details.rb
134
- - lib/braintree/merchant_account/individual_details.rb
135
132
  - lib/braintree/merchant_account_gateway.rb
136
133
  - lib/braintree/merchant_gateway.rb
137
134
  - lib/braintree/meta_checkout_card.rb
@@ -152,6 +149,8 @@ files:
152
149
  - lib/braintree/payment_method_parser.rb
153
150
  - lib/braintree/paypal_account.rb
154
151
  - lib/braintree/paypal_account_gateway.rb
152
+ - lib/braintree/paypal_payment_resource.rb
153
+ - lib/braintree/paypal_payment_resource_gateway.rb
155
154
  - lib/braintree/plan.rb
156
155
  - lib/braintree/plan_gateway.rb
157
156
  - lib/braintree/processor_response_types.rb
@@ -269,6 +268,7 @@ files:
269
268
  - spec/integration/braintree/payment_method_spec.rb
270
269
  - spec/integration/braintree/payment_method_us_bank_account_spec.rb
271
270
  - spec/integration/braintree/paypal_account_spec.rb
271
+ - spec/integration/braintree/paypal_payment_resource_spec.rb
272
272
  - spec/integration/braintree/plan_spec.rb
273
273
  - spec/integration/braintree/samsung_pay_card_spec.rb
274
274
  - spec/integration/braintree/sepa_direct_debit_account_spec.rb
@@ -277,6 +277,7 @@ files:
277
277
  - spec/integration/braintree/test/transaction_amounts_spec.rb
278
278
  - spec/integration/braintree/test_transaction_spec.rb
279
279
  - spec/integration/braintree/transaction_line_item_spec.rb
280
+ - spec/integration/braintree/transaction_payment_facilitator_spec.rb
280
281
  - spec/integration/braintree/transaction_search_spec.rb
281
282
  - spec/integration/braintree/transaction_spec.rb
282
283
  - spec/integration/braintree/transaction_us_bank_account_spec.rb
@@ -305,7 +306,6 @@ files:
305
306
  - spec/unit/braintree/customer_session_gateway_spec.rb
306
307
  - spec/unit/braintree/customer_spec.rb
307
308
  - spec/unit/braintree/digest_spec.rb
308
- - spec/unit/braintree/disbursement_spec.rb
309
309
  - spec/unit/braintree/dispute_search_spec.rb
310
310
  - spec/unit/braintree/dispute_spec.rb
311
311
  - spec/unit/braintree/document_upload_spec.rb
@@ -317,6 +317,7 @@ files:
317
317
  - spec/unit/braintree/exchange_rate_quote_response_spec.rb
318
318
  - spec/unit/braintree/exchange_rate_quote_spec.rb
319
319
  - spec/unit/braintree/exchange_rate_spec.rb
320
+ - spec/unit/braintree/google_pay_card_spec.rb
320
321
  - spec/unit/braintree/graphql/create_customer_session_input_spec.rb
321
322
  - spec/unit/braintree/graphql/customer_recommendations_input_spec.rb
322
323
  - spec/unit/braintree/graphql/customer_session_input_spec.rb
@@ -327,7 +328,6 @@ files:
327
328
  - spec/unit/braintree/local_payment_completed_spec.rb
328
329
  - spec/unit/braintree/local_payment_expired_spec.rb
329
330
  - spec/unit/braintree/local_payment_funded_spec.rb
330
- - spec/unit/braintree/merchant_account_spec.rb
331
331
  - spec/unit/braintree/meta_checkout_card_details_spec.rb
332
332
  - spec/unit/braintree/meta_checkout_card_spec.rb
333
333
  - spec/unit/braintree/meta_checkout_token_details_spec.rb
@@ -340,6 +340,7 @@ files:
340
340
  - spec/unit/braintree/payment_method_nonce_spec.rb
341
341
  - spec/unit/braintree/payment_method_spec.rb
342
342
  - spec/unit/braintree/paypal_account_spec.rb
343
+ - spec/unit/braintree/paypal_payment_resource_spec.rb
343
344
  - spec/unit/braintree/resource_collection_spec.rb
344
345
  - spec/unit/braintree/risk_data/liability_shift.rb
345
346
  - spec/unit/braintree/risk_data_spec.rb
@@ -351,14 +352,19 @@ files:
351
352
  - spec/unit/braintree/subscription_spec.rb
352
353
  - spec/unit/braintree/successful_result_spec.rb
353
354
  - spec/unit/braintree/three_d_secure_info_spec.rb
355
+ - spec/unit/braintree/transaction/apple_pay_details_spec.rb
354
356
  - spec/unit/braintree/transaction/credit_card_details_spec.rb
355
357
  - spec/unit/braintree/transaction/customer_details_spec.rb
356
358
  - spec/unit/braintree/transaction/deposit_details_spec.rb
359
+ - spec/unit/braintree/transaction/google_pay_details_spec.rb
357
360
  - spec/unit/braintree/transaction/installment_spec.rb
358
361
  - spec/unit/braintree/transaction/local_payment_details_spec.rb
362
+ - spec/unit/braintree/transaction/meta_checkout_card_details_spec.rb
363
+ - spec/unit/braintree/transaction/meta_checkout_token_details_spec.rb
359
364
  - spec/unit/braintree/transaction/payment_receipt_spec.rb
360
365
  - spec/unit/braintree/transaction/paypal_details_spec.rb
361
366
  - spec/unit/braintree/transaction/sepa_direct_debit_account_details_spec.rb
367
+ - spec/unit/braintree/transaction/visa_checkout_card_details_spec.rb
362
368
  - spec/unit/braintree/transaction_gateway_spec.rb
363
369
  - spec/unit/braintree/transaction_search_spec.rb
364
370
  - spec/unit/braintree/transaction_spec.rb
@@ -370,12 +376,14 @@ files:
370
376
  - spec/unit/braintree/validation_error_collection_spec.rb
371
377
  - spec/unit/braintree/validation_error_spec.rb
372
378
  - spec/unit/braintree/venmo_profile_data_spec.rb
379
+ - spec/unit/braintree/visa_checkout_card_spec.rb
373
380
  - spec/unit/braintree/webhook_notification_spec.rb
374
381
  - spec/unit/braintree/xml/libxml_spec.rb
375
382
  - spec/unit/braintree/xml/parser_spec.rb
376
383
  - spec/unit/braintree/xml/rexml_spec.rb
377
384
  - spec/unit/braintree/xml_spec.rb
378
385
  - spec/unit/braintree_spec.rb
386
+ - spec/unit/credit_card_details_spec.rb
379
387
  - spec/unit/spec_helper.rb
380
388
  homepage: https://www.braintreepayments.com/
381
389
  licenses:
@@ -1,17 +0,0 @@
1
- module Braintree
2
- class MerchantAccount
3
- class BusinessDetails
4
- include BaseModule
5
-
6
- attr_reader :address_details
7
- attr_reader :dba_name
8
- attr_reader :legal_name
9
- attr_reader :tax_id
10
-
11
- def initialize(attributes)
12
- set_instance_variables_from_hash attributes unless attributes.nil?
13
- @address_details = MerchantAccount::AddressDetails.new(@address)
14
- end
15
- end
16
- end
17
- end
@@ -1,18 +0,0 @@
1
- module Braintree
2
- class MerchantAccount
3
- class FundingDetails
4
- include BaseModule
5
-
6
- attr_reader :account_number_last_4
7
- attr_reader :descriptor
8
- attr_reader :destination
9
- attr_reader :email
10
- attr_reader :mobile_phone
11
- attr_reader :routing_number
12
-
13
- def initialize(attributes)
14
- set_instance_variables_from_hash attributes unless attributes.nil?
15
- end
16
- end
17
- end
18
- end
@@ -1,20 +0,0 @@
1
- module Braintree
2
- class MerchantAccount
3
- class IndividualDetails
4
- include BaseModule
5
-
6
- attr_reader :address_details
7
- attr_reader :date_of_birth
8
- attr_reader :email
9
- attr_reader :first_name
10
- attr_reader :last_name
11
- attr_reader :phone
12
- attr_reader :ssn_last_4
13
-
14
- def initialize(attributes)
15
- set_instance_variables_from_hash attributes unless attributes.nil?
16
- @address_details = MerchantAccount::AddressDetails.new(@address)
17
- end
18
- end
19
- end
20
- end
@@ -1,131 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
-
3
- describe Braintree::Disbursement do
4
- describe "new" do
5
- it "is protected" do
6
- expect do
7
- Braintree::Disbursement.new
8
- end.to raise_error(NoMethodError, /protected method .new/)
9
- end
10
- end
11
-
12
- describe "inspect" do
13
- it "prints attributes of disbursement object" do
14
- disbursement = Braintree::Disbursement._new(
15
- :gateway,
16
- :id => "123456",
17
- :merchant_account => {
18
- :id => "sandbox_sub_merchant_account",
19
- :master_merchant_account => {
20
- :id => "sandbox_master_merchant_account",
21
- :status => "active"
22
- },
23
- :status => "active"
24
- },
25
- :transaction_ids => ["sub_merchant_transaction"],
26
- :amount => "100.00",
27
- :disbursement_date => "2013-04-10",
28
- :exception_message => "invalid_account_number",
29
- :follow_up_action => "update",
30
- :retry => false,
31
- :success => false,
32
- )
33
-
34
- expect(disbursement.inspect).to include('id: "123456"')
35
- expect(disbursement.inspect).to include('amount: "100.0"')
36
- expect(disbursement.inspect).to include('exception_message: "invalid_account_number"')
37
- expect(disbursement.inspect).to include("disbursement_date: 2013-04-10")
38
- expect(disbursement.inspect).to include('follow_up_action: "update"')
39
- expect(disbursement.inspect).to include("merchant_account: #<Braintree::MerchantAccount: ")
40
- expect(disbursement.inspect).to include('transaction_ids: ["sub_merchant_transaction"]')
41
- expect(disbursement.inspect).to include("retry: false")
42
- expect(disbursement.inspect).to include("success: false")
43
- end
44
- end
45
-
46
- describe "success?" do
47
- it "is an alias of success" do
48
- disbursement = Braintree::Disbursement._new(
49
- :gateway,
50
- :merchant_account => {
51
- :id => "sandbox_sub_merchant_account",
52
- :master_merchant_account => {
53
- :id => "sandbox_master_merchant_account",
54
- :status => "active"
55
- },
56
- :status => "active"
57
- },
58
- :success => false,
59
- :disbursement_date => "2013-04-10",
60
- )
61
- expect(disbursement.success?).to eq(false)
62
-
63
- disbursement = Braintree::Disbursement._new(
64
- :gateway,
65
- :merchant_account => {
66
- :id => "sandbox_sub_merchant_account",
67
- :master_merchant_account => {
68
- :id => "sandbox_master_merchant_account",
69
- :status => "active"
70
- },
71
- :status => "active"
72
- },
73
- :success => true,
74
- :disbursement_date => "2013-04-10",
75
- )
76
- expect(disbursement.success?).to eq(true)
77
- end
78
- end
79
-
80
- describe "credit?" do
81
- subject do
82
- described_class._new(
83
- :gateway,
84
- merchant_account: {
85
- id: "sandbox_master_merchant_account",
86
- status: "active",
87
- },
88
- success: true,
89
- amount: "100.00",
90
- disbursement_type: type,
91
- disbursement_date: "2013-04-10",
92
- )
93
- end
94
-
95
- context "when the disbursement type is credit" do
96
- let(:type) { described_class::Types::Credit }
97
- it { is_expected.to be_credit }
98
- end
99
-
100
- context "when the disbursement type is not credit" do
101
- let(:type) { described_class::Types::Debit }
102
- it { is_expected.not_to be_credit }
103
- end
104
- end
105
-
106
- describe "debit?" do
107
- subject do
108
- described_class._new(
109
- :gateway,
110
- merchant_account: {
111
- id: "sandbox_master_merchant_account",
112
- status: "active",
113
- },
114
- success: true,
115
- amount: "100.00",
116
- disbursement_type: type,
117
- disbursement_date: "2013-04-10",
118
- )
119
- end
120
-
121
- context "when the disbursement type is debit" do
122
- let(:type) { described_class::Types::Debit }
123
- it { is_expected.to be_debit }
124
- end
125
-
126
- context "when the disbursement type is not debit" do
127
- let(:type) { described_class::Types::Credit }
128
- it { is_expected.not_to be_debit }
129
- end
130
- end
131
- end
@@ -1,33 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
-
3
- describe Braintree::MerchantAccount do
4
- describe "#inspect" do
5
- it "is a string representation of the merchant account" do
6
- account = Braintree::MerchantAccount._new(nil, :id => "merchant_account", :status => "active", :master_merchant_account => nil)
7
-
8
- expect(account.inspect).to eq("#<Braintree::MerchantAccount: id: \"merchant_account\", status: \"active\", master_merchant_account: nil>")
9
- end
10
-
11
- it "handles a master merchant account" do
12
- account = Braintree::MerchantAccount._new(
13
- nil,
14
- :id => "merchant_account",
15
- :status => "active",
16
- :master_merchant_account => {:id => "master_merchant_account", :status => "active", :master_merchant_account => nil},
17
- )
18
-
19
- master_merchant_account = "#<Braintree::MerchantAccount: id: \"master_merchant_account\", status: \"active\", master_merchant_account: nil>"
20
- expect(account.inspect).to eq("#<Braintree::MerchantAccount: id: \"merchant_account\", status: \"active\", master_merchant_account: #{master_merchant_account}>")
21
- end
22
- end
23
-
24
- describe "default?" do
25
- it "is an alias of default" do
26
- account = Braintree::MerchantAccount._new(nil, :default => false)
27
- expect(account.default?).to eq(false)
28
- account = Braintree::MerchantAccount._new(nil, :default => true)
29
- expect(account.default?).to eq(true)
30
- end
31
- end
32
- end
33
-