笔者在这一章节,进行hashId及取得nonce资料的实作
def get_hash_id(hash_a1, hash_a2, hash_b1, hash_b2):
hash_a = format((int(hash_a1, 16) ^ int(hash_a2, 16)), 'x')
hash_b = format((int(hash_b1, 16) ^ int(hash_b2, 16)), 'x')
hash_id = hash_a + hash_b
return hash_id.upper()
def get_nonce(shop_no):
nonce_url = "https://sandbox.sinopac.com/QPay.WebAPI/api/Nonce"
req_body = {"ShopNo": shop_no}
r = requests.post(url=nonce_url, json = req_body)
return r.json()["Nonce"]
get_hash_id这个function是用来将丰收款提供的四组Hash产出HashId,先将Hex转成int後,再利用^做XOR,之後再转回去Hex字串,最後将两组XOR完的字串加在一起。
get_nonce则是透过requests这个library去帮我们实践Http的post请求,最後将response转成json後,取得"Nonce"这个栏位的资料即可。
以上是我的两个function的实作
今天这篇文章主要想介绍两个重点: 测试使用 Vuex 的元件 测试 Vuex 本身 Testing ...
请教各位高手,如这个卖纪念品的网站 https://myspotifyplaque.com/ 他可以...
Chain 和 Range 的差异 讲者很用心提到这个地方,他用换页的时後底下点点跟着移动作为例子。...
前言 我们经常会说换位思考,也就是说,身为工程师,如果能清楚知道管理阶级的想法,就能聪明有效率的做事...
For the topic today, I can't fully understand the ...