Skip to content

Commit

Permalink
Intermediate commit for paymentmethod details contract
Browse files Browse the repository at this point in the history
  • Loading branch information
brorbw committed Jan 12, 2024
1 parent c61b896 commit 4557ee9
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions lib/aliquot/validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -232,27 +232,28 @@ class EncryptedMessageContract < Dry::Validation::Contract
rule(:messageExpiration).validate(:integer_string?)
rule(:paymentMethodDetails) do
contract = nil
if 'ECv1'.eql?(values[:protocolVersion])
if 'TOKENIZED_CARD'.eql?(values[:paymentMethod])
contract = ECv1_TokenizedPaymentMethodDetailsContract.new
else
contract = ECv1_PaymentMethodDetailsContract.new
end
if 'ECv1'.eql?(values[:protocolVersion])
if 'TOKENIZED_CARD'.eql?(values[:paymentMethod])
contract = ECv1_TokenizedPaymentMethodDetailsContract.new
else
if 'CRYPTOGRAM_3DS'.eql?(values[:authMethod])
contract = ECv2_TokenizedPaymentMethodDetailsContract.new
else
contract = ECv2_PaymentMethodDetailsContract.new
end
key.failure("test") unless
contract.(values)
contract = ECv1_PaymentMethodDetailsContract.new
end
else
if 'CRYPTOGRAM_3DS'.eql?(values[:authMethod])
contract = ECv2_TokenizedPaymentMethodDetailsContract.new
else
contract = ECv2_PaymentMethodDetailsContract.new
end
end
# contract.(values)
end
rule(:paymentMethod) do
if '3DS'.eql?(values[:paymentMethodDetails] && values[:paymentMethodDetails]['authMethod']) # Tokenized ECv1
key.failure('must be equal to TOKENIZED_CARD') unless 'TOKENIZED_CARD'.eql?(value)
else
key.failure('must be equal to CARD') unless 'CARD'.eql?(value)
if values[:paymentMethodDetails]
if '3DS'.eql?(values[:paymentMethodDetails] && values[:paymentMethodDetails]['authMethod']) # Tokenized ECv1
key.failure('must be equal to TOKENIZED_CARD') unless 'TOKENIZED_CARD'.eql?(value)
else
key.failure('must be equal to CARD') unless 'CARD'.eql?(value)
end
end
end
end
Expand Down

0 comments on commit 4557ee9

Please sign in to comment.