braintree 2.74.0 → 4.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (286) hide show
  1. checksums.yaml +5 -5
  2. data/LICENSE +1 -1
  3. data/braintree.gemspec +13 -7
  4. data/lib/braintree/account_updater_daily_report.rb +2 -2
  5. data/lib/braintree/ach_mandate.rb +2 -1
  6. data/lib/braintree/address/country_names.rb +4 -1
  7. data/lib/braintree/address.rb +30 -38
  8. data/lib/braintree/address_gateway.rb +12 -2
  9. data/lib/braintree/advanced_search.rb +8 -0
  10. data/lib/braintree/apple_pay.rb +29 -0
  11. data/lib/braintree/apple_pay_card.rb +28 -4
  12. data/lib/braintree/apple_pay_gateway.rb +37 -0
  13. data/lib/braintree/apple_pay_options.rb +19 -0
  14. data/lib/braintree/authorization_adjustment.rb +23 -0
  15. data/lib/braintree/base_module.rb +10 -0
  16. data/lib/braintree/bin_data.rb +33 -0
  17. data/lib/braintree/client_token.rb +3 -3
  18. data/lib/braintree/client_token_gateway.rb +3 -1
  19. data/lib/braintree/configuration.rb +57 -10
  20. data/lib/braintree/connected_merchant_paypal_status_changed.rb +6 -2
  21. data/lib/braintree/connected_merchant_status_transitioned.rb +6 -2
  22. data/lib/braintree/credentials_parser.rb +5 -1
  23. data/lib/braintree/credit_card.rb +53 -107
  24. data/lib/braintree/credit_card_gateway.rb +43 -30
  25. data/lib/braintree/credit_card_verification.rb +61 -21
  26. data/lib/braintree/credit_card_verification_gateway.rb +19 -6
  27. data/lib/braintree/credit_card_verification_search.rb +1 -1
  28. data/lib/braintree/customer.rb +51 -98
  29. data/lib/braintree/customer_gateway.rb +30 -23
  30. data/lib/braintree/customer_search.rb +1 -1
  31. data/lib/braintree/descriptor.rb +3 -1
  32. data/lib/braintree/disbursement.rb +24 -2
  33. data/lib/braintree/dispute/evidence.rb +24 -0
  34. data/lib/braintree/{transaction/coinbase_details.rb → dispute/paypal_message.rb} +5 -3
  35. data/lib/braintree/dispute/status_history.rb +18 -0
  36. data/lib/braintree/dispute/transaction.rb +20 -0
  37. data/lib/braintree/dispute/transaction_details.rb +2 -1
  38. data/lib/braintree/dispute.rb +114 -10
  39. data/lib/braintree/dispute_gateway.rb +142 -0
  40. data/lib/braintree/dispute_search.rb +31 -0
  41. data/lib/braintree/document_upload.rb +37 -0
  42. data/lib/braintree/document_upload_gateway.rb +38 -0
  43. data/lib/braintree/enriched_customer_data.rb +21 -0
  44. data/lib/braintree/error_codes.rb +328 -109
  45. data/lib/braintree/error_result.rb +8 -1
  46. data/lib/braintree/exceptions.rb +5 -3
  47. data/lib/braintree/exchange_rate.rb +13 -0
  48. data/lib/braintree/exchange_rate_quote.rb +24 -0
  49. data/lib/braintree/exchange_rate_quote_gateway.rb +35 -0
  50. data/lib/braintree/exchange_rate_quote_input.rb +21 -0
  51. data/lib/braintree/exchange_rate_quote_request.rb +18 -0
  52. data/lib/braintree/exchange_rate_quote_response.rb +18 -0
  53. data/lib/braintree/facilitated_details.rb +21 -0
  54. data/lib/braintree/facilitator_details.rb +2 -1
  55. data/lib/braintree/gateway.rb +29 -11
  56. data/lib/braintree/google_pay_card.rb +61 -0
  57. data/lib/braintree/granted_payment_instrument_update.rb +23 -0
  58. data/lib/braintree/graphql_client.rb +34 -0
  59. data/lib/braintree/http.rb +81 -20
  60. data/lib/braintree/local_payment_completed.rb +23 -0
  61. data/lib/braintree/local_payment_expired.rb +21 -0
  62. data/lib/braintree/local_payment_funded.rb +22 -0
  63. data/lib/braintree/local_payment_reversed.rb +19 -0
  64. data/lib/braintree/merchant.rb +11 -4
  65. data/lib/braintree/merchant_account/address_details.rb +4 -1
  66. data/lib/braintree/merchant_account/business_details.rb +4 -1
  67. data/lib/braintree/merchant_account/funding_details.rb +6 -1
  68. data/lib/braintree/merchant_account/individual_details.rb +7 -2
  69. data/lib/braintree/merchant_account.rb +23 -10
  70. data/lib/braintree/merchant_account_gateway.rb +13 -1
  71. data/lib/braintree/merchant_gateway.rb +2 -2
  72. data/lib/braintree/modification.rb +1 -1
  73. data/lib/braintree/oauth_credentials.rb +5 -2
  74. data/lib/braintree/oauth_gateway.rb +8 -14
  75. data/lib/braintree/paginated_result.rb +3 -1
  76. data/lib/braintree/payment_instrument_type.rb +11 -11
  77. data/lib/braintree/payment_method.rb +20 -12
  78. data/lib/braintree/payment_method_customer_data_updated_metadata.rb +24 -0
  79. data/lib/braintree/payment_method_gateway.rb +82 -54
  80. data/lib/braintree/payment_method_nonce.rb +22 -8
  81. data/lib/braintree/payment_method_nonce_details.rb +40 -0
  82. data/lib/braintree/payment_method_nonce_details_payer_info.rb +32 -0
  83. data/lib/braintree/payment_method_nonce_gateway.rb +19 -2
  84. data/lib/braintree/payment_method_parser.rb +28 -0
  85. data/lib/braintree/paypal_account.rb +10 -1
  86. data/lib/braintree/plan.rb +25 -5
  87. data/lib/braintree/plan_gateway.rb +100 -0
  88. data/lib/braintree/processor_response_types.rb +7 -0
  89. data/lib/braintree/resource_collection.rb +8 -3
  90. data/lib/braintree/revoked_payment_method_metadata.rb +22 -0
  91. data/lib/braintree/risk_data/liability_shift.rb +22 -0
  92. data/lib/braintree/risk_data.rb +12 -2
  93. data/lib/braintree/samsung_pay_card.rb +83 -0
  94. data/lib/braintree/sepa_direct_debit_account.rb +60 -0
  95. data/lib/braintree/sepa_direct_debit_account_gateway.rb +25 -0
  96. data/lib/braintree/sepa_direct_debit_account_nonce_details.rb +28 -0
  97. data/lib/braintree/settlement_batch_summary.rb +2 -1
  98. data/lib/braintree/settlement_batch_summary_gateway.rb +2 -0
  99. data/lib/braintree/subscription/status_details.rb +8 -1
  100. data/lib/braintree/subscription.rb +56 -41
  101. data/lib/braintree/subscription_gateway.rb +25 -2
  102. data/lib/braintree/successful_result.rb +23 -1
  103. data/lib/braintree/test/authentication_id.rb +21 -0
  104. data/lib/braintree/test/credit_card.rb +13 -0
  105. data/lib/braintree/test/nonce.rb +28 -20
  106. data/lib/braintree/test/transaction_amounts.rb +1 -0
  107. data/lib/braintree/three_d_secure_info.rb +34 -2
  108. data/lib/braintree/transaction/address_details.rb +24 -4
  109. data/lib/braintree/transaction/apple_pay_details.rb +20 -2
  110. data/lib/braintree/transaction/credit_card_details.rb +45 -6
  111. data/lib/braintree/transaction/customer_details.rb +8 -1
  112. data/lib/braintree/transaction/disbursement_details.rb +6 -1
  113. data/lib/braintree/transaction/google_pay_details.rb +41 -0
  114. data/lib/braintree/transaction/installment/adjustment.rb +33 -0
  115. data/lib/braintree/transaction/installment.rb +28 -0
  116. data/lib/braintree/transaction/local_payment_details.rb +24 -0
  117. data/lib/braintree/transaction/paypal_details.rb +26 -4
  118. data/lib/braintree/transaction/paypal_here_details.rb +23 -0
  119. data/lib/braintree/transaction/{masterpass_card_details.rb → samsung_pay_card_details.rb} +21 -6
  120. data/lib/braintree/transaction/sepa_direct_debit_account_details.rb +27 -0
  121. data/lib/braintree/transaction/status_details.rb +5 -1
  122. data/lib/braintree/transaction/subscription_details.rb +4 -1
  123. data/lib/braintree/transaction/us_bank_account_details.rb +8 -1
  124. data/lib/braintree/transaction/venmo_account_details.rb +5 -1
  125. data/lib/braintree/transaction/visa_checkout_card_details.rb +19 -4
  126. data/lib/braintree/transaction.rb +201 -188
  127. data/lib/braintree/transaction_gateway.rb +124 -30
  128. data/lib/braintree/transaction_line_item.rb +40 -0
  129. data/lib/braintree/transaction_line_item_gateway.rb +19 -0
  130. data/lib/braintree/transaction_review.rb +18 -0
  131. data/lib/braintree/transaction_search.rb +6 -3
  132. data/lib/braintree/unknown_payment_method.rb +3 -2
  133. data/lib/braintree/us_bank_account.rb +24 -8
  134. data/lib/braintree/us_bank_account_gateway.rb +0 -1
  135. data/lib/braintree/us_bank_account_verification.rb +81 -0
  136. data/lib/braintree/us_bank_account_verification_gateway.rb +51 -0
  137. data/lib/braintree/us_bank_account_verification_search.rb +19 -0
  138. data/lib/braintree/util.rb +79 -9
  139. data/lib/braintree/validation_error.rb +13 -3
  140. data/lib/braintree/validation_error_collection.rb +2 -1
  141. data/lib/braintree/venmo_account.rb +11 -4
  142. data/lib/braintree/venmo_profile_data.rb +23 -0
  143. data/lib/braintree/version.rb +2 -2
  144. data/lib/braintree/visa_checkout_card.rb +29 -13
  145. data/lib/braintree/webhook_notification.rb +66 -26
  146. data/lib/braintree/webhook_notification_gateway.rb +5 -3
  147. data/lib/braintree/webhook_testing.rb +2 -2
  148. data/lib/braintree/webhook_testing_gateway.rb +721 -55
  149. data/lib/braintree/xml/generator.rb +6 -4
  150. data/lib/braintree/xml/parser.rb +22 -35
  151. data/lib/braintree/xml/rexml.rb +4 -5
  152. data/lib/braintree.rb +60 -22
  153. data/lib/ssl/api_braintreegateway_com.ca.crt +50 -0
  154. data/spec/fixtures/files/bt_logo.png +0 -0
  155. data/spec/fixtures/files/gif_extension_bt_logo.gif +0 -0
  156. data/spec/fixtures/files/malformed_pdf.pdf +1 -0
  157. data/spec/fixtures/files/too_long.pdf +0 -0
  158. data/spec/integration/braintree/add_on_spec.rb +3 -3
  159. data/spec/integration/braintree/address_spec.rb +30 -113
  160. data/spec/integration/braintree/advanced_search_spec.rb +45 -45
  161. data/spec/integration/braintree/apple_pay_spec.rb +63 -0
  162. data/spec/integration/braintree/braintree_gateway_spec.rb +72 -0
  163. data/spec/integration/braintree/client_api/client_token_spec.rb +14 -32
  164. data/spec/integration/braintree/client_api/spec_helper.rb +104 -65
  165. data/spec/integration/braintree/credit_card_spec.rb +460 -615
  166. data/spec/integration/braintree/credit_card_verification_search_spec.rb +2 -2
  167. data/spec/integration/braintree/credit_card_verification_spec.rb +222 -6
  168. data/spec/integration/braintree/customer_search_spec.rb +8 -8
  169. data/spec/integration/braintree/customer_spec.rb +810 -498
  170. data/spec/integration/braintree/discount_spec.rb +1 -1
  171. data/spec/integration/braintree/dispute_search_spec.rb +167 -0
  172. data/spec/integration/braintree/dispute_spec.rb +333 -0
  173. data/spec/integration/braintree/document_upload_spec.rb +87 -0
  174. data/spec/integration/braintree/error_codes_spec.rb +1 -1
  175. data/spec/integration/braintree/exchange_rate_quote_spec.rb +97 -0
  176. data/spec/integration/braintree/graphql_client_spec.rb +72 -0
  177. data/spec/integration/braintree/http_spec.rb +12 -4
  178. data/spec/integration/braintree/merchant_account_spec.rb +74 -26
  179. data/spec/integration/braintree/merchant_spec.rb +39 -13
  180. data/spec/integration/braintree/oauth_spec.rb +18 -25
  181. data/spec/integration/braintree/payment_method_nonce_spec.rb +239 -5
  182. data/spec/integration/braintree/payment_method_spec.rb +882 -300
  183. data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +416 -0
  184. data/spec/integration/braintree/paypal_account_spec.rb +32 -31
  185. data/spec/integration/braintree/plan_spec.rb +82 -0
  186. data/spec/integration/braintree/samsung_pay_card_spec.rb +144 -0
  187. data/spec/integration/braintree/sepa_direct_debit_account_spec.rb +196 -0
  188. data/spec/integration/braintree/settlement_batch_summary_spec.rb +8 -8
  189. data/spec/integration/braintree/subscription_spec.rb +274 -180
  190. data/spec/integration/braintree/test/transaction_amounts_spec.rb +2 -2
  191. data/spec/integration/braintree/test_transaction_spec.rb +18 -18
  192. data/spec/integration/braintree/transaction_line_item_spec.rb +38 -0
  193. data/spec/integration/braintree/transaction_search_spec.rb +280 -152
  194. data/spec/integration/braintree/transaction_spec.rb +3709 -1175
  195. data/spec/integration/braintree/transaction_us_bank_account_spec.rb +438 -0
  196. data/spec/integration/braintree/us_bank_account_spec.rb +38 -17
  197. data/spec/integration/braintree/us_bank_account_verification_search_spec.rb +178 -0
  198. data/spec/integration/braintree/us_bank_account_verification_spec.rb +240 -0
  199. data/spec/integration/braintree/visa_checkout_card_spec.rb +5 -5
  200. data/spec/integration/spec_helper.rb +27 -6
  201. data/spec/oauth_test_helper.rb +1 -1
  202. data/spec/script/httpsd.rb +6 -6
  203. data/spec/spec_helper.rb +26 -23
  204. data/spec/unit/braintree/address_spec.rb +1 -9
  205. data/spec/unit/braintree/apple_pay_card_spec.rb +104 -4
  206. data/spec/unit/braintree/client_token_spec.rb +2 -2
  207. data/spec/unit/braintree/configuration_spec.rb +108 -33
  208. data/spec/unit/braintree/credit_card_spec.rb +62 -33
  209. data/spec/unit/braintree/credit_card_verification_gateway_spec.rb +51 -0
  210. data/spec/unit/braintree/credit_card_verification_search_spec.rb +1 -1
  211. data/spec/unit/braintree/credit_card_verification_spec.rb +39 -6
  212. data/spec/unit/braintree/customer_spec.rb +107 -27
  213. data/spec/unit/braintree/disbursement_spec.rb +59 -7
  214. data/spec/unit/braintree/dispute_search_spec.rb +66 -0
  215. data/spec/unit/braintree/dispute_spec.rb +472 -8
  216. data/spec/unit/braintree/document_upload_spec.rb +35 -0
  217. data/spec/unit/braintree/enriched_customer_data_spec.rb +32 -0
  218. data/spec/unit/braintree/error_result_spec.rb +5 -5
  219. data/spec/unit/braintree/errors_spec.rb +8 -8
  220. data/spec/unit/braintree/exchange_rate_quote_input_spec.rb +42 -0
  221. data/spec/unit/braintree/exchange_rate_quote_request_spec.rb +82 -0
  222. data/spec/unit/braintree/exchange_rate_quote_response_spec.rb +52 -0
  223. data/spec/unit/braintree/exchange_rate_quote_spec.rb +42 -0
  224. data/spec/unit/braintree/exchange_rate_spec.rb +23 -0
  225. data/spec/unit/braintree/http_spec.rb +93 -5
  226. data/spec/unit/braintree/local_payment_completed_spec.rb +50 -0
  227. data/spec/unit/braintree/local_payment_expired_spec.rb +24 -0
  228. data/spec/unit/braintree/local_payment_funded_spec.rb +34 -0
  229. data/spec/unit/braintree/merchant_account_spec.rb +1 -1
  230. data/spec/unit/braintree/modification_spec.rb +1 -1
  231. data/spec/unit/braintree/payment_method_customer_data_updated_metadata_spec.rb +45 -0
  232. data/spec/unit/braintree/payment_method_nonce_details_payer_info_spec.rb +31 -0
  233. data/spec/unit/braintree/payment_method_nonce_details_spec.rb +51 -0
  234. data/spec/unit/braintree/payment_method_nonce_spec.rb +40 -0
  235. data/spec/unit/braintree/payment_method_spec.rb +1 -1
  236. data/spec/unit/braintree/paypal_account_spec.rb +2 -2
  237. data/spec/unit/braintree/resource_collection_spec.rb +30 -1
  238. data/spec/unit/braintree/risk_data/liability_shift.rb +26 -0
  239. data/spec/unit/braintree/risk_data_spec.rb +40 -6
  240. data/spec/unit/braintree/sepa_debit_account_nonce_details_spec.rb +29 -0
  241. data/spec/unit/braintree/sepa_debit_account_spec.rb +86 -0
  242. data/spec/unit/braintree/subscription_search_spec.rb +1 -1
  243. data/spec/unit/braintree/subscription_spec.rb +2 -2
  244. data/spec/unit/braintree/successful_result_spec.rb +1 -1
  245. data/spec/unit/braintree/three_d_secure_info_spec.rb +34 -6
  246. data/spec/unit/braintree/transaction/credit_card_details_spec.rb +19 -3
  247. data/spec/unit/braintree/transaction/customer_details_spec.rb +1 -1
  248. data/spec/unit/braintree/transaction/deposit_details_spec.rb +2 -2
  249. data/spec/unit/braintree/transaction/installment_spec.rb +25 -0
  250. data/spec/unit/braintree/transaction/paypal_details_spec.rb +63 -0
  251. data/spec/unit/braintree/transaction/sepa_direct_debit_account_details_spec.rb +33 -0
  252. data/spec/unit/braintree/transaction_gateway_spec.rb +111 -0
  253. data/spec/unit/braintree/transaction_search_spec.rb +12 -12
  254. data/spec/unit/braintree/transaction_spec.rb +171 -55
  255. data/spec/unit/braintree/us_bank_account_verification_search_spec.rb +60 -0
  256. data/spec/unit/braintree/us_bank_account_verification_spec.rb +93 -0
  257. data/spec/unit/braintree/util_spec.rb +162 -19
  258. data/spec/unit/braintree/validation_error_collection_spec.rb +336 -133
  259. data/spec/unit/braintree/venmo_profile_data_spec.rb +32 -0
  260. data/spec/unit/braintree/webhook_notification_spec.rb +546 -114
  261. data/spec/unit/braintree/xml/parser_spec.rb +21 -16
  262. data/spec/unit/braintree/xml_spec.rb +31 -24
  263. data/spec/unit/braintree_spec.rb +1 -0
  264. metadata +290 -198
  265. data/README.rdoc +0 -93
  266. data/lib/braintree/amex_express_checkout_card.rb +0 -26
  267. data/lib/braintree/android_pay_card.rb +0 -35
  268. data/lib/braintree/coinbase_account.rb +0 -25
  269. data/lib/braintree/europe_bank_account.rb +0 -34
  270. data/lib/braintree/europe_bank_account_gateway.rb +0 -17
  271. data/lib/braintree/ideal_payment.rb +0 -46
  272. data/lib/braintree/ideal_payment_gateway.rb +0 -18
  273. data/lib/braintree/masterpass_card.rb +0 -66
  274. data/lib/braintree/settlement_batch.rb +0 -0
  275. data/lib/braintree/transaction/amex_express_checkout_details.rb +0 -14
  276. data/lib/braintree/transaction/android_pay_details.rb +0 -17
  277. data/lib/braintree/transaction/ideal_payment_details.rb +0 -13
  278. data/lib/braintree/transparent_redirect.rb +0 -40
  279. data/lib/braintree/transparent_redirect_gateway.rb +0 -105
  280. data/spec/hacks/tcp_socket.rb +0 -18
  281. data/spec/httpsd.pid +0 -1
  282. data/spec/integration/braintree/coinbase_spec.rb +0 -31
  283. data/spec/integration/braintree/ideal_payment_spec.rb +0 -87
  284. data/spec/integration/braintree/masterpass_card_spec.rb +0 -97
  285. data/spec/integration/braintree/transparent_redirect_spec.rb +0 -268
  286. data/spec/unit/braintree/transparent_redirect_spec.rb +0 -223
