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
@@ -6,18 +6,23 @@ module Braintree
6
6
  @config.assert_has_access_token_or_keys
7
7
  end
8
8
 
9
- def sample_notification(kind, id)
10
- payload = Base64.encode64(_sample_xml(kind, id))
9
+ def sample_notification(kind, id, source_merchant_id=nil)
10
+ payload = Base64.encode64(_sample_xml(kind, id, source_merchant_id))
11
11
  signature_string = "#{@config.public_key}|#{Braintree::Digest.hexdigest(@config.private_key, payload)}"
12
12
 
13
13
  return {:bt_signature => signature_string, :bt_payload => payload}
14
14
  end
15
15
 
16
- def _sample_xml(kind, data)
16
+ def _sample_xml(kind, data, source_merchant_id=nil)
17
+ unless source_merchant_id.nil?
18
+ source_merchant_xml = "<source-merchant-id>#{source_merchant_id}</source-merchant-id>"
19
+ end
20
+
17
21
  <<-XML
18
22
  <notification>
19
23
  <timestamp type="datetime">#{Time.now.utc.iso8601}</timestamp>
20
24
  <kind>#{kind}</kind>
25
+ #{source_merchant_xml}
21
26
  <subject>
22
27
  #{_subject_sample_xml(kind, data)}
23
28
  </subject>
@@ -35,18 +40,30 @@ module Braintree
35
40
  _dispute_lost_sample_xml(id)
36
41
  when Braintree::WebhookNotification::Kind::DisputeWon
37
42
  _dispute_won_sample_xml(id)
43
+ when Braintree::WebhookNotification::Kind::DisputeAccepted
44
+ _dispute_accepted_sample_xml(id)
45
+ when Braintree::WebhookNotification::Kind::DisputeAutoAccepted
46
+ _dispute_auto_accepted_sample_xml(id)
47
+ when Braintree::WebhookNotification::Kind::DisputeDisputed
48
+ _dispute_disputed_sample_xml(id)
49
+ when Braintree::WebhookNotification::Kind::DisputeExpired
50
+ _dispute_expired_sample_xml(id)
38
51
  when Braintree::WebhookNotification::Kind::PartnerMerchantConnected
39
52
  _partner_merchant_connected_sample_xml(id)
40
53
  when Braintree::WebhookNotification::Kind::PartnerMerchantDisconnected
41
54
  _partner_merchant_disconnected_sample_xml(id)
42
55
  when Braintree::WebhookNotification::Kind::PartnerMerchantDeclined
43
56
  _partner_merchant_declined_sample_xml(id)
57
+ when Braintree::WebhookNotification::Kind::OAuthAccessRevoked
58
+ _oauth_access_revoked_sample_xml(id)
44
59
  when Braintree::WebhookNotification::Kind::SubMerchantAccountApproved
45
60
  _merchant_account_approved_sample_xml(id)
46
61
  when Braintree::WebhookNotification::Kind::SubMerchantAccountDeclined
47
62
  _merchant_account_declined_sample_xml(id)
48
63
  when Braintree::WebhookNotification::Kind::TransactionDisbursed
49
64
  _transaction_disbursed_sample_xml(id)
65
+ when Braintree::WebhookNotification::Kind::TransactionReviewed
66
+ _transaction_reviewed_sample_xml(id)
50
67
  when Braintree::WebhookNotification::Kind::TransactionSettled
51
68
  _transaction_settled_sample_xml(id)
52
69
  when Braintree::WebhookNotification::Kind::TransactionSettlementDeclined
@@ -57,16 +74,32 @@ module Braintree
57
74
  _disbursement_sample_xml(id)
58
75
  when Braintree::WebhookNotification::Kind::SubscriptionChargedSuccessfully
59
76
  _subscription_charged_successfully(id)
77
+ when Braintree::WebhookNotification::Kind::SubscriptionChargedUnsuccessfully
78
+ _subscription_charged_unsuccessfully(id)
60
79
  when Braintree::WebhookNotification::Kind::AccountUpdaterDailyReport
61
80
  _account_updater_daily_report_sample_xml(id)
62
81
  when Braintree::WebhookNotification::Kind::ConnectedMerchantStatusTransitioned
63
82
  _auth_status_transitioned_sample_xml(id)
64
83
  when Braintree::WebhookNotification::Kind::ConnectedMerchantPayPalStatusChanged
65
84
  _auth_paypal_status_changed_sample_xml(id)
