braintree 3.1.0 → 4.1.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 (154) hide show
  1. checksums.yaml +4 -4
  2. data/braintree.gemspec +3 -3
  3. data/lib/braintree.rb +8 -1
  4. data/lib/braintree/account_updater_daily_report.rb +1 -1
  5. data/lib/braintree/address.rb +2 -1
  6. data/lib/braintree/apple_pay.rb +1 -1
  7. data/lib/braintree/apple_pay_card.rb +1 -1
  8. data/lib/braintree/apple_pay_options.rb +1 -1
  9. data/lib/braintree/authorization_adjustment.rb +1 -1
  10. data/lib/braintree/client_token.rb +1 -1
  11. data/lib/braintree/configuration.rb +11 -11
  12. data/lib/braintree/connected_merchant_paypal_status_changed.rb +1 -1
  13. data/lib/braintree/connected_merchant_status_transitioned.rb +1 -1
  14. data/lib/braintree/credit_card.rb +2 -2
  15. data/lib/braintree/credit_card_gateway.rb +14 -4
  16. data/lib/braintree/credit_card_verification.rb +5 -5
  17. data/lib/braintree/credit_card_verification_search.rb +1 -1
  18. data/lib/braintree/customer.rb +6 -4
  19. data/lib/braintree/customer_gateway.rb +2 -0
  20. data/lib/braintree/customer_search.rb +1 -1
  21. data/lib/braintree/disbursement.rb +1 -1
  22. data/lib/braintree/dispute.rb +15 -1
  23. data/lib/braintree/dispute/paypal_message.rb +15 -0
  24. data/lib/braintree/dispute_gateway.rb +2 -2
  25. data/lib/braintree/dispute_search.rb +3 -2
  26. data/lib/braintree/document_upload.rb +1 -1
  27. data/lib/braintree/error_codes.rb +12 -4
  28. data/lib/braintree/google_pay_card.rb +1 -1
  29. data/lib/braintree/granted_payment_instrument_update.rb +1 -1
  30. data/lib/braintree/graphql_client.rb +7 -7
  31. data/lib/braintree/http.rb +3 -3
  32. data/lib/braintree/local_payment_completed.rb +1 -1
  33. data/lib/braintree/local_payment_reversed.rb +19 -0
  34. data/lib/braintree/merchant.rb +1 -1
  35. data/lib/braintree/merchant_account.rb +1 -1
  36. data/lib/braintree/merchant_account_gateway.rb +1 -1
  37. data/lib/braintree/merchant_gateway.rb +1 -1
  38. data/lib/braintree/modification.rb +1 -1
  39. data/lib/braintree/oauth_credentials.rb +1 -1
  40. data/lib/braintree/oauth_gateway.rb +5 -5
  41. data/lib/braintree/payment_instrument_type.rb +10 -10
  42. data/lib/braintree/payment_method_gateway.rb +11 -8
  43. data/lib/braintree/payment_method_nonce.rb +1 -1
  44. data/lib/braintree/payment_method_nonce_details.rb +37 -0
  45. data/lib/braintree/payment_method_nonce_details_payer_info.rb +32 -0
  46. data/lib/braintree/payment_method_nonce_gateway.rb +1 -1
  47. data/lib/braintree/plan.rb +1 -1
  48. data/lib/braintree/processor_response_types.rb +3 -3
  49. data/lib/braintree/resource_collection.rb +8 -3
  50. data/lib/braintree/revoked_payment_method_metadata.rb +1 -1
  51. data/lib/braintree/risk_data.rb +3 -1
  52. data/lib/braintree/samsung_pay_card.rb +1 -1
  53. data/lib/braintree/settlement_batch_summary.rb +2 -2
  54. data/lib/braintree/subscription.rb +6 -6
  55. data/lib/braintree/test/credit_card.rb +1 -0
  56. data/lib/braintree/three_d_secure_info.rb +22 -12
  57. data/lib/braintree/transaction.rb +40 -24
  58. data/lib/braintree/transaction/installment.rb +28 -0
  59. data/lib/braintree/transaction/installment/adjustment.rb +33 -0
  60. data/lib/braintree/transaction_gateway.rb +27 -6
  61. data/lib/braintree/transaction_line_item.rb +1 -1
  62. data/lib/braintree/transaction_search.rb +3 -1
  63. data/lib/braintree/unknown_payment_method.rb +1 -1
  64. data/lib/braintree/us_bank_account.rb +3 -3
  65. data/lib/braintree/us_bank_account_verification.rb +1 -1
  66. data/lib/braintree/us_bank_account_verification_gateway.rb +1 -1
  67. data/lib/braintree/util.rb +4 -4
  68. data/lib/braintree/venmo_account.rb +1 -1
  69. data/lib/braintree/version.rb +1 -1
  70. data/lib/braintree/visa_checkout_card.rb +2 -2
  71. data/lib/braintree/webhook_notification.rb +30 -20
  72. data/lib/braintree/webhook_notification_gateway.rb +5 -5
  73. data/lib/braintree/webhook_testing_gateway.rb +30 -0
  74. data/lib/braintree/xml/generator.rb +5 -4
  75. data/lib/braintree/xml/libxml.rb +0 -1
  76. data/lib/braintree/xml/parser.rb +22 -12
  77. data/lib/braintree/xml/rexml.rb +70 -0
  78. data/spec/integration/braintree/add_on_spec.rb +1 -1
  79. data/spec/integration/braintree/address_spec.rb +28 -24
  80. data/spec/integration/braintree/advanced_search_spec.rb +45 -45
  81. data/spec/integration/braintree/apple_pay_spec.rb +3 -3
  82. data/spec/integration/braintree/braintree_gateway_spec.rb +2 -1
  83. data/spec/integration/braintree/client_api/client_token_spec.rb +14 -14
  84. data/spec/integration/braintree/client_api/spec_helper.rb +5 -5
  85. data/spec/integration/braintree/credit_card_spec.rb +213 -122
  86. data/spec/integration/braintree/credit_card_verification_search_spec.rb +2 -2
  87. data/spec/integration/braintree/credit_card_verification_spec.rb +1 -1
  88. data/spec/integration/braintree/customer_search_spec.rb +8 -8
  89. data/spec/integration/braintree/customer_spec.rb +433 -149
  90. data/spec/integration/braintree/dispute_search_spec.rb +28 -3
  91. data/spec/integration/braintree/dispute_spec.rb +6 -6
  92. data/spec/integration/braintree/error_codes_spec.rb +1 -1
  93. data/spec/integration/braintree/http_spec.rb +2 -2
  94. data/spec/integration/braintree/merchant_account_spec.rb +25 -26
  95. data/spec/integration/braintree/merchant_spec.rb +14 -14
  96. data/spec/integration/braintree/oauth_spec.rb +11 -11
  97. data/spec/integration/braintree/payment_method_nonce_spec.rb +26 -35
  98. data/spec/integration/braintree/payment_method_spec.rb +430 -149
  99. data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +17 -13
  100. data/spec/integration/braintree/paypal_account_spec.rb +28 -28
  101. data/spec/integration/braintree/samsung_pay_card_spec.rb +9 -9
  102. data/spec/integration/braintree/settlement_batch_summary_spec.rb +8 -8
  103. data/spec/integration/braintree/subscription_spec.rb +133 -133
  104. data/spec/integration/braintree/test/transaction_amounts_spec.rb +2 -2
  105. data/spec/integration/braintree/test_transaction_spec.rb +10 -10
  106. data/spec/integration/braintree/transaction_search_spec.rb +93 -67
  107. data/spec/integration/braintree/transaction_spec.rb +752 -383
  108. data/spec/integration/braintree/transaction_us_bank_account_spec.rb +32 -26
  109. data/spec/integration/braintree/us_bank_account_spec.rb +6 -6
  110. data/spec/integration/braintree/us_bank_account_verification_search_spec.rb +7 -7
  111. data/spec/integration/braintree/us_bank_account_verification_spec.rb +8 -8
  112. data/spec/integration/braintree/visa_checkout_card_spec.rb +5 -5
  113. data/spec/integration/spec_helper.rb +9 -3
  114. data/spec/oauth_test_helper.rb +1 -1
  115. data/spec/script/httpsd.rb +6 -6
  116. data/spec/spec_helper.rb +6 -3
  117. data/spec/unit/braintree/address_spec.rb +1 -1
  118. data/spec/unit/braintree/apple_pay_card_spec.rb +1 -1
  119. data/spec/unit/braintree/client_token_spec.rb +2 -2
  120. data/spec/unit/braintree/configuration_spec.rb +42 -42
  121. data/spec/unit/braintree/credit_card_spec.rb +13 -13
  122. data/spec/unit/braintree/credit_card_verification_search_spec.rb +1 -1
  123. data/spec/unit/braintree/credit_card_verification_spec.rb +8 -4
  124. data/spec/unit/braintree/customer_spec.rb +21 -10
  125. data/spec/unit/braintree/disbursement_spec.rb +7 -7
  126. data/spec/unit/braintree/dispute_search_spec.rb +1 -0
  127. data/spec/unit/braintree/dispute_spec.rb +34 -9
  128. data/spec/unit/braintree/error_result_spec.rb +5 -5
  129. data/spec/unit/braintree/errors_spec.rb +8 -8
  130. data/spec/unit/braintree/http_spec.rb +5 -5
  131. data/spec/unit/braintree/merchant_account_spec.rb +1 -1
  132. data/spec/unit/braintree/payment_method_nonce_details_payer_info_spec.rb +31 -0
  133. data/spec/unit/braintree/payment_method_nonce_details_spec.rb +43 -0
  134. data/spec/unit/braintree/payment_method_spec.rb +1 -1
  135. data/spec/unit/braintree/paypal_account_spec.rb +2 -2
  136. data/spec/unit/braintree/resource_collection_spec.rb +30 -1
  137. data/spec/unit/braintree/risk_data_spec.rb +9 -5
  138. data/spec/unit/braintree/subscription_search_spec.rb +1 -1
  139. data/spec/unit/braintree/successful_result_spec.rb +1 -1
  140. data/spec/unit/braintree/three_d_secure_info_spec.rb +32 -14
  141. data/spec/unit/braintree/transaction/credit_card_details_spec.rb +3 -3
  142. data/spec/unit/braintree/transaction/customer_details_spec.rb +1 -1
  143. data/spec/unit/braintree/transaction/deposit_details_spec.rb +2 -2
  144. data/spec/unit/braintree/transaction/installment_spec.rb +25 -0
  145. data/spec/unit/braintree/transaction/paypal_details_spec.rb +1 -1
  146. data/spec/unit/braintree/transaction_search_spec.rb +12 -12
  147. data/spec/unit/braintree/transaction_spec.rb +25 -17
  148. data/spec/unit/braintree/util_spec.rb +18 -18
  149. data/spec/unit/braintree/validation_error_collection_spec.rb +36 -36
  150. data/spec/unit/braintree/webhook_notification_spec.rb +88 -56
  151. data/spec/unit/braintree/xml/rexml_spec.rb +51 -0
  152. data/spec/unit/braintree/xml_spec.rb +31 -31
  153. metadata +18 -8
  154. data/lib/braintree/settlement_batch.rb +0 -0
