# 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