/// <summary>Gets the payment result.
        /// Not fully implemented...
        /// </summary>
        /// <param name="data">The data.</param>
        /// <param name="format">The format.</param>
        /// <returns>PaymentResponse.</returns>
        public PaymentResponse GetPaymentResult(NameValueCollection data, RequestFormat format)
        {
            string responseBase64 = ""; //, signatureAlgorithm, responseBase64, type, custom_css_url, locale;

            switch (format)
            {
            case RequestFormat.Json:
            {
                //string signatureBase64 = data["response-signature-base64"];
                //string signatureAlgorithm = data["response-signature-altorithm"];
                responseBase64 = data["response-base64"];
            }
            break;

            case RequestFormat.Xml:
            {
                //string type = data["psp_name"];
                //string custom_css_url = data["custom_css_url"];
                //string locale = data["locale"];
                responseBase64 = data["eppresponse"];
            }
            break;

            case RequestFormat.JsonSigned:
                break;

            case RequestFormat.FormUrlEndocded:
                break;

            default:
                break;
            }

            return(PaymentResponse.Parse(Base64Decode(responseBase64), format));
        }
예제 #2
0
        /// <summary>
        /// Ipns the specified response.
        /// </summary>
        /// <param name="response">The response.</param>
        /// <returns>Task&lt;IActionResult&gt;.</returns>
        public async Task <IActionResult> Ipn()
        {
            string bodyContent = await new StreamReader(Request.Body).ReadToEndAsync();
            var    response    = PaymentResponse.Parse(bodyContent, RequestFormat.Json);

            if (response.Payment.TransactionType.Equals("purcharse"))
            {
                _logger.LogInformation($"{response.Payment.RequestId} Payment Ipn Response Tyle was purchase.", response.Payment.RequestId, response.Payment.TransactionState);
            }

            await LogIpnData(response, bodyContent);

            _logger.LogInformation($"{response.Payment.RequestId} Payment Ipn Response", response.Payment.RequestId, response.Payment.TransactionState);

            return(Ok());
        }
 public void ParsePaymentIpnResponseTest(string responseFile, string payment, RequestFormat type)
 {
     string content = GetFileInStartupPath(responseFile);
     var    result  = PaymentResponse.Parse(content, type);
 }
 public void ParsePaymentResponseTest(string responseFile, string payment, RequestFormat type)
 {
     string content = GetFileInStartupPath(responseFile);
     var    result  = PaymentResponse.Parse(content, type);
     //Assert.IsTrue(result.Payment.PaymentMethods.PaymentMethod.FirstOrDefault().Name == payment);
 }