@@ -1,20 +1,21 @@
1
1
  module Braintree
2
2
  class Transaction
3
3
  include BaseModule
4
+ include Braintree::Util::IdEquality
4
5
 
5
6
  module CreatedUsing
6
- FullInformation = 'full_information'
7
- Token = 'token'
8
- Unrecognized = 'unrecognized'
7
+ FullInformation = "full_information"
8
+ Token = "token"
9
+ Unrecognized = "unrecognized"
9
10
  end
10
11
 
11
12
  module EscrowStatus
12
- HoldPending = 'hold_pending'
13
- Held = 'held'
14
- ReleasePending = 'release_pending'
15
- Released = 'released'
16
- Refunded = 'refunded'
17
- Unrecognized = 'unrecognized'
13
+ HoldPending = "hold_pending"
14
+ Held = "held"
15
+ ReleasePending = "release_pending"
16
+ Released = "released"
17
+ Refunded = "refunded"
18
+ Unrecognized = "unrecognized"
18
19
  end
19
20
 
20
21
  module GatewayRejectionReason
@@ -23,26 +24,29 @@ module Braintree
23
24
  AVSAndCVV = "avs_and_cvv"
24
25
  CVV = "cvv"
25
26
  Duplicate = "duplicate"
27
+ ExcessiveRetry = "excessive_retry"
26
28
  Fraud = "fraud"
29
+ RiskThreshold = "risk_threshold"
27
30
  ThreeDSecure = "three_d_secure"
31
+ TokenIssuance = "token_issuance"
28
32
  Unrecognized = "unrecognized"
29
33
  end
30
34
 
31
35
  module Status
32
- AuthorizationExpired = 'authorization_expired'
33
- Authorizing = 'authorizing'
34
- Authorized = 'authorized'
35
- GatewayRejected = 'gateway_rejected'
36
- Failed = 'failed'
37
- ProcessorDeclined = 'processor_declined'
38
- Settled = 'settled'
39
- SettlementConfirmed = 'settlement_confirmed'
40
- SettlementDeclined = 'settlement_declined'
41
- SettlementPending = 'settlement_pending'
42
- Settling = 'settling'
43
- SubmittedForSettlement = 'submitted_for_settlement'
44
- Voided = 'voided'
45
- Unrecognized = 'unrecognized'
36
+ AuthorizationExpired = "authorization_expired"
37
+ Authorizing = "authorizing"
38
+ Authorized = "authorized"
39
+ GatewayRejected = "gateway_rejected"
40
+ Failed = "failed"
41
+ ProcessorDeclined = "processor_declined"
42
+ Settled = "settled"
43
+ SettlementConfirmed = "settlement_confirmed"
44
+ SettlementDeclined = "settlement_declined"
45
+ SettlementPending = "settlement_pending"
46
+ Settling = "settling"
47
+ SubmittedForSettlement = "submitted_for_settlement"
48
+ Voided = "voided"
49
+ Unrecognized = "unrecognized"
46
50
 
