/// <summary> /// Refunds completely the paid payment. /// </summary> /// <param name="onlinePayment"></param> /// <param name="verifyResult"></param> /// <param name="cancellationToken"></param> public static Task <IPaymentRefundResult> RefundCompletelyAsync( this IOnlinePayment onlinePayment, IPaymentVerifyResult verifyResult, CancellationToken cancellationToken = default) { if (onlinePayment == null) { throw new ArgumentNullException(nameof(onlinePayment)); } if (verifyResult == null) { throw new ArgumentNullException(nameof(verifyResult)); } return(onlinePayment.RefundAsync(new RefundInvoice(verifyResult.TrackingNumber), cancellationToken)); }
/// <summary> /// Refunds a specific amount of a payment with the given tracking number. /// <para>Note: Only Saman Gateway supports this operation.</para> /// </summary> /// <param name="onlinePayment"></param> /// <param name="trackingNumber">The tracking number of the payment that must be refunded.</param> /// <param name="amount">Amount of refund.</param> /// <param name="cancellationToken"></param> public static Task <IPaymentRefundResult> RefundSpecificAmountAsync( this IOnlinePayment onlinePayment, long trackingNumber, decimal amount, CancellationToken cancellationToken = default) => onlinePayment.RefundAsync(new RefundInvoice(trackingNumber, amount), cancellationToken);
/// <summary> /// Refunds completely a specific payment with the given tracking number. /// </summary> /// <param name="onlinePayment"></param> /// <param name="trackingNumber">The tracking number of the payment that must be refunded.</param> public static IPaymentRefundResult RefundCompletely(this IOnlinePayment onlinePayment, long trackingNumber) => onlinePayment.RefundAsync(new RefundInvoice(trackingNumber)) .GetAwaiter() .GetResult();
/// <summary> /// Refunds completely a specific payment with the given tracking number. /// </summary> /// <param name="onlinePayment"></param> /// <param name="trackingNumber">The tracking number of the payment that must be refunded.</param> /// <param name="cancellationToken"></param> public static Task <IPaymentRefundResult> RefundCompletelyAsync( this IOnlinePayment onlinePayment, long trackingNumber, CancellationToken cancellationToken = default) => onlinePayment.RefundAsync(new RefundInvoice(trackingNumber), cancellationToken);
/// <summary> /// Performs a refund request for the given invoice. /// </summary> /// <param name="onlinePayment"></param> /// <param name="invoice">The invoice that must be refunded.</param> public static IPaymentRefundResult Refund(this IOnlinePayment onlinePayment, RefundInvoice invoice) => onlinePayment.RefundAsync(invoice) .GetAwaiter() .GetResult();