braintree 4.13.0 → 4.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/lib/braintree/credit_card.rb +13 -0
  3. data/lib/braintree/credit_card_gateway.rb +15 -3
  4. data/lib/braintree/payment_method_gateway.rb +15 -3
  5. data/lib/braintree/test/nonce.rb +1 -0
  6. data/lib/braintree/test/venmo_sdk.rb +2 -0
  7. data/lib/braintree/transaction/credit_card_details.rb +3 -0
  8. data/lib/braintree/transaction/local_payment_details.rb +2 -0
  9. data/lib/braintree/transaction/payment_receipt/card_present_data.rb +36 -0
  10. data/lib/braintree/transaction/payment_receipt/merchant_address.rb +19 -0
  11. data/lib/braintree/transaction/payment_receipt.rb +31 -0
  12. data/lib/braintree/transaction/us_bank_account_details.rb +1 -0
  13. data/lib/braintree/transaction.rb +7 -4
  14. data/lib/braintree/transaction_gateway.rb +15 -3
  15. data/lib/braintree/transaction_search.rb +6 -5
  16. data/lib/braintree/version.rb +1 -1
  17. data/lib/braintree/webhook_notification.rb +1 -0
  18. data/lib/braintree/webhook_testing_gateway.rb +17 -0
  19. data/lib/braintree.rb +3 -0
  20. data/spec/integration/braintree/add_on_spec.rb +9 -9
  21. data/spec/integration/braintree/address_spec.rb +69 -69
  22. data/spec/integration/braintree/advanced_search_spec.rb +45 -45
  23. data/spec/integration/braintree/apple_pay_spec.rb +8 -8
  24. data/spec/integration/braintree/client_api/client_token_spec.rb +15 -15
  25. data/spec/integration/braintree/credit_card_spec.rb +223 -223
  26. data/spec/integration/braintree/credit_card_verification_search_spec.rb +16 -16
  27. data/spec/integration/braintree/credit_card_verification_spec.rb +52 -52
  28. data/spec/integration/braintree/customer_search_spec.rb +20 -20
  29. data/spec/integration/braintree/customer_spec.rb +313 -313
  30. data/spec/integration/braintree/disbursement_spec.rb +2 -2
  31. data/spec/integration/braintree/discount_spec.rb +9 -9
  32. data/spec/integration/braintree/dispute_spec.rb +87 -87
  33. data/spec/integration/braintree/document_upload_spec.rb +17 -17
  34. data/spec/integration/braintree/error_codes_spec.rb +2 -2
  35. data/spec/integration/braintree/http_spec.rb +28 -28
  36. data/spec/integration/braintree/merchant_account_spec.rb +127 -127
  37. data/spec/integration/braintree/merchant_spec.rb +103 -103
  38. data/spec/integration/braintree/oauth_spec.rb +61 -61
  39. data/spec/integration/braintree/payment_method_nonce_spec.rb +73 -73
  40. data/spec/integration/braintree/payment_method_spec.rb +389 -389
  41. data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +78 -78
  42. data/spec/integration/braintree/paypal_account_spec.rb +38 -38
  43. data/spec/integration/braintree/plan_spec.rb +15 -15
  44. data/spec/integration/braintree/samsung_pay_card_spec.rb +65 -65
  45. data/spec/integration/braintree/sepa_direct_debit_account_spec.rb +51 -51
  46. data/spec/integration/braintree/settlement_batch_summary_spec.rb +11 -11
  47. data/spec/integration/braintree/subscription_spec.rb +364 -364
  48. data/spec/integration/braintree/test/transaction_amounts_spec.rb +2 -2
  49. data/spec/integration/braintree/test_transaction_spec.rb +19 -19
  50. data/spec/integration/braintree/transaction_line_item_spec.rb +6 -6
  51. data/spec/integration/braintree/transaction_search_spec.rb +198 -165
  52. data/spec/integration/braintree/transaction_spec.rb +1319 -1151
  53. data/spec/integration/braintree/transaction_us_bank_account_spec.rb +32 -32
  54. data/spec/integration/braintree/us_bank_account_spec.rb +30 -30
  55. data/spec/integration/braintree/us_bank_account_verification_search_spec.rb +18 -18
  56. data/spec/integration/braintree/us_bank_account_verification_spec.rb +33 -33
  57. data/spec/integration/braintree/visa_checkout_card_spec.rb +57 -57
  58. data/spec/spec_helper.rb +9 -8
  59. data/spec/unit/braintree/address_spec.rb +8 -8
  60. data/spec/unit/braintree/base_module_spec.rb +4 -4
  61. data/spec/unit/braintree/client_token_spec.rb +2 -2
  62. data/spec/unit/braintree/configuration_spec.rb +57 -57
  63. data/spec/unit/braintree/credentials_parser_spec.rb +6 -6
  64. data/spec/unit/braintree/credit_card_spec.rb +31 -29
  65. data/spec/unit/braintree/credit_card_verification_gateway_spec.rb +28 -28
  66. data/spec/unit/braintree/credit_card_verification_search_spec.rb +9 -9
  67. data/spec/unit/braintree/credit_card_verification_spec.rb +17 -17
  68. data/spec/unit/braintree/customer_spec.rb +41 -40
  69. data/spec/unit/braintree/digest_spec.rb +5 -5
  70. data/spec/unit/braintree/disbursement_spec.rb +11 -11
  71. data/spec/unit/braintree/dispute_search_spec.rb +2 -2
  72. data/spec/unit/braintree/dispute_spec.rb +56 -56
  73. data/spec/unit/braintree/document_upload_spec.rb +8 -8
  74. data/spec/unit/braintree/enriched_customer_data_spec.rb +2 -2
  75. data/spec/unit/braintree/error_result_spec.rb +5 -5
  76. data/spec/unit/braintree/errors_spec.rb +9 -9
  77. data/spec/unit/braintree/http_spec.rb +8 -8
  78. data/spec/unit/braintree/local_payment_completed_spec.rb +11 -11
  79. data/spec/unit/braintree/local_payment_expired_spec.rb +2 -2
  80. data/spec/unit/braintree/local_payment_funded_spec.rb +6 -6
  81. data/spec/unit/braintree/merchant_account_spec.rb +4 -4
  82. data/spec/unit/braintree/modification_spec.rb +1 -1
  83. data/spec/unit/braintree/payment_method_customer_data_updated_metadata_spec.rb +6 -6
  84. data/spec/unit/braintree/payment_method_nonce_details_payer_info_spec.rb +7 -7
  85. data/spec/unit/braintree/payment_method_nonce_details_spec.rb +14 -14
  86. data/spec/unit/braintree/payment_method_spec.rb +19 -19
  87. data/spec/unit/braintree/paypal_account_spec.rb +4 -4
  88. data/spec/unit/braintree/resource_collection_spec.rb +7 -7
  89. data/spec/unit/braintree/sepa_debit_account_nonce_details_spec.rb +1 -1
  90. data/spec/unit/braintree/sha256_digest_spec.rb +1 -1
  91. data/spec/unit/braintree/signature_service_spec.rb +2 -2
  92. data/spec/unit/braintree/subscription_search_spec.rb +17 -17
  93. data/spec/unit/braintree/subscription_spec.rb +8 -8
  94. data/spec/unit/braintree/successful_result_spec.rb +5 -5
  95. data/spec/unit/braintree/three_d_secure_info_spec.rb +20 -20
  96. data/spec/unit/braintree/transaction/credit_card_details_spec.rb +5 -5
  97. data/spec/unit/braintree/transaction/customer_details_spec.rb +1 -1
  98. data/spec/unit/braintree/transaction/deposit_details_spec.rb +2 -2
  99. data/spec/unit/braintree/transaction/local_payment_details_spec.rb +30 -0
  100. data/spec/unit/braintree/transaction/payment_receipt_spec.rb +73 -0
  101. data/spec/unit/braintree/transaction_gateway_spec.rb +9 -6
  102. data/spec/unit/braintree/transaction_search_spec.rb +2 -2
  103. data/spec/unit/braintree/transaction_spec.rb +101 -93
  104. data/spec/unit/braintree/unknown_payment_method_spec.rb +4 -4
  105. data/spec/unit/braintree/us_bank_account_spec.rb +2 -2
  106. data/spec/unit/braintree/us_bank_account_verification_search_spec.rb +7 -7
  107. data/spec/unit/braintree/us_bank_account_verification_spec.rb +7 -7
  108. data/spec/unit/braintree/util_spec.rb +27 -27
  109. data/spec/unit/braintree/validation_error_collection_spec.rb +34 -34
  110. data/spec/unit/braintree/validation_error_spec.rb +4 -4
  111. data/spec/unit/braintree/venmo_profile_data_spec.rb +5 -5
  112. data/spec/unit/braintree/webhook_notification_spec.rb +206 -191
  113. data/spec/unit/braintree/xml/libxml_spec.rb +5 -5
  114. data/spec/unit/braintree/xml/parser_spec.rb +8 -8
  115. data/spec/unit/braintree/xml/rexml_spec.rb +5 -5
  116. data/spec/unit/braintree/xml_spec.rb +17 -17
  117. data/spec/unit/braintree_spec.rb +2 -2
  118. metadata +7 -2