@@ -0,0 +1,37 @@
1
+ module Braintree
2
+ class PaymentMethodNonceDetails # :nodoc:
3
+ include BaseModule
4
+
5
+ attr_reader :bin
6
+ attr_reader :card_type
7
+ attr_reader :expiration_month
8
+ attr_reader :expiration_year
9
+ attr_reader :is_network_tokenized
10
+ attr_reader :last_two
11
+ attr_reader :payer_info
12
+
13
+ alias_method :is_network_tokenized?, :is_network_tokenized
14
+
15
+ def initialize(attributes)
16
+ set_instance_variables_from_hash attributes unless attributes.nil?
17
+ @payer_info = PaymentMethodNonceDetailsPayerInfo.new(attributes[:payer_info]) if attributes[:payer_info]
18
+ end
19
+
20
+ def inspect
21
+ attr_order = [
22
+ :bin,
23
+ :card_type,
24
+ :expiration_month,
25
+ :expiration_year,
26
+ :is_network_tokenized,
27
+ :last_two,
28
+ :payer_info,
29
+ ]
30
+
31
+ formatted_attrs = attr_order.map do |attr|
32
+ "#{attr}: #{send(attr).inspect}"
33
+ end
34
+ "#<PaymentMethodNonceDetails #{formatted_attrs.join(", ")}>"
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,32 @@
1
+ module Braintree
2
+ class PaymentMethodNonceDetailsPayerInfo # :nodoc:
3
+ include BaseModule
4
+
5
+ attr_reader :billing_agreement_id
6
+ attr_reader :country_code
7
+ attr_reader :email
8
+ attr_reader :first_name
9
+ attr_reader :last_name
10
+ attr_reader :payer_id
11
+
12
+ def initialize(attributes)
13
+ set_instance_variables_from_hash attributes unless attributes.nil?
14
+ end
15
+
16
+ def inspect
17
+ attr_order = [
18
+ :billing_agreement_id,
19
+ :country_code,
20
+ :email,
21
+ :first_name,
22
+ :last_name,
23
+ :payer_id,
24
+ ]
25
+
26
+ formatted_attrs = attr_order.map do |attr|
27
+ "#{attr}: #{send(attr).inspect}"
28
+ end
29
+ "#<PaymentMethodNonceDetailsPayerInfo #{formatted_attrs.join(", ")}>"
30
+ end
31
+ end
32
+ end
@@ -8,7 +8,7 @@ module Braintree
8
8
  @config.assert_has_access_token_or_keys
9
9
  end
10
10
 
11
- def create(payment_method_token, args = { payment_method_nonce: {} })
11
+ def create(payment_method_token, args = {payment_method_nonce: {}})
12
12
  Util.verify_keys(PaymentMethodNonceGateway._create_signature, args)
13
13
 
14
14
  response = @config.http.post("#{@config.base_merchant_path}/payment_methods/#{payment_method_token}/nonces", args)
@@ -36,7 +36,7 @@ module Braintree
36
36
  end
37
37
 
38
38
  def self._new(*args)
39
- self.new *args
39
+ self.new(*args)
40
40
  end
41
41
  end
42
42
  end
@@ -1,7 +1,7 @@
1
1
  module Braintree
2
2
  module ProcessorResponseTypes
3
- Approved = 'approved'
4
- SoftDeclined = 'soft_declined'
5
- HardDeclined = 'hard_declined'
3
+ Approved = "approved"
4
+ SoftDeclined = "soft_declined"
5
+ HardDeclined = "hard_declined"
6
6
  end
7
7
  end
@@ -22,9 +22,14 @@ module Braintree
22
22
  @ids.empty?
23
23
  end
24
24
 
25
- # Returns the first item in the collection or nil if the collection is empty
26
- def first
27
- @paging_block.call([@ids.first]).first
25
+ # Returns the first or the first N items in the collection or nil if the collection is empty
26
+ def first(amount = 1)
27
+ return nil if @ids.empty?
28
+ return @paging_block.call([@ids.first]).first if amount == 1
29
+
30
+ @ids.first(amount).each_slice(@page_size).flat_map do |page_of_ids|
31
+ @paging_block.call(page_of_ids)
32
+ end
28
33
  end
29
34
 
30
35
  # Only the maximum size of a resource collection can be determined since the data on the server can change while
@@ -15,7 +15,7 @@ module Braintree
15
15
  class << self
16
16
  protected :new
17
17
  def _new(*args) # :nodoc:
18
- self.new *args
18
+ self.new(*args)
19
19
  end
20
20
  end
21
21
  end
@@ -6,16 +6,18 @@ module Braintree
6
6
  attr_reader :customer_location_zip
7
7
  attr_reader :customer_tenure
8
8
  attr_reader :decision
9
+ attr_reader :decision_reasons
9
10
  attr_reader :device_data_captured
10
11
  attr_reader :fraud_service_provider
11
12
  attr_reader :id
13
+ attr_reader :transaction_risk_score
12
14
 
13
15
  def initialize(attributes)
14
16
  set_instance_variables_from_hash attributes unless attributes.nil?
15
17
  end
16
18
 
17
19
  def inspect
18
- attr_order = [:id, :decision, :device_data_captured, :fraud_service_provider]
20
+ attr_order = [:id, :decision, :decision_reasons, :device_data_captured, :fraud_service_provider, :transaction_risk_score]
19
21
  formatted_attrs = attr_order.map do |attr|
20
22
  "#{attr}: #{send(attr).inspect}"
