braintree 2.98.0 → 4.23.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 (308) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/braintree.gemspec +7 -4
  4. data/lib/braintree/account_updater_daily_report.rb +4 -4
  5. data/lib/braintree/ach_mandate.rb +1 -1
  6. data/lib/braintree/add_on_gateway.rb +1 -1
  7. data/lib/braintree/address.rb +7 -27
  8. data/lib/braintree/address_gateway.rb +8 -7
  9. data/lib/braintree/advanced_search.rb +11 -12
  10. data/lib/braintree/apple_pay.rb +4 -4
  11. data/lib/braintree/apple_pay_card.rb +18 -4
  12. data/lib/braintree/apple_pay_options.rb +4 -4
  13. data/lib/braintree/authorization_adjustment.rb +4 -4
  14. data/lib/braintree/base_module.rb +11 -1
  15. data/lib/braintree/bin_data.rb +10 -3
  16. data/lib/braintree/client_token.rb +1 -1
  17. data/lib/braintree/client_token_gateway.rb +4 -3
  18. data/lib/braintree/configuration.rb +35 -35
  19. data/lib/braintree/connected_merchant_paypal_status_changed.rb +2 -2
  20. data/lib/braintree/connected_merchant_status_transitioned.rb +2 -2
  21. data/lib/braintree/credit_card.rb +40 -86
  22. data/lib/braintree/credit_card_gateway.rb +58 -44
  23. data/lib/braintree/credit_card_verification.rb +39 -20
  24. data/lib/braintree/credit_card_verification_gateway.rb +35 -5
  25. data/lib/braintree/credit_card_verification_search.rb +2 -2
  26. data/lib/braintree/customer.rb +23 -88
  27. data/lib/braintree/customer_gateway.rb +17 -32
  28. data/lib/braintree/customer_search.rb +2 -2
  29. data/lib/braintree/descriptor.rb +1 -1
  30. data/lib/braintree/digest.rb +1 -1
  31. data/lib/braintree/disbursement.rb +7 -7
  32. data/lib/braintree/discount_gateway.rb +1 -1
  33. data/lib/braintree/dispute/evidence.rb +1 -1
  34. data/lib/braintree/{transaction/coinbase_details.rb → dispute/paypal_message.rb} +5 -6
  35. data/lib/braintree/dispute/{history_event.rb → status_history.rb} +3 -1
  36. data/lib/braintree/dispute/transaction.rb +3 -1
  37. data/lib/braintree/dispute/transaction_details.rb +1 -1
  38. data/lib/braintree/dispute.rb +47 -6
  39. data/lib/braintree/dispute_gateway.rb +5 -10
  40. data/lib/braintree/dispute_search.rb +8 -4
  41. data/lib/braintree/document_upload.rb +3 -3
  42. data/lib/braintree/document_upload_gateway.rb +3 -3
  43. data/lib/braintree/enriched_customer_data.rb +21 -0
  44. data/lib/braintree/error_codes.rb +217 -175
  45. data/lib/braintree/error_result.rb +2 -3
  46. data/lib/braintree/errors.rb +3 -3
  47. data/lib/braintree/exceptions.rb +6 -5
  48. data/lib/braintree/exchange_rate.rb +13 -0
  49. data/lib/braintree/exchange_rate_quote.rb +24 -0
  50. data/lib/braintree/exchange_rate_quote_gateway.rb +35 -0
  51. data/lib/braintree/exchange_rate_quote_input.rb +21 -0
  52. data/lib/braintree/exchange_rate_quote_request.rb +18 -0
  53. data/lib/braintree/exchange_rate_quote_response.rb +18 -0
  54. data/lib/braintree/facilitated_details.rb +1 -1
  55. data/lib/braintree/facilitator_details.rb +1 -1
  56. data/lib/braintree/gateway.rb +6 -12
  57. data/lib/braintree/{android_pay_card.rb → google_pay_card.rb} +18 -5
  58. data/lib/braintree/granted_payment_instrument_update.rb +2 -2
  59. data/lib/braintree/graphql_client.rb +14 -8
  60. data/lib/braintree/http.rb +9 -10
  61. data/lib/braintree/local_payment_completed/blik_alias.rb +23 -0
  62. data/lib/braintree/local_payment_completed.rb +10 -5
  63. data/lib/braintree/local_payment_expired.rb +21 -0
  64. data/lib/braintree/local_payment_funded.rb +22 -0
  65. data/lib/braintree/local_payment_reversed.rb +19 -0
  66. data/lib/braintree/merchant.rb +4 -4
  67. data/lib/braintree/merchant_account.rb +3 -3
  68. data/lib/braintree/merchant_account_gateway.rb +10 -8
  69. data/lib/braintree/merchant_gateway.rb +1 -1
  70. data/lib/braintree/meta_checkout_card.rb +89 -0
  71. data/lib/braintree/meta_checkout_token.rb +88 -0
  72. data/lib/braintree/modification.rb +4 -4
  73. data/lib/braintree/oauth_credentials.rb +4 -4
  74. data/lib/braintree/oauth_gateway.rb +5 -5
  75. data/lib/braintree/paginated_collection.rb +2 -2
  76. data/lib/braintree/paginated_result.rb +1 -1
  77. data/lib/braintree/payment_instrument_type.rb +14 -13
  78. data/lib/braintree/payment_method_customer_data_updated_metadata.rb +24 -0
  79. data/lib/braintree/payment_method_gateway.rb +52 -22
  80. data/lib/braintree/payment_method_nonce.rb +12 -7
  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 +14 -3
  84. data/lib/braintree/payment_method_parser.rb +4 -7
  85. data/lib/braintree/paypal_account.rb +3 -2
  86. data/lib/braintree/paypal_account_gateway.rb +5 -5
  87. data/lib/braintree/plan.rb +22 -2
  88. data/lib/braintree/plan_gateway.rb +101 -1
  89. data/lib/braintree/processor_response_types.rb +3 -3
  90. data/lib/braintree/resource_collection.rb +10 -5
  91. data/lib/braintree/revoked_payment_method_metadata.rb +2 -2
  92. data/lib/braintree/risk_data/liability_shift.rb +22 -0
  93. data/lib/braintree/risk_data.rb +10 -3
  94. data/lib/braintree/samsung_pay_card.rb +8 -6
  95. data/lib/braintree/sepa_direct_debit_account.rb +60 -0
  96. data/lib/braintree/sepa_direct_debit_account_gateway.rb +25 -0
  97. data/lib/braintree/sepa_direct_debit_account_nonce_details.rb +28 -0
  98. data/lib/braintree/settlement_batch_summary.rb +2 -2
  99. data/lib/braintree/settlement_batch_summary_gateway.rb +1 -1
  100. data/lib/braintree/sha256_digest.rb +1 -1
  101. data/lib/braintree/subscription/status_details.rb +1 -1
  102. data/lib/braintree/subscription.rb +13 -13
  103. data/lib/braintree/subscription_gateway.rb +6 -6
  104. data/lib/braintree/subscription_search.rb +1 -1
  105. data/lib/braintree/successful_result.rb +5 -4
  106. data/lib/braintree/test/authentication_id.rb +21 -0
  107. data/lib/braintree/test/credit_card.rb +9 -10
  108. data/lib/braintree/test/merchant_account.rb +1 -1
  109. data/lib/braintree/test/nonce.rb +27 -20
  110. data/lib/braintree/test/transaction_amounts.rb +2 -3
  111. data/lib/braintree/test/venmo_sdk.rb +2 -0
  112. data/lib/braintree/testing_gateway.rb +1 -1
  113. data/lib/braintree/three_d_secure_info.rb +23 -11
  114. data/lib/braintree/transaction/address_details.rb +14 -1
  115. data/lib/braintree/transaction/apple_pay_details.rb +13 -10
  116. data/lib/braintree/transaction/credit_card_details.rb +8 -1
  117. data/lib/braintree/transaction/customer_details.rb +3 -2
  118. data/lib/braintree/transaction/disbursement_details.rb +2 -1
  119. data/lib/braintree/transaction/{android_pay_details.rb → google_pay_details.rb} +6 -1
  120. data/lib/braintree/transaction/installment/adjustment.rb +33 -0
  121. data/lib/braintree/transaction/installment.rb +28 -0
  122. data/lib/braintree/transaction/local_payment_details.rb +3 -0
  123. data/lib/braintree/transaction/meta_checkout_card_details.rb +52 -0
  124. data/lib/braintree/transaction/meta_checkout_token_details.rb +54 -0
  125. data/lib/braintree/transaction/package_details.rb +19 -0
  126. data/lib/braintree/transaction/payment_receipt/card_present_data.rb +36 -0
  127. data/lib/braintree/transaction/payment_receipt/merchant_address.rb +19 -0
  128. data/lib/braintree/transaction/payment_receipt.rb +31 -0
  129. data/lib/braintree/transaction/paypal_details.rb +5 -0
  130. data/lib/braintree/transaction/samsung_pay_card_details.rb +3 -1
  131. data/lib/braintree/transaction/sepa_direct_debit_account_details.rb +27 -0
  132. data/lib/braintree/transaction/status_details.rb +1 -1
  133. data/lib/braintree/transaction/subscription_details.rb +3 -1
  134. data/lib/braintree/transaction/us_bank_account_details.rb +2 -1
  135. data/lib/braintree/transaction/visa_checkout_card_details.rb +1 -1
  136. data/lib/braintree/transaction.rb +119 -128
  137. data/lib/braintree/transaction_gateway.rb +138 -64
  138. data/lib/braintree/transaction_line_item.rb +14 -11
  139. data/lib/braintree/transaction_line_item_gateway.rb +1 -1
  140. data/lib/braintree/transaction_review.rb +18 -0
  141. data/lib/braintree/transaction_search.rb +11 -7
  142. data/lib/braintree/unknown_payment_method.rb +2 -2
  143. data/lib/braintree/us_bank_account.rb +5 -5
  144. data/lib/braintree/us_bank_account_verification.rb +24 -16
  145. data/lib/braintree/us_bank_account_verification_gateway.rb +1 -1
  146. data/lib/braintree/us_bank_account_verification_search.rb +1 -1
  147. data/lib/braintree/util.rb +25 -10
  148. data/lib/braintree/validation_error.rb +1 -1
  149. data/lib/braintree/validation_error_collection.rb +3 -3
  150. data/lib/braintree/venmo_account.rb +4 -4
  151. data/lib/braintree/venmo_profile_data.rb +25 -0
  152. data/lib/braintree/version.rb +2 -2
  153. data/lib/braintree/visa_checkout_card.rb +8 -8
  154. data/lib/braintree/webhook_notification.rb +55 -33
  155. data/lib/braintree/webhook_notification_gateway.rb +9 -9
  156. data/lib/braintree/webhook_testing.rb +1 -1
  157. data/lib/braintree/webhook_testing_gateway.rb +569 -46
  158. data/lib/braintree/xml/generator.rb +6 -5
  159. data/lib/braintree/xml/libxml.rb +1 -1
  160. data/lib/braintree/xml/parser.rb +24 -37
  161. data/lib/braintree/xml/rexml.rb +6 -7
  162. data/lib/braintree/xml.rb +1 -1
  163. data/lib/braintree.rb +41 -24
  164. data/lib/ssl/api_braintreegateway_com.ca.crt +401 -168
  165. data/spec/integration/braintree/add_on_spec.rb +10 -10
  166. data/spec/integration/braintree/address_spec.rb +101 -178
  167. data/spec/integration/braintree/advanced_search_spec.rb +93 -93
  168. data/spec/integration/braintree/apple_pay_spec.rb +12 -12
  169. data/spec/integration/braintree/braintree_gateway_spec.rb +2 -1
  170. data/spec/integration/braintree/client_api/client_token_spec.rb +279 -62
  171. data/spec/integration/braintree/client_api/spec_helper.rb +99 -73
  172. data/spec/integration/braintree/credit_card_spec.rb +522 -821
  173. data/spec/integration/braintree/credit_card_verification_search_spec.rb +18 -18
  174. data/spec/integration/braintree/credit_card_verification_spec.rb +219 -30
  175. data/spec/integration/braintree/customer_search_spec.rb +28 -28
  176. data/spec/integration/braintree/customer_spec.rb +840 -757
  177. data/spec/integration/braintree/disbursement_spec.rb +2 -2
  178. data/spec/integration/braintree/discount_spec.rb +9 -9
  179. data/spec/integration/braintree/dispute_search_spec.rb +45 -9
  180. data/spec/integration/braintree/dispute_spec.rb +109 -82
  181. data/spec/integration/braintree/document_upload_spec.rb +29 -17
  182. data/spec/integration/braintree/error_codes_spec.rb +3 -3
  183. data/spec/integration/braintree/exchange_rate_quote_spec.rb +97 -0
  184. data/spec/integration/braintree/graphql_client_spec.rb +0 -2
  185. data/spec/integration/braintree/http_spec.rb +31 -33
  186. data/spec/integration/braintree/merchant_account_spec.rb +155 -156
  187. data/spec/integration/braintree/merchant_spec.rb +71 -192
  188. data/spec/integration/braintree/oauth_spec.rb +72 -72
  189. data/spec/integration/braintree/package_tracking_spec.rb +130 -0
  190. data/spec/integration/braintree/payment_method_nonce_spec.rb +173 -78
  191. data/spec/integration/braintree/payment_method_spec.rb +953 -501
  192. data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +147 -234
  193. data/spec/integration/braintree/paypal_account_spec.rb +74 -72
  194. data/spec/integration/braintree/plan_spec.rb +96 -15
  195. data/spec/integration/braintree/samsung_pay_card_spec.rb +75 -73
  196. data/spec/integration/braintree/sepa_direct_debit_account_spec.rb +194 -0
  197. data/spec/integration/braintree/settlement_batch_summary_spec.rb +18 -18
  198. data/spec/integration/braintree/subscription_spec.rb +507 -513
  199. data/spec/integration/braintree/test/transaction_amounts_spec.rb +4 -4
  200. data/spec/integration/braintree/test_transaction_spec.rb +29 -29
  201. data/spec/integration/braintree/transaction_line_item_spec.rb +12 -6
  202. data/spec/integration/braintree/transaction_search_spec.rb +410 -217
  203. data/spec/integration/braintree/transaction_spec.rb +3252 -2102
  204. data/spec/integration/braintree/transaction_us_bank_account_spec.rb +42 -278
  205. data/spec/integration/braintree/us_bank_account_spec.rb +36 -36
  206. data/spec/integration/braintree/us_bank_account_verification_search_spec.rb +25 -25
  207. data/spec/integration/braintree/us_bank_account_verification_spec.rb +41 -41
  208. data/spec/integration/braintree/visa_checkout_card_spec.rb +62 -62
  209. data/spec/integration/spec_helper.rb +22 -7
  210. data/spec/oauth_test_helper.rb +1 -1
  211. data/spec/script/httpsd.rb +6 -6
  212. data/spec/spec_helper.rb +15 -20
  213. data/spec/unit/braintree/address_spec.rb +9 -17
  214. data/spec/unit/braintree/apple_pay_card_spec.rb +110 -7
  215. data/spec/unit/braintree/base_module_spec.rb +4 -4
  216. data/spec/unit/braintree/client_token_spec.rb +6 -6
  217. data/spec/unit/braintree/configuration_spec.rb +84 -84
  218. data/spec/unit/braintree/credentials_parser_spec.rb +6 -6
  219. data/spec/unit/braintree/credit_card_spec.rb +91 -58
  220. data/spec/unit/braintree/credit_card_verification_gateway_spec.rb +56 -0
  221. data/spec/unit/braintree/credit_card_verification_search_spec.rb +10 -10
  222. data/spec/unit/braintree/credit_card_verification_spec.rb +40 -18
  223. data/spec/unit/braintree/customer_spec.rb +102 -57
  224. data/spec/unit/braintree/digest_spec.rb +5 -6
  225. data/spec/unit/braintree/disbursement_spec.rb +14 -14
  226. data/spec/unit/braintree/dispute_search_spec.rb +6 -2
  227. data/spec/unit/braintree/dispute_spec.rb +144 -66
  228. data/spec/unit/braintree/document_upload_spec.rb +8 -8
  229. data/spec/unit/braintree/enriched_customer_data_spec.rb +41 -0
  230. data/spec/unit/braintree/error_result_spec.rb +11 -11
  231. data/spec/unit/braintree/errors_spec.rb +17 -17
  232. data/spec/unit/braintree/exchange_rate_quote_input_spec.rb +42 -0
  233. data/spec/unit/braintree/exchange_rate_quote_request_spec.rb +82 -0
  234. data/spec/unit/braintree/exchange_rate_quote_response_spec.rb +52 -0
  235. data/spec/unit/braintree/exchange_rate_quote_spec.rb +42 -0
  236. data/spec/unit/braintree/exchange_rate_spec.rb +23 -0
  237. data/spec/unit/braintree/http_spec.rb +19 -17
  238. data/spec/unit/braintree/local_payment_completed_spec.rb +62 -8
  239. data/spec/unit/braintree/local_payment_expired_spec.rb +24 -0
  240. data/spec/unit/braintree/local_payment_funded_spec.rb +34 -0
  241. data/spec/unit/braintree/merchant_account_spec.rb +5 -5
  242. data/spec/unit/braintree/meta_checkout_card_details_spec.rb +60 -0
  243. data/spec/unit/braintree/meta_checkout_card_spec.rb +60 -0
  244. data/spec/unit/braintree/meta_checkout_token_details_spec.rb +63 -0
  245. data/spec/unit/braintree/meta_checkout_token_spec.rb +63 -0
  246. data/spec/unit/braintree/modification_spec.rb +1 -1
  247. data/spec/unit/braintree/package_tracking_spec.rb +77 -0
  248. data/spec/unit/braintree/payment_method_customer_data_updated_metadata_spec.rb +45 -0
  249. data/spec/unit/braintree/payment_method_nonce_details_payer_info_spec.rb +31 -0
  250. data/spec/unit/braintree/payment_method_nonce_details_spec.rb +51 -0
  251. data/spec/unit/braintree/payment_method_nonce_spec.rb +40 -0
  252. data/spec/unit/braintree/payment_method_spec.rb +20 -20
  253. data/spec/unit/braintree/paypal_account_spec.rb +16 -7
  254. data/spec/unit/braintree/resource_collection_spec.rb +34 -5
  255. data/spec/unit/braintree/risk_data/liability_shift.rb +26 -0
  256. data/spec/unit/braintree/risk_data_spec.rb +38 -8
  257. data/spec/unit/braintree/sepa_debit_account_nonce_details_spec.rb +29 -0
  258. data/spec/unit/braintree/sepa_debit_account_spec.rb +86 -0
  259. data/spec/unit/braintree/sha256_digest_spec.rb +1 -1
  260. data/spec/unit/braintree/signature_service_spec.rb +2 -2
  261. data/spec/unit/braintree/subscription_search_spec.rb +18 -18
  262. data/spec/unit/braintree/subscription_spec.rb +8 -8
  263. data/spec/unit/braintree/successful_result_spec.rb +6 -6
  264. data/spec/unit/braintree/three_d_secure_info_spec.rb +37 -17
  265. data/spec/unit/braintree/transaction/credit_card_details_spec.rb +22 -6
  266. data/spec/unit/braintree/transaction/customer_details_spec.rb +3 -2
  267. data/spec/unit/braintree/transaction/deposit_details_spec.rb +4 -4
  268. data/spec/unit/braintree/transaction/installment_spec.rb +25 -0
  269. data/spec/unit/braintree/transaction/local_payment_details_spec.rb +36 -0
  270. data/spec/unit/braintree/transaction/payment_receipt_spec.rb +73 -0
  271. data/spec/unit/braintree/transaction/paypal_details_spec.rb +63 -0
  272. data/spec/unit/braintree/transaction/sepa_direct_debit_account_details_spec.rb +33 -0
  273. data/spec/unit/braintree/transaction_gateway_spec.rb +150 -0
  274. data/spec/unit/braintree/transaction_search_spec.rb +12 -12
  275. data/spec/unit/braintree/transaction_spec.rb +221 -124
  276. data/spec/unit/braintree/unknown_payment_method_spec.rb +4 -4
  277. data/spec/unit/braintree/us_bank_account_spec.rb +2 -2
  278. data/spec/unit/braintree/us_bank_account_verification_search_spec.rb +7 -7
  279. data/spec/unit/braintree/us_bank_account_verification_spec.rb +12 -7
  280. data/spec/unit/braintree/util_spec.rb +78 -44
  281. data/spec/unit/braintree/validation_error_collection_spec.rb +62 -62
  282. data/spec/unit/braintree/validation_error_spec.rb +4 -4
  283. data/spec/unit/braintree/venmo_profile_data_spec.rb +43 -0
  284. data/spec/unit/braintree/webhook_notification_spec.rb +434 -197
  285. data/spec/unit/braintree/xml/libxml_spec.rb +5 -5
  286. data/spec/unit/braintree/xml/parser_spec.rb +27 -22
  287. data/spec/unit/braintree/xml/rexml_spec.rb +5 -5
  288. data/spec/unit/braintree/xml_spec.rb +38 -38
  289. data/spec/unit/braintree_spec.rb +2 -2
  290. metadata +91 -30
  291. data/lib/braintree/amex_express_checkout_card.rb +0 -38
  292. data/lib/braintree/coinbase_account.rb +0 -34
  293. data/lib/braintree/europe_bank_account.rb +0 -36
  294. data/lib/braintree/europe_bank_account_gateway.rb +0 -17
  295. data/lib/braintree/ideal_payment.rb +0 -61
  296. data/lib/braintree/ideal_payment_gateway.rb +0 -19
  297. data/lib/braintree/masterpass_card.rb +0 -81
  298. data/lib/braintree/settlement_batch.rb +0 -0
  299. data/lib/braintree/transaction/amex_express_checkout_details.rb +0 -21
  300. data/lib/braintree/transaction/ideal_payment_details.rb +0 -19
  301. data/lib/braintree/transaction/masterpass_card_details.rb +0 -47
  302. data/lib/braintree/transparent_redirect.rb +0 -40
  303. data/lib/braintree/transparent_redirect_gateway.rb +0 -105
  304. data/spec/hacks/tcp_socket.rb +0 -18
  305. data/spec/integration/braintree/coinbase_spec.rb +0 -34
  306. data/spec/integration/braintree/masterpass_card_spec.rb +0 -97
  307. data/spec/integration/braintree/transparent_redirect_spec.rb +0 -268
  308. data/spec/unit/braintree/transparent_redirect_spec.rb +0 -223
