-
-
Save dcomartin/546f2c2d43a8844f39d6519ccbd0e7fd 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 class ProcessPayment | |
| { | |
| public record Command(decimal Amount, string Token); | |
| public class Handler | |
| { | |
| public async Task Handle(Command command) | |
| { | |
| var chargeService = new ChargeService(); | |
| var charge = await chargeService.CreateAsync(new ChargeCreateOptions | |
| { | |
| Amount = (long)(command.Amount * 100), | |
| Currency = "usd", | |
| Source = command.Token | |
| }); | |
| var paymentId = charge.Id; | |
| // save result, publish event, etc. | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment