braintree 2.28.0 → 2.29.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/braintree.rb +1 -0
- data/lib/braintree/digest.rb +1 -1
- data/lib/braintree/disbursement.rb +39 -0
- data/lib/braintree/modification.rb +1 -0
- data/lib/braintree/test/merchant_account.rb +5 -0
- data/lib/braintree/transaction/disbursement_details.rb +5 -1
- data/lib/braintree/transaction_gateway.rb +1 -0
- data/lib/braintree/version.rb +1 -1
- data/lib/braintree/webhook_notification.rb +4 -1
- data/lib/braintree/webhook_testing_gateway.rb +55 -1
- data/spec/httpsd.pid +1 -1
- data/spec/integration/braintree/disbursement_spec.rb +31 -0
- data/spec/integration/braintree/plan_spec.rb +1 -5
- data/spec/integration/braintree/subscription_spec.rb +10 -0
- data/spec/integration/braintree/transaction_spec.rb +22 -0
- data/spec/unit/braintree/disbursement_spec.rb +45 -0
- data/spec/unit/braintree/transaction_spec.rb +4 -2
- data/spec/unit/braintree/webhook_notification_spec.rb +50 -10
- metadata +112 -113
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c4a39949c4ad04830fd50ba8541a0b82f5a1be18
|
4
|
+
data.tar.gz: c32ed9335b5c72c6a6c11efb3bf6f1a0614a2943
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2a9655094854360aa9aae75db3353f34bc5eb642d0bafe457f12ae2f9566616a1f02687b096e408189a04366989c504442d3409237d66f9349d64bda38328b12
|
7
|
+
data.tar.gz: fa69dfd1f607ced6d96801082fa2313ea4a1019ed69f82d6d6cd9edea06d9c77524279ee0126a69b0baf8b6424d147e8236dad8595ff9d57863823c00c1e2207
|
data/lib/braintree.rb
CHANGED
@@ -72,6 +72,7 @@ require "braintree/transaction/subscription_details"
|
|
72
72
|
require "braintree/transaction_gateway"
|
73
73
|
require "braintree/transaction_search"
|
74
74
|
require "braintree/transaction/status_details"
|
75
|
+
require "braintree/disbursement"
|
75
76
|
require "braintree/transparent_redirect"
|
76
77
|
require "braintree/transparent_redirect_gateway"
|
77
78
|
require "braintree/util"
|
data/lib/braintree/digest.rb
CHANGED
@@ -0,0 +1,39 @@
|
|
1
|
+
module Braintree
|
2
|
+
class Disbursement
|
3
|
+
include BaseModule
|
4
|
+
|
5
|
+
attr_reader :id, :amount, :exception_message, :disbursement_date, :follow_up_action, :merchant_account, :transaction_ids, :retry, :success
|
6
|
+
|
7
|
+
def initialize(gateway, attributes) # :nodoc:
|
8
|
+
@gateway = gateway
|
9
|
+
set_instance_variables_from_hash(attributes)
|
10
|
+
@amount = Util.to_big_decimal(amount)
|
11
|
+
@disbursement_date = Date.parse(disbursement_date)
|
12
|
+
@merchant_account = MerchantAccount._new(gateway, @merchant_account)
|
13
|
+
end
|
14
|
+
|
15
|
+
def transactions
|
16
|
+
transactions = @gateway.transaction.search do |search|
|
17
|
+
search.ids.in transaction_ids
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def inspect # :nodoc:
|
22
|
+
nice_attributes = self.class._inspect_attributes.map { |attr| "#{attr}: #{send(attr).inspect}" }
|
23
|
+
nice_attributes << "amount: #{self.amount.to_s("F").inspect}"
|
24
|
+
nice_attributes << "disbursement_date: #{self.disbursement_date.to_s}"
|
25
|
+
"#<#{self.class} #{nice_attributes.join(', ')}>"
|
26
|
+
end
|
27
|
+
|
28
|
+
class << self
|
29
|
+
protected :new
|
30
|
+
def _new(*args) # :nodoc:
|
31
|
+
self.new *args
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def self._inspect_attributes # :nodoc:
|
36
|
+
[:id, :exception_message, :follow_up_action, :merchant_account, :transaction_ids, :retry, :success]
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -2,6 +2,11 @@ module Braintree
|
|
2
2
|
module Test # :nodoc:
|
3
3
|
module MerchantAccount
|
4
4
|
Approve = "approve_me"
|
5
|
+
|
6
|
+
InsufficientFundsContactUs = "insufficient_funds__contact"
|
7
|
+
AccountNotAuthorizedContactUs = "account_not_authorized__contact"
|
8
|
+
BankRejectedUpdateFundingInformation = "bank_rejected__update"
|
9
|
+
BankRejectedNone = "bank_rejected__none"
|
5
10
|
end
|
6
11
|
end
|
7
12
|
end
|
@@ -3,7 +3,7 @@ module Braintree
|
|
3
3
|
class DisbursementDetails # :nodoc:
|
4
4
|
include BaseModule
|
5
5
|
|
6
|
-
attr_reader :disbursement_date, :settlement_amount, :settlement_currency_iso_code, :settlement_currency_exchange_rate
|
6
|
+
attr_reader :disbursement_date, :settlement_amount, :settlement_currency_iso_code, :settlement_currency_exchange_rate, :success
|
7
7
|
|
8
8
|
def initialize(attributes)
|
9
9
|
set_instance_variables_from_hash attributes unless attributes.nil?
|
@@ -13,6 +13,10 @@ module Braintree
|
|
13
13
|
@funds_held
|
14
14
|
end
|
15
15
|
|
16
|
+
def success?
|
17
|
+
@success
|
18
|
+
end
|
19
|
+
|
16
20
|
def valid?
|
17
21
|
!disbursement_date.nil?
|
18
22
|
end
|
@@ -117,6 +117,7 @@ module Braintree
|
|
117
117
|
:amount, :customer_id, :merchant_account_id, :order_id, :channel, :payment_method_token,
|
118
118
|
:purchase_order_number, :recurring, :shipping_address_id, :type, :tax_amount, :tax_exempt,
|
119
119
|
:venmo_sdk_payment_method_code, :device_session_id, :service_fee_amount, :device_data, :fraud_merchant_id,
|
120
|
+
:billing_address_id,
|
120
121
|
{:credit_card => [:token, :cardholder_name, :cvv, :expiration_date, :expiration_month, :expiration_year, :number]},
|
121
122
|
{:customer => [:id, :company, :email, :fax, :first_name, :last_name, :phone, :website]},
|
122
123
|
{
|
data/lib/braintree/version.rb
CHANGED
@@ -5,6 +5,8 @@ module Braintree
|
|
5
5
|
include BaseModule
|
6
6
|
|
7
7
|
module Kind
|
8
|
+
Disbursement = "disbursement"
|
9
|
+
DisbursementException = "disbursement_exception"
|
8
10
|
SubscriptionCanceled = "subscription_canceled"
|
9
11
|
SubscriptionChargedSuccessfully = "subscription_charged_successfully"
|
10
12
|
SubscriptionChargedUnsuccessfully = "subscription_charged_unsuccessfully"
|
@@ -21,7 +23,7 @@ module Braintree
|
|
21
23
|
PartnerMerchantDeclined = "partner_merchant_declined"
|
22
24
|
end
|
23
25
|
|
24
|
-
attr_reader :subscription, :kind, :timestamp, :transaction, :partner_merchant
|
26
|
+
attr_reader :subscription, :kind, :timestamp, :transaction, :partner_merchant, :disbursement
|
25
27
|
|
26
28
|
def self.parse(signature, payload)
|
27
29
|
Configuration.gateway.webhook_notification.parse(signature, payload)
|
@@ -39,6 +41,7 @@ module Braintree
|
|
39
41
|
@partner_merchant = OpenStruct.new(@subject[:partner_merchant]) if @subject.has_key?(:partner_merchant)
|
40
42
|
@subscription = Subscription._new(gateway, @subject[:subscription]) if @subject.has_key?(:subscription)
|
41
43
|
@transaction = Transaction._new(gateway, @subject[:transaction]) if @subject.has_key?(:transaction)
|
44
|
+
@disbursement = Disbursement._new(gateway, @subject[:disbursement]) if @subject.has_key?(:disbursement)
|
42
45
|
end
|
43
46
|
|
44
47
|
def merchant_account
|
@@ -38,6 +38,10 @@ module Braintree
|
|
38
38
|
_merchant_account_declined_sample_xml(id)
|
39
39
|
when Braintree::WebhookNotification::Kind::TransactionDisbursed
|
40
40
|
_transaction_disbursed_sample_xml(id)
|
41
|
+
when Braintree::WebhookNotification::Kind::DisbursementException
|
42
|
+
_disbursement_exception_sample_xml(id)
|
43
|
+
when Braintree::WebhookNotification::Kind::Disbursement
|
44
|
+
_disbursement_sample_xml(id)
|
41
45
|
else
|
42
46
|
_subscription_sample_xml(id)
|
43
47
|
end
|
@@ -139,10 +143,60 @@ module Braintree
|
|
139
143
|
<id>#{id}</id>
|
140
144
|
<amount>100</amount>
|
141
145
|
<disbursement-details>
|
142
|
-
<disbursement-date type="
|
146
|
+
<disbursement-date type="date">2013-07-09</disbursement-date>
|
143
147
|
</disbursement-details>
|
144
148
|
</transaction>
|
145
149
|
XML
|
146
150
|
end
|
151
|
+
|
152
|
+
def _disbursement_exception_sample_xml(id)
|
153
|
+
|
154
|
+
<<-XML
|
155
|
+
<disbursement>
|
156
|
+
<id>#{id}</id>
|
157
|
+
<transaction-ids type="array">
|
158
|
+
<item>afv56j</item>
|
159
|
+
<item>kj8hjk</item>
|
160
|
+
</transaction-ids>
|
161
|
+
<success type="boolean">false</success>
|
162
|
+
<retry type="boolean">false</retry>
|
163
|
+
<merchant-account>
|
164
|
+
<id>merchant_account_token</id>
|
165
|
+
<currency-iso-code>USD</currency-iso-code>
|
166
|
+
<sub-merchant-account type="boolean">false</sub-merchant-account>
|
167
|
+
<status>active</status>
|
168
|
+
</merchant-account>
|
169
|
+
<amount>100.00</amount>
|
170
|
+
<disbursement-date type="date">2014-02-10</disbursement-date>
|
171
|
+
<exception-message>bank_rejected</exception-message>
|
172
|
+
<follow-up-action>update_funding_information</follow-up-action>
|
173
|
+
</disbursement>
|
174
|
+
XML
|
175
|
+
end
|
176
|
+
|
177
|
+
def _disbursement_sample_xml(id)
|
178
|
+
|
179
|
+
<<-XML
|
180
|
+
<disbursement>
|
181
|
+
<id>#{id}</id>
|
182
|
+
<transaction-ids type="array">
|
183
|
+
<item>afv56j</item>
|
184
|
+
<item>kj8hjk</item>
|
185
|
+
</transaction-ids>
|
186
|
+
<success type="boolean">true</success>
|
187
|
+
<retry type="boolean">false</retry>
|
188
|
+
<merchant-account>
|
189
|
+
<id>merchant_account_token</id>
|
190
|
+
<currency-iso-code>USD</currency-iso-code>
|
191
|
+
<sub-merchant-account type="boolean">false</sub-merchant-account>
|
192
|
+
<status>active</status>
|
193
|
+
</merchant-account>
|
194
|
+
<amount>100.00</amount>
|
195
|
+
<disbursement-date type="date">2014-02-10</disbursement-date>
|
196
|
+
<exception-message nil="true"/>
|
197
|
+
<follow-up-action nil="true"/>
|
198
|
+
</disbursement>
|
199
|
+
XML
|
200
|
+
end
|
147
201
|
end
|
148
202
|
end
|
data/spec/httpsd.pid
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
31122
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper")
|
2
|
+
|
3
|
+
describe Braintree::Disbursement do
|
4
|
+
describe "transactions" do
|
5
|
+
it "finds the transactions associated with the disbursement" do
|
6
|
+
attributes = {
|
7
|
+
:id => "123456",
|
8
|
+
:merchant_account => {
|
9
|
+
:id => "sandbox_sub_merchant_account",
|
10
|
+
:master_merchant_account => {
|
11
|
+
:id => "sandbox_master_merchant_account",
|
12
|
+
:status => "active"
|
13
|
+
},
|
14
|
+
:status => "active"
|
15
|
+
},
|
16
|
+
:transaction_ids => ["sub_merchant_transaction"],
|
17
|
+
:amount => "100.00",
|
18
|
+
:disbursement_date => "2013-04-10",
|
19
|
+
:exception_message => "invalid_account_number",
|
20
|
+
:follow_up_action => "update",
|
21
|
+
:retry => false,
|
22
|
+
:success => false
|
23
|
+
}
|
24
|
+
|
25
|
+
disbursement = Braintree::Disbursement._new(Braintree::Configuration.gateway, attributes)
|
26
|
+
disbursement.transactions.maximum_size.should == 1
|
27
|
+
transaction = disbursement.transactions.first
|
28
|
+
transaction.id.should == "sub_merchant_transaction"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -14,9 +14,7 @@ describe Braintree::Plan do
|
|
14
14
|
:name => "ruby_test plan",
|
15
15
|
:number_of_billing_cycles => 1,
|
16
16
|
:price => "1.00",
|
17
|
-
:
|
18
|
-
:trial_duration_unit => "day",
|
19
|
-
:trial_period => true,
|
17
|
+
:trial_period => false,
|
20
18
|
}
|
21
19
|
create_plan_for_tests(attributes)
|
22
20
|
|
@@ -36,8 +34,6 @@ describe Braintree::Plan do
|
|
36
34
|
plan.name.should == attributes[:name]
|
37
35
|
plan.number_of_billing_cycles.should == attributes[:number_of_billing_cycles]
|
38
36
|
plan.price.should == Braintree::Util.to_big_decimal("1.00")
|
39
|
-
plan.trial_duration.should == attributes[:trial_duration]
|
40
|
-
plan.trial_duration_unit.should == attributes[:trial_duration_unit]
|
41
37
|
plan.trial_period.should == attributes[:trial_period]
|
42
38
|
plan.created_at.should_not be_nil
|
43
39
|
plan.updated_at.should_not be_nil
|
@@ -362,12 +362,14 @@ describe Braintree::Subscription do
|
|
362
362
|
add_ons.first.quantity.should == 1
|
363
363
|
add_ons.first.number_of_billing_cycles.should be_nil
|
364
364
|
add_ons.first.never_expires?.should be_true
|
365
|
+
add_ons.first.current_billing_cycle.should == 0
|
365
366
|
|
366
367
|
add_ons.last.id.should == "increase_20"
|
367
368
|
add_ons.last.amount.should == BigDecimal.new("20.00")
|
368
369
|
add_ons.last.quantity.should == 1
|
369
370
|
add_ons.last.number_of_billing_cycles.should be_nil
|
370
371
|
add_ons.last.never_expires?.should be_true
|
372
|
+
add_ons.last.current_billing_cycle.should == 0
|
371
373
|
|
372
374
|
subscription.discounts.size.should == 2
|
373
375
|
discounts = subscription.discounts.sort_by { |discount| discount.id }
|
@@ -377,12 +379,14 @@ describe Braintree::Subscription do
|
|
377
379
|
discounts.first.quantity.should == 1
|
378
380
|
discounts.first.number_of_billing_cycles.should be_nil
|
379
381
|
discounts.first.never_expires?.should be_true
|
382
|
+
discounts.first.current_billing_cycle.should == 0
|
380
383
|
|
381
384
|
discounts.last.id.should == "discount_7"
|
382
385
|
discounts.last.amount.should == BigDecimal.new("7.00")
|
383
386
|
discounts.last.quantity.should == 1
|
384
387
|
discounts.last.number_of_billing_cycles.should be_nil
|
385
388
|
discounts.last.never_expires?.should be_true
|
389
|
+
discounts.last.current_billing_cycle.should == 0
|
386
390
|
end
|
387
391
|
|
388
392
|
it "allows overriding of inherited add_ons and discounts" do
|
@@ -422,10 +426,12 @@ describe Braintree::Subscription do
|
|
422
426
|
add_ons.first.quantity.should == 2
|
423
427
|
add_ons.first.number_of_billing_cycles.should == 5
|
424
428
|
add_ons.first.never_expires?.should be_false
|
429
|
+
add_ons.first.current_billing_cycle.should == 0
|
425
430
|
|
426
431
|
add_ons.last.id.should == "increase_20"
|
427
432
|
add_ons.last.amount.should == BigDecimal.new("20.00")
|
428
433
|
add_ons.last.quantity.should == 1
|
434
|
+
add_ons.last.current_billing_cycle.should == 0
|
429
435
|
|
430
436
|
subscription.discounts.size.should == 2
|
431
437
|
discounts = subscription.discounts.sort_by { |discount| discount.id }
|
@@ -433,12 +439,14 @@ describe Braintree::Subscription do
|
|
433
439
|
discounts.first.id.should == "discount_11"
|
434
440
|
discounts.first.amount.should == BigDecimal.new("11.00")
|
435
441
|
discounts.first.quantity.should == 1
|
442
|
+
discounts.first.current_billing_cycle.should == 0
|
436
443
|
|
437
444
|
discounts.last.id.should == "discount_7"
|
438
445
|
discounts.last.amount.should == BigDecimal.new("15.00")
|
439
446
|
discounts.last.quantity.should == 3
|
440
447
|
discounts.last.number_of_billing_cycles.should be_nil
|
441
448
|
discounts.last.never_expires?.should be_true
|
449
|
+
discounts.last.current_billing_cycle.should == 0
|
442
450
|
end
|
443
451
|
|
444
452
|
it "allows deleting of inherited add_ons and discounts" do
|
@@ -460,11 +468,13 @@ describe Braintree::Subscription do
|
|
460
468
|
subscription.add_ons.first.id.should == "increase_20"
|
461
469
|
subscription.add_ons.first.amount.should == BigDecimal.new("20.00")
|
462
470
|
subscription.add_ons.first.quantity.should == 1
|
471
|
+
subscription.add_ons.first.current_billing_cycle.should == 0
|
463
472
|
|
464
473
|
subscription.discounts.size.should == 1
|
465
474
|
subscription.discounts.last.id.should == "discount_11"
|
466
475
|
subscription.discounts.last.amount.should == BigDecimal.new("11.00")
|
467
476
|
subscription.discounts.last.quantity.should == 1
|
477
|
+
subscription.discounts.last.current_billing_cycle.should == 0
|
468
478
|
end
|
469
479
|
|
470
480
|
it "allows adding new add_ons and discounts" do
|
@@ -171,6 +171,27 @@ describe Braintree::Transaction do
|
|
171
171
|
result.success?.should == true
|
172
172
|
end
|
173
173
|
|
174
|
+
it "accepts billing_address_id in place of billing_address" do
|
175
|
+
result = Braintree::Customer.create()
|
176
|
+
address_result = Braintree::Address.create(
|
177
|
+
:customer_id => result.customer.id,
|
178
|
+
:country_code_alpha2 => "US"
|
179
|
+
)
|
180
|
+
|
181
|
+
result = Braintree::Transaction.create(
|
182
|
+
:type => "sale",
|
183
|
+
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
184
|
+
:customer_id => result.customer.id,
|
185
|
+
:billing_address_id => address_result.address.id,
|
186
|
+
:credit_card => {
|
187
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
188
|
+
:expiration_date => "05/2009"
|
189
|
+
}
|
190
|
+
)
|
191
|
+
|
192
|
+
result.success?.should == true
|
193
|
+
end
|
194
|
+
|
174
195
|
it "returns processor response code and text if declined" do
|
175
196
|
result = Braintree::Transaction.create(
|
176
197
|
:type => "sale",
|
@@ -2035,6 +2056,7 @@ describe Braintree::Transaction do
|
|
2035
2056
|
disbursement.settlement_currency_iso_code.should == "USD"
|
2036
2057
|
disbursement.settlement_currency_exchange_rate.should == "1"
|
2037
2058
|
disbursement.funds_held?.should == false
|
2059
|
+
disbursement.success?.should be_true
|
2038
2060
|
end
|
2039
2061
|
|
2040
2062
|
it "is not disbursed" do
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
2
|
+
|
3
|
+
describe Braintree::Disbursement do
|
4
|
+
describe "new" do
|
5
|
+
it "is protected" do
|
6
|
+
expect do
|
7
|
+
Braintree::Disbursement.new
|
8
|
+
end.to raise_error(NoMethodError, /protected method .new/)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
describe "inspect" do
|
13
|
+
it "prints attributes of disbursement object" do
|
14
|
+
disbursement = Braintree::Disbursement._new(
|
15
|
+
:gateway,
|
16
|
+
:id => "123456",
|
17
|
+
:merchant_account => {
|
18
|
+
:id => "sandbox_sub_merchant_account",
|
19
|
+
:master_merchant_account => {
|
20
|
+
:id => "sandbox_master_merchant_account",
|
21
|
+
:status => "active"
|
22
|
+
},
|
23
|
+
:status => "active"
|
24
|
+
},
|
25
|
+
:transaction_ids => ["sub_merchant_transaction"],
|
26
|
+
:amount => "100.00",
|
27
|
+
:disbursement_date => "2013-04-10",
|
28
|
+
:exception_message => "invalid_account_number",
|
29
|
+
:follow_up_action => "update",
|
30
|
+
:retry => false,
|
31
|
+
:success => false
|
32
|
+
)
|
33
|
+
|
34
|
+
disbursement.inspect.should include('id: "123456"')
|
35
|
+
disbursement.inspect.should include('amount: "100.0"')
|
36
|
+
disbursement.inspect.should include('exception_message: "invalid_account_number"')
|
37
|
+
disbursement.inspect.should include('disbursement_date: 2013-04-10')
|
38
|
+
disbursement.inspect.should include('follow_up_action: "update"')
|
39
|
+
disbursement.inspect.should include('merchant_account: #<Braintree::MerchantAccount: ')
|
40
|
+
disbursement.inspect.should include('transaction_ids: ["sub_merchant_transaction"]')
|
41
|
+
disbursement.inspect.should include('retry: false')
|
42
|
+
disbursement.inspect.should include('success: false')
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -93,7 +93,8 @@ describe Braintree::Transaction do
|
|
93
93
|
:settlement_amount => "120.00",
|
94
94
|
:settlement_currency_iso_code => "USD",
|
95
95
|
:settlement_currency_exchange_rate => "1",
|
96
|
-
:funds_held => false
|
96
|
+
:funds_held => false,
|
97
|
+
:success => true
|
97
98
|
}
|
98
99
|
)
|
99
100
|
disbursement = transaction.disbursement_details
|
@@ -101,7 +102,8 @@ describe Braintree::Transaction do
|
|
101
102
|
disbursement.settlement_amount.should == "120.00"
|
102
103
|
disbursement.settlement_currency_iso_code.should == "USD"
|
103
104
|
disbursement.settlement_currency_exchange_rate.should == "1"
|
104
|
-
disbursement.funds_held?.should
|
105
|
+
disbursement.funds_held?.should be_false
|
106
|
+
disbursement.success?.should be_true
|
105
107
|
end
|
106
108
|
|
107
109
|
it "sets up credit card attributes in credit_card_details" do
|
@@ -58,18 +58,58 @@ describe Braintree::WebhookNotification do
|
|
58
58
|
notification.timestamp.should be_close(Time.now.utc, 10)
|
59
59
|
end
|
60
60
|
|
61
|
-
|
62
|
-
|
63
|
-
Braintree::
|
64
|
-
|
65
|
-
|
61
|
+
context "disbursement" do
|
62
|
+
it "builds a sample notification for a transaction disbursed webhook" do
|
63
|
+
signature, payload = Braintree::WebhookTesting.sample_notification(
|
64
|
+
Braintree::WebhookNotification::Kind::TransactionDisbursed,
|
65
|
+
"my_id"
|
66
|
+
)
|
66
67
|
|
67
|
-
|
68
|
+
notification = Braintree::WebhookNotification.parse(signature, payload)
|
69
|
+
|
70
|
+
notification.kind.should == Braintree::WebhookNotification::Kind::TransactionDisbursed
|
71
|
+
notification.transaction.id.should == "my_id"
|
72
|
+
notification.transaction.amount.should == 1_00
|
73
|
+
notification.transaction.disbursement_details.disbursement_date.should == "2013-07-09"
|
74
|
+
end
|
68
75
|
|
69
|
-
notification
|
70
|
-
|
71
|
-
|
72
|
-
|
76
|
+
it "builds a sample notification for a disbursement_exception webhook" do
|
77
|
+
signature, payload = Braintree::WebhookTesting.sample_notification(
|
78
|
+
Braintree::WebhookNotification::Kind::DisbursementException,
|
79
|
+
"my_id"
|
80
|
+
)
|
81
|
+
|
82
|
+
notification = Braintree::WebhookNotification.parse(signature, payload)
|
83
|
+
|
84
|
+
notification.kind.should == Braintree::WebhookNotification::Kind::DisbursementException
|
85
|
+
notification.disbursement.id.should == "my_id"
|
86
|
+
notification.disbursement.transaction_ids.should == %W{ afv56j kj8hjk }
|
87
|
+
notification.disbursement.retry.should be_false
|
88
|
+
notification.disbursement.success.should be_false
|
89
|
+
notification.disbursement.exception_message.should == "bank_rejected"
|
90
|
+
notification.disbursement.disbursement_date.should == Date.parse("2014-02-10")
|
91
|
+
notification.disbursement.follow_up_action.should == "update_funding_information"
|
92
|
+
notification.disbursement.merchant_account.id.should == "merchant_account_token"
|
93
|
+
end
|
94
|
+
|
95
|
+
it "builds a sample notification for a disbursement webhook" do
|
96
|
+
signature, payload = Braintree::WebhookTesting.sample_notification(
|
97
|
+
Braintree::WebhookNotification::Kind::Disbursement,
|
98
|
+
"my_id"
|
99
|
+
)
|
100
|
+
|
101
|
+
notification = Braintree::WebhookNotification.parse(signature, payload)
|
102
|
+
|
103
|
+
notification.kind.should == Braintree::WebhookNotification::Kind::Disbursement
|
104
|
+
notification.disbursement.id.should == "my_id"
|
105
|
+
notification.disbursement.transaction_ids.should == %W{ afv56j kj8hjk }
|
106
|
+
notification.disbursement.retry.should be_false
|
107
|
+
notification.disbursement.success.should be_true
|
108
|
+
notification.disbursement.exception_message.should be_nil
|
109
|
+
notification.disbursement.disbursement_date.should == Date.parse("2014-02-10")
|
110
|
+
notification.disbursement.follow_up_action.should be_nil
|
111
|
+
notification.disbursement.merchant_account.id.should == "merchant_account_token"
|
112
|
+
end
|
73
113
|
end
|
74
114
|
|
75
115
|
context "merchant account" do
|
metadata
CHANGED
@@ -1,30 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: braintree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
5
|
-
prerelease:
|
4
|
+
version: 2.29.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Braintree
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-03-04 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: builder
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: 2.0.0
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: 2.0.0
|
30
27
|
description: Ruby library for integrating with the Braintree Gateway
|
@@ -36,166 +33,168 @@ files:
|
|
36
33
|
- README.rdoc
|
37
34
|
- LICENSE
|
38
35
|
- lib/braintree.rb
|
39
|
-
- lib/braintree/subscription_search.rb
|
40
|
-
- lib/braintree/modification.rb
|
41
|
-
- lib/braintree/errors.rb
|
42
|
-
- lib/braintree/test/credit_card.rb
|
43
|
-
- lib/braintree/test/transaction_amounts.rb
|
44
|
-
- lib/braintree/test/merchant_account.rb
|
45
|
-
- lib/braintree/test/venmo_sdk.rb
|
46
|
-
- lib/braintree/webhook_testing.rb
|
47
|
-
- lib/braintree/webhook_testing_gateway.rb
|
48
|
-
- lib/braintree/advanced_search.rb
|
49
|
-
- lib/braintree/version.rb
|
50
|
-
- lib/braintree/add_on.rb
|
51
|
-
- lib/braintree/address.rb
|
52
|
-
- lib/braintree/digest.rb
|
53
|
-
- lib/braintree/settlement_batch_summary.rb
|
54
|
-
- lib/braintree/error_codes.rb
|
55
|
-
- lib/braintree/discount.rb
|
56
|
-
- lib/braintree/webhook_notification.rb
|
57
36
|
- lib/braintree/settlement_batch_summary_gateway.rb
|
58
|
-
- lib/braintree/
|
59
|
-
- lib/braintree/
|
37
|
+
- lib/braintree/discount.rb
|
38
|
+
- lib/braintree/base_module.rb
|
39
|
+
- lib/braintree/xml.rb
|
40
|
+
- lib/braintree/customer.rb
|
41
|
+
- lib/braintree/validation_error.rb
|
42
|
+
- lib/braintree/transaction_gateway.rb
|
43
|
+
- lib/braintree/gateway.rb
|
44
|
+
- lib/braintree/exceptions.rb
|
45
|
+
- lib/braintree/customer_gateway.rb
|
46
|
+
- lib/braintree/credit_card_verification.rb
|
47
|
+
- lib/braintree/digest.rb
|
60
48
|
- lib/braintree/credit_card.rb
|
61
|
-
- lib/braintree/
|
49
|
+
- lib/braintree/discount_gateway.rb
|
50
|
+
- lib/braintree/disbursement.rb
|
51
|
+
- lib/braintree/subscription.rb
|
62
52
|
- lib/braintree/util.rb
|
63
|
-
- lib/braintree/
|
64
|
-
- lib/braintree/
|
53
|
+
- lib/braintree/configuration.rb
|
54
|
+
- lib/braintree/merchant_account.rb
|
55
|
+
- lib/braintree/credit_card_gateway.rb
|
56
|
+
- lib/braintree/resource_collection.rb
|
57
|
+
- lib/braintree/merchant_account_gateway.rb
|
58
|
+
- lib/braintree/address/country_names.rb
|
59
|
+
- lib/braintree/credit_card_verification_search.rb
|
60
|
+
- lib/braintree/version.rb
|
61
|
+
- lib/braintree/plan.rb
|
62
|
+
- lib/braintree/error_codes.rb
|
63
|
+
- lib/braintree/validation_error_collection.rb
|
64
|
+
- lib/braintree/address_gateway.rb
|
65
|
+
- lib/braintree/subscription_gateway.rb
|
66
|
+
- lib/braintree/webhook_notification_gateway.rb
|
67
|
+
- lib/braintree/add_on.rb
|
68
|
+
- lib/braintree/test/credit_card.rb
|
69
|
+
- lib/braintree/test/transaction_amounts.rb
|
70
|
+
- lib/braintree/test/venmo_sdk.rb
|
71
|
+
- lib/braintree/test/merchant_account.rb
|
65
72
|
- lib/braintree/xml/rexml.rb
|
73
|
+
- lib/braintree/xml/generator.rb
|
66
74
|
- lib/braintree/xml/libxml.rb
|
67
75
|
- lib/braintree/xml/parser.rb
|
68
|
-
- lib/braintree/
|
69
|
-
- lib/braintree/
|
70
|
-
- lib/braintree/
|
71
|
-
- lib/braintree/
|
72
|
-
- lib/braintree/
|
73
|
-
- lib/braintree/
|
76
|
+
- lib/braintree/transparent_redirect.rb
|
77
|
+
- lib/braintree/plan_gateway.rb
|
78
|
+
- lib/braintree/transaction_search.rb
|
79
|
+
- lib/braintree/customer_search.rb
|
80
|
+
- lib/braintree/transparent_redirect_gateway.rb
|
81
|
+
- lib/braintree/webhook_notification.rb
|
82
|
+
- lib/braintree/webhook_testing_gateway.rb
|
83
|
+
- lib/braintree/webhook_testing.rb
|
84
|
+
- lib/braintree/credit_card_verification_gateway.rb
|
85
|
+
- lib/braintree/descriptor.rb
|
86
|
+
- lib/braintree/modification.rb
|
74
87
|
- lib/braintree/transaction.rb
|
75
|
-
- lib/braintree/http.rb
|
76
|
-
- lib/braintree/address_gateway.rb
|
77
|
-
- lib/braintree/subscription_gateway.rb
|
78
|
-
- lib/braintree/customer_gateway.rb
|
79
|
-
- lib/braintree/merchant_account/business_details.rb
|
80
|
-
- lib/braintree/merchant_account/funding_details.rb
|
81
88
|
- lib/braintree/merchant_account/individual_details.rb
|
82
89
|
- lib/braintree/merchant_account/address_details.rb
|
83
|
-
- lib/braintree/
|
84
|
-
- lib/braintree/
|
90
|
+
- lib/braintree/merchant_account/funding_details.rb
|
91
|
+
- lib/braintree/merchant_account/business_details.rb
|
92
|
+
- lib/braintree/add_on_gateway.rb
|
85
93
|
- lib/braintree/successful_result.rb
|
94
|
+
- lib/braintree/advanced_search.rb
|
95
|
+
- lib/braintree/subscription_search.rb
|
96
|
+
- lib/braintree/error_result.rb
|
97
|
+
- lib/braintree/settlement_batch_summary.rb
|
98
|
+
- lib/braintree/address.rb
|
86
99
|
- lib/braintree/settlement_batch.rb
|
87
|
-
- lib/braintree/plan.rb
|
88
|
-
- lib/braintree/gateway.rb
|
89
|
-
- lib/braintree/transparent_redirect_gateway.rb
|
90
|
-
- lib/braintree/base_module.rb
|
91
|
-
- lib/braintree/add_on_gateway.rb
|
92
|
-
- lib/braintree/transaction/subscription_details.rb
|
93
100
|
- lib/braintree/transaction/disbursement_details.rb
|
94
|
-
- lib/braintree/transaction/customer_details.rb
|
95
|
-
- lib/braintree/transaction/credit_card_details.rb
|
96
101
|
- lib/braintree/transaction/status_details.rb
|
97
102
|
- lib/braintree/transaction/address_details.rb
|
98
|
-
- lib/braintree/
|
99
|
-
- lib/braintree/
|
100
|
-
- lib/braintree/
|
101
|
-
- lib/braintree/
|
102
|
-
- lib/braintree/
|
103
|
-
- lib/
|
104
|
-
- lib/
|
105
|
-
- lib/braintree/address/country_names.rb
|
106
|
-
- lib/braintree/webhook_notification_gateway.rb
|
107
|
-
- lib/braintree/merchant_account_gateway.rb
|
108
|
-
- lib/braintree/customer.rb
|
109
|
-
- lib/braintree/discount_gateway.rb
|
103
|
+
- lib/braintree/transaction/subscription_details.rb
|
104
|
+
- lib/braintree/transaction/customer_details.rb
|
105
|
+
- lib/braintree/transaction/credit_card_details.rb
|
106
|
+
- lib/braintree/errors.rb
|
107
|
+
- lib/braintree/http.rb
|
108
|
+
- lib/ssl/api_braintreegateway_com.ca.crt
|
109
|
+
- lib/ssl/securetrust_ca.crt
|
110
110
|
- lib/ssl/www_braintreegateway_com.ca.crt
|
111
111
|
- lib/ssl/sandbox_braintreegateway_com.ca.crt
|
112
|
-
-
|
113
|
-
-
|
112
|
+
- spec/spec.opts
|
113
|
+
- spec/ssl/privateKey.key
|
114
|
+
- spec/ssl/certificate.crt
|
115
|
+
- spec/ssl/geotrust_global.crt
|
116
|
+
- spec/hacks/tcp_socket.rb
|
114
117
|
- spec/script/httpsd.rb
|
115
|
-
- spec/
|
116
|
-
- spec/unit/
|
117
|
-
- spec/unit/braintree/
|
118
|
-
- spec/unit/braintree/
|
119
|
-
- spec/unit/braintree/
|
120
|
-
- spec/unit/braintree/
|
121
|
-
- spec/unit/braintree/
|
118
|
+
- spec/unit/braintree_spec.rb
|
119
|
+
- spec/unit/braintree/credit_card_spec.rb
|
120
|
+
- spec/unit/braintree/errors_spec.rb
|
121
|
+
- spec/unit/braintree/subscription_search_spec.rb
|
122
|
+
- spec/unit/braintree/util_spec.rb
|
123
|
+
- spec/unit/braintree/address_spec.rb
|
124
|
+
- spec/unit/braintree/subscription_spec.rb
|
122
125
|
- spec/unit/braintree/webhook_notification_spec.rb
|
126
|
+
- spec/unit/braintree/transparent_redirect_spec.rb
|
127
|
+
- spec/unit/braintree/resource_collection_spec.rb
|
123
128
|
- spec/unit/braintree/http_spec.rb
|
124
|
-
- spec/unit/braintree/
|
125
|
-
- spec/unit/braintree/
|
126
|
-
- spec/unit/braintree/
|
129
|
+
- spec/unit/braintree/merchant_account_spec.rb
|
130
|
+
- spec/unit/braintree/customer_spec.rb
|
131
|
+
- spec/unit/braintree/error_result_spec.rb
|
127
132
|
- spec/unit/braintree/successful_result_spec.rb
|
128
133
|
- spec/unit/braintree/credit_card_verification_spec.rb
|
129
134
|
- spec/unit/braintree/validation_error_spec.rb
|
130
|
-
- spec/unit/braintree/resource_collection_spec.rb
|
131
|
-
- spec/unit/braintree/xml/libxml_spec.rb
|
132
135
|
- spec/unit/braintree/xml/parser_spec.rb
|
133
136
|
- spec/unit/braintree/xml/rexml_spec.rb
|
137
|
+
- spec/unit/braintree/xml/libxml_spec.rb
|
138
|
+
- spec/unit/braintree/credit_card_verification_search_spec.rb
|
139
|
+
- spec/unit/braintree/base_module_spec.rb
|
140
|
+
- spec/unit/braintree/transaction_spec.rb
|
134
141
|
- spec/unit/braintree/configuration_spec.rb
|
142
|
+
- spec/unit/braintree/xml_spec.rb
|
135
143
|
- spec/unit/braintree/validation_error_collection_spec.rb
|
136
|
-
- spec/unit/braintree/merchant_account_spec.rb
|
137
|
-
- spec/unit/braintree/errors_spec.rb
|
138
144
|
- spec/unit/braintree/modification_spec.rb
|
139
|
-
- spec/unit/braintree/
|
140
|
-
- spec/unit/braintree/
|
141
|
-
- spec/unit/braintree/
|
142
|
-
- spec/unit/braintree/transparent_redirect_spec.rb
|
145
|
+
- spec/unit/braintree/digest_spec.rb
|
146
|
+
- spec/unit/braintree/disbursement_spec.rb
|
147
|
+
- spec/unit/braintree/transaction/customer_details_spec.rb
|
143
148
|
- spec/unit/braintree/transaction/deposit_details_spec.rb
|
144
149
|
- spec/unit/braintree/transaction/credit_card_details_spec.rb
|
145
|
-
- spec/unit/braintree/
|
146
|
-
- spec/unit/
|
147
|
-
- spec/unit/braintree/digest_spec.rb
|
148
|
-
- spec/unit/braintree_spec.rb
|
149
|
-
- spec/hacks/tcp_socket.rb
|
150
|
+
- spec/unit/braintree/transaction_search_spec.rb
|
151
|
+
- spec/unit/spec_helper.rb
|
150
152
|
- spec/httpsd.pid
|
151
|
-
- spec/integration/
|
152
|
-
- spec/integration/braintree/settlement_batch_summary_spec.rb
|
153
|
-
- spec/integration/braintree/transaction_search_spec.rb
|
154
|
-
- spec/integration/braintree/test/transaction_amounts_spec.rb
|
155
|
-
- spec/integration/braintree/customer_spec.rb
|
156
|
-
- spec/integration/braintree/transaction_spec.rb
|
153
|
+
- spec/integration/braintree/credit_card_spec.rb
|
157
154
|
- spec/integration/braintree/add_on_spec.rb
|
158
|
-
- spec/integration/braintree/http_spec.rb
|
159
|
-
- spec/integration/braintree/subscription_spec.rb
|
160
|
-
- spec/integration/braintree/credit_card_verification_search_spec.rb
|
161
|
-
- spec/integration/braintree/credit_card_verification_spec.rb
|
162
|
-
- spec/integration/braintree/advanced_search_spec.rb
|
163
|
-
- spec/integration/braintree/customer_search_spec.rb
|
164
|
-
- spec/integration/braintree/merchant_account_spec.rb
|
165
155
|
- spec/integration/braintree/plan_spec.rb
|
156
|
+
- spec/integration/braintree/advanced_search_spec.rb
|
166
157
|
- spec/integration/braintree/error_codes_spec.rb
|
167
158
|
- spec/integration/braintree/address_spec.rb
|
159
|
+
- spec/integration/braintree/subscription_spec.rb
|
168
160
|
- spec/integration/braintree/transparent_redirect_spec.rb
|
169
|
-
- spec/integration/braintree/
|
161
|
+
- spec/integration/braintree/http_spec.rb
|
162
|
+
- spec/integration/braintree/merchant_account_spec.rb
|
163
|
+
- spec/integration/braintree/customer_spec.rb
|
164
|
+
- spec/integration/braintree/credit_card_verification_spec.rb
|
165
|
+
- spec/integration/braintree/test/transaction_amounts_spec.rb
|
166
|
+
- spec/integration/braintree/settlement_batch_summary_spec.rb
|
167
|
+
- spec/integration/braintree/credit_card_verification_search_spec.rb
|
168
|
+
- spec/integration/braintree/transaction_spec.rb
|
169
|
+
- spec/integration/braintree/customer_search_spec.rb
|
170
170
|
- spec/integration/braintree/discount_spec.rb
|
171
|
-
- spec/
|
172
|
-
- spec/
|
173
|
-
- spec/
|
174
|
-
- spec/
|
171
|
+
- spec/integration/braintree/disbursement_spec.rb
|
172
|
+
- spec/integration/braintree/transaction_search_spec.rb
|
173
|
+
- spec/integration/spec_helper.rb
|
174
|
+
- spec/spec_helper.rb
|
175
175
|
- braintree.gemspec
|
176
176
|
homepage: http://www.braintreepayments.com/
|
177
177
|
licenses:
|
178
178
|
- MIT
|
179
|
+
metadata: {}
|
179
180
|
post_install_message:
|
180
181
|
rdoc_options: []
|
181
182
|
require_paths:
|
182
183
|
- lib
|
183
184
|
required_ruby_version: !ruby/object:Gem::Requirement
|
184
|
-
none: false
|
185
185
|
requirements:
|
186
|
-
- -
|
186
|
+
- - '>='
|
187
187
|
- !ruby/object:Gem::Version
|
188
188
|
version: '0'
|
189
189
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
190
|
-
none: false
|
191
190
|
requirements:
|
192
|
-
- -
|
191
|
+
- - '>='
|
193
192
|
- !ruby/object:Gem::Version
|
194
193
|
version: '0'
|
195
194
|
requirements: []
|
196
195
|
rubyforge_project: braintree
|
197
|
-
rubygems_version: 1.
|
196
|
+
rubygems_version: 2.1.11
|
198
197
|
signing_key:
|
199
|
-
specification_version:
|
198
|
+
specification_version: 4
|
200
199
|
summary: Braintree Gateway Ruby Client Library
|
201
200
|
test_files: []
|