47
51
  All = constants.map { |c| const_get(c) }
48
52
  end
@@ -57,6 +61,18 @@ module Braintree
57
61
  module IndustryType
58
62
  Lodging = "lodging"
59
63
  TravelAndCruise = "travel_cruise"
64
+ TravelAndFlight = "travel_flight"
65
+
66
+ All = constants.map { |c| const_get(c) }
67
+ end
68
+
69
+ module AdditionalCharge
70
+ Restaurant = "restaurant"
71
+ GiftShop = "gift_shop"
72
+ MiniBar = "mini_bar"
73
+ Telephone = "telephone"
74
+ Laundry = "laundry"
75
+ Other = "other"
60
76
 
61
77
  All = constants.map { |c| const_get(c) }
62
78
  end
@@ -68,219 +84,257 @@ module Braintree
68
84
  All = constants.map { |c| const_get(c) }
69
85
  end
70
86
 
71
- attr_reader :avs_error_response_code, :avs_postal_code_response_code, :avs_street_address_response_code
72
- attr_reader :amount, :created_at, :credit_card_details, :customer_details, :subscription_details, :service_fee_amount, :id
87
+ module ExternalVault
88
+ module Status
89
+ WillVault = "will_vault"
90
+ Vaulted = "vaulted"
91
+ end
92
+ end
93
+
94
+ attr_reader :acquirer_reference_number
95
+ attr_reader :ach_return_code
96
+ attr_reader :add_ons
97
+ attr_reader :additional_processor_response # The raw response from the processor.
98
+ attr_reader :amount
99
+ attr_reader :apple_pay_details
100
+ attr_reader :authorization_adjustments
101
+ attr_reader :authorization_expires_at
102
+ attr_reader :authorized_transaction_id
103
+ attr_reader :avs_error_response_code
104
+ attr_reader :avs_postal_code_response_code
105
+ attr_reader :avs_street_address_response_code
106
+ attr_reader :billing_details
107
+ attr_reader :channel
108
+ attr_reader :created_at
109
+ attr_reader :credit_card_details
73
110
  attr_reader :currency_iso_code
