public async Task TransactionRefundAsync(string transactionID, string amount, string exchangeUrl) { try { ClearDebug(); var parsed = int.TryParse(amount, out var numValue); if (!parsed || transactionID == "") { if (!parsed) { AddDebug("foutieve invoer"); AddDebug("amount: only numbers. 3,40 must be filled in as 350"); } AddDebug("foutieve invoer"); AddDebug("transactionID mag niet leeg zijn"); } else if (exchangeUrl != "") { AddDebug("-----"); AddDebug("Working with modified version of call"); var response = await new Transaction(ClientService) .RefundAsync(transactionID, null, numValue, null, exchangeUrl); tbMain.Text = response.RefundId; } else { var request = new PayNL.API.Transaction.Refund.Request { Amount = numValue, TransactionId = transactionID }; InitRequestDebug(request); await ClientService.PerformPostRequestAsync(request); DebugRawResponse(request); tbMain.Text = request.Response.RefundId; } } catch (ErrorException ee) { AddDebug("~~EXCEPTION~~"); AddDebug(ee.Message); } }
/// <summary> /// Performs a (partial) refund call on an existing transaction /// </summary> /// <param name="transactionId">Transaction ID</param> /// <param name="description">Reason for the refund. May be null.</param> /// <param name="amount">Amount of the refund. If null is given, it will be the full amount of the transaction.</param> /// <param name="processDate">Date to process the refund. May be null.</param> /// <returns>Full response including the Refund ID</returns> public async Task <API.Transaction.Refund.Response> RefundAsync(string transactionId, string description, int?amount, DateTime?processDate) { var request = new TransactionRefund { TransactionId = transactionId, Description = description, Amount = amount, ProcessDate = processDate }; await ClientService.PerformPostRequestAsync(request); return(request.Response); }