21
23
  end
@@ -77,7 +77,7 @@ module Braintree
77
77
  end
78
78
 
79
79
  def self._new(*args) # :nodoc:
80
- self.new *args
80
+ self.new(*args)
81
81
  end
82
82
  end
83
83
  end
@@ -1,11 +1,11 @@
1
1
  module Braintree
2
2
  class SettlementBatchSummary
3
3
  include BaseModule
4
-
4
+
5
5
  attr_reader :records
6
6
 
7
7
  def self.generate(settlement_date, group_by_custom_field = nil)
8
- criteria = { :settlement_date => settlement_date }
8
+ criteria = {:settlement_date => settlement_date}
9
9
  criteria.merge!({:group_by_custom_field => group_by_custom_field}) if group_by_custom_field
10
10
  Configuration.gateway.settlement_batch_summary.generate(criteria)
11
11
  end
@@ -11,11 +11,11 @@ module Braintree
11
11
  end
12
12
 
13
13
  module Status
14
- Active = 'Active'
15
- Canceled = 'Canceled'
16
- Expired = 'Expired'
17
- PastDue = 'Past Due'
18
- Pending = 'Pending'
14
+ Active = "Active"
15
+ Canceled = "Canceled"
16
+ Expired = "Expired"
17
+ PastDue = "Past Due"
18
+ Pending = "Pending"
19
19
 
20
20
  All = constants.map { |c| const_get(c) }
21
21
  end
@@ -115,7 +115,7 @@ module Braintree
115
115
  class << self
116
116
  protected :new
117
117
  def _new(*args) # :nodoc:
118
- self.new *args
118
+ self.new(*args)
119
119
  end
120
120
  end
121
121
  end
@@ -36,6 +36,7 @@ module Braintree
36
36
  Hipercard = "6062820524845321"
37
37
 
38
38
  Visa = "4012888888881881"
39
+ VisaCountryOfIssuanceIE = "4023490000000008"
39
40
  VisaInternational = "4009348888881881" # :nodoc:
40
41
  VisaPrepaid = "4500600000000061"
41
42
 
@@ -2,16 +2,21 @@ module Braintree
2
2
  class ThreeDSecureInfo # :nodoc:
3
3
  include BaseModule
4
4
 
5
+ attr_reader :acs_transaction_id
6
+ attr_reader :cavv
7
+ attr_reader :ds_transaction_id
8
+ attr_reader :eci_flag
5
9
  attr_reader :enrolled
6
- attr_reader :liability_shifted
7
10
  attr_reader :liability_shift_possible
11
+ attr_reader :liability_shifted
12
+ attr_reader :pares_status
8
13
  attr_reader :status
9
- attr_reader :cavv
10
- attr_reader :xid
11
- attr_reader :eci_flag
12
- attr_reader :three_d_secure_version
13
- attr_reader :ds_transaction_id
14
14
  attr_reader :three_d_secure_authentication_id
15
+ attr_reader :three_d_secure_transaction_id
16
+ attr_reader :three_d_secure_version
17
+ attr_reader :xid
18
+ attr_reader :lookup
19
+ attr_reader :authentication
15
20
 
16
21
  alias_method :liability_shifted?, :liability_shifted
17
22
  alias_method :liability_shift_possible?, :liability_shift_possible