@@ -10,7 +10,7 @@ describe Braintree::Test::TransactionAmounts do
10
10
  :expiration_date => "12/2012"
11
11
  },
12
12
  )
13
- transaction.status.should == Braintree::Transaction::Status::Authorized
13
+ expect(transaction.status).to eq(Braintree::Transaction::Status::Authorized)
14
14
  end
15
15
  end
16
16
 
@@ -23,7 +23,7 @@ describe Braintree::Test::TransactionAmounts do
23
23
  :expiration_date => "12/2012"
24
24
  },
25
25
  )
26
- result.transaction.status.should == Braintree::Transaction::Status::ProcessorDeclined
26
+ expect(result.transaction.status).to eq(Braintree::Transaction::Status::ProcessorDeclined)
27
27
  end
28
28
  end
29
29
  end
@@ -11,12 +11,12 @@ describe Braintree::TestTransaction do
11
11
  :submit_for_settlement => true
12
12
  },
13
13
  )
14
- sale_result.success?.should == true
15
- sale_result.transaction.status.should == Braintree::Transaction::Status::SubmittedForSettlement
14
+ expect(sale_result.success?).to eq(true)
15
+ expect(sale_result.transaction.status).to eq(Braintree::Transaction::Status::SubmittedForSettlement)
16
16
 