66
- when Braintree::WebhookNotification::Kind::IdealPaymentComplete
67
- _ideal_payment_complete_sample_xml(id)
68
- when Braintree::WebhookNotification::Kind::IdealPaymentFailed
69
- _ideal_payment_failed_sample_xml(id)
85
+ when Braintree::WebhookNotification::Kind::GrantorUpdatedGrantedPaymentMethod
86
+ _granted_payment_instrument_update_sample_xml(id)
87
+ when Braintree::WebhookNotification::Kind::RecipientUpdatedGrantedPaymentMethod
88
+ _granted_payment_instrument_update_sample_xml(id)
89
+ when Braintree::WebhookNotification::Kind::GrantedPaymentMethodRevoked
90
+ _granted_payment_method_revoked_xml(id)
91
+ when Braintree::WebhookNotification::Kind::PaymentMethodRevokedByCustomer
92
+ _payment_method_revoked_by_customer_sample_xml(id)
93
+ when Braintree::WebhookNotification::Kind::LocalPaymentCompleted
94
+ _local_payment_completed_sample_xml(id)
95
+ when Braintree::WebhookNotification::Kind::LocalPaymentExpired
96
+ _local_payment_expired_sample_xml
97
+ when Braintree::WebhookNotification::Kind::LocalPaymentFunded
98
+ _local_payment_funded_sample_xml(id)
99
+ when Braintree::WebhookNotification::Kind::LocalPaymentReversed
100
+ _local_payment_reversed_sample_xml
101
+ when Braintree::WebhookNotification::Kind::PaymentMethodCustomerDataUpdated
102
+ _payment_method_customer_data_updated_sample_xml(id)
70
103
  else
71
104
  _subscription_sample_xml(id)
72
105
  end
@@ -86,6 +119,7 @@ module Braintree
86
119
  <id>#{id}</id>
87
120
  <transactions type="array">
88
121
  <transaction>
122
+ <id>#{id}</id>
89
123
  <status>submitted_for_settlement</status>
90
124
  <amount>49.99</amount>
91
125
  </transaction>
@@ -98,6 +132,26 @@ module Braintree
98
132
  XML
99
133
  end
100
134
 
135
+ def _subscription_charged_unsuccessfully(id)
136
+
137
+ <<-XML
138
+ <subscription>
139
+ <id>#{id}</id>
140
+ <transactions type="array">
141
+ <transaction>
142
+ <id>#{id}</id>
143
+ <status>failed</status>
144
+ <amount>49.99</amount>
145
+ </transaction>
146
+ </transactions>
147
+ <add_ons type="array">
148
+ </add_ons>
149
+ <discounts type="array">
150
+ </discounts>
151
+ </subscription>
152
+ XML
153
+ end
154
+
101
155
  def _subscription_sample_xml(id)
102
156
 
103
157
  <<-XML
@@ -200,6 +254,19 @@ module Braintree
200
254
  XML
201
255
  end
202
256
 
257
+ def _transaction_reviewed_sample_xml(id)
258
+
259
+ <<-XML
260
+ <transaction-review>
261
+ <transaction-id>my_id</transaction-id>
262
+ <decision>decision</decision>
263
+ <reviewer-email>hey@girl.com</reviewer-email>
264
+ <reviewer-note>i reviewed this</reviewer-note>
265
+ <reviewed-time type="datetime">2017-06-16T20:44:41Z</reviewed-time>
266
+ </transaction-review>
267
+ XML
268
+ end
269
+
203
270
  def _transaction_settled_sample_xml(id)
204
271
  <<-XML
205
272
  <transaction>
@@ -241,10 +308,65 @@ module Braintree
241
308
  end
242
309
 
243
310
  def _dispute_opened_sample_xml(id)
311
+ if id == "legacy_dispute_id"
312
+ _old_dispute_opened_sample_xml(id)
313
+ else
314
+ _new_dispute_opened_sample_xml(id)
315
+ end
316
+ end
317
+
318
+ def _dispute_lost_sample_xml(id)
319
+ if id == "legacy_dispute_id"
320
+ _old_dispute_lost_sample_xml(id)
321
+ else
322
+ _new_dispute_lost_sample_xml(id)
323
+ end
324
+ end
325
+
326
+ def _dispute_won_sample_xml(id)
327
+ if id == "legacy_dispute_id"
328
+ _old_dispute_won_sample_xml(id)
329
+ else
330
+ _new_dispute_won_sample_xml(id)
331
+ end
332
+ end
333
+
334
+ def _dispute_accepted_sample_xml(id)
335
+ if id == "legacy_dispute_id"
336
+ _old_dispute_accepted_sample_xml(id)
337
+ else
338
+ _new_dispute_accepted_sample_xml(id)
339
+ end
340
+ end
341
+
342
+ def _dispute_auto_accepted_sample_xml(id)
343
+ if id == "legacy_dispute_id"
344
+ _old_dispute_auto_accepted_sample_xml(id)
345
+ else
346
+ _new_dispute_auto_accepted_sample_xml(id)
347
+ end
348
+ end
349
+
350
+ def _dispute_disputed_sample_xml(id)
351
+ if id == "legacy_dispute_id"
352
+ _old_dispute_disputed_sample_xml(id)
353
+ else
354
+ _new_dispute_disputed_sample_xml(id)
355
+ end
356
+ end
357
+
358
+ def _dispute_expired_sample_xml(id)
359
+ if id == "legacy_dispute_id"
360
+ _old_dispute_expired_sample_xml(id)
361
+ else
362
+ _new_dispute_expired_sample_xml(id)
363
+ end
364
+ end
244
365
 
366
+ def _old_dispute_opened_sample_xml(id)
245
367
  <<-XML
246
368
  <dispute>
247
- <amount>250.00</amount>
369
+ <amount>100.00</amount>
248
370
  <currency-iso-code>USD</currency-iso-code>
249
371
  <received-date type="date">2014-03-01</received-date>
