Created
July 6, 2018 19:28
-
-
Save jonatasmaxi/c9158151bcbc1b39af7af791df20d033 to your computer and use it in GitHub Desktop.
Refund With Split C#
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
| PagarMeService.DefaultApiKey = "SUA_API_KEY" | |
| PagarMeService.DefaultEncryptionKey = "ENCRYPTION_KEY"; | |
| var account = PagarMeService.GetDefaultService().BankAccounts.Find("ID_DA_CONTA"); | |
| var transaction = PagarMeService.GetDefaultService().Transactions.Find("ID_DA_TRANSACAO"); | |
| var splitRules = new SplitRule[]{ | |
| new SplitRule | |
| { | |
| Id = transaction.SplitRules[0].Id, | |
| Amount = 200, | |
| RecipientId = transaction.SplitRules[0].RecipientId, | |
| ChargeProcessingFee = true | |
| }, | |
| new SplitRule | |
| { | |
| Id = transaction.SplitRules[1].Id, | |
| Amount = 200, | |
| RecipientId = transaction.SplitRules[1].RecipientId, | |
| ChargeProcessingFee = true | |
| } | |
| }; | |
| try { | |
| transaction.Refund(400, splitRules,account); | |
| //Chamada caso cartao | |
| //transaction.Refund(400, splitRules); | |
| } catch(PagarMeException ex){ | |
| Console.WriteLine(ex.Error.Errors[0].Message); | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment