【发布时间】:2018-06-22 00:49:14
【问题描述】:
当通知在 payumoney 处理后传递给应用程序时,它会发送响应散列,我们需要计算散列并将其与传入的响应散列匹配。
我使用以下代码来计算预期的响应哈希。
Digest::SHA512.hexdigest([
PAYU_SALT,
notification.transaction_status,
notification.user_defined,
notification.customer_email,
notification.customer_first_name,
notification.product_info,
notification.gross,
notification.invoice,
PAYU_KEY].join("|"))
计算以下字符串的哈希
"salt|success|||||||||||||Payment|100.0|1|key"
当我打印以下哈希时,它给出了
Digest::SHA512.hexdigest([
PAYU_SALT,
notification.transaction_status,
notification.user_defined,
notification.customer_email,
notification.customer_first_name,
notification.product_info,
notification.gross,
notification.invoice,
PAYU_KEY].join("|"))
#⇒ e7b3c5ba00b98aad9186a5e6eea65028a[...]
而notification.checksum 给了
#⇒ 546f5d23e0cadad2d4158911ef72f095d[...]
所以两个哈希不匹配。
我正在使用以下 gem:https://github.com/payu-india/payuindia
感谢任何有关响应哈希不匹配原因的帮助。我计算响应哈希的逻辑是否有任何错误?谢谢!
【问题讨论】:
标签: ruby-on-rails ruby payment-gateway payumoney