Skip to content

Commit f168855

Browse files
committed
Sync balance transactions with Stripe Charges
1 parent a71fc95 commit f168855

File tree

57 files changed

+23222
-7179
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+23222
-7179
lines changed

app/models/pay/stripe/charge.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class Charge < Pay::Charge
55

66
def self.sync(charge_id, object: nil, stripe_account: nil, try: 0, retries: 1)
77
# Skip loading the latest charge details from the API if we already have it
8-
object ||= ::Stripe::Charge.retrieve({id: charge_id, expand: ["invoice.total_discount_amounts.discount", "invoice.total_tax_amounts.tax_rate", "refunds"]}, {stripe_account: stripe_account}.compact)
8+
object ||= ::Stripe::Charge.retrieve({id: charge_id, expand: ["balance_transaction", "invoice.total_discount_amounts.discount", "invoice.total_tax_amounts.tax_rate", "refunds"]}, {stripe_account: stripe_account}.compact)
99
if object.customer.blank?
1010
Rails.logger.debug "Stripe Charge #{object.id} does not have a customer"
1111
return

test/pay/stripe/customer_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ class Pay::Stripe::CustomerTest < ActiveSupport::TestCase
259259

260260
test "stripe saves acss_debit" do
261261
pm = Stripe::PaymentMethod.create(type: "acss_debit",
262-
acss_debit: {account_number: "00123456789", institution_number: "000", transit_number: "11000"}, billing_details: {email: "test@example.org", name: "Test User"})
262+
acss_debit: {account_number: "000123456789", institution_number: "000", transit_number: "11000"}, billing_details: {email: "test@example.org", name: "Test User"})
263263
@pay_customer.save_payment_method(pm, default: true)
264264
assert_equal "acss_debit", @pay_customer.default_payment_method.payment_method_type
265265
assert_equal "STRIPE TEST BANK", @pay_customer.default_payment_method.bank

test/support/vcr.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
class ActiveSupport::TestCase
1717
setup do
1818
# Test filenames are case sensitive in CI
19-
VCR.insert_cassette name
19+
VCR.insert_cassette name#, re_record_interval: 6.months
2020
end
2121

2222
teardown do

test/vcr_cassettes/test_cancel_now_when_scheduled_for_cancellation.yml

Lines changed: 1029 additions & 270 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/vcr_cassettes/test_connect_direct_subscription.yml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/vcr_cassettes/test_stripe_allows_subscription_quantities.yml

Lines changed: 671 additions & 268 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/vcr_cassettes/test_stripe_can_authorize_a_charge.yml

Lines changed: 367 additions & 124 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)