@@ -0,0 +1,42 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
+
3
+ describe Braintree::ExchangeRateQuoteInput do
4
+ let(:exchange_rate_quote_input) do
5
+ {
6
+ base_currency: "USD",
7
+ quote_currency: "EUR",
8
+ base_amount: "10.00",
9
+ markup: "2.00"
10
+ }
11
+ end
12
+
13
+ describe "#initialize" do
14
+ it "initialize and sets the input keys to attrs variable" do
15
+ quote_input = described_class.new(exchange_rate_quote_input)
16
+
17
+ expect(quote_input.attrs).to include(:base_currency)
18
+ expect(quote_input.attrs).to include(:quote_currency)
19
+ expect(quote_input.attrs).to include(:base_amount)
20
+ expect(quote_input.attrs).to include(:markup)
21
+ expect(quote_input.attrs.length).to eq(4)
22
+ end
23
+ end
24
+
25
+ describe "inspect" do
26
+ it "includes the base_currency first" do
27
+ output = described_class.new(base_currency: "USD").inspect
28
+
29
+ expect(output).to include("#<Braintree::ExchangeRateQuoteInput base_currency:\"USD\">")
30
+ end
31
+
32
+ it "includes all quote input attributes" do
33
+ quote_input = described_class.new(exchange_rate_quote_input)
34
+ output = quote_input.inspect
35
+
36
+ expect(output).to include("base_currency:\"USD\"")
37
+ expect(output).to include("quote_currency:\"EUR\"")
38
+ expect(output).to include("base_amount:\"10.00\"")
39
+ expect(output).to include("markup:\"2.00\"")
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,82 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
+
3
+ describe Braintree::ExchangeRateQuoteRequest do
4
+ describe "#initialize" do
5
+ it "creates and validates the exchange rate quote request" do
6
+ req = Braintree::ExchangeRateQuoteRequest.new(
7
+ :quotes => [
8
+ {
9
+ :base_currency => "USD",
10
+ :quote_currency => "EUR",
11
+ :base_amount => "10.00",
12
+ :markup => "2.00"
13
+ },
14
+ {
15
+ :base_currency => "EUR",
16
+ :quote_currency => "GBP",
17
+ :base_amount => "20.00",
18
+ :markup => "4.00"
19
+ }
20
+ ],
21
+ )
22
+
23
+ expect(req.quotes[0].base_currency).to eq("USD")
24
+ expect(req.quotes[0].quote_currency).to eq("EUR")
25
+ expect(req.quotes[0].base_amount).to eq("10.00")
26
+ expect(req.quotes[0].markup).to eq("2.00")
27
+
28
+ expect(req.quotes[1].base_currency).to eq("EUR")
29
+ expect(req.quotes[1].quote_currency).to eq("GBP")
30
+ expect(req.quotes[1].base_amount).to eq("20.00")
31
+ expect(req.quotes[1].markup).to eq("4.00")
32
+ end
33
+
34
+ it "creates and validates the exchange rate quote request without amount and markup" do
35
+ req = Braintree::ExchangeRateQuoteRequest.new(
36
+ :quotes => [
37
+ {
38
+ :base_currency => "USD",
39
+ :quote_currency => "EUR",
40
+ },
41
+ {
42
+ :base_currency => "EUR",
43
+ :quote_currency => "GBP",
44
+ }
45
+ ],
46
+ )
47
+
48
+ expect(req.quotes[0].base_currency).to eq("USD")
49
+ expect(req.quotes[0].quote_currency).to eq("EUR")
50
+ expect(req.quotes[0].base_amount).to be_nil
51
+ expect(req.quotes[0].markup).to be_nil
52
+
53
+ expect(req.quotes[1].base_currency).to eq("EUR")
54
+ expect(req.quotes[1].quote_currency).to eq("GBP")
55
+ expect(req.quotes[1].base_amount).to be_nil
56
+ expect(req.quotes[1].markup).to be_nil
57
+ end
58
+
59
+ end
60
+
61
+ describe "inspect" do
62
+ it "prints the attributes" do
63
+ exchange_rate_req = Braintree::ExchangeRateQuoteRequest.new(
64
+ :quotes => [
65
+ {
66
+ :base_currency => "USD",
67
+ :quote_currency => "EUR",
68
+ :base_amount => "10.00",
69
+ :markup => "2.00"
70
+ },
71
+ {
72
+ :base_currency => "EUR",
73
+ :quote_currency => "GBP",
74
+ :base_amount => "20.00",
75
+ :markup => "4.00"
76
+ }
77
+ ],
78
+ )
79
+ expect(exchange_rate_req.inspect).to eq(%(#<Braintree::ExchangeRateQuoteRequest quotes:[#<Braintree::ExchangeRateQuoteInput base_currency:"USD" quote_currency:"EUR" base_amount:"10.00" markup:"2.00">, #<Braintree::ExchangeRateQuoteInput base_currency:"EUR" quote_currency:"GBP" base_amount:"20.00" markup:"4.00">]>))
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,52 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
+
3
+ describe Braintree::ExchangeRateQuoteResponse do
4
+ describe "#initialize" do
5
+ it "creates and validated the exchange rate quote payload" do
6
+ quote_payload = Braintree::ExchangeRateQuoteResponse.new(
7
+ quotes: [
8
+ {
9
+ :base_amount => "10.00",
10
+ :quote_amount => "9.03",
11
+ :exchange_rate => "0.90"
12
+ },
13
+ {
14
+ :base_amount => "20.00",
15
+ :quote_amount => "18.06",
16
+ :exchange_rate => "0.90"
17
+ }
18
+ ],
19
+ )
20
+
21
+ quote_1 = quote_payload.quotes[0]
22
+ quote_2 = quote_payload.quotes[1]
23
+
24
+ expect(quote_1.base_amount).to eq("10.00")
25
+ expect(quote_1.quote_amount).to eq("9.03")
26
+ expect(quote_1.exchange_rate).to eq("0.90")
27
+
28
+ expect(quote_2.base_amount).to eq("20.00")
29
+ expect(quote_2.quote_amount).to eq("18.06")
30
+ expect(quote_1.exchange_rate).to eq("0.90")
31
+ end
32
+ end
33
+
34
+ describe "inspect" do
35
+ it "prints the attributes" do
36
+ exchange_rate_quote_payload = Braintree::ExchangeRateQuoteResponse.new(
37
+ quotes: [
38
+ {
39
+ :base_amount => "10.00",
40
+ :quote_amount => "9.03"
41
+ },
42
+ {
43
+ :base_amount => "20.00",
44
+ :quote_amount => "18.06"
45
+ }
46
+ ],
47
+ )
48
+
49
+ expect(exchange_rate_quote_payload.inspect).to eq(%(#<Braintree::ExchangeRateQuoteResponse quotes:[#<Braintree::ExchangeRateQuote base_amount:"10.00" quote_amount:"9.03">, #<Braintree::ExchangeRateQuote base_amount:"20.00" quote_amount:"18.06">]>))
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,42 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
+
3
+ describe Braintree::ExchangeRateQuote do
4
+ let(:rate_quote) do
5
+ {
6
+ id: "1234",
7
+ base_amount: "10.00",
8
+ exchange_rate: "74",
9
+ quote_amount: "740"
10
+ }
11
+ end
12
+
13
+ describe "#initialize" do
14
+ it "initialize and sets the input keys to attrs variable" do
15
+ quote = described_class.new(rate_quote)
16
+
17
+ expect(quote.attrs).to include(:id)
18
+ expect(quote.attrs).to include(:base_amount)
19
+ expect(quote.attrs).to include(:exchange_rate)
20
+ expect(quote.attrs).to include(:quote_amount)
21
+ expect(quote.attrs.length).to eq(4)
22
+ end
23
+ end
24
+
25
+ describe "inspect" do
26
+ it "includes the id first" do
27
+ output = described_class.new(id: "1234").inspect
28
+
29
+ expect(output).to include("#<Braintree::ExchangeRateQuote id:\"1234\">")
30
+ end
31
+
32
+ it "includes all quote attributes" do
33
+ quote = described_class.new(rate_quote)
34
+ output = quote.inspect
35
+
36
+ expect(output).to include("id:\"1234\"")
37
+ expect(output).to include("base_amount:\"10.00\"")
38
+ expect(output).to include("exchange_rate:\"74\"")
39
+ expect(output).to include("quote_amount:\"740\"")
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,23 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
+
3
+ describe ::Braintree::ExchangeRate do
4
+ let(:rate_quote) do
5
+ {
6
+ id: "1234",
7
+ base_amount: "10.00",
8
+ exchange_rate: "74",
9
+ quote_amount: "740"
10
+ }
11
+ end
12
+
13
+ describe "#initialize" do
14
+ it "initialize and sets the attributes" do
15
+ exchange_rate = described_class.new(:gateway, rate_quote).inspect
16
+
17
+ expect(exchange_rate).to include("@id=\"1234\"")
18
+ expect(exchange_rate).to include("@base_amount=\"10.00\"")
19
+ expect(exchange_rate).to include("@exchange_rate=\"74\"")
20
+ expect(exchange_rate).to include("@quote_amount=\"740\"")
21
+ end
22
+ end
23
+ end
@@ -15,7 +15,7 @@ END
15
15
  [Braintree] <last-name>Doe</last-name>
16
16
  [Braintree] </customer>
17
17
  END
18
- Braintree::Http.new(:config)._format_and_sanitize_body_for_log(input_xml).should == expected_xml
18
+ expect(Braintree::Http.new(:config)._format_and_sanitize_body_for_log(input_xml)).to eq(expected_xml)
19
19
  end
20
20
 
21
21
  it "sanitizes credit card number and cvv" do
@@ -25,6 +25,7 @@ END
25
25
  <last-name>Doe</last-name>
26
26
  <number>1234560000001234</number>
27
27
  <cvv>123</cvv>
28
+ <encrypted-card-data>8F34DFB312DC79C24FD5320622F3E11682D79E6B0C0FD881</encrypted-card-data>
28
29
  </customer>
29
30
  END
30
31
 
@@ -34,9 +35,10 @@ END
34
35
  [Braintree] <last-name>Doe</last-name>
35
36
  [Braintree] <number>123456******1234</number>
36
37
  [Braintree] <cvv>***</cvv>
38
+ [Braintree] <encrypted-card-data>***</encrypted-card-data>
37
39
  [Braintree] </customer>
38
40
  END
39
- Braintree::Http.new(:config)._format_and_sanitize_body_for_log(input_xml).should == expected_xml
41
+ expect(Braintree::Http.new(:config)._format_and_sanitize_body_for_log(input_xml)).to eq(expected_xml)
40
42
  end
41
43
 
42
44
  it "sanitizes credit card number and cvv with newlines" do
@@ -57,7 +59,7 @@ END
57
59
  [Braintree] <cvv>***</cvv>
58
60
  [Braintree] </customer>
59
61
  END
60
- Braintree::Http.new(:config)._format_and_sanitize_body_for_log(input_xml).should == expected_xml
62
+ expect(Braintree::Http.new(:config)._format_and_sanitize_body_for_log(input_xml)).to eq(expected_xml)
61
63
  end
62
64
  end
63
65
 
@@ -67,7 +69,7 @@ END
67
69
  :proxy_address => "localhost",
68
70
  :proxy_port => 8080,
69
71
  :proxy_user => "user",
70
- :proxy_pass => "test"
72
+ :proxy_pass => "test",
71
73
  )
72
74
 
73
75
  http = Braintree::Http.new(config)
@@ -75,10 +77,10 @@ END
75
77
  "Net::HTTP",
76
78
  :open_timeout= => nil,
77
79
  :read_timeout= => nil,
78
- :start => nil
80
+ :start => nil,
79
81
  )
80
82
 
81
- Net::HTTP.should_receive(:new).with(nil, nil, "localhost", 8080, "user", "test").and_return(net_http_instance)
83
+ expect(Net::HTTP).to receive(:new).with(nil, nil, "localhost", 8080, "user", "test").and_return(net_http_instance)
82
84
 
83
85
  http._http_do("GET", "/plans")
84
86
  end
@@ -86,7 +88,7 @@ END
86
88
  it "accepts a partially specified proxy" do
87
89
  config = Braintree::Configuration.new(
88
90
  :proxy_address => "localhost",
89
- :proxy_port => 8080
91
+ :proxy_port => 8080,
90
92
  )
91
93
 
92
94
  http = Braintree::Http.new(config)
@@ -94,10 +96,10 @@ END
94
96
  "Net::HTTP",
95
97
  :open_timeout= => nil,
96
98
  :read_timeout= => nil,
97
- :start => nil
99
+ :start => nil,
98
100
  )
99
101
 
100
- Net::HTTP.should_receive(:new).with(nil, nil, "localhost", 8080, nil, nil).and_return(net_http_instance)
102
+ expect(Net::HTTP).to receive(:new).with(nil, nil, "localhost", 8080, nil, nil).and_return(net_http_instance)
101
103
 
102
104
  http._http_do("GET", "/plans")
103
105
  end
@@ -109,17 +111,17 @@ END
109
111
  "Net::HTTP",
110
112
  :open_timeout= => nil,
111
113
  :read_timeout= => nil,
112
- :start => nil
114
+ :start => nil,
113
115
  )
