public bool PayIn(string source, string dest, decimal amount, string message) { long timestamp = ((DateTimeOffset)DateTime.UtcNow).ToUnixTimeSeconds(); string hash = Encrypting.HMD5Hash($"{_partnerCode}|{timestamp.ToString()}|{source}|{dest}|{(int)amount}|{message}", _secretKey); _encrypt.SetKey(_setting.BankCode); var obj = new { from_account_number = source, to_account_number = dest, amount = amount, message = message }; var headers = new Dictionary <string, string>() { { "partner_code", _partnerCode }, { "timestamp", timestamp.ToString() }, { "hash", hash }, { "signature", _encrypt.EncryptData(hash, _secretKey) } }; var info = CallAPIHelper.CallAPI <ExternalBankRes <ExternalTransferMoneyResponse> >(string.Concat(_url, "api/transactions/receive_external"), "POST", obj, headers, addQueryParams: true); if (info != null) { return(info.data.is_success); } else { return(false); } }
public IActionResult Sign(string partnerCode, string input) { _external.SetPartnerCode(); var t1 = _external.GetInfoUser("0000000043"); var t2 = _external.PayIn("0170013731", "0000000043", 1000, "test"); _encrypt.SetKey(partnerCode); var signed = _encrypt.EncryptData(input, ""); return(Ok(signed)); }