public FormUrlEncodedContent MakePostContent()
        {
            var keyValues = new List <KeyValuePair <string, string> >();

            keyValues.Add(new KeyValuePair <string, string>("merchant_id", MerchantId.ToString()));
            keyValues.Add(new KeyValuePair <string, string>("token", Token));
            keyValues.Add(new KeyValuePair <string, string>("checksum", Checksum));
            return(new FormUrlEncodedContent(keyValues));
        }
示例#2
0
        public IEnumerable <ValidationResult> Validate(ValidationContext validationContext)
        {
            var paymentProvider = (IPaymentProvider)validationContext
                                  .GetService(typeof(IPaymentProvider));
            var expectedSignature = paymentProvider.GetSignature(MerchantId.ToString(), ReferenceCode, TotalValue, Currency, TransactionState.ToString());

            if (!expectedSignature.Equals(Signature, StringComparison.OrdinalIgnoreCase))
            {
                yield return(ValidationResult.Success);
                //yield return new ValidationResult("This request is not verified by the payment provider");
            }
        }
        public FormUrlEncodedContent MakePostContent()
        {
            var keyValues = new List <KeyValuePair <string, string> >();

            keyValues.Add(new KeyValuePair <string, string>("merchant_id", MerchantId.ToString()));
            keyValues.Add(new KeyValuePair <string, string>("merchant_password", SecurityHelper.MD5Hash(MerchantPassword)));
            keyValues.Add(new KeyValuePair <string, string>("version", Version));
            keyValues.Add(new KeyValuePair <string, string>("function", Function));
            keyValues.Add(new KeyValuePair <string, string>("receiver_email", ReceiverEmail));
            keyValues.Add(new KeyValuePair <string, string>("order_code", OrderCode));
            keyValues.Add(new KeyValuePair <string, string>("total_amount", TotalAmount.ToString()));
            keyValues.Add(new KeyValuePair <string, string>("payment_method", PaymentMethod));
            keyValues.Add(new KeyValuePair <string, string>("bank_code", BankCode));
            keyValues.Add(new KeyValuePair <string, string>("return_url", ReturnUrl));
            keyValues.Add(new KeyValuePair <string, string>("cancel_url", CancelUrl));
            keyValues.Add(new KeyValuePair <string, string>("buyer_fullname", BuyerFullname));
            keyValues.Add(new KeyValuePair <string, string>("buyer_email", BuyerEmail));
            keyValues.Add(new KeyValuePair <string, string>("buyer_mobile", BuyerMobile));
            keyValues.Add(new KeyValuePair <string, string>("cur_code", "vnd"));
            return(new FormUrlEncodedContent(keyValues));
        }