114
116
 
115
- Net::HTTP.should_receive(:new).with(nil, nil).and_return(net_http_instance)
117
+ expect(Net::HTTP).to receive(:new).with(nil, nil).and_return(net_http_instance)
116
118
 
117
119
  http._http_do("GET", "/plans")
118
120
  end
119
121
  end
120
122
 
121
123
  describe "_compose_headers" do
122
- before (:each) do
124
+ before(:each) do
123
125
  config = Braintree::Configuration.new
124
126
  @http = Braintree::Http.new(config)
125
127
  end
@@ -130,7 +132,7 @@ END
130
132
  expect(default_headers["Accept-Encoding"]).to eq("gzip")
131
133
  expect(default_headers["Content-Type"]).to eq("application/xml")
132
134
  expect(default_headers["User-Agent"]).to match(/Braintree Ruby Gem .*/)
133
- expect(default_headers["X-ApiVersion"]).to eq("5")
135
+ expect(default_headers["X-ApiVersion"]).to eq("6")
134
136
  end
135
137
 
136
138
  it "overwrites defaults with override headers" do
@@ -144,7 +146,7 @@ END
144
146
  expect(headers["Authorization"]).to eq("token")
145
147
  expect(headers["Content-Type"]).to eq("application/xml")
146
148
  expect(headers["User-Agent"]).to match(/Braintree Ruby Gem .*/)
147
- expect(headers["X-ApiVersion"]).to eq("5")
149
+ expect(headers["X-ApiVersion"]).to eq("6")
148
150
  end
149
151
 
150
152
  it "extends default headers when new headers are specified" do
@@ -156,7 +158,7 @@ END
156
158
  expect(headers["Accept-Encoding"]).to eq("gzip")
157
159
  expect(headers["Content-Type"]).to eq("application/xml")
158
160
  expect(headers["User-Agent"]).to match(/Braintree Ruby Gem .*/)
159
- expect(headers["X-ApiVersion"]).to eq("5")
161
+ expect(headers["X-ApiVersion"]).to eq("6")
160
162
  expect(headers["New-Header"]).to eq("New Value")
161
163
  end
162
164
  end
@@ -183,13 +185,13 @@ END
183
185
 
184
186
  describe "_build_query_string" do
185
187
  it "returns an empty string for empty query params" do
186
- Braintree::Http.new(:config)._build_query_string({}).should == ""
188
+ expect(Braintree::Http.new(:config)._build_query_string({})).to eq("")
187
189
  end
188
190
 
189
191
  it "returns a proper query string for non-nested hashes" do
190
192
  query_params = {:one => 1, :two => 2}
191
193
 
192
- Braintree::Http.new(:config)._build_query_string(query_params).should =~ /^\?(one=1&two=2|two=2&one=1)$/
194
+ expect(Braintree::Http.new(:config)._build_query_string(query_params)).to match(/^\?(one=1&two=2|two=2&one=1)$/)
193
195
  end
