-
-
Save dcomartin/49b790f3be68bfba5c434620a0996ff6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public async Task Handle(int orderId, decimal amount) | |
| { | |
| try | |
| { | |
| await _paymentGateway.Capture(orderId, amount); | |
| } | |
| catch (TimeoutException) | |
| { | |
| if (await _paymentGateway.MaybeCaptured(orderId) == false) | |
| { | |
| await RetryLater(orderId); | |
| } | |
| } | |
| catch (PaymentProviderException ex) | |
| { | |
| if (ex.Code == "DUPLICATE_REQUEST") | |
| { | |
| await CheckProviderState(orderId); | |
| } | |
| else if (ex.Code == "UNKNOWN") | |
| { | |
| await FlagForManualReview(orderId); | |
| } | |
| else | |
| { | |
| await CompensateInventory(orderId); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment