Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign up[FIX] payment: error logs + [FIX] payment_stripe_sca: less aggressive raise #39370
Conversation
return False | ||
return True | ||
|
||
tx_to_process = self.filtered(filter_trans) |
This comment has been minimized.
This comment has been minimized.
dbo-odoo
Oct 28, 2019
Contributor
I really dislike that your filtering method logs stuff... for me, it should only handle the recordset and the logging should be done in the flow
tx_to_process = self.filtered(lambda tx: tx.state == 'draft')
tx_already_pending = self.filtered(lambda tx: tx.state == 'pending')
tx_bad_state = self - tx_to_process - tx_already_pending
for pending_tx in tx_already_pending:
_logger.info('blablabla')
for bad_tx in tx_bad_state:
_logger.warning('machinmachinmachin')
# then go one with the tx_to_process recordset
This comment has been minimized.
This comment has been minimized.
'date': datetime.now().strftime(DEFAULT_SERVER_DATETIME_FORMAT), | ||
'state_message': '', | ||
}) | ||
tx_to_process._log_payment_transaction_received() |
This comment has been minimized.
This comment has been minimized.
dbo-odoo
Oct 28, 2019
Contributor
just checked to be sure: this is indeed a multi method (note to self)
f43b4a6
to
f3087c0
f3087c0
to
3c976db
This comment has been minimized.
This comment has been minimized.
@jev-odoo i've hijacked this PR for a fix in payment_stripe_sca since I needed it to work properly. Will merge soon |
This comment has been minimized.
This comment has been minimized.
note to self: cfr https://stripe.com/docs/error-codes the smart thing would be to raise_for_status if error code is not present Edit: I have now done the smart thing |
Before this commit, trying to put a transaction in a state where it was already in was causing an error. For example: Putting a transaction in'Done' when it was already in'Done' caused an error 'Only draft/authorized transaction can be posted.' Now, we just log a note that the transaction is already in the good state and pass over.
In some cases, Stripe will return the result of a transaction with a faulty HTTP Status (e.g. 4XX statuses) - not because the request was malformed, but because the payment failed. It is a bit unfortunate that Stripe would not differentiate between payment status and request validity, but that's the state of things. This commit ensures that such a response will be logged correctly, by making the call to `raise_for_status` conditionnal on the response object's status code and internal structure, forwarding the response's json to the validation flow if the status is in the 4XX range and a `code` key is found in the response, as described in https://stripe.com/docs/error-codes While testing this fix, it became apparent that some error message processing in the frontend was not correctly handled as well - instead of purely rejecting the promise, a failed payment should still send its payload to the backend, to allow the server to put the transaction in the correct state according to the response.
3c976db
to
64551ac
This comment has been minimized.
This comment has been minimized.
@jev-odoo I would appreciate your opinion when you come back on wednesday :) |
This comment has been minimized.
This comment has been minimized.
@dbo-odoo Thanks for this ;) |
This comment has been minimized.
This comment has been minimized.
@robodoo r+ |
This comment has been minimized.
This comment has been minimized.
Because this PR has multiple commits, I need to know how to merge it:
|
This comment has been minimized.
This comment has been minimized.
@robodoo rebase-ff |
This comment has been minimized.
This comment has been minimized.
Merge method set to rebase and fast-forward |
In some cases, Stripe will return the result of a transaction with a faulty HTTP Status (e.g. 4XX statuses) - not because the request was malformed, but because the payment failed. It is a bit unfortunate that Stripe would not differentiate between payment status and request validity, but that's the state of things. This commit ensures that such a response will be logged correctly, by making the call to `raise_for_status` conditionnal on the response object's status code and internal structure, forwarding the response's json to the validation flow if the status is in the 4XX range and a `code` key is found in the response, as described in https://stripe.com/docs/error-codes While testing this fix, it became apparent that some error message processing in the frontend was not correctly handled as well - instead of purely rejecting the promise, a failed payment should still send its payload to the backend, to allow the server to put the transaction in the correct state according to the response. closes #39370 Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
This comment has been minimized.
This comment has been minimized.
Staging failed: ci/runbot (view more at http://runbot.odoo.com/runbot/build/718657) |
This comment has been minimized.
This comment has been minimized.
@robodoo retry |
This comment has been minimized.
This comment has been minimized.
Staging failed: ci/runbot on 01a5f0d9627d970bda7218cbadb8a73148e194df (view more at http://runbot.odoo.com/runbot/build/719196) |
This comment has been minimized.
This comment has been minimized.
@robodoo retry |
In some cases, Stripe will return the result of a transaction with a faulty HTTP Status (e.g. 4XX statuses) - not because the request was malformed, but because the payment failed. It is a bit unfortunate that Stripe would not differentiate between payment status and request validity, but that's the state of things. This commit ensures that such a response will be logged correctly, by making the call to `raise_for_status` conditionnal on the response object's status code and internal structure, forwarding the response's json to the validation flow if the status is in the 4XX range and a `code` key is found in the response, as described in https://stripe.com/docs/error-codes While testing this fix, it became apparent that some error message processing in the frontend was not correctly handled as well - instead of purely rejecting the promise, a failed payment should still send its payload to the backend, to allow the server to put the transaction in the correct state according to the response. closes #39370 Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
This comment has been minimized.
This comment has been minimized.
This pull request has forward-port PRs awaiting action (not merged or closed): #41375 |
This comment has been minimized.
This comment has been minimized.
This pull request has forward-port PRs awaiting action (not merged or closed): #41389 |
2 similar comments
This comment has been minimized.
This comment has been minimized.
This pull request has forward-port PRs awaiting action (not merged or closed): #41389 |
This comment has been minimized.
This comment has been minimized.
This pull request has forward-port PRs awaiting action (not merged or closed): #41389 |
jev-odoo commentedOct 25, 2019
Before this commit, trying to put a transaction in a state
where it was already in was causing an error.
For example: Putting a transaction in'Done' when it was
already in'Done' caused an error
'Only draft/authorized transaction can be posted.'
Now, we just log a note that the transaction is
already in the required state and pass over.