Пример #1
0
        }                                           //Refund transaction reference

        protected override void dataValidate()
        {
            //Amount validation
            ParamValidator.amountValidate("refundAmount", refundAmount);

            //Currency validation
            if (string.IsNullOrEmpty(currency))
            {
                throw new YuanpayException("currency is missing");
            }

            //Settlement Currency validation
            if (string.IsNullOrEmpty(settleCurrency))
            {
                throw new YuanpayException("settleCurrency is missing");
            }

            //TransactionNo and Reference validation
            if (string.IsNullOrEmpty(transactionNo) && string.IsNullOrEmpty(reference))
            {
                throw new YuanpayException("transaction number and reference cannot be null at the same time");
            }
            if (!string.IsNullOrEmpty(transactionNo) && !string.IsNullOrEmpty(reference))
            {
                throw new YuanpayException("transaction number and reference cannot exist at the same time");
            }
        }
Пример #2
0
        protected override void dataValidate()
        {
            if (string.IsNullOrEmpty(outAuthInfoNo) &&
                string.IsNullOrEmpty(authInfoNo))
            {
                throw new YuanpayException("outAuthInfoNo and authInfoNo missing");
            }

            if (!string.IsNullOrEmpty(outAuthDetailNo) &&
                !string.IsNullOrEmpty(authInfoNo))
            {
                throw new YuanpayException("outAuthInfoNo and authInfoNo cannot exist at the same time");
            }


            if (string.IsNullOrEmpty(outAuthDetailNo))
            {
                throw new YuanpayException("outAuthDetailNo missing");
            }

            if (string.IsNullOrEmpty(currency))
            {
                throw new YuanpayException("currency missing");
            }
            if (string.IsNullOrEmpty(settleCurrency))
            {
                throw new YuanpayException("settleCurrency missing");
            }

            ParamValidator.amountValidate("unfreezeAmount", unfreezeAmount);
        }
Пример #3
0
        }                                  //Asynchronous callback address

        protected override void dataValidate()
        {
            //AutoDebitNo validation
            if (string.IsNullOrEmpty(autoDebitNo))
            {
                throw new YuanpayException("autoDebitNo is missing");
            }

            //Amount validation
            ParamValidator.amountValidate("amount", amount);

            //Currency validation
            if (string.IsNullOrEmpty(currency))
            {
                throw new YuanpayException("currency is missing");
            }

            //Settlement Currency validation
            if (string.IsNullOrEmpty(settleCurrency))
            {
                throw new YuanpayException("settleCurrency is missing");
            }

            //Reference validation
            if (string.IsNullOrEmpty(reference))
            {
                throw new YuanpayException("reference is missing");
            }

            //IpnUrl validation
            if (string.IsNullOrEmpty(ipnUrl))
            {
                throw new YuanpayException("ipnUrl is missing");
            }
        }
Пример #4
0
 protected override void dataValidate()
 {
     //Validate if infos are missing
     if (string.IsNullOrEmpty(outAuthInfoNo))
     {
         throw new YuanpayException("outAuthInfoNo missing");
     }
     if (string.IsNullOrEmpty(outAuthDetailNo))
     {
         throw new YuanpayException("outAuthDetailNo missing");
     }
     if (string.IsNullOrEmpty(vendor))
     {
         throw new YuanpayException("vendor missing");
     }
     //币种校验
     if (string.IsNullOrEmpty(currency))
     {
         throw new YuanpayException("currency missing.");
     }
     if (string.IsNullOrEmpty(settleCurrency))
     {
         throw new YuanpayException("settleCurrency missing");
     }
     ParamValidator.amountValidate("amount", amount);
 }
Пример #5
0
        }                                     //Transaction reference number

        protected override void dataValidate()
        {
            //Amount validation
            ParamValidator.amountValidate("amount", amount);

            //Currency validation
            if (string.IsNullOrEmpty(currency))
            {
                throw new YuanpayException("currency is missing");
            }
            bool currencyFlag = CurrencyEnums.containValidate(currency);

            if (!currencyFlag)
            {
                throw new YuanpayException("data error: currency");
            }

            //Settlement Currency validation
            if (string.IsNullOrEmpty(settleCurrency))
            {
                throw new YuanpayException("settleCurrency is missing");
            }
            bool settleCurrencyFlag = SettleCurrencyEnums.containValidate(settleCurrency);

            if (!settleCurrencyFlag)
            {
                throw new YuanpayException("data error: settleCurrency");
            }

            //Reference validation
            if (string.IsNullOrEmpty(reference))
            {
                throw new YuanpayException("reference is missing");
            }
        }
        public string note { get; set; } //Transaction note

        protected override void dataValidate()
        {
            //Amount validation
            ParamValidator.amountValidate("amount", amount);

            //Reference number validation
            if (string.IsNullOrEmpty(reference))
            {
                throw new YuanpayException("reference is missing");
            }

            //Currency validation
            if (string.IsNullOrEmpty(currency))
            {
                throw new YuanpayException("currency is missing");
            }

            
            if (string.IsNullOrEmpty(settleCurrency))
            {
                throw new YuanpayException("settleCurrency is missing");
            }

            //Vendor validation
            if (string.IsNullOrEmpty(vendor))
            {
                throw new YuanpayException("vendor is missing");
            }

            //Terminal validation
            if (string.IsNullOrEmpty(terminal))
            {
                throw new YuanpayException("terminal is missing");
            }

            if(VendorEnums.ALIPAY.Value.Equals(vendor) && !TerminalEnums.APP.Value.Equals(terminal))
            {
                throw new YuanpayException("data error: terminal");
            }

            //Openid validation
            if (VendorEnums.WECHATPAY.Value.Equals(vendor))
            {
                if (TerminalEnums.MINIPROGRAM.Value.Equals(terminal) && string.IsNullOrEmpty(openid))
                {
                    throw new YuanpayException("openid is missing");
                }
            }
        }
