Beispiel #1
0
        /// <summary>
        /// 進行信用卡請退款
        /// </summary>
        /// <param name="tradeNo"></param>
        /// <param name="amt"></param>
        /// <param name="closeType">請款=1, 退款=2</param>
        /// <returns></returns>
        public NewebPayCreditCardCloseResponse CreditCardCloseByTradeNo(string tradeNo, int amt, int closeType)
        {
            var postData = new NewebpayCreditCardClosePostDataInfo()
            {
                TradeNo         = tradeNo,
                Version         = _configService.CreditCardCloseVersion,
                Amt             = amt,
                CloseType       = closeType,
                IndexType       = 2,
                RespondType     = "JSON",
                TimeStamp       = UnixDateTimeService.GetUNIX(DateTime.Now).ToString(),
                MerchantOrderNo = ""
            };

            return(DoCreditCardClose(postData));
        }
Beispiel #2
0
        public NewebpayQueryTradeInfoResult QueryTradeInfo(string merchantOrderNo, int amt)
        {
            var postData = new NewebpayQueryTradeInfoInfo()
            {
                MerchantID      = _configService.MerchantId,
                RespondType     = "JSON",
                Version         = _configService.QueryTradeInfoVersion,
                TimeStamp       = UnixDateTimeService.GetUNIX(DateTime.Now).ToString(),
                MerchantOrderNo = merchantOrderNo,
                Amt             = amt
            };

            postData.CheckValue = GetQueryTradeInfoCheckValue($"{nameof(postData.Amt)}={postData.Amt}&{nameof(postData.MerchantID)}={postData.MerchantID}&{nameof(postData.MerchantOrderNo)}={postData.MerchantOrderNo}",
                                                              _configService.HashKey, _configService.HashIv);

            return(DoPostQueryTradeInfo(postData));
        }
        public EzPayInvoiceInvalidResponse InvalidInvoice(ref EzPayInvoiceInvalidInfo ezPayInvoiceInvalidInfo)
        {
            ezPayInvoiceInvalidInfo.Version     = string.IsNullOrEmpty(ezPayInvoiceInvalidInfo.Version) ? _configService.EzPayInvoiceInvalidVersion : ezPayInvoiceInvalidInfo.Version;
            ezPayInvoiceInvalidInfo.RespondType = "JSON";
            ezPayInvoiceInvalidInfo.TimeStamp   = UnixDateTimeService.GetUNIX(DateTime.Now).ToString();

            EzPayInvoiceInvalidResponse response = null;

            var request = new EzPayInvoiceRequest()
            {
                MerchantID_ = _configService.EzPayMerchantId,
                PostData_   = HashService.EncryptAESHex(ezPayInvoiceInvalidInfo.GetDataString(), _configService.EzPayHashKey, _configService.EzPayHashIv)
            };

            FormUrlEncodedContent formContent = new FormUrlEncodedContent(new[] {
                new KeyValuePair <string, string>(nameof(request.MerchantID_), request.MerchantID_),
                new KeyValuePair <string, string>(nameof(request.PostData_), request.PostData_)
            });

            string responseBody = HttpService.PostForm(_configService.EzPayInvoiceInvalid, formContent);

            if (!string.IsNullOrEmpty(responseBody))
            {
                var deserializeObj = JsonConvert.DeserializeObject <JObject>(responseBody);
                response = new EzPayInvoiceInvalidResponse()
                {
                    Message = deserializeObj.GetValue("Message").ToString(),
                    Status  = deserializeObj.GetValue("Status").ToString(),
                };

                if (response.IsSucceed)
                {
                    response.Result = JsonConvert.DeserializeObject <EzPayInvoiceInvalidResult>(deserializeObj.GetValue("Result").ToString());
                }
            }

            return(response);
        }