74
111
  attr_reader :custom_fields
112
+ attr_reader :customer_details
75
113
  attr_reader :cvv_response_code
114
+ attr_reader :descriptor
76
115
  attr_reader :disbursement_details
116
+ attr_reader :discount_amount
117
+ attr_reader :discounts
77
118
  attr_reader :disputes
78
- attr_reader :descriptor
79
119
  attr_reader :escrow_status
120
+ attr_reader :facilitated_details
121
+ attr_reader :facilitator_details
80
122
  attr_reader :gateway_rejection_reason
123
+ attr_reader :google_pay_details
124
+ attr_reader :graphql_id
125
+ attr_reader :id
126
+ attr_reader :installment_count
127
+ attr_reader :installments
128
+ attr_reader :local_payment_details
81
129
  attr_reader :merchant_account_id
130
+ attr_reader :merchant_advice_code
131
+ attr_reader :merchant_advice_code_text
132
+ attr_reader :network_response_code # Response code from the card network
133
+ attr_reader :network_response_text # Response text from the card network
134
+ attr_reader :network_token_details
135
+ attr_reader :network_transaction_id
82
136
  attr_reader :order_id
83
- attr_reader :channel
84
- attr_reader :billing_details, :shipping_details
137
+ attr_reader :partial_settlement_transaction_ids
138
+ attr_reader :payment_instrument_type
85
139
  attr_reader :paypal_details
86
- attr_reader :apple_pay_details
87
- attr_reader :android_pay_details
88
- attr_reader :amex_express_checkout_details
89
- attr_reader :venmo_account_details
90
- attr_reader :coinbase_details
140
+ attr_reader :paypal_here_details
91
141
  attr_reader :plan_id
92
- # The authorization code from the processor.
93
- attr_reader :processor_authorization_code
94
- # The response code from the processor.
95
- attr_reader :processor_response_code
96
- # The response text from the processor.
97
- attr_reader :processor_response_text
98
- # The raw response from the processor.
99
- attr_reader :additional_processor_response
100
- # The settlement response code from the processor.
101
- attr_reader :processor_settlement_response_code
102
- # The settlement response text from the processor.
103
- attr_reader :processor_settlement_response_text
104
- attr_reader :voice_referral_number
142
+ attr_reader :processor_authorization_code # Authorization code from the processor.
143
+ attr_reader :processor_response_code # Response code from the processor.
144
+ attr_reader :processor_response_text # Response text from the processor.
145
+ attr_reader :processor_response_type # Response type from the processor.
146
+ attr_reader :processor_settlement_response_code # Settlement response code from the processor.
147
+ attr_reader :processor_settlement_response_text # Settlement response text from the processor.
148
+ attr_reader :product_sku
105
149
  attr_reader :purchase_order_number
106
150
  attr_reader :recurring
107
- attr_reader :refund_ids, :refunded_transaction_id
151
+ attr_reader :refund_ids
152
+ attr_reader :refunded_transaction_id
153
+ attr_reader :refunded_installments
154
+ attr_reader :retried
155
+ attr_reader :retrieval_reference_number
156
+ attr_reader :risk_data
157
+ attr_reader :samsung_pay_card_details
158
+ attr_reader :sca_exemption_requested
159
+ attr_reader :service_fee_amount
160
+ attr_reader :sepa_direct_debit_account_details
161
+ attr_reader :sepa_direct_debit_return_code
108
162
  attr_reader :settlement_batch_id
