public static string CreateRefundData(ParsianGatewayOptions options, Payment payment, Money amount) { var transaction = payment.Transactions.SingleOrDefault(item => item.Type == TransactionType.Verify); if (transaction == null) { throw new InvalidOperationException($"No transaction record found in database for payment with tracking number {payment.TrackingNumber}."); } if (!AdditionalDataConverter.ToDictionary(transaction).TryGetValue("token", out var token)) { throw new InvalidOperationException($"No token found in database for payment with tracking number {payment.TrackingNumber}."); } return ("<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:rev=\"https://pec.Shaparak.ir/NewIPGServices/Reversal/ReversalService\">" + "<soap:Header/>" + "<soap:Body>" + "<rev:ReversalRequest>" + "<!--Optional:-->" + "<rev:requestData>" + "<!--Optional:-->" + $"<rev:LoginAccount>{options.LoginAccount}</rev:LoginAccount>" + $"<rev:Token>{token}</rev:Token>" + "</rev:requestData>" + "</rev:ReversalRequest>" + "</soap:Body>" + "</soap:Envelope>"); }
public static string CreateVerifyData(ParsianGatewayOptions options, ParsianCallbackResult callbackResult) { return ("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:con=\"https://pec.Shaparak.ir/NewIPGServices/Confirm/ConfirmService\">" + "<soapenv:Header/>" + "<soapenv:Body>" + "<con:ConfirmPayment>" + "<!--Optional:-->" + "<con:requestData>" + "<!--Optional:-->" + $"<con:LoginAccount>{options.LoginAccount}</con:LoginAccount>" + $"<con:Token>{callbackResult.Token}</con:Token>" + "</con:requestData>" + "</con:ConfirmPayment>" + "</soapenv:Body>" + "</soapenv:Envelope>"); }
public static string CreateRequestData(ParsianGatewayOptions options, Invoice invoice) { return ("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:sal=\"https://pec.Shaparak.ir/NewIPGServices/Sale/SaleService\">" + "<soapenv:Header/>" + "<soapenv:Body>" + "<sal:SalePaymentRequest>" + "<!--Optional:-->" + "<sal:requestData>" + "<!--Optional:-->" + $"<sal:LoginAccount>{options.LoginAccount}</sal:LoginAccount>" + $"<sal:Amount>{(long)invoice.Amount}</sal:Amount>" + $"<sal:OrderId>{invoice.TrackingNumber}</sal:OrderId>" + "<!--Optional:-->" + $"<sal:CallBackUrl>{invoice.CallbackUrl}</sal:CallBackUrl>" + "<!--Optional:-->" + "<sal:AdditionalData></sal:AdditionalData>" + "<!--Optional:-->" + "<sal:Originator></sal:Originator>" + "</sal:requestData>" + "</sal:SalePaymentRequest> " + "</soapenv:Body> " + "</soapenv:Envelope> "); }