194
196
 
195
197
  it "raises ArgumentError for nested hashes" do
@@ -12,8 +12,11 @@ describe Braintree::LocalPaymentCompleted do
12
12
  describe "self._new" do
13
13
  it "initializes the object with the appropriate attributes set" do
14
14
  params = {
15
- payment_id: "a-payment-id",
15
+ bic: "a-bic",
16
+ iban_last_chars: "1234",
16
17
  payer_id: "a-payer-id",
18
+ payer_name: "John Doe",
19
+ payment_id: "a-payment-id",
17
20
  payment_method_nonce: "a-nonce",
18
21
  transaction: {
19
22
  id: "a-transaction-id",
@@ -24,13 +27,64 @@ describe Braintree::LocalPaymentCompleted do
24
27
  }
25
28
  local_payment_completed = Braintree::LocalPaymentCompleted._new(params)
26
29
 
27
- local_payment_completed.payment_id.should eq("a-payment-id")
28
- local_payment_completed.payer_id.should eq("a-payer-id")
29
- local_payment_completed.payment_method_nonce.should eq("a-nonce")
30
- local_payment_completed.transaction.id.should eq("a-transaction-id")
31
- local_payment_completed.transaction.amount.should eq(31.0)
32
- local_payment_completed.transaction.order_id.should eq("an-order-id")
33
- local_payment_completed.transaction.status.should eq(Braintree::Transaction::Status::Authorized)
30
+ expect(local_payment_completed.bic).to eq("a-bic")
31
+ expect(local_payment_completed.iban_last_chars).to eq("1234")
32
+ expect(local_payment_completed.payer_id).to eq("a-payer-id")
33
+ expect(local_payment_completed.payer_name).to eq("John Doe")
34
+ expect(local_payment_completed.payment_id).to eq("a-payment-id")
35
+ expect(local_payment_completed.payment_method_nonce).to eq("a-nonce")
36
+ expect(local_payment_completed.transaction.amount).to eq(31.0)
37
+ expect(local_payment_completed.transaction.id).to eq("a-transaction-id")
38
+ expect(local_payment_completed.transaction.order_id).to eq("an-order-id")
39
+ expect(local_payment_completed.transaction.status).to eq(Braintree::Transaction::Status::Authorized)
40
+ end
41
+
42
+ it "initializes the object with the appropriate attributes set if no transaction is provided" do
43
+ params = {
44
+ bic: "a-bic",
45
+ iban_last_chars: "1234",
46
+ payer_id: "a-payer-id",
47
+ payer_name: "John Doe",
48
+ payment_id: "a-payment-id",
49
+ payment_method_nonce: "a-nonce",
50
+ }
51
+ local_payment_completed = Braintree::LocalPaymentCompleted._new(params)
52
+
53
+ expect(local_payment_completed.bic).to eq("a-bic")
54
+ expect(local_payment_completed.blik_aliases).to be_nil
55
+ expect(local_payment_completed.iban_last_chars).to eq("1234")
56
+ expect(local_payment_completed.payer_id).to eq("a-payer-id")
57
+ expect(local_payment_completed.payer_name).to eq("John Doe")
58
+ expect(local_payment_completed.payment_id).to eq("a-payment-id")
59
+ expect(local_payment_completed.payment_method_nonce).to eq("a-nonce")
60
+ expect(local_payment_completed.transaction).to be_nil
61
+ end
62
+
63
+ it "initializes the object with the appropriate attributes when blik_aliases is provided" do
64
+ params = {
65
+ bic: "a-bic",
66
+ blik_aliases: [
67
+ {
68
+ key: "an-alias-key",
69
+ label: "an-alias-label"
70
+ }
71
+ ],
72
+ iban_last_chars: "1234",
73
+ payer_id: "a-payer-id",
74
+ payer_name: "John Doe",
75
+ payment_id: "a-payment-id",
76
+ payment_method_nonce: "a-nonce",
77
+ }
78
+ local_payment_completed = Braintree::LocalPaymentCompleted._new(params)
79
+
80
+ expect(local_payment_completed.bic).to eq("a-bic")
81
+ expect(local_payment_completed.blik_aliases).to match_array([{key: "an-alias-key", label: "an-alias-label"}])
82
+ expect(local_payment_completed.iban_last_chars).to eq("1234")
83
+ expect(local_payment_completed.payer_id).to eq("a-payer-id")
84
+ expect(local_payment_completed.payer_name).to eq("John Doe")
85
+ expect(local_payment_completed.payment_id).to eq("a-payment-id")
86
+ expect(local_payment_completed.payment_method_nonce).to eq("a-nonce")
87
+ expect(local_payment_completed.transaction).to be_nil
34
88
  end
35
89
  end
36
90
  end
@@ -0,0 +1,24 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
+
3
+ describe Braintree::LocalPaymentExpired do
4
+ describe "self.new" do
5
+ it "is protected" do
6
+ expect do
7
+ Braintree::LocalPaymentExpired.new
8
+ end.to raise_error(NoMethodError, /protected method .new/)
9
+ end
10
+ end
11
+
12
+ describe "self._new" do
13
+ it "initializes the object with the appropriate attributes set" do
14
+ params = {
15
+ payment_id: "a-payment-id",
16
+ payment_context_id: "a-payment-context-id",
17
+ }
18
+ local_payment_expired = Braintree::LocalPaymentExpired._new(params)
19
+
20
+ expect(local_payment_expired.payment_id).to eq("a-payment-id")
21
+ expect(local_payment_expired.payment_context_id).to eq("a-payment-context-id")
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,34 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
+
3
+ describe Braintree::LocalPaymentFunded do
4
+ describe "self.new" do
5
+ it "is protected" do
6
+ expect do
7
+ Braintree::LocalPaymentFunded.new
8
+ end.to raise_error(NoMethodError, /protected method .new/)
9
+ end
10
+ end
11
+
12
+ describe "self._new" do
13
+ it "initializes the object with the appropriate attributes set" do
14
+ params = {
15
+ payment_id: "a-payment-id",
16
+ payment_context_id: "a-payment-context-id",
17
+ transaction: {
18
+ id: "a-transaction-id",
19
+ amount: "31.00",
20
+ order_id: "an-order-id",
21
+ status: Braintree::Transaction::Status::Settled,
22
+ },
23
+ }
24
+ local_payment_funded = Braintree::LocalPaymentFunded._new(params)
25
+
26
+ expect(local_payment_funded.payment_id).to eq("a-payment-id")
27
+ expect(local_payment_funded.payment_context_id).to eq("a-payment-context-id")
28
+ expect(local_payment_funded.transaction.id).to eq("a-transaction-id")
29
+ expect(local_payment_funded.transaction.amount).to eq(31.0)
30
+ expect(local_payment_funded.transaction.order_id).to eq("an-order-id")
31
+ expect(local_payment_funded.transaction.status).to eq(Braintree::Transaction::Status::Settled)
32
+ end
33
+ end
34
+ end
@@ -5,7 +5,7 @@ describe Braintree::MerchantAccount do
5
5
  it "is a string representation of the merchant account" do
6
6
  account = Braintree::MerchantAccount._new(nil, :id => "merchant_account", :status => "active", :master_merchant_account => nil)
7
7
 
8
- account.inspect.should == "#<Braintree::MerchantAccount: id: \"merchant_account\", status: \"active\", master_merchant_account: nil>"
8
+ expect(account.inspect).to eq("#<Braintree::MerchantAccount: id: \"merchant_account\", status: \"active\", master_merchant_account: nil>")
9
9
  end
10
10
 
11
11
  it "handles a master merchant account" do
@@ -13,20 +13,20 @@ describe Braintree::MerchantAccount do
13
13
  nil,
14
14
  :id => "merchant_account",
15
15
  :status => "active",
16
- :master_merchant_account => {:id => "master_merchant_account", :status => "active", :master_merchant_account => nil}
16
+ :master_merchant_account => {:id => "master_merchant_account", :status => "active", :master_merchant_account => nil},
17
17
  )
