~singpolyma/sgx-jmp

ref: bb9f4f1daf70f170db0d1420ceae49f5b7ebb4c1 sgx-jmp/lib/payment_method.rb -rw-r--r-- 532 bytes
bb9f4f1dStephen Paul Weber Send 3DS id when making a transaction 9 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# frozen_string_literal: true

require "delegate"

class PaymentMethod < SimpleDelegator
	def self.for(method, three_d_secure={})
		three_d = three_d_secure[method.token]
		return ThreeDSecure.new(method, three_d) if three_d

		new(method)
	end

	def transaction_details
		{
			payment_method_token: token
		}
	end

	class ThreeDSecure < PaymentMethod
		def initialize(method, three_d)
			super(method)
			@three_d = three_d
		end

		def transaction_details
			super.merge(three_d_secure_authentication_id: @three_d)
		end
	end
end