250
372
  <reply-by-date type="date">2014-03-21</reply-by-date>
@@ -254,18 +376,17 @@ module Braintree
254
376
  <id>#{id}</id>
255
377
  <transaction>
256
378
  <id>#{id}</id>
257
- <amount>250.00</amount>
379
+ <amount>100.00</amount>
258
380
  </transaction>
259
381
  <date-opened type=\"date\">2014-03-21</date-opened>
260
382
  </dispute>
261
383
  XML
262
384
  end
263
385
 
264
- def _dispute_lost_sample_xml(id)
265
-
386
+ def _old_dispute_lost_sample_xml(id)
266
387
  <<-XML
267
388
  <dispute>
268
- <amount>250.00</amount>
389
+ <amount>100.00</amount>
269
390
  <currency-iso-code>USD</currency-iso-code>
270
391
  <received-date type="date">2014-03-01</received-date>
271
392
  <reply-by-date type="date">2014-03-21</reply-by-date>
@@ -275,18 +396,17 @@ module Braintree
275
396
  <id>#{id}</id>
276
397
  <transaction>
277
398
  <id>#{id}</id>
278
- <amount>250.00</amount>
399
+ <amount>100.00</amount>
279
400
  </transaction>
280
401
  <date-opened type=\"date\">2014-03-21</date-opened>
281
402
  </dispute>
282
403
  XML
283
404
  end
284
405
 
285
- def _dispute_won_sample_xml(id)
286
-
406
+ def _old_dispute_won_sample_xml(id)
287
407
  <<-XML
288
408
  <dispute>
289
- <amount>250.00</amount>
409
+ <amount>100.00</amount>
290
410
  <currency-iso-code>USD</currency-iso-code>
291
411
  <received-date type="date">2014-03-01</received-date>
292
412
  <reply-by-date type="date">2014-03-21</reply-by-date>
@@ -296,7 +416,7 @@ module Braintree
296
416
  <id>#{id}</id>
297
417
  <transaction>
298
418
  <id>#{id}</id>
299
- <amount>250.00</amount>
419
+ <amount>100.00</amount>
300
420
  </transaction>
301
421
  <date-opened type=\"date\">2014-03-21</date-opened>
302
422
  <date-won type=\"date\">2014-03-22</date-won>
@@ -304,6 +424,450 @@ module Braintree
304
424
  XML
305
425
  end
306
426
 