@@ -22,16 +27,21 @@ module Braintree
22
27
 
23
28
  def inspect
24
29
  attr_order = [
30
+ :acs_transaction_id,
31
+ :authentication,
32
+ :cavv,
33
+ :ds_transaction_id,
34
+ :eci_flag,
25
35
  :enrolled,
26
- :liability_shifted,
27
36
  :liability_shift_possible,
37
+ :liability_shifted,
38
+ :lookup,
39
+ :pares_status,
28
40
  :status,
29
- :cavv,
30
- :xid,
31
- :eci_flag,
32
- :three_d_secure_version,
33
- :ds_transaction_id,
34
41
  :three_d_secure_authentication_id,
42
+ :three_d_secure_transaction_id,
43
+ :three_d_secure_version,
44
+ :xid
35
45
  ]
36
46
 
37
47
  formatted_attrs = attr_order.map do |attr|
@@ -4,18 +4,18 @@ module Braintree
4
4
  include Braintree::Util::IdEquality
5
5
 
6
6
  module CreatedUsing
7
- FullInformation = 'full_information'
8
- Token = 'token'
9
- Unrecognized = 'unrecognized'
7
+ FullInformation = "full_information"
8
+ Token = "token"
9
+ Unrecognized = "unrecognized"
10
10
  end
11
11
 
12
12
  module EscrowStatus
13
- HoldPending = 'hold_pending'
14
- Held = 'held'
15
- ReleasePending = 'release_pending'
16
- Released = 'released'
17
- Refunded = 'refunded'
18
- Unrecognized = 'unrecognized'
13
+ HoldPending = "hold_pending"
14
+ Held = "held"
15
+ ReleasePending = "release_pending"
16
+ Released = "released"
17
+ Refunded = "refunded"
18
+ Unrecognized = "unrecognized"
19
19
  end
20
20
 
21
21
  module GatewayRejectionReason
@@ -32,20 +32,20 @@ module Braintree
32
32
  end
33
33
 
34
34
  module Status
35
- AuthorizationExpired = 'authorization_expired'
36
- Authorizing = 'authorizing'
37
- Authorized = 'authorized'
38
- GatewayRejected = 'gateway_rejected'
39
- Failed = 'failed'
40
- ProcessorDeclined = 'processor_declined'
41
- Settled = 'settled'
42
- SettlementConfirmed = 'settlement_confirmed'
43
- SettlementDeclined = 'settlement_declined'
44
- SettlementPending = 'settlement_pending'
45
- Settling = 'settling'
46
- SubmittedForSettlement = 'submitted_for_settlement'
47
- Voided = 'voided'
48
- Unrecognized = 'unrecognized'
35
+ AuthorizationExpired = "authorization_expired"
36
+ Authorizing = "authorizing"
37
+ Authorized = "authorized"
38
+ GatewayRejected = "gateway_rejected"
39
+ Failed = "failed"
40
+ ProcessorDeclined = "processor_declined"
41
+ Settled = "settled"
42
+ SettlementConfirmed = "settlement_confirmed"
43
+ SettlementDeclined = "settlement_declined"
44
+ SettlementPending = "settlement_pending"
45
+ Settling = "settling"
46
+ SubmittedForSettlement = "submitted_for_settlement"
47
+ Voided = "voided"
48
+ Unrecognized = "unrecognized"
49
49
 
50
50
  All = constants.map { |c| const_get(c) }
51
51
  end
@@ -121,6 +121,8 @@ module Braintree
121
121
  attr_reader :google_pay_details
122
122
  attr_reader :graphql_id
123
123
  attr_reader :id
124
+ attr_reader :installment_count
125
+ attr_reader :installments
124
126
  attr_reader :local_payment_details
125
127
  attr_reader :merchant_account_id
126
128
  attr_reader :network_response_code # Response code from the card network
@@ -143,9 +145,11 @@ module Braintree
143
145
  attr_reader :recurring
144
146
  attr_reader :refund_ids
145
147
  attr_reader :refunded_transaction_id
148
+ attr_reader :refunded_installments
146
149
  attr_reader :retrieval_reference_number