109
- attr_reader :authorized_transaction_id
110
- attr_reader :partial_settlement_transaction_ids
111
- # See Transaction::Status
112
- attr_reader :status
163
+ attr_reader :shipping_amount
164
+ attr_reader :shipping_details
165
+ attr_reader :ships_from_postal_code
166
+ attr_reader :status # See Transaction::Status
113
167
  attr_reader :status_history
168
+ attr_reader :subscription_details
114
169
  attr_reader :subscription_id
115
170
  attr_reader :tax_amount
116
171
  attr_reader :tax_exempt
117
- # Will either be "sale" or "credit"
118
- attr_reader :type
119
- attr_reader :updated_at
120
- attr_reader :add_ons, :discounts
121
- attr_reader :payment_instrument_type
122
- attr_reader :risk_data
123
- attr_reader :facilitator_details
124
172
  attr_reader :three_d_secure_info
173
+ attr_reader :type # Will either be "sale" or "credit"
174
+ attr_reader :updated_at
125
175
  attr_reader :us_bank_account_details
126
- attr_reader :ideal_payment_details
176
+ attr_reader :venmo_account_details
127
177
  attr_reader :visa_checkout_card_details
128
- attr_reader :masterpass_card_details
178
+ attr_reader :voice_referral_number
179
+ attr_reader :ach_return_responses
129
180
 
130
- def self.create(attributes)
131
- Configuration.gateway.transaction.create(attributes)
181
+ def self.adjust_authorization(*args)
182
+ Configuration.gateway.transaction.adjust_authorization(*args)
132
183
  end
133
184
 
134
- def self.create!(attributes)
135
- return_object_or_raise(:transaction) { create(attributes) }
185
+ def self.adjust_authorization!(*args)
186
+ Configuration.gateway.transaction.adjust_authorization!(*args)
136
187
  end
137
188
 
138
- def self.cancel_release(transaction_id)
139
- Configuration.gateway.transaction.cancel_release(transaction_id)
189
+ def self.create(*args)
190
+ Configuration.gateway.transaction.create(*args)
140
191
  end
141
192
 
142
- def self.cancel_release!(transaction_id)
143
- return_object_or_raise(:transaction) { cancel_release(transaction_id) }
193
+ def self.create!(*args)
194
+ return_object_or_raise(:transaction) { create(*args) }
144
195
  end
145
196
 
146
- def self.clone_transaction(transaction_id, attributes)
147
- Configuration.gateway.transaction.clone_transaction(transaction_id, attributes)
197
+ def self.cancel_release(*args)
198
+ Configuration.gateway.transaction.cancel_release(*args)
148
199
  end
149
200
 
150
- def self.clone_transaction!(transaction_id, attributes)
151
- return_object_or_raise(:transaction) { clone_transaction(transaction_id, attributes) }
201
+ def self.cancel_release!(*args)
202
+ Configuration.gateway.transaction.cancel_release!(*args)
152
203
  end
153
204
 
154
- # Deprecated. Use Braintree::TransparentRedirect.confirm
155
- def self.create_from_transparent_redirect(query_string)
156
- warn "[DEPRECATED] Transaction.create_from_transparent_redirect is deprecated. Please use TransparentRedirect.confirm"
157
- Configuration.gateway.transaction.create_from_transparent_redirect(query_string)
205
+ def self.clone_transaction(*args)
206
+ Configuration.gateway.transaction.clone_transaction(*args)
158
207
  end
159
208
 
160
- # Deprecated. Use Braintree::TransparentRedirect.url
161
- def self.create_transaction_url
162
- warn "[DEPRECATED] Transaction.create_transaction_url is deprecated. Please use TransparentRedirect.url"
163
- Configuration.gateway.transaction.create_transaction_url
209
+ def self.clone_transaction!(*args)
210
+ Configuration.gateway.transaction.clone_transaction!(*args)
164
211
  end
165
212
 
166
- def self.credit(attributes)
167
- Configuration.gateway.transaction.credit(attributes)
213
+ def self.credit(*args)
214
+ Configuration.gateway.transaction.credit(*args)
168
215
  end
169
216
 
170
- def self.credit!(attributes)
171
- return_object_or_raise(:transaction) { credit(attributes) }
217
+ def self.credit!(*args)
218
+ Configuration.gateway.transaction.credit!(*args)
172
219
  end
173
220
 
174
- def self.find(id)
175
- Configuration.gateway.transaction.find(id)
221
+ def self.find(*args)
222
+ Configuration.gateway.transaction.find(*args)
176
223
  end
177
224
 
178
- def self.hold_in_escrow(id)
179
- Configuration.gateway.transaction.hold_in_escrow(id)
225
+ def self.line_items(*args)
226
+ Configuration.gateway.transaction_line_item.find_all(*args)
180
227
  end
181
228
 
182
- def self.hold_in_escrow!(id)
183
- return_object_or_raise(:transaction) { hold_in_escrow(id) }
229
+ def self.hold_in_escrow(*args)
230
+ Configuration.gateway.transaction.hold_in_escrow(*args)
184
231
  end
185
232
 
186
- def self.refund(id, amount_or_options = nil)
187
- Configuration.gateway.transaction.refund(id, amount_or_options)
233
+ def self.hold_in_escrow!(*args)
234
+ Configuration.gateway.transaction.hold_in_escrow!(*args)
188
235
  end
189
236
 
190
- def self.refund!(id, amount_or_options = nil)
191
- return_object_or_raise(:transaction) { refund(id, amount_or_options) }
237
+ def self.refund(*args)
238
+ Configuration.gateway.transaction.refund(*args)
192
239
  end
193
240
 
194
- def self.sale(attributes)
195
- Configuration.gateway.transaction.sale(attributes)
241
+ def self.refund!(*args)
242
+ Configuration.gateway.transaction.refund!(*args)
196
243
  end
197
244
 
198
- def self.sale!(attributes)
199
- return_object_or_raise(:transaction) { sale(attributes) }
245
+ def self.sale(*args)
246
+ Configuration.gateway.transaction.sale(*args)
247
+ end
248
+
249
+ def self.sale!(*args)
250
+ Configuration.gateway.transaction.sale!(*args)
200
251
  end
