예제 #1
0
        public static PaymentVerifyResult CreateVerifyResult(
            string webServiceResponse,
            InvoiceContext context,
            IranKishCallbackResult callbackResult,
            MessagesOptions messagesOptions)
        {
            var result = XmlHelper.GetNodeValueFromXml(webServiceResponse, "KicccPaymentsVerificationResult");

            // The result object is actually the amount of invoice . It must equal to invoice's amount.
            if (!long.TryParse(result, out var numericResult))
            {
                return(new PaymentVerifyResult
                {
                    TrackingNumber = callbackResult.InvoiceNumber,
                    TransactionCode = callbackResult.ReferenceId,
                    IsSucceed = false,
                    Message = messagesOptions.InvalidDataReceivedFromGateway
                });
            }

            var isSuccess = numericResult != (long)context.Payment.Amount;

            var translatedMessage = isSuccess
                ? messagesOptions.PaymentSucceed
                : IranKishGatewayResultTranslator.Translate(result, messagesOptions);

            return(new PaymentVerifyResult
            {
                TrackingNumber = callbackResult.InvoiceNumber,
                TransactionCode = callbackResult.ReferenceId,
                IsSucceed = true,
                Message = translatedMessage
            });
        }
예제 #2
0
 public static string CreateVerifyData(IranKishCallbackResult callbackResult, IranKishGatewayAccount account)
 {
     return
         ("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:tem=\"http://tempuri.org/\">" +
          "<soapenv:Header/>" +
          "<soapenv:Body>" +
          "<tem:KicccPaymentsVerification>" +
          $"<tem:token>{callbackResult.Token}</tem:token>" +
          $"<tem:merchantId>{account.MerchantId}</tem:merchantId>" +
          $"<tem:referenceNumber>{callbackResult.ReferenceId}</tem:referenceNumber>" +
          "<tem:sha1Key></tem:sha1Key>" +
          "</tem:KicccPaymentsVerification>" +
          "</soapenv:Body>" +
          "</soapenv:Envelope>");
 }