17
17
  settle_result = Braintree::TestTransaction.settle(sale_result.transaction.id)
18
- settle_result.transaction.status.should == Braintree::Transaction::Status::Settled
19
- settle_result.success?.should == true
18
+ expect(settle_result.transaction.status).to eq(Braintree::Transaction::Status::Settled)
19
+ expect(settle_result.success?).to eq(true)
20
20
  end
21
21
 
22
22
  it "changes transaction status to settlement_confirmed" do
@@ -27,12 +27,12 @@ describe Braintree::TestTransaction do
27
27
  :submit_for_settlement => true
28
28
  },
29
29
  )
30
- sale_result.success?.should == true
31
- sale_result.transaction.status.should == Braintree::Transaction::Status::SubmittedForSettlement
30
+ expect(sale_result.success?).to eq(true)
31
+ expect(sale_result.transaction.status).to eq(Braintree::Transaction::Status::SubmittedForSettlement)
32
32
 
33
33
  settle_result = Braintree::TestTransaction.settlement_confirm(sale_result.transaction.id)
34
- settle_result.transaction.status.should == Braintree::Transaction::Status::SettlementConfirmed
35
- settle_result.success?.should == true
34
+ expect(settle_result.transaction.status).to eq(Braintree::Transaction::Status::SettlementConfirmed)
35
+ expect(settle_result.success?).to eq(true)
36
36
  end
37
37
 
38
38
  it "changes transaction status to settlement_declined" do
