1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-19 13:54:25 +01:00

fix passing payzen tests

This commit is contained in:
Sylvain 2021-06-14 14:53:59 +02:00
parent ec301ba07e
commit 7cfa2ca2c7
2 changed files with 3 additions and 3 deletions

View File

@ -19,10 +19,10 @@ class PayZen::Helper
end
## generate an unique string reference for the content of a cart
def generate_ref(cart_items, customer, date = DateTime.current)
def generate_ref(cart_items, customer)
require 'sha3'
content = { cart_items: cart_items, customer: customer }.to_json + date.to_s
content = { cart_items: cart_items, customer: customer }.to_json + DateTime.current.to_s
# It's safe to truncate a hash. See https://crypto.stackexchange.com/questions/74646/sha3-255-one-bit-less
SHA3::Digest.hexdigest(:sha224, content)[0...24]
end

View File

@ -93,7 +93,7 @@ class PayzenTest < ActionDispatch::IntegrationTest
cs = CartService.new(@user)
cart = cs.from_hash(cart_items)
amount = cart.total[:total]
id = PayZen::Helper.generate_ref(cart_items, @user.id, DateTime.new(1970, 1, 1, 0, 0, 0))
id = 'dffd53627a4901e986862674'
VCR.use_cassette('confirm_payzen_payment_success') do
client = PayZen::PCI::Charge.new