Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
 private string GetQueryTradeInfoCheckValue(string queryTradeInfo, string hashKey, string hashIv)
 {
     return(HashService.EncryptSHA256($"IV={hashIv}&{queryTradeInfo}&Key={hashKey}"));
 }
Exemplo n.º 3
0
 private string GetTradeSha(string aesTradeInfoString, string hashKey, string hashIv)
 {
     return(HashService.EncryptSHA256($"HashKey={hashKey}&{aesTradeInfoString}&HashIV={hashIv}"));
 }
Exemplo n.º 4
0
 private string GetCheckCode(string checkCodeInfoString, string hashKey, string hashIv)
 {
     return(HashService.EncryptSHA256($"HashIV={hashIv}&{checkCodeInfoString}&HashKey={hashKey}"));
 }