427
+ def _old_dispute_accepted_sample_xml(id)
428
+ <<-XML
429
+ <dispute>
430
+ <amount>100.00</amount>
431
+ <currency-iso-code>USD</currency-iso-code>
432
+ <received-date type="date">2014-03-01</received-date>
433
+ <reply-by-date type="date">2014-03-21</reply-by-date>
434
+ <kind>chargeback</kind>
435
+ <status>accepted</status>
436
+ <reason>fraud</reason>
437
+ <id>#{id}</id>
438
+ <transaction>
439
+ <id>#{id}</id>
440
+ <amount>100.00</amount>
441
+ </transaction>
442
+ <date-opened type=\"date\">2014-03-21</date-opened>
443
+ </dispute>
444
+ XML
445
+ end
446
+
447
+ def _old_dispute_auto_accepted_sample_xml(id)
448
+ <<-XML
449
+ <dispute>
450
+ <amount>100.00</amount>
451
+ <currency-iso-code>USD</currency-iso-code>
452
+ <received-date type="date">2014-03-01</received-date>
453
+ <reply-by-date type="date">2014-03-21</reply-by-date>
454
+ <kind>chargeback</kind>
455
+ <status>auto_accepted</status>
456
+ <reason>fraud</reason>
457
+ <id>#{id}</id>
458
+ <transaction>
459
+ <id>#{id}</id>
460
+ <amount>100.00</amount>
461
+ </transaction>
462
+ <date-opened type=\"date\">2014-03-21</date-opened>
463
+ </dispute>
464
+ XML
465
+ end
466
+
467
+ def _old_dispute_disputed_sample_xml(id)
468
+ <<-XML
469
+ <dispute>
470
+ <amount>100.00</amount>
471
+ <currency-iso-code>USD</currency-iso-code>
472
+ <received-date type="date">2014-03-01</received-date>
473
+ <reply-by-date type="date">2014-03-21</reply-by-date>
474
+ <kind>chargeback</kind>
475
+ <status>disputed</status>
476
+ <reason>fraud</reason>
477
+ <id>#{id}</id>
478
+ <transaction>
479
+ <id>#{id}</id>
480
+ <amount>100.00</amount>
481
+ </transaction>
482
+ <date-opened type=\"date\">2014-03-21</date-opened>
483
+ </dispute>
484
+ XML
485
+ end
486
+
487
+ def _old_dispute_expired_sample_xml(id)
488
+ <<-XML
489
+ <dispute>
490
+ <amount>100.00</amount>
491
+ <currency-iso-code>USD</currency-iso-code>
492
+ <received-date type="date">2014-03-01</received-date>
493
+ <reply-by-date type="date">2014-03-21</reply-by-date>
494
+ <kind>chargeback</kind>
495
+ <status>expired</status>
496
+ <reason>fraud</reason>
497
+ <id>#{id}</id>
498
+ <transaction>
499
+ <id>#{id}</id>
500
+ <amount>100.00</amount>
501
+ </transaction>
502
+ <date-opened type=\"date\">2014-03-21</date-opened>
503
+ </dispute>
504
+ XML
505
+ end
506
+
507
+ def _new_dispute_opened_sample_xml(id)
508
+ <<-XML
509
+ <dispute>
510
+ <id>#{id}</id>
511
+ <amount>100.00</amount>
512
+ <amount-disputed>100.00</amount-disputed>
513
+ <amount-won>95.00</amount-won>
514
+ <case-number>CASE-12345</case-number>
515
+ <created-at type="datetime">2017-06-16T20:44:41Z</created-at>
516
+ <currency-iso-code>USD</currency-iso-code>
517
+ <forwarded-comments nil="true"/>
518
+ <kind>chargeback</kind>
519
+ <merchant-account-id>ytnlulaloidoqwvzxjrdqputg</merchant-account-id>
520
+ <reason>fraud</reason>
521
+ <reason-code nil="true"/>
522
+ <reason-description nil="true"/>
523
+ <received-date type="date">2016-02-15</received-date>
524
+ <reference-number>REF-9876</reference-number>
525
+ <reply-by-date type="date">2016-02-22</reply-by-date>
526
+ <status>open</status>
527
+ <updated-at type="datetime">2017-06-16T20:44:41Z</updated-at>
528
+ <original-dispute-id>9qde5qgp</original-dispute-id>
529
+ <status-history type="array">
530
+ <status-history>
531
+ <status>open</status>
532
+ <timestamp type="datetime">2017-06-16T20:44:41Z</timestamp>
533
+ </status-history>
534
+ </status-history>
535
+ <evidence type="array"/>
536
+ <transaction>
537
+ <id>#{id}</id>
538
+ <amount>100.00</amount>
539
+ <created-at>2017-06-21T20:44:41Z</created-at>
540
+ <order-id nil="true"/>
541
+ <purchase-order-number nil="true"/>
542
+ <payment-instrument-subtype>Visa</payment-instrument-subtype>
543
+ </transaction>
544
+ <date-opened type=\"date\">2014-03-21</date-opened>
545
+ </dispute>
546
+ XML
547
+ end
548
+
549
+ def _new_dispute_lost_sample_xml(id)
550
+ <<-XML
551
+ <dispute>
552
+ <id>#{id}</id>
553
+ <amount>100.00</amount>
554
+ <amount-disputed>100.00</amount-disputed>
555
+ <amount-won>95.00</amount-won>
556
+ <case-number>CASE-12345</case-number>
557
+ <created-at type="datetime">2017-06-16T20:44:41Z</created-at>
558
+ <currency-iso-code>USD</currency-iso-code>
559
+ <forwarded-comments nil="true"/>
560
+ <kind>chargeback</kind>
561
+ <merchant-account-id>ytnlulaloidoqwvzxjrdqputg</merchant-account-id>
562
+ <reason>fraud</reason>
563
+ <reason-code nil="true"/>
564
+ <reason-description nil="true"/>
565
+ <received-date type="date">2016-02-15</received-date>
566
+ <reference-number>REF-9876</reference-number>
567
+ <reply-by-date type="date">2016-02-22</reply-by-date>
568
+ <status>lost</status>
569
+ <updated-at type="datetime">2017-06-21T20:44:41Z</updated-at>
570
+ <original-dispute-id>9qde5qgp</original-dispute-id>
571
+ <status-history type="array">
572
+ <status-history>
573
+ <status>open</status>
574
+ <timestamp type="datetime">2017-06-16T20:44:41Z</timestamp>
575
+ </status-history>
576
+ <status-history>
577
+ <status>lost</status>
578
+ <timestamp type="datetime">2017-06-25T20:50:55Z</timestamp>
579
+ </status-history>
580
+ </status-history>
581
+ <evidence type="array">
582
+ <evidence>
583
+ <id>rxtngk9j5j93tsrq</id>
584
+ <comments nil="true"/>
585
+ <created-at type="datetime">2017-06-21T20:44:42Z</created-at>
586
+ <sent-to-processor-at nil="true"/>
587
+ <url>s3.amazonaws.com/foo.jpg</url>
588
+ </evidence>
589
+ <evidence>
590
+ <id>88cfb8dd</id>
591
+ <comments>text evidence</comments>
592
+ <created-at type="datetime">2017-06-21T20:44:42Z</created-at>
593
+ <sent-to-processor-at nil="true"/>
594
+ <url nil="true"/>
595
+ </evidence>
596
+ </evidence>
597
+ <transaction>
598
+ <id>#{id}</id>
599
+ <amount>100.00</amount>
600
+ <created-at>2017-06-21T20:44:41Z</created-at>
601
+ <order-id nil="true"/>
602
+ <purchase-order-number nil="true"/>
603
+ <payment-instrument-subtype>Visa</payment-instrument-subtype>
604
+ </transaction>
605
+ <date-opened type=\"date\">2014-03-21</date-opened>
606
+ </dispute>
607
+ XML
608
+ end
609
+
610
+ def _new_dispute_won_sample_xml(id)
611
+ <<-XML
612
+ <dispute>
613
+ <id>#{id}</id>
614
+ <amount>100.00</amount>
615
+ <amount-disputed>100.00</amount-disputed>
616
+ <amount-won>95.00</amount-won>
617
+ <case-number>CASE-12345</case-number>
618
+ <created-at type="datetime">2017-06-16T20:44:41Z</created-at>
619
+ <currency-iso-code>USD</currency-iso-code>
620
+ <forwarded-comments nil="true"/>
621
+ <kind>chargeback</kind>
622
+ <merchant-account-id>ytnlulaloidoqwvzxjrdqputg</merchant-account-id>
623
+ <reason>fraud</reason>
624
+ <reason-code nil="true"/>
625
+ <reason-description nil="true"/>
626
+ <received-date type="date">2016-02-15</received-date>
627
+ <reference-number>REF-9876</reference-number>
628
+ <reply-by-date type="date">2016-02-22</reply-by-date>
629
+ <status>won</status>
630
+ <updated-at type="datetime">2017-06-21T20:44:41Z</updated-at>
631
+ <original-dispute-id>9qde5qgp</original-dispute-id>
632
+ <status-history type="array">
633
+ <status-history>
634
+ <status>open</status>
635
+ <timestamp type="datetime">2017-06-16T20:44:41Z</timestamp>
636
+ </status-history>
637
+ <status-history>
638
+ <status>won</status>
639
+ <timestamp type="datetime">2017-06-25T20:50:55Z</timestamp>
640
+ </status-history>
641
+ </status-history>
642
+ <evidence type="array">
643
+ <evidence>
644
+ <id>rxtngk9j5j93tsrq</id>
645
+ <comments nil="true"/>
646
+ <created-at type="datetime">2017-06-21T20:44:42Z</created-at>
647
+ <sent-to-processor-at nil="true"/>
648
+ <url>s3.amazonaws.com/foo.jpg</url>
649
+ </evidence>
650
+ <evidence>
651
+ <id>88cfb8dd</id>
652
+ <comments>text evidence</comments>
653
+ <created-at type="datetime">2017-06-21T20:44:42Z</created-at>
654
+ <sent-to-processor-at nil="true"/>
655
+ <url nil="true"/>
656
+ </evidence>
657
+ </evidence>
658
+ <transaction>
659
+ <id>#{id}</id>
660
+ <amount>100.00</amount>
661
+ <created-at>2017-06-21T20:44:41Z</created-at>
662
+ <order-id nil="true"/>
663
+ <purchase-order-number nil="true"/>
664
+ <payment-instrument-subtype>Visa</payment-instrument-subtype>
665
+ </transaction>
666
+ <date-opened type=\"date\">2014-03-21</date-opened>
667
+ <date-won type=\"date\">2014-03-22</date-won>
668
+ </dispute>
669
+ XML
670
+ end
671
+
672
+ def _new_dispute_accepted_sample_xml(id)
673
+ <<-XML
674
+ <dispute>
675
+ <id>#{id}</id>
676
+ <amount>100.00</amount>
677
+ <amount-disputed>100.00</amount-disputed>
678
+ <amount-won>95.00</amount-won>
679
+ <case-number>CASE-12345</case-number>
680
+ <created-at type="datetime">2017-06-16T20:44:41Z</created-at>
681
+ <currency-iso-code>USD</currency-iso-code>
682
+ <forwarded-comments nil="true"/>
683
+ <kind>chargeback</kind>
684
+ <merchant-account-id>ytnlulaloidoqwvzxjrdqputg</merchant-account-id>
685
+ <reason>fraud</reason>
686
+ <reason-code nil="true"/>
687
+ <reason-description nil="true"/>
688
+ <received-date type="date">2016-02-15</received-date>
689
+ <reference-number>REF-9876</reference-number>
690
+ <reply-by-date type="date">2016-02-22</reply-by-date>
691
+ <status>accepted</status>
692
+ <updated-at type="datetime">2017-06-16T20:44:41Z</updated-at>
693
+ <original-dispute-id>9qde5qgp</original-dispute-id>
694
+ <status-history type="array">
695
+ <status-history>
696
+ <status>open</status>
697
+ <timestamp type="datetime">2017-06-16T20:44:41Z</timestamp>
698
+ </status-history>
699
+ <status-history>
700
+ <status>accepted</status>
701
+ <timestamp type="datetime">2017-06-25T20:50:55Z</timestamp>
702
+ </status-history>
703
+ </status-history>
704
+ <evidence type="array"/>
705
+ <transaction>
706
+ <id>#{id}</id>
707
+ <amount>100.00</amount>
708
+ <created-at>2017-06-21T20:44:41Z</created-at>
709
+ <order-id nil="true"/>
710
+ <purchase-order-number nil="true"/>
711
+ <payment-instrument-subtype>Visa</payment-instrument-subtype>
712
+ </transaction>
713
+ <date-opened type=\"date\">2014-03-21</date-opened>
714
+ </dispute>
715
+ XML
716
+ end
717
+
718
+ def _new_dispute_auto_accepted_sample_xml(id)
719
+ <<-XML
720
+ <dispute>
721
+ <id>#{id}</id>
722
+ <amount>100.00</amount>
723
+ <amount-disputed>100.00</amount-disputed>
724
+ <amount-won>95.00</amount-won>
725
+ <case-number>CASE-12345</case-number>
726
+ <created-at type="datetime">2017-06-16T20:44:41Z</created-at>
727
+ <currency-iso-code>USD</currency-iso-code>
728
+ <forwarded-comments nil="true"/>
729
+ <kind>chargeback</kind>
730
+ <merchant-account-id>ytnlulaloidoqwvzxjrdqputg</merchant-account-id>
731
+ <reason>fraud</reason>
732
+ <reason-code nil="true"/>
733
+ <reason-description nil="true"/>
734
+ <received-date type="date">2016-02-15</received-date>
735
+ <reference-number>REF-9876</reference-number>
736
+ <reply-by-date type="date">2016-02-22</reply-by-date>
737
+ <status>auto_accepted</status>
738
+ <updated-at type="datetime">2017-06-16T20:44:41Z</updated-at>
739
+ <original-dispute-id>9qde5qgp</original-dispute-id>
740
+ <status-history type="array">
741
+ <status-history>
742
+ <status>open</status>
743
+ <timestamp type="datetime">2017-06-16T20:44:41Z</timestamp>
744
+ </status-history>
745
+ <status-history>
746
+ <status>auto_accepted</status>
747
+ <timestamp type="datetime">2017-06-25T20:50:55Z</timestamp>
748
+ </status-history>
749
+ </status-history>
750
+ <evidence type="array"/>
751
+ <transaction>
752
+ <id>#{id}</id>
753
+ <amount>100.00</amount>
754
+ <created-at>2017-06-21T20:44:41Z</created-at>
755
+ <order-id nil="true"/>
756
+ <purchase-order-number nil="true"/>
757
+ <payment-instrument-subtype>Visa</payment-instrument-subtype>
758
+ </transaction>
759
+ <date-opened type=\"date\">2014-03-21</date-opened>
760
+ </dispute>
761
+ XML
762
+ end
763
+
764
+ def _new_dispute_disputed_sample_xml(id)
765
+ <<-XML
766
+ <dispute>
767
+ <id>#{id}</id>
768
+ <amount>100.00</amount>
769
+ <amount-disputed>100.00</amount-disputed>
770
+ <amount-won>95.00</amount-won>
771
+ <case-number>CASE-12345</case-number>
772
+ <created-at type="datetime">2017-06-16T20:44:41Z</created-at>
773
+ <currency-iso-code>USD</currency-iso-code>
774
+ <forwarded-comments nil="true"/>
775
+ <kind>chargeback</kind>
776
+ <merchant-account-id>ytnlulaloidoqwvzxjrdqputg</merchant-account-id>
777
+ <reason>fraud</reason>
778
+ <reason-code nil="true"/>
779
+ <reason-description nil="true"/>
780
+ <received-date type="date">2016-02-15</received-date>
781
+ <reference-number>REF-9876</reference-number>
782
+ <reply-by-date type="date">2016-02-22</reply-by-date>
783
+ <status>disputed</status>
784
+ <updated-at type="datetime">2017-06-21T20:44:41Z</updated-at>
785
+ <original-dispute-id>9qde5qgp</original-dispute-id>
786
+ <status-history type="array">
787
+ <status-history>
788
+ <status>open</status>
789
+ <timestamp type="datetime">2017-06-16T20:44:41Z</timestamp>
790
+ </status-history>
791
+ <status-history>
792
+ <status>disputed</status>
793
+ <timestamp type="datetime">2017-06-25T20:50:55Z</timestamp>
794
+ </status-history>
795
+ </status-history>
796
+ <evidence type="array">
797
+ <evidence>
798
+ <id>rxtngk9j5j93tsrq</id>
799
+ <comments nil="true"/>
800
+ <created-at type="datetime">2017-06-21T20:44:42Z</created-at>
801
+ <sent-to-processor-at nil="true"/>
802
+ <url>s3.amazonaws.com/foo.jpg</url>
803
+ </evidence>
804
+ <evidence>
805
+ <id>88cfb8dd</id>
806
+ <comments>text evidence</comments>
807
+ <created-at type="datetime">2017-06-21T20:44:42Z</created-at>
808
+ <sent-to-processor-at nil="true"/>
809
+ <url nil="true"/>
810
+ </evidence>
811
+ </evidence>
812
+ <transaction>
813
+ <id>#{id}</id>
814
+ <amount>100.00</amount>
815
+ <created-at>2017-06-21T20:44:41Z</created-at>
816
+ <order-id nil="true"/>
817
+ <purchase-order-number nil="true"/>
818
+ <payment-instrument-subtype>Visa</payment-instrument-subtype>
819
+ </transaction>
820
+ <date-opened type=\"date\">2014-03-21</date-opened>
821
+ </dispute>
822
+ XML
823
+ end
824
+
825
+ def _new_dispute_expired_sample_xml(id)
826
+ <<-XML
827
+ <dispute>
828
+ <id>#{id}</id>
829
+ <amount>100.00</amount>
830
+ <amount-disputed>100.00</amount-disputed>
831
+ <amount-won>95.00</amount-won>
832
+ <case-number>CASE-12345</case-number>
833
+ <created-at type="datetime">2017-06-16T20:44:41Z</created-at>
834
+ <currency-iso-code>USD</currency-iso-code>
835
+ <forwarded-comments nil="true"/>
836
+ <kind>chargeback</kind>
837
+ <merchant-account-id>ytnlulaloidoqwvzxjrdqputg</merchant-account-id>
838
+ <reason>fraud</reason>
839
+ <reason-code nil="true"/>
840
+ <reason-description nil="true"/>
841
+ <received-date type="date">2016-02-15</received-date>
842
+ <reference-number>REF-9876</reference-number>
843
+ <reply-by-date type="date">2016-02-22</reply-by-date>
844
+ <status>expired</status>
845
+ <updated-at type="datetime">2017-06-16T20:44:41Z</updated-at>
846
+ <original-dispute-id>9qde5qgp</original-dispute-id>
847
+ <status-history type="array">
848
+ <status-history>
849
+ <status>open</status>
850
+ <timestamp type="datetime">2017-06-16T20:44:41Z</timestamp>
851
+ </status-history>
852
+ <status-history>
853
+ <status>expired</status>
854
+ <timestamp type="datetime">2017-06-25T20:50:55Z</timestamp>
855
+ </status-history>
856
+ </status-history>
857
+ <evidence type="array"/>
858
+ <transaction>
859
+ <id>#{id}</id>
860
+ <amount>100.00</amount>
861
+ <created-at>2017-06-21T20:44:41Z</created-at>
862
+ <order-id nil="true"/>
863
+ <purchase-order-number nil="true"/>
864
+ <payment-instrument-subtype>Visa</payment-instrument-subtype>
865
+ </transaction>
866
+ <date-opened type=\"date\">2014-03-21</date-opened>
867
+ </dispute>
868
+ XML
869
+ end
870
+
307
871
  def _disbursement_exception_sample_xml(id)