147
150
  attr_reader :risk_data
148
151
  attr_reader :samsung_pay_card_details
152
+ attr_reader :sca_exemption_requested
149
153
  attr_reader :service_fee_amount
150
154
  attr_reader :settlement_batch_id
151
155
  attr_reader :shipping_amount
@@ -165,6 +169,14 @@ module Braintree
165
169
  attr_reader :visa_checkout_card_details
166
170
  attr_reader :voice_referral_number
167
171
 
172
+ def self.adjust_authorization(*args)
173
+ Configuration.gateway.transaction.adjust_authorization(*args)
174
+ end
175
+
176
+ def self.adjust_authorization!(*args)
177
+ Configuration.gateway.transaction.adjust_authorization!(*args)
178
+ end
179
+
168
180
  def self.create(*args)
169
181
  Configuration.gateway.transaction.create(*args)
170
182
  end
@@ -305,7 +317,11 @@ module Braintree
305
317
  @us_bank_account_details = UsBankAccountDetails.new(attributes[:us_bank_account]) if attributes[:us_bank_account]
306
318
  @visa_checkout_card_details = VisaCheckoutCardDetails.new(attributes[:visa_checkout_card])
307
319
  @samsung_pay_card_details = SamsungPayCardDetails.new(attributes[:samsung_pay_card])
320
+ @sca_exemption_requested = attributes[:sca_exemption_requested]
308
321
  authorization_adjustments.map! { |attrs| AuthorizationAdjustment._new(attrs) } if authorization_adjustments
322
+
323
+ installments.map! { |attrs| Installment.new(attrs) } if installments
324
+ refunded_installments.map! { |attrs| Installment.new(attrs) } if refunded_installments
309
325
  end
310
326
 
311
327
  def inspect # :nodoc:
@@ -378,7 +394,7 @@ module Braintree
378
394
  class << self
379
395
  protected :new
380
396
  def _new(*args) # :nodoc:
381
- self.new *args
397
+ self.new(*args)
382
398
  end
383
399
  end
384
400
 
@@ -0,0 +1,28 @@
1
+ module Braintree
2
+ class Transaction
3
+ class Installment
4
+ include BaseModule
5
+
6
+ attr_reader :id
7
+ attr_reader :amount
8
+ attr_reader :projected_disbursement_date
9
+ attr_reader :actual_disbursement_date
10
+ attr_reader :adjustments
11
+
12
+ def initialize(attributes)
13
+ set_instance_variables_from_hash attributes unless attributes.nil?
14
+ @amount = Util.to_big_decimal(amount)
15
+ adjustments.map! { |attrs| Adjustment.new(attrs) } if adjustments
16
+ end
17
+
18
+ def inspect
19
+ attrs = [:id, :amount, :projected_disbursement_date, :actual_disbursement_date, :adjustments]
20
+ formatted_attrs = attrs.map do |attr|
21
+ "#{attr}: #{send(attr).inspect}"
22
+ end
23
+
24
+ "#<#{formatted_attrs.join(", ")}>"
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,33 @@
1
+ module Braintree
2
+ class Transaction
3
+ class Installment
4
+ class Adjustment
5
+ include BaseModule
6
+
7
+ module Kind
8
+ Refund = "REFUND"
9
+ Dispute = "DISPUTE"
10
+ end
11
+
12
+ attr_reader :amount
13
+ attr_reader :kind
14
+ attr_reader :projected_disbursement_date
15
+ attr_reader :actual_disbursement_date
16
+
17
+ def initialize(attributes)
18
+ set_instance_variables_from_hash attributes unless attributes.nil?
19
+ @amount = Util.to_big_decimal(amount)
20
+ end
21
+
22
+ def inspect
23
+ attrs = [:amount, :kind, :projected_disbursement_date, :actual_disbursement_date]
24
+ formatted_attrs = attrs.map do |attr|
25
+ "#{attr}: #{send(attr).inspect}"
26
+ end
27
+
28
+ "#<#{formatted_attrs.join(", ")}>"
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end