Пример #7
0
        protected override void dataValidate()
        {
            //Validation
            if (string.IsNullOrEmpty(cardNumber))
            {
                throw new YuanpayException("cardNumber missing");
            }
            if (string.IsNullOrEmpty(cardExpYear))
            {
                throw new YuanpayException("cardExpYear missing");
            }
            if (string.IsNullOrEmpty(cardExpMonth))
            {
                throw new YuanpayException("cardExpMonth missing");
            }
            if (string.IsNullOrEmpty(cardCvv))
            {
                throw new YuanpayException("cardCvv missing");
            }

            ParamValidator.numberValidate("cardNumber", cardNumber);
            ParamValidator.numberValidate("cardExpYear", cardExpYear);
            ParamValidator.numberValidate("cardExpMonth", cardExpMonth);
            ParamValidator.numberValidate("cardCvv", cardCvv);

            ParamValidator.amountValidate("amount", amount);

            if (string.IsNullOrEmpty(currency))
            {
                throw new YuanpayException("currency missing.");
            }
            if (string.IsNullOrEmpty(settleCurrency))
            {
                throw new YuanpayException("settleCurrency missing");
            }
            if (string.IsNullOrEmpty(reference))
            {
                throw new YuanpayException("reference missing");
            }
            if (string.IsNullOrEmpty(clientIp))
            {
                throw new YuanpayException("clientIp missing");
            }
        }
Пример #8
0
        }                                   //The subject line for the email the gets sent out when a payment is completed.

        //Data validation
        protected override void dataValidate()
        {
            //Amount validation
            ParamValidator.amountValidate("amount", amount);

            //Reference validation
            if (string.IsNullOrEmpty(customerNo))
            {
                throw new YuanpayException("customerNo is missing");
            }

            if (string.IsNullOrEmpty(accountToken))
            {
                throw new YuanpayException("accountToken is missing");
            }

            //Currency validation
            if (string.IsNullOrEmpty(currency))
            {
                throw new YuanpayException("currency is missing");
            }

            if (!string.IsNullOrEmpty(invoiceId))
            {
                throw new YuanpayException("invoiceId is missing");
            }

            if (!string.IsNullOrEmpty(description))
            {
                if (description.Length > 100)
                {
                    throw new YuanpayException("description is too long");
                }
            }

            if (!string.IsNullOrEmpty(note))
            {
                if (note.Length > 100)
                {
                    throw new YuanpayException("note is too long");
                }
            }
        }
Пример #9
0
        //Data validation
        protected override void dataValidate()
        {
            //Amount validation
            ParamValidator.amountValidate("amount", amount);

            //Reference validation
            if (string.IsNullOrEmpty(reference))
            {
                throw new YuanpayException("reference is missing");
            }

            //Currency validation
            if (string.IsNullOrEmpty(currency))
            {
                throw new YuanpayException("currency is missing");
            }

            //Settlement Currency validation
            if (string.IsNullOrEmpty(settleCurrency))
            {
                throw new YuanpayException("currency is missing");
            }

            //Vendor validation
            if (string.IsNullOrEmpty(vendor))
            {
                throw new YuanpayException("vendor is missing");
            }

            //Terminal validation
            if (string.IsNullOrEmpty(terminal))
            {
                throw new YuanpayException("terminal is missing");
            }

            //Description and note validation
            if (!string.IsNullOrEmpty(description))
            {
                if (description.Length > 100)
                {
                    throw new YuanpayException("description is too long");
                }
            }

            if (!string.IsNullOrEmpty(note))
            {
                if (note.Length > 100)
                {
                    throw new YuanpayException("note is too long");
                }
            }

            //Goods Info validation
            if (!string.IsNullOrEmpty(goodsInfo))
            {
                var  token    = JToken.Parse(goodsInfo);
                bool jsonFlag = token is JArray;
                if (!jsonFlag)
                {
                    throw new YuanpayException("goodsInfo should be json array format");
                }
            }
        }