308
872
 
309
873
  <<-XML
@@ -384,47 +948,149 @@ module Braintree
384
948
  XML
385
949
  end
386
950
 
387
- def _ideal_payment_complete_sample_xml(id)
951
+ def _oauth_access_revoked_sample_xml(id)
952
+ <<-XML
953
+ <oauth-application-revocation>
954
+ <merchant-id>#{id}</merchant-id>
955
+ <oauth-application-client-id>oauth_application_client_id</oauth-application-client-id>
956
+ </oauth-application-revocation>
957
+ XML
958
+ end
388
959
 
960
+ def _granted_payment_instrument_update_sample_xml(id)
389
961
  <<-XML
390
- <ideal-payment>
391
- <id>#{id}</id>
392
- <status>COMPLETE</status>
393
- <issuer>ABCISSUER</issuer>
394
- <order-id>ORDERABC</order-id>
395
- <currency>EUR</currency>
396
- <amount>10.00</amount>
397
- <created-at>2016-11-29T23:27:34.547Z</created-at>
398
- <iban-bank-account>
399
- <created-at>2016-11-29T23:27:36.386Z</created-at>
400
- <description>DESCRIPTION ABC</description>
401
- <bic>XXXXNLXX</bic>
402
- <iban-country>11</iban-country>
403
- <iban-account-number-last-4>0000</iban-account-number-last-4>
404
- <masked-iban>NL************0000</masked-iban>
405
- <account-holder-name>Account Holder</account-holder-name>
406
- </iban-bank-account>
407
- <approval-url>https://example.com</approval-url>
408
- <ideal-transaction-id>1234567890</ideal-transaction-id>
409
- </ideal-payment>
410
- XML
411
- end
412
-
413
- def _ideal_payment_failed_sample_xml(id)
414
-
415
- <<-XML
416
- <ideal-payment>
417
- <id>#{id}</id>
418
- <status>FAILED</status>
419
- <issuer>ABCISSUER</issuer>
420
- <order-id>ORDERABC</order-id>
421
- <currency>EUR</currency>
422
- <amount>10.00</amount>
423
- <created-at>2016-11-29T23:27:34.547Z</created-at>
424
- <approval-url>https://example.com</approval-url>
425
- <ideal-transaction-id>1234567890</ideal-transaction-id>
426
- </ideal-payment>
962
+ <granted-payment-instrument-update>
963
+ <grant-owner-merchant-id>vczo7jqrpwrsi2px</grant-owner-merchant-id>
964
+ <grant-recipient-merchant-id>cf0i8wgarszuy6hc</grant-recipient-merchant-id>
965
+ <payment-method-nonce>
966
+ <nonce>ee257d98-de40-47e8-96b3-a6954ea7a9a4</nonce>
967
+ <consumed type="boolean">false</consumed>
968
+ <locked type="boolean">false</locked>
969
+ </payment-method-nonce>
970
+ <token>abc123z</token>
971
+ <updated-fields type="array">
972
+ <item>expiration-month</item>
973
+ <item>expiration-year</item>
974
+ </updated-fields>
975
+ </granted-payment-instrument-update>
427
976
  XML