@@ -43,12 +43,12 @@ describe Braintree::TestTransaction do
43
43
  :submit_for_settlement => true
44
44
  },
45
45
  )
46
- sale_result.success?.should == true
47
- sale_result.transaction.status.should == Braintree::Transaction::Status::SubmittedForSettlement
46
+ expect(sale_result.success?).to eq(true)
47
+ expect(sale_result.transaction.status).to eq(Braintree::Transaction::Status::SubmittedForSettlement)
48
48
 
49
49
  settle_result = Braintree::TestTransaction.settlement_decline(sale_result.transaction.id)
50
- settle_result.transaction.status.should == Braintree::Transaction::Status::SettlementDeclined
51
- settle_result.success?.should == true
50
+ expect(settle_result.transaction.status).to eq(Braintree::Transaction::Status::SettlementDeclined)
51
+ expect(settle_result.success?).to eq(true)
52
52
  end
53
53
 
54
54
  it "changes transaction status to settlement_pending" do
@@ -59,12 +59,12 @@ describe Braintree::TestTransaction do
59
59
  :submit_for_settlement => true
60
60
  },
61
61
  )
62
- sale_result.success?.should == true
63
- sale_result.transaction.status.should == Braintree::Transaction::Status::SubmittedForSettlement
62
+ expect(sale_result.success?).to eq(true)
63
+ expect(sale_result.transaction.status).to eq(Braintree::Transaction::Status::SubmittedForSettlement)
64
64
 
65
65
  settle_result = Braintree::TestTransaction.settlement_pending(sale_result.transaction.id)
66
- settle_result.transaction.status.should == Braintree::Transaction::Status::SettlementPending
67
- settle_result.success?.should == true
66
+ expect(settle_result.transaction.status).to eq(Braintree::Transaction::Status::SettlementPending)
67
+ expect(settle_result.success?).to eq(true)
68
68
  end
69
69
 
70
70
  it "returns a validation error when invalid transition is specified" do
@@ -72,11 +72,11 @@ describe Braintree::TestTransaction do
72
72
  :amount => "100",
73
73
  :payment_method_nonce => Braintree::Test::Nonce::VisaCheckoutVisa,
74
74
  )
75
- sale_result.success?.should == true
75
+ expect(sale_result.success?).to eq(true)
76
76
 
77
77
  settle_result = Braintree::TestTransaction.settlement_decline(sale_result.transaction.id)
78
- settle_result.success?.should be(false)
79
- settle_result.errors.for(:transaction).on(:base).first.code.should == Braintree::ErrorCodes::Transaction::CannotSimulateTransactionSettlement
78
+ expect(settle_result.success?).to be(false)
79
+ expect(settle_result.errors.for(:transaction).on(:base).first.code).to eq(Braintree::ErrorCodes::Transaction::CannotSimulateTransactionSettlement)
80
80
  end
81
81
  end
82
82
 
@@ -21,17 +21,17 @@ describe Braintree::TransactionLineItem do
21
21
  },
22
22
  ],
23
23
  )
24
- result.success?.should == true
24
+ expect(result.success?).to eq(true)
25
25
  transaction = result.transaction
26
26
 
27
27
  line_items = Braintree::TransactionLineItem.find_all(transaction.id)
28
28
 
29
29
  line_item = line_items[0]
30
- line_item.quantity.should == BigDecimal("1.0232")
31
- line_item.name.should == "Name #1"
32
- line_item.kind.should == "debit"
33
- line_item.unit_amount.should == BigDecimal("45.1232")
34
- line_item.total_amount.should == BigDecimal("45.15")
30
+ expect(line_item.quantity).to eq(BigDecimal("1.0232"))
31
+ expect(line_item.name).to eq("Name #1")
32
+ expect(line_item.kind).to eq("debit")
33
+ expect(line_item.unit_amount).to eq(BigDecimal("45.1232"))
34
+ expect(line_item.total_amount).to eq(BigDecimal("45.15"))
35
35
  end
36
36
  end
37
37
  end