Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions spec/integration/customers/wallets_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ def assert_wallet_attributes(wallet, **attributes)
end

def assert_wallet_attributes_with_updated_balance(wallet, **attributes)
# The balance is synced synchronously when the wallet transaction settles, but the ongoing
# balance is now refreshed by an async job (RefreshWalletJob). Re-fetch until that refresh has
# landed, otherwise the ongoing balance can still be 0 when the balance already reached 2000.
Comment thread
groyoh marked this conversation as resolved.
expected_ongoing_balance_cents = attributes.fetch(:ongoing_balance_cents, 2000)
wait_until do
wallet = client.customers.wallets.get(wallet.external_customer_id, wallet.code)
wallet.ongoing_balance_cents == expected_ongoing_balance_cents
end

assert_wallet_attributes(
wallet,
credits_balance: '10.0',
Expand Down
9 changes: 9 additions & 0 deletions spec/integration/wallets_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ def assert_wallet_attributes(wallet, **attributes)
end

def assert_wallet_attributes_with_updated_balance(wallet, **attributes)
# The balance is synced synchronously when the wallet transaction settles, but the ongoing
# balance is now refreshed by an async job (RefreshWalletJob). Re-fetch until that refresh has
# landed, otherwise the ongoing balance can still be 0 when the balance already reached 2000.
expected_ongoing_balance_cents = attributes.fetch(:ongoing_balance_cents, 2000)
wait_until do
wallet = client.wallets.get(wallet.lago_id)
wallet.ongoing_balance_cents == expected_ongoing_balance_cents
end

assert_wallet_attributes(
wallet,
credits_balance: '10.0',
Expand Down
Loading