428
977
  end
978
+
979
+ def _granted_payment_method_revoked_xml(id)
980
+ _venmo_account_xml(id)
981
+ end
982
+
983
+ def _payment_method_revoked_by_customer_sample_xml(id)
984
+ <<-XML
985
+ <paypal-account>
986
+ <billing-agreement-id>a-billing-agreement-id</billing-agreement-id>
987
+ <created-at type="datetime">2019-01-01T12:00:00Z</created-at>
988
+ <customer-id>a-customer-id</customer-id>
989
+ <default type="boolean">true</default>
990
+ <email>name@email.com</email>
991
+ <global-id>cGF5bWVudG1ldGhvZF9jaDZieXNz</global-id>
992
+ <image-url>https://assets.braintreegateway.com/payment_method_logo/paypal.png?environment=test</image-url>
993
+ <subscriptions type="array"/>
994
+ <token>#{id}</token>
995
+ <updated-at type="datetime">2019-01-02T12:00:00Z</updated-at>
996
+ <is-channel-initiated nil="true"/>
997
+ <payer-id>a-payer-id</payer-id>
998
+ <payer-info nil="true"/>
999
+ <limited-use-order-id nil="true"/>
1000
+ <revoked-at type="datetime">2019-01-02T12:00:00Z</revoked-at>
1001
+ </paypal-account>
1002
+ XML
1003
+ end
1004
+
1005
+ def _local_payment_completed_sample_xml(id)
1006
+ <<-XML
1007
+ <local-payment>
1008
+ <payment-id>PAY-XYZ123</payment-id>
1009
+ <payer-id>ABCPAYER</payer-id>
1010
+ <payment-method-nonce>ee257d98-de40-47e8-96b3-a6954ea7a9a4</payment-method-nonce>
1011
+ <transaction>
1012
+ <id>#{id}</id>
1013
+ <status>authorized</status>
1014
+ <amount>49.99</amount>
1015
+ <order-id>order4567</order-id>
1016
+ </transaction>
1017
+ </local-payment>
1018
+ XML
1019
+ end
1020
+
1021
+ def _local_payment_expired_sample_xml
1022
+ <<-XML
1023
+ <local-payment-expired>
1024
+ <payment-id>PAY-XYZ123</payment-id>
1025
+ <payment-context-id>cG5b=</payment-context-id>
1026
+ </local-payment-expired>
1027
+ XML
1028
+ end
1029
+
1030
+ def _local_payment_funded_sample_xml(id)
1031
+ <<-XML
1032
+ <local-payment-funded>
1033
+ <payment-id>PAY-XYZ123</payment-id>
1034
+ <payment-context-id>cG5b=</payment-context-id>
1035
+ <transaction>
1036
+ <id>#{id}</id>
1037
+ <status>settled</status>
1038
+ <amount>49.99</amount>
1039
+ <order-id>order4567</order-id>
1040
+ </transaction>
1041
+ </local-payment-funded>
1042
+ XML
1043
+ end
1044
+
1045
+ def _local_payment_reversed_sample_xml
1046
+ <<-XML
1047
+ <local-payment-reversed>
1048
+ <payment-id>PAY-XYZ123</payment-id>
1049
+ <payment-context-id>cG5b=</payment-context-id>
1050
+ </local-payment-reversed>
1051
+ XML
1052
+ end
1053
+
1054
+ def _payment_method_customer_data_updated_sample_xml(id)
1055
+ <<-XML
1056
+ <payment-method-customer-data-updated-metadata>
1057
+ <token>TOKEN-12345</token>
1058
+ <payment-method>
1059
+ #{_venmo_account_xml(id)}
1060
+ </payment-method>
1061
+ <datetime-updated type='dateTime'>2022-01-01T21:28:37Z</datetime-updated>
1062
+ <enriched-customer-data>
1063
+ <fields-updated type='array'>
1064
+ <item>username</item>
1065
+ </fields-updated>
1066
+ <profile-data>
1067
+ <username>venmo_username</username>
1068
+ <first-name>John</first-name>
1069
+ <last-name>Doe</last-name>
1070
+ <phone-number>1231231234</phone-number>
1071
+ <email>john.doe@paypal.com</email>
1072
+ </profile-data>
1073
+ </enriched-customer-data>
1074
+ </payment-method-customer-data-updated-metadata>
1075
+ XML
1076
+ end
1077
+
1078
+ def _venmo_account_xml(id)
1079
+ <<-XML
1080
+ <venmo-account>
1081
+ <created-at type='dateTime'>2018-10-11T21:28:37Z</created-at>
1082
+ <updated-at type='dateTime'>2018-10-11T21:28:37Z</updated-at>
1083
+ <default type='boolean'>true</default>
1084
+ <image-url>https://assets.braintreegateway.com/payment_method_logo/venmo.png?environment=test</image-url>
1085
+ <token>#{id}</token>
1086
+ <source-description>Venmo Account: venmojoe</source-description>
1087
+ <username>venmojoe</username>
1088
+ <venmo-user-id>456</venmo-user-id>
1089
+ <subscriptions type='array'/>
1090
+ <customer-id>venmo_customer_id</customer-id>
1091
+ <global-id>cGF5bWVudG1ldGhvZF92ZW5tb2FjY291bnQ</global-id>
1092
+ </venmo-account>
1093
+ XML
1094
+ end
429
1095
  end
430
1096
  end