201
252
 
202
253
  def self.search(&block)
203
254
  Configuration.gateway.transaction.search(&block)
204
255
  end
205
256
 
206
- def self.release_from_escrow(transaction_id)
207
- Configuration.gateway.transaction.release_from_escrow(transaction_id)
257
+ def self.release_from_escrow(*args)
258
+ Configuration.gateway.transaction.release_from_escrow(*args)
208
259
  end
209
260
 
210
- def self.release_from_escrow!(transaction_id)
211
- return_object_or_raise(:transaction) { release_from_escrow(transaction_id) }
261
+ def self.release_from_escrow!(*args)
262
+ Configuration.gateway.transaction.release_from_escrow!(*args)
212
263
  end
213
264
 
214
- def self.submit_for_settlement(transaction_id, amount = nil, options = {})
215
- Configuration.gateway.transaction.submit_for_settlement(transaction_id, amount, options)
265
+ def self.submit_for_settlement(*args)
266
+ Configuration.gateway.transaction.submit_for_settlement(*args)
216
267
  end
217
268
 
218
- def self.submit_for_settlement!(transaction_id, amount = nil, options = {})
219
- return_object_or_raise(:transaction) { submit_for_settlement(transaction_id, amount, options) }
269
+ def self.submit_for_settlement!(*args)
270
+ Configuration.gateway.transaction.submit_for_settlement!(*args)
220
271
  end
221
272
 
222
- def self.update_details(transaction_id, options = {})
223
- Configuration.gateway.transaction.update_details(transaction_id, options)
273
+ def self.update_details(*args)
274
+ Configuration.gateway.transaction.update_details(*args)
224
275
  end
225
276
 
226
- def self.update_details!(transaction_id, options = {})
227
- return_object_or_raise(:transaction) { update_details(transaction_id, options) }
277
+ def self.update_details!(*args)
278
+ return_object_or_raise(:transaction) { update_details(*args) }
228
279
  end
229
280
 
230
- def self.submit_for_partial_settlement(authorized_transaction_id, amount = nil, options = {})
231
- Configuration.gateway.transaction.submit_for_partial_settlement(authorized_transaction_id, amount, options)
281
+ def self.submit_for_partial_settlement(*args)
282
+ Configuration.gateway.transaction.submit_for_partial_settlement(*args)
232
283
  end
233
284
 
234
- def self.submit_for_partial_settlement!(authorized_transaction_id, amount = nil, options = {})
235
- return_object_or_raise(:transaction) { submit_for_partial_settlement(authorized_transaction_id, amount, options) }
285
+ def self.submit_for_partial_settlement!(*args)
286
+ Configuration.gateway.transaction.submit_for_partial_settlement!(*args)
236
287
  end
237
288
 
238
- def self.void(transaction_id)
239
- Configuration.gateway.transaction.void(transaction_id)
289
+ def self.void(*args)
290
+ Configuration.gateway.transaction.void(*args)
240
291
  end
241
292
 
242
- def self.void!(transaction_id)
243
- return_object_or_raise(:transaction) { void(transaction_id) }
293
+ def self.void!(*args)
294
+ Configuration.gateway.transaction.void!(*args)
244
295
  end
245
296
 
246
297
  def initialize(gateway, attributes) # :nodoc:
247
298
  @gateway = gateway
248
299
  set_instance_variables_from_hash(attributes)
300
+
249
301
  @amount = Util.to_big_decimal(amount)
302
+ @apple_pay_details = ApplePayDetails.new(@apple_pay)
303
+ @billing_details = AddressDetails.new(@billing)
250
304
  @credit_card_details = CreditCardDetails.new(@credit_card)
251
- @service_fee_amount = Util.to_big_decimal(service_fee_amount)
252
- @subscription_details = SubscriptionDetails.new(@subscription)
305
+ @network_token_details = CreditCardDetails.new(@network_token)
306
+ @custom_fields = attributes[:custom_fields].is_a?(Hash) ? attributes[:custom_fields] : {}
253
307
  @customer_details = CustomerDetails.new(@customer)
254
- @billing_details = AddressDetails.new(@billing)
308
+ @descriptor = Descriptor.new(@descriptor)
255
309
  @disbursement_details = DisbursementDetails.new(@disbursement_details)
310
+ @google_pay_details = GooglePayDetails.new(@google_pay_card)
311
+ @local_payment_details = LocalPaymentDetails.new(@local_payment)
312
+ @payment_instrument_type = attributes[:payment_instrument_type]
313
+ @paypal_details = PayPalDetails.new(@paypal)
314
+ @paypal_here_details = PayPalHereDetails.new(@paypal_here)
315
+ @samsung_pay_card_details = SamsungPayCardDetails.new(attributes[:samsung_pay_card])
316
+ @sca_exemption_requested = attributes[:sca_exemption_requested]
317
+ @sepa_direct_debit_account_details = SepaDirectDebitAccountDetails.new(@sepa_debit_account_detail)
318
+ @service_fee_amount = Util.to_big_decimal(service_fee_amount)
256
319
  @shipping_details = AddressDetails.new(@shipping)
257
320
  @status_history = attributes[:status_history] ? attributes[:status_history].map { |s| StatusDetails.new(s) } : []
321
+ @subscription_details = SubscriptionDetails.new(@subscription)
258
322
  @tax_amount = Util.to_big_decimal(tax_amount)
259
- @descriptor = Descriptor.new(@descriptor)
260
- @paypal_details = PayPalDetails.new(@paypal)
261
- @apple_pay_details = ApplePayDetails.new(@apple_pay)
262
- @android_pay_details = AndroidPayDetails.new(@android_pay_card)
263
- @amex_express_checkout_details = AmexExpressCheckoutDetails.new(@amex_express_checkout_card)
264
323
  @venmo_account_details = VenmoAccountDetails.new(@venmo_account)
