~singpolyma/jmp-pay

fdedfcb0838f1f360b097e5fa4cba30122378987 — Stephen Paul Weber 29 days ago a56128b
Stop storing 3DS ID

It can't be used after vault time anyway.
1 files changed, 1 insertions(+), 32 deletions(-)

M lib/three_d_secure_repo.rb
M lib/three_d_secure_repo.rb => lib/three_d_secure_repo.rb +1 -32
@@ 3,23 3,7 @@
class ThreeDSecureRepo
	class Failed < StandardError; end

	def initialize(redis: REDIS)
		@redis = redis
	end

	def find(customer_id, token)
		redis(:hget, customer_id, token)
	end

	def put(customer_id, token, authid)
		if !authid || authid.empty?
			redis(:hdel, customer_id, token)
		else
			redis(:hset, customer_id, token, authid)
		end
	end

	def put_from_payment_method(customer_id, method)
	def put_from_payment_method(_customer_id, method)
		return unless method.verification # Already vaulted

		three_d = method.verification.three_d_secure_info


@@ 27,20 11,5 @@ class ThreeDSecureRepo
		   (three_d.liability_shift_possible && !three_d.liability_shifted)
			raise Failed, method.token
		end

		put(
			customer_id, method.token,
			three_d.three_d_secure_authentication_id
		)
	end

protected

	def redis(action, customer_id, *args)
		@redis.public_send(
			action,
			"jmp_customer_three_d_secure_authentication_id-#{customer_id}",
			*args
		)
	end
end