iT邦幫忙

2021 iThome 鐵人賽

DAY 14
0

更新一下get_iv這支程式

def get_iv(nonce):
    sha_nonce_value = hashlib.sha256(nonce.encode("utf-8")).hexdigest().upper()
    return sha_nonce_value[-17:-1]

本節將進行整合,產出加密過的Message

shop_no = 'NA0249_001 '
hash_a1 = '86D50DEF3EB7400E'
hash_a2 = '01FD27C09E5549E5'
hash_b1 = '9E004965F4244953'
hash_b2 = '7FB3385F414E4F91'

origin_message = {
    'ShopNo': shop_no,
    'OrderNo': get_order(True),
    'Amount': 500 * 100,
    'CurrencyID': 'TWD',
    'PayType': 'A',
    'ATMParam': {
        'ExpireDate': '20210929'
    },
    'PrdtName': '虛擬帳號訂單',
    'ReturnURL': 'http://10.11.22.113:8803/QPay.ApiClient/Store/Return',
    'BackendURL': 'http://10.11.22.113:8803/QPay.ApiClient/AutoPush/PushSuccess'
}
data_string = json.dumps(origin_message, ensure_ascii=False, separators=(',', ':'))

將結果print出來

print(get_message(get_hash_id(hash_a1, hash_a2, hash_b1, hash_b2), data_string, get_iv(get_nonce(shop_no))))

結果為

BE7E5D86D964765EEB05935DB851AD65120679F696243EAE53E3915B17AC430904995AB31820AB406ED6855742D0ABF4EA2B623324E968584025C1E87860FF999F7F7EE6DCE011CC7C1876C6D17772F3654F4FB46072CA4CAC5A468B64C2560544C9516F0BB13A86837DE0A03BD0677330487ED1B27E521AF245A354C5CC49A6C4CC553D27FB8727D13BB989C24A639E31803394263DA54C8DD3E6EE3503FD7F6442CF226A9EBCB8B24697C89E958FE1D515CEFA7BADD32AFE0BCA5A46372E1DE674B6E334EF34B9F82FC2797A097261679722F81CB1CC51D69CD3E21419262DFBA5BB9AD2BAF2449B4DAFBEE5931907C2F48F24478ADACC43E8F6049AE8291A12E91BE6453420539D9BE42B5A9F54BCE64CC474971480A61BB9B749C1C60C15A06FC67BC8F18DE11725DFE86F5163AB05AAA570860AE25B65A890514D0CD32E73BCE435BA8050CC087FFFAE5B5327CB

上一篇
[Day13] 建立訂單交易API_6
下一篇
[Day15] 建立訂單交易API_8
系列文
從永豐金融APIs進入Open API的30天挑戰18
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言