265
- @coinbase_details = CoinbaseDetails.new(@coinbase_account)
266
- disputes.map! { |attrs| Dispute._new(attrs) } if disputes
267
- @custom_fields = attributes[:custom_fields].is_a?(Hash) ? attributes[:custom_fields] : {}
268
- add_ons.map! { |attrs| AddOn._new(attrs) } if add_ons
269
- discounts.map! { |attrs| Discount._new(attrs) } if discounts
270
- @payment_instrument_type = attributes[:payment_instrument_type]
271
- @risk_data = RiskData.new(attributes[:risk_data]) if attributes[:risk_data]
324
+ @visa_checkout_card_details = VisaCheckoutCardDetails.new(attributes[:visa_checkout_card])
325
+
326
+ @facilitated_details = FacilitatedDetails.new(attributes[:facilitated_details]) if attributes[:facilitated_details]
272
327
  @facilitator_details = FacilitatorDetails.new(attributes[:facilitator_details]) if attributes[:facilitator_details]
328
+ @risk_data = RiskData.new(attributes[:risk_data]) if attributes[:risk_data]
273
329
  @three_d_secure_info = ThreeDSecureInfo.new(attributes[:three_d_secure_info]) if attributes[:three_d_secure_info]
274
330
  @us_bank_account_details = UsBankAccountDetails.new(attributes[:us_bank_account]) if attributes[:us_bank_account]
275
- @ideal_payment_details = IdealPaymentDetails.new(attributes[:ideal_payment]) if attributes[:ideal_payment]
276
- @visa_checkout_card_details = VisaCheckoutCardDetails.new(attributes[:visa_checkout_card])
277
- @masterpass_card_details = MasterpassCardDetails.new(attributes[:masterpass_card])
278
- end
279
331
 
280
- # True if <tt>other</tt> is a Braintree::Transaction with the same id.
281
- def ==(other)
282
- return false unless other.is_a?(Transaction)
283
- id == other.id
332
+ add_ons.map! { |attrs| AddOn._new(attrs) } if add_ons
333
+ authorization_adjustments.map! { |attrs| AuthorizationAdjustment._new(attrs) } if authorization_adjustments
334
+ discounts.map! { |attrs| Discount._new(attrs) } if discounts
335
+ disputes.map! { |attrs| Dispute._new(attrs) } if disputes
336
+ installments.map! { |attrs| Installment.new(attrs) } if installments
337
+ refunded_installments.map! { |attrs| Installment.new(attrs) } if refunded_installments
284
338
  end
285
339
 
286
340
  def inspect # :nodoc:
@@ -296,16 +350,8 @@ module Braintree
296
350
  "#<#{self.class} #{nice_attributes.join(', ')}>"
297
351
  end
298
352
 
299
- # Deprecated. Use Braintree::Transaction.refund
300
- def refund(amount = nil)
301
- warn "[DEPRECATED] refund as an instance method is deprecated. Please use Transaction.refund"
302
- result = @gateway.transaction.refund(id, amount)
303
-
304
- if result.success?
305
- SuccessfulResult.new(:new_transaction => result.transaction)
306
- else
307
- result
308
- end
353
+ def line_items
354
+ @gateway.transaction_line_item.find_all(id)
309
355
  end
310
356
 
311
357
  # Returns true if the transaction has been refunded. False otherwise.
@@ -318,27 +364,6 @@ module Braintree
318
364
  @disbursement_details.valid?
319
365
  end
320
366
 
321
- def refund_id
322
- warn "[DEPRECATED] Transaction.refund_id is deprecated. Please use Transaction.refund_ids"
323
- @refund_id
324
- end
325
-
326
- # Deprecated. Use Braintree::Transaction.submit_for_settlement
327
- def submit_for_settlement(amount = nil)
328
- warn "[DEPRECATED] submit_for_settlement as an instance method is deprecated. Please use Transaction.submit_for_settlement"
329
- result = @gateway.transaction.submit_for_settlement(id, amount)
330
- if result.success?
331
- copy_instance_variables_from_object result.transaction
332
- end
333
- result
334
- end
335
-
336
- # Deprecated. Use Braintree::Transaction.submit_for_settlement!
337
- def submit_for_settlement!(amount = nil)
338
- warn "[DEPRECATED] submit_for_settlement! as an instance method is deprecated. Please use Transaction.submit_for_settlement!"
339
- return_object_or_raise(:transaction) { submit_for_settlement(amount) }
340
- end
341
-
342
367
  # If this transaction was stored in the vault, or created from vault records,
343
368
  # vault_billing_address will return the associated Braintree::Address. Because the
344
369
  # vault billing address can be updated after the transaction was created, the attributes
@@ -375,31 +400,19 @@ module Braintree
375
400
  @gateway.address.find(customer_details.id, shipping_details.id)
376
401
  end
377
402
 
378
- # Deprecated. Use Braintree::Transaction.void
379
- def void
380
- warn "[DEPRECATED] void as an instance method is deprecated. Please use Transaction.void"
381
- result = @gateway.transaction.void(id)
382
- if result.success?
383
- copy_instance_variables_from_object result.transaction
384
- end
385
- result
386
- end
387
-
388
- # Deprecated. Use Braintree::Transaction.void!
389
- def void!
390
- warn "[DEPRECATED] void! as an instance method is deprecated. Please use Transaction.void!"
391
- return_object_or_raise(:transaction) { void }
403
+ def processed_with_network_token?
404
+ @processed_with_network_token
392
405
  end
393
406
 
394
407
  class << self
395
408
  protected :new
396
409
  def _new(*args) # :nodoc:
397
- self.new *args
410
+ self.new(*args)
398
411
  end
399
412
  end
400
413
 
401
414
  def self._attributes # :nodoc:
402
- [:amount, :created_at, :credit_card_details, :customer_details, :id, :status, :subscription_details, :type, :updated_at]
415
+ [:amount, :created_at, :credit_card_details, :customer_details, :id, :status, :subscription_details, :type, :updated_at, :processed_with_network_token?]
403
416
  end
404
417
  end
405
418
  end