18
18
 
19
19
  master_merchant_account = "#<Braintree::MerchantAccount: id: \"master_merchant_account\", status: \"active\", master_merchant_account: nil>"
20
- account.inspect.should == "#<Braintree::MerchantAccount: id: \"merchant_account\", status: \"active\", master_merchant_account: #{master_merchant_account}>"
20
+ expect(account.inspect).to eq("#<Braintree::MerchantAccount: id: \"merchant_account\", status: \"active\", master_merchant_account: #{master_merchant_account}>")
21
21
  end
22
22
  end
23
23
 
24
24
  describe "default?" do
25
25
  it "is an alias of default" do
26
26
  account = Braintree::MerchantAccount._new(nil, :default => false)
27
- account.default?.should == false
27
+ expect(account.default?).to eq(false)
28
28
  account = Braintree::MerchantAccount._new(nil, :default => true)
29
- account.default?.should == true
29
+ expect(account.default?).to eq(true)
30
30
  end
31
31
  end
32
32
  end
@@ -0,0 +1,60 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
+
3
+ describe Braintree::Transaction::MetaCheckoutCardDetails do
4
+ let(:attributes) do {
5
+
6
+ :bin => "abc1234",
7
+ :container_id => "a-container-id",
8
+ :card_type => "Visa",
9
+ :cardholder_name => "Meta Checkout Card CardHolder",
10
+ :commercial => "NO",
11
+ :country_of_issuance => "US",
12
+ :created_at => "2023-05-05T21:28:37Z",
13
+ :debit => "NO",
14
+ :durbin_regulated => "NO",
15
+ :expiration_month => "05",
16
+ :expiration_year => "2024",
17
+ :healthcare => "NO",
18
+ :last_4 => "1234",
19
+ :payroll => "NO",
20
+ :prepaid => "NO",
21
+ :token => "token1",
22
+ :unique_number_identifier => "abc1234",
23
+ :updated_at => "2023-05-05T21:28:37Z"
24
+ }
25
+ end
26
+
27
+ describe "unit tests" do
28
+ it "initializes with the correct attributes" do
29
+ card = Braintree::Transaction::MetaCheckoutCardDetails.new(attributes)
30
+
31
+ card.bin.should == "abc1234"
32
+ card.container_id.should == "a-container-id"
33
+ card.card_type.should == "Visa"
34
+ card.cardholder_name.should == "Meta Checkout Card CardHolder"
35
+ card.commercial == "NO"
36
+ card.country_of_issuance == "US"
37
+ card.created_at == "2023-05-05T21:28:37Z"
38
+ card.updated_at == "2023-05-05T21:28:37Z"
39
+ card.debit == "NO"
40
+ card.payroll == "NO"
41
+ card.prepaid == "NO"
42
+ card.healthcare == "NO"
43
+ card.token == "token1"
44
+ card.unique_number_identifier == "abc1234"
45
+ card.expiration_month.should == "05"
46
+ card.expiration_year.should == "2024"
47
+ card.last_4.should == "1234"
48
+ end
49
+
50
+ it "sets expiration date correctly" do
51
+ card = Braintree::Transaction::MetaCheckoutCardDetails.new(attributes)
52
+ card.expiration_date.should == "05/2024"
53
+ end
54
+
55
+ it "masks the card number correctly" do
56
+ card = Braintree::Transaction::MetaCheckoutCardDetails.new(attributes)
57
+ card.masked_number.should == "abc1234******1234"
58
+ end
59
+ end
60
+ end