-
-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🧹 Marketplace
: Cache the fee amount on the Order
#1701
🧹 Marketplace
: Cache the fee amount on the Order
#1701
Conversation
- #1327 In order to pull the splitting of the payment to a retriable background job; we need to cache the payment processor fee information.
See #1702 for the usage of this cached value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comments below.
def vendors_share | ||
product_total - payment_processor_fee | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should product_total
be monetize
d as well? It seems odd to be substracting two values, one of which is monetized and the other one isn't.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
product_total is monetized, in that it sums the monetized product_price * quantity
@@ -21,7 +21,7 @@ def create | |||
latest_charge = Stripe::Charge.retrieve(payment_intent.latest_charge, api_key: marketplace.stripe_api_key) | |||
balance_transaction = Stripe::BalanceTransaction.retrieve(latest_charge.balance_transaction, api_key: marketplace.stripe_api_key) | |||
|
|||
order.update(status: :paid, placed_at: DateTime.now) | |||
order.update(status: :paid, placed_at: DateTime.now, payment_processor_fee_cents: balance_transaction.fee) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not from this PR, but I'm noticing that we do this .update
and don't seem to be checking for success, opening us up to the possibility that this update will fail, the order won't be marked as paid
, but notifications and other parts of the "order pipeline" would continue as if everything was fine.
One quick fix would be to throw a !
onto the order.update
call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point! Will do!
… `paid` - Recommended by @anaulin #1701 (comment)
… `paid` (#1717) - Recommended by @anaulin #1701 (comment)
Marketplace
:Split
Payment
betweenVendor
andDistributor
#1327In order to pull the splitting of the payment to a retriable background job; we need to cache the payment processor fee information.