From c7109f9aa14821a38617066378a8dc47794a5d4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Armando=20Rodr=C3=ADguez?= <127134616+armando-rodriguez-cko@users.noreply.github.com> Date: Fri, 25 Oct 2024 15:41:22 +0200 Subject: [PATCH] VISA, Paypal source, Partial Auth and account_holder updates --- .gitignore | 1 + lib/checkout_sdk/accounts/accounts.rb | 21 +++ .../accounts/additional_document.rb | 11 ++ lib/checkout_sdk/accounts/additional_info.rb | 17 +++ .../accounts/articles_of_association_type.rb | 10 ++ .../accounts/bank_verification.rb | 14 ++ .../accounts/bank_verification_type.rb | 9 ++ lib/checkout_sdk/accounts/company.rb | 8 +- lib/checkout_sdk/accounts/contact_details.rb | 5 +- .../accounts/date_of_incorporation.rb | 14 ++ .../accounts/financial_verification.rb | 14 ++ .../accounts/financial_verification_type.rb | 9 ++ lib/checkout_sdk/accounts/invitee.rb | 11 ++ lib/checkout_sdk/accounts/onboard_entity.rb | 17 ++- .../accounts/onboard_sub_entity_documents.rb | 35 ++++- .../accounts/processing_details.rb | 26 ++++ .../accounts/proof_of_legality.rb | 14 ++ .../accounts/proof_of_legality_type.rb | 9 ++ .../accounts/proof_of_principal_address.rb | 14 ++ .../proof_of_principal_address_type.rb | 9 ++ .../accounts/shareholder_structure.rb | 14 ++ .../accounts/shareholder_structure_type.rb | 9 ++ .../common/account_change_indicator_type.rb | 12 ++ lib/checkout_sdk/common/account_holder.rb | 11 +- .../account_password_change_indicator_type.rb | 13 ++ .../common/account_type_card_product_type.rb | 11 ++ .../cardholder_account_age_indicator_type.rb | 13 ++ lib/checkout_sdk/common/common.rb | 6 + lib/checkout_sdk/common/customer_retry.rb | 11 ++ lib/checkout_sdk/common/destination.rb | 38 +++++ .../common/payment_source_type.rb | 5 + lib/checkout_sdk/payments/exemption.rb | 2 + .../hosted/hosted_payments_session.rb | 20 ++- .../payments/links/payment_link.rb | 16 ++ .../payments/partial_authorization.rb | 11 ++ lib/checkout_sdk/payments/payment_request.rb | 3 + lib/checkout_sdk/payments/payments.rb | 6 +- .../payments/sender/government_sender.rb | 3 + .../payments/sender/individual_sender.rb | 3 + .../sessions/payment_sessions_request.rb | 3 + .../payments/source/apm/ach_source.rb | 27 ++++ .../payments/source/apm/bizum_source.rb | 15 ++ .../payments/source/apm/octopus_source.rb | 11 ++ .../payments/source/apm/plaid_source.rb | 17 +++ .../payments/source/apm/sequra_source.rb | 15 ++ .../payments/source/card_source.rb | 5 +- .../payments/source/customer_source.rb | 5 +- lib/checkout_sdk/payments/source/id_source.rb | 5 +- .../payments/source/network_token_source.rb | 5 +- .../payments/source/token_source.rb | 5 +- .../sessions/authentication_method.rb | 6 +- .../sessions/authentication_type.rb | 6 +- .../sessions/card_holder_account_info.rb | 42 +++++- .../sessions/channel/browser_session.rb | 3 +- .../sessions/channel/channel_data_type.rb | 1 + .../channel/merchant_initiated_session.rb | 15 ++ .../sessions/channel/request_type.rb | 19 +++ .../sessions/channel/sdk_interface_type.rb | 4 +- .../sessions/initial_transaction.rb | 23 +++ lib/checkout_sdk/sessions/installment.rb | 5 + .../sessions/merchant_risk_info.rb | 22 ++- lib/checkout_sdk/sessions/optimization.rb | 19 +++ .../sessions/optimized_properties.rb | 17 +++ .../pre_order_purchase_indicator_type.rb | 10 ++ lib/checkout_sdk/sessions/recurring.rb | 5 + .../sessions/reorder_items_indicator_type.rb | 10 ++ lib/checkout_sdk/sessions/session_request.rb | 22 ++- lib/checkout_sdk/sessions/sessions.rb | 9 ++ .../sessions/source/card_source.rb | 3 +- .../sessions/three_ds_req_auth_method.rb | 16 ++ .../three_ds_requestor_authentication_info.rb | 17 +++ lib/checkout_sdk/sessions/transaction_type.rb | 6 +- .../request_apm_payments_integration_spec.rb | 139 ++++++++++++++++-- spec/checkout_sdk/sessions/sessions_helper.rb | 6 + .../sessions/sessions_integration_spec.rb | 23 +++ 75 files changed, 977 insertions(+), 59 deletions(-) create mode 100644 lib/checkout_sdk/accounts/additional_document.rb create mode 100644 lib/checkout_sdk/accounts/additional_info.rb create mode 100644 lib/checkout_sdk/accounts/articles_of_association_type.rb create mode 100644 lib/checkout_sdk/accounts/bank_verification.rb create mode 100644 lib/checkout_sdk/accounts/bank_verification_type.rb create mode 100644 lib/checkout_sdk/accounts/date_of_incorporation.rb create mode 100644 lib/checkout_sdk/accounts/financial_verification.rb create mode 100644 lib/checkout_sdk/accounts/financial_verification_type.rb create mode 100644 lib/checkout_sdk/accounts/invitee.rb create mode 100644 lib/checkout_sdk/accounts/processing_details.rb create mode 100644 lib/checkout_sdk/accounts/proof_of_legality.rb create mode 100644 lib/checkout_sdk/accounts/proof_of_legality_type.rb create mode 100644 lib/checkout_sdk/accounts/proof_of_principal_address.rb create mode 100644 lib/checkout_sdk/accounts/proof_of_principal_address_type.rb create mode 100644 lib/checkout_sdk/accounts/shareholder_structure.rb create mode 100644 lib/checkout_sdk/accounts/shareholder_structure_type.rb create mode 100644 lib/checkout_sdk/common/account_change_indicator_type.rb create mode 100644 lib/checkout_sdk/common/account_password_change_indicator_type.rb create mode 100644 lib/checkout_sdk/common/account_type_card_product_type.rb create mode 100644 lib/checkout_sdk/common/cardholder_account_age_indicator_type.rb create mode 100644 lib/checkout_sdk/common/customer_retry.rb create mode 100644 lib/checkout_sdk/common/destination.rb create mode 100644 lib/checkout_sdk/payments/partial_authorization.rb create mode 100644 lib/checkout_sdk/payments/source/apm/ach_source.rb create mode 100644 lib/checkout_sdk/payments/source/apm/bizum_source.rb create mode 100644 lib/checkout_sdk/payments/source/apm/octopus_source.rb create mode 100644 lib/checkout_sdk/payments/source/apm/plaid_source.rb create mode 100644 lib/checkout_sdk/payments/source/apm/sequra_source.rb create mode 100644 lib/checkout_sdk/sessions/channel/merchant_initiated_session.rb create mode 100644 lib/checkout_sdk/sessions/channel/request_type.rb create mode 100644 lib/checkout_sdk/sessions/initial_transaction.rb create mode 100644 lib/checkout_sdk/sessions/optimization.rb create mode 100644 lib/checkout_sdk/sessions/optimized_properties.rb create mode 100644 lib/checkout_sdk/sessions/pre_order_purchase_indicator_type.rb create mode 100644 lib/checkout_sdk/sessions/reorder_items_indicator_type.rb create mode 100644 lib/checkout_sdk/sessions/three_ds_req_auth_method.rb create mode 100644 lib/checkout_sdk/sessions/three_ds_requestor_authentication_info.rb diff --git a/.gitignore b/.gitignore index ceb2034..5c86ca7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ *.DS_Store *.lock +/vendor/ /.bundle/ /.yardoc /_yardoc/ diff --git a/lib/checkout_sdk/accounts/accounts.rb b/lib/checkout_sdk/accounts/accounts.rb index 7bf5d6f..d2d69e3 100644 --- a/lib/checkout_sdk/accounts/accounts.rb +++ b/lib/checkout_sdk/accounts/accounts.rb @@ -36,3 +36,24 @@ require 'checkout_sdk/accounts/payment_instruments_query' require 'checkout_sdk/accounts/headers' require 'checkout_sdk/accounts/update_payment_instrument_request' +require 'checkout_sdk/accounts/additional_document' +require 'checkout_sdk/accounts/additional_info' +require 'checkout_sdk/accounts/articles_of_association_type' +require 'checkout_sdk/accounts/bank_verification' +require 'checkout_sdk/accounts/bank_verification_type' +require 'checkout_sdk/accounts/company_verification' +require 'checkout_sdk/accounts/company_verification_type' +require 'checkout_sdk/accounts/date_of_incorporation' +require 'checkout_sdk/accounts/financial_verification' +require 'checkout_sdk/accounts/financial_verification_type' +require 'checkout_sdk/accounts/invitee' +require 'checkout_sdk/accounts/onboard_sub_entity_documents' +require 'checkout_sdk/accounts/processing_details' +require 'checkout_sdk/accounts/proof_of_legality' +require 'checkout_sdk/accounts/proof_of_legality_type' +require 'checkout_sdk/accounts/proof_of_principal_address' +require 'checkout_sdk/accounts/proof_of_principal_address_type' +require 'checkout_sdk/accounts/shareholder_structure' +require 'checkout_sdk/accounts/shareholder_structure_type' +require 'checkout_sdk/accounts/tax_verification' +require 'checkout_sdk/accounts/tax_verification_type' diff --git a/lib/checkout_sdk/accounts/additional_document.rb b/lib/checkout_sdk/accounts/additional_document.rb new file mode 100644 index 0000000..749ef9d --- /dev/null +++ b/lib/checkout_sdk/accounts/additional_document.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module CheckoutSdk + module Accounts + # @!attribute front + # @return [String] + class AdditionalDocument + attr_accessor :front + end + end +end diff --git a/lib/checkout_sdk/accounts/additional_info.rb b/lib/checkout_sdk/accounts/additional_info.rb new file mode 100644 index 0000000..c70191b --- /dev/null +++ b/lib/checkout_sdk/accounts/additional_info.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module CheckoutSdk + module Accounts + # @!attribute field1 + # @return [String] + # @!attribute field2 + # @return [String] + # @!attribute field3 + # @return [String] + class AdditionalInfo + attr_accessor :field1, + :field2, + :field3 + end + end +end diff --git a/lib/checkout_sdk/accounts/articles_of_association_type.rb b/lib/checkout_sdk/accounts/articles_of_association_type.rb new file mode 100644 index 0000000..6879c08 --- /dev/null +++ b/lib/checkout_sdk/accounts/articles_of_association_type.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module CheckoutSdk + module Accounts + module ArticlesOfAssociationType + MEMORANDUM_OF_ASSOCIATION = 'memorandum_of_association' + ARTICLES_OF_ASSOCIATION = 'articles_of_association' + end + end +end diff --git a/lib/checkout_sdk/accounts/bank_verification.rb b/lib/checkout_sdk/accounts/bank_verification.rb new file mode 100644 index 0000000..f25be5d --- /dev/null +++ b/lib/checkout_sdk/accounts/bank_verification.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module CheckoutSdk + module Accounts + # @!attribute type + # @return [BankVerificationType] + # @!attribute front + # @return [String] + class BankVerification + attr_accessor :type, + :front + end + end +end diff --git a/lib/checkout_sdk/accounts/bank_verification_type.rb b/lib/checkout_sdk/accounts/bank_verification_type.rb new file mode 100644 index 0000000..594ac99 --- /dev/null +++ b/lib/checkout_sdk/accounts/bank_verification_type.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +module CheckoutSdk + module Accounts + module BankVerificationType + BANK_STATEMENT = 'bank_statement' + end + end +end diff --git a/lib/checkout_sdk/accounts/company.rb b/lib/checkout_sdk/accounts/company.rb index d719fcf..1bdccf0 100644 --- a/lib/checkout_sdk/accounts/company.rb +++ b/lib/checkout_sdk/accounts/company.rb @@ -10,12 +10,16 @@ module Accounts # @return [String] # @!attribute trading_name # @return [String] + # @!attribute date_of_incorporation + # @return [DateOfIncorporation] + # @!attribute regulatory_licence_number + # @return [String] # @!attribute principal_address # @return [CheckoutSdk::Common::Address] # @!attribute registered_address # @return [CheckoutSdk::Common::Address] # @!attribute representatives - # @return [Array(Representative)] + # @return [Array(EntityRepresentative)] # @!attribute document # @return [EntityDocument] # @!attribute financial_details @@ -25,6 +29,8 @@ class Company :business_type, :legal_name, :trading_name, + :date_of_incorporation, + :regulatory_licence_number, :principal_address, :registered_address, :representatives, diff --git a/lib/checkout_sdk/accounts/contact_details.rb b/lib/checkout_sdk/accounts/contact_details.rb index f72dd2c..3df6b5c 100644 --- a/lib/checkout_sdk/accounts/contact_details.rb +++ b/lib/checkout_sdk/accounts/contact_details.rb @@ -6,9 +6,12 @@ module Accounts # @return [Phone] # @!attribute email_addresses # @return [EntityEmailAddresses] + # @!attribute invitee + # @return [Invitee] class ContactDetails attr_accessor :phone, - :email_addresses + :email_addresses, + :invitee end end end diff --git a/lib/checkout_sdk/accounts/date_of_incorporation.rb b/lib/checkout_sdk/accounts/date_of_incorporation.rb new file mode 100644 index 0000000..243d335 --- /dev/null +++ b/lib/checkout_sdk/accounts/date_of_incorporation.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module CheckoutSdk + module Accounts + # @!attribute month + # @return [Integer] + # @!attribute year + # @return [Integer] + class DateOfIncorporation + attr_reader :month, + :year + end + end +end diff --git a/lib/checkout_sdk/accounts/financial_verification.rb b/lib/checkout_sdk/accounts/financial_verification.rb new file mode 100644 index 0000000..4176906 --- /dev/null +++ b/lib/checkout_sdk/accounts/financial_verification.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module CheckoutSdk + module Accounts + # @!attribute type + # @return [FinancialVerificationType] + # @!attribute front + # @return [String] + class FinancialVerification + attr_reader :type, + :front + end + end +end diff --git a/lib/checkout_sdk/accounts/financial_verification_type.rb b/lib/checkout_sdk/accounts/financial_verification_type.rb new file mode 100644 index 0000000..c9ed63b --- /dev/null +++ b/lib/checkout_sdk/accounts/financial_verification_type.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +module CheckoutSdk + module Accounts + module FinancialVerificationType + FINANCIAL_STATEMENT = 'financial_statement' + end + end +end diff --git a/lib/checkout_sdk/accounts/invitee.rb b/lib/checkout_sdk/accounts/invitee.rb new file mode 100644 index 0000000..be50ef6 --- /dev/null +++ b/lib/checkout_sdk/accounts/invitee.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module CheckoutSdk + module Accounts + # @!attribute email + # @return [String] + class Invitee + attr_accessor :email + end + end +end diff --git a/lib/checkout_sdk/accounts/onboard_entity.rb b/lib/checkout_sdk/accounts/onboard_entity.rb index aed1fc5..7e6adb0 100644 --- a/lib/checkout_sdk/accounts/onboard_entity.rb +++ b/lib/checkout_sdk/accounts/onboard_entity.rb @@ -4,23 +4,32 @@ module CheckoutSdk module Accounts # @!attribute reference # @return [String] - # @!attribute contact_details - # @return [ContactDetails] + # @!attribute is_draft + # @return [Boolean] # @!attribute profile # @return [Profile] + # @!attribute contact_details + # @return [ContactDetails] # @!attribute company # @return [Company] + # @!attribute processing_details + # @return [ProcessingDetails] # @!attribute individual # @return [Individual] # @!attribute documents # @return [OnboardSubEntityDocuments] + # @!attribute additional_info + # @return [AdditionalInfo] class OnboardEntity attr_accessor :reference, - :contact_details, + :is_draft, :profile, + :contact_details, :company, + :processing_details, :individual, - :documents + :documents, + :additional_info end end end diff --git a/lib/checkout_sdk/accounts/onboard_sub_entity_documents.rb b/lib/checkout_sdk/accounts/onboard_sub_entity_documents.rb index bee9faf..5cd7561 100644 --- a/lib/checkout_sdk/accounts/onboard_sub_entity_documents.rb +++ b/lib/checkout_sdk/accounts/onboard_sub_entity_documents.rb @@ -2,16 +2,43 @@ module CheckoutSdk module Accounts - # @!attribute documents - # @return [Document] + # @!attribute identity_verification + # @return [EntityIdentificationDocument] # @!attribute company_verification # @return [CompanyVerification] + # @!attribute articles_of_association + # @return [ArticlesOfAssociationType] + # @!attribute bank_verification + # @return [BankVerification] + # @!attribute shareholder_structure + # @return [ShareholderStructure] + # @!attribute proof_of_legality + # @return [ProofOfLegality] + # @!attribute proof_of_principal_address + # @return [ProofOfPrincipalAddress] + # @!attribute additional_document1 + # @return [AdditionalDocument] + # @!attribute additional_document2 + # @return [AdditionalDocument] + # @!attribute additional_document3 + # @return [AdditionalDocument] # @!attribute tax_verification # @return [TaxVerification] + # @!attribute financial_verification + # @return [FinancialVerification] class OnboardSubEntityDocuments - attr_accessor :documents, + attr_accessor :identity_verification, :company_verification, - :tax_verification + :articles_of_association, + :bank_verification, + :shareholder_structure, + :proof_of_legality, + :proof_of_principal_address, + :additional_document1, + :additional_document2, + :additional_document3, + :tax_verification, + :financial_verification end end end diff --git a/lib/checkout_sdk/accounts/processing_details.rb b/lib/checkout_sdk/accounts/processing_details.rb new file mode 100644 index 0000000..234e538 --- /dev/null +++ b/lib/checkout_sdk/accounts/processing_details.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +module CheckoutSdk + module Accounts + # @!attribute settlement_country + # @return [String] + # @!attribute target_countries + # @return [Array(String)] + # @!attribute annual_processing_volume + # @return [Integer] + # @!attribute average_transaction_value + # @return [Integer] + # @!attribute highest_transaction_value + # @return [Integer] + # @!attribute currency + # @return [CheckoutSdk::Common::Currency] + class ProcessingDetails + attr_accessor :settlement_country, + :target_countries, + :annual_processing_volume, + :average_transaction_value, + :highest_transaction_value, + :currency + end + end +end diff --git a/lib/checkout_sdk/accounts/proof_of_legality.rb b/lib/checkout_sdk/accounts/proof_of_legality.rb new file mode 100644 index 0000000..3b31aec --- /dev/null +++ b/lib/checkout_sdk/accounts/proof_of_legality.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module CheckoutSdk + module Accounts + # @!attribute type + # @return [ProofOfLegalityType] + # @!attribute front + # @return [String] + class ProofOfLegality + attr_accessor :type, + :front + end + end +end diff --git a/lib/checkout_sdk/accounts/proof_of_legality_type.rb b/lib/checkout_sdk/accounts/proof_of_legality_type.rb new file mode 100644 index 0000000..e3c3e2c --- /dev/null +++ b/lib/checkout_sdk/accounts/proof_of_legality_type.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +module CheckoutSdk + module Accounts + module ProofOfLegalityType + PROOF_OF_LEGALITY = 'proof_of_legality' + end + end +end diff --git a/lib/checkout_sdk/accounts/proof_of_principal_address.rb b/lib/checkout_sdk/accounts/proof_of_principal_address.rb new file mode 100644 index 0000000..f9de87a --- /dev/null +++ b/lib/checkout_sdk/accounts/proof_of_principal_address.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module CheckoutSdk + module Accounts + # @!attribute type + # @return [ProofOfPrincipalAddressType] + # @!attribute front + # @return [String] + class ProofOfPrincipalAddress + attr_reader :type, + :front + end + end +end diff --git a/lib/checkout_sdk/accounts/proof_of_principal_address_type.rb b/lib/checkout_sdk/accounts/proof_of_principal_address_type.rb new file mode 100644 index 0000000..a8f2dca --- /dev/null +++ b/lib/checkout_sdk/accounts/proof_of_principal_address_type.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +module CheckoutSdk + module Accounts + module ProofOfPrincipalAddressType + PROOF_OF_ADDRESS = 'proof_of_address' + end + end +end diff --git a/lib/checkout_sdk/accounts/shareholder_structure.rb b/lib/checkout_sdk/accounts/shareholder_structure.rb new file mode 100644 index 0000000..c5f721f --- /dev/null +++ b/lib/checkout_sdk/accounts/shareholder_structure.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module CheckoutSdk + module Accounts + # @!attribute type + # @return [ShareholderStructureType] + # @!attribute front + # @return [String] + class ShareholderStructure + attr_accessor :type, + :front + end + end +end diff --git a/lib/checkout_sdk/accounts/shareholder_structure_type.rb b/lib/checkout_sdk/accounts/shareholder_structure_type.rb new file mode 100644 index 0000000..f5a1078 --- /dev/null +++ b/lib/checkout_sdk/accounts/shareholder_structure_type.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +module CheckoutSdk + module Accounts + module ShareholderStructureType + CERTIFIED_SHAREHOLDER_STRUCTURE = 'certified_shareholder_structure' + end + end +end diff --git a/lib/checkout_sdk/common/account_change_indicator_type.rb b/lib/checkout_sdk/common/account_change_indicator_type.rb new file mode 100644 index 0000000..c58d786 --- /dev/null +++ b/lib/checkout_sdk/common/account_change_indicator_type.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module CheckoutSdk + module Common + class AccountChangeIndicatorType + THIS_TRANSACTION = 'this_transaction' + LESS_THAN_THIRTY_DAYS = 'less_than_thirty_days' + THIRTY_TO_SIXTY_DAYS = 'thirty_to_sixty_days' + MORE_THAN_SIXTY_DAYS = 'more_than_sixty_days' + end + end +end diff --git a/lib/checkout_sdk/common/account_holder.rb b/lib/checkout_sdk/common/account_holder.rb index 7dae674..838ce2b 100644 --- a/lib/checkout_sdk/common/account_holder.rb +++ b/lib/checkout_sdk/common/account_holder.rb @@ -4,7 +4,7 @@ module CheckoutSdk module Common # @!attribute type # @return [String] {AccountHolderType} - # @!attribute title + # @!attribute full_name # @return [String] # @!attribute first_name # @return [String] @@ -21,7 +21,7 @@ module Common # @!attribute country_of_birth # @return [Country] # @!attribute residential_status - # @return [String] + # @return [String] {ResidentialStatusType} # @!attribute billing_address # @return [Address] # @!attribute phone @@ -32,9 +32,11 @@ module Common # @return [String] # @!attribute gender # @return [String] + # @!attribute account_name_inquiry + # @return [Boolean] class AccountHolder attr_accessor :type, - :title, + :full_name, :first_name, :middle_name, :last_name, @@ -47,7 +49,8 @@ class AccountHolder :phone, :identification, :email, - :gender + :gender, + :account_name_inquiry end end end diff --git a/lib/checkout_sdk/common/account_password_change_indicator_type.rb b/lib/checkout_sdk/common/account_password_change_indicator_type.rb new file mode 100644 index 0000000..5ffe6b0 --- /dev/null +++ b/lib/checkout_sdk/common/account_password_change_indicator_type.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module CheckoutSdk + module Common + class AccountPasswordChangeIndicatorType + NO_CHANGE = 'no_change' + THIS_TRANSACTION = 'this_transaction' + LESS_THAN_THIRTY_DAYS = 'less_than_thirty_days' + THIRTY_TO_SIXTY_DAYS = 'thirty_to_sixty_days' + MORE_THAN_SIXTY_DAYS = 'more_than_sixty_days' + end + end +end diff --git a/lib/checkout_sdk/common/account_type_card_product_type.rb b/lib/checkout_sdk/common/account_type_card_product_type.rb new file mode 100644 index 0000000..a1aee3f --- /dev/null +++ b/lib/checkout_sdk/common/account_type_card_product_type.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module CheckoutSdk + module Common + class AccountTypeCardProductType + CREDIT = 'credit' + DEBIT = 'debit' + NOT_APPLICABLE = 'not_applicable' + end + end +end diff --git a/lib/checkout_sdk/common/cardholder_account_age_indicator_type.rb b/lib/checkout_sdk/common/cardholder_account_age_indicator_type.rb new file mode 100644 index 0000000..91562c5 --- /dev/null +++ b/lib/checkout_sdk/common/cardholder_account_age_indicator_type.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module CheckoutSdk + module Common + class CardholderAccountAgeIndicatorType + LESS_THAN_THIRTY_DAYS = 'less_than_thirty_days' + MORE_THAN_SIXTY_DAYS = 'more_than_sixty_days' + NO_ACCOUNT = 'no_account' + THIRTY_TO_SIXTY_DAYS = 'thirty_to_sixty_days' + THIS_TRANSACTION = 'this_transaction' + end + end +end diff --git a/lib/checkout_sdk/common/common.rb b/lib/checkout_sdk/common/common.rb index b1c9af4..ad955ec 100644 --- a/lib/checkout_sdk/common/common.rb +++ b/lib/checkout_sdk/common/common.rb @@ -23,3 +23,9 @@ require 'checkout_sdk/common/shipping_info' require 'checkout_sdk/common/product' require 'checkout_sdk/common/date_range_query_filter' +require 'checkout_sdk/common/account_change_indicator_type' +require 'checkout_sdk/common/account_password_change_indicator_type' +require 'checkout_sdk/common/account_type_card_product_type' +require 'checkout_sdk/common/cardholder_account_age_indicator_type' +require 'checkout_sdk/common/customer_retry' +require 'checkout_sdk/common/destination' diff --git a/lib/checkout_sdk/common/customer_retry.rb b/lib/checkout_sdk/common/customer_retry.rb new file mode 100644 index 0000000..ef5f253 --- /dev/null +++ b/lib/checkout_sdk/common/customer_retry.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module CheckoutSdk + module Accounts + # @!attribute max_attempts + # @return [Integer] + class CustomerRetry + attr_accessor :max_attempts + end + end +end diff --git a/lib/checkout_sdk/common/destination.rb b/lib/checkout_sdk/common/destination.rb new file mode 100644 index 0000000..0cc84a1 --- /dev/null +++ b/lib/checkout_sdk/common/destination.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +module CheckoutSdk + module Common + # @!attribute account_type + # @return [AccountType] + # @!attribute account_number + # @return [String] + # @!attribute bank_code + # @return [String] + # @!attribute branch_code + # @return [String] + # @!attribute iban + # @return [String] + # @!attribute bban + # @return [String] + # @!attribute swift_bic + # @return [String] + # @!attribute country + # @return [Country] + # @!attribute account_holder + # @return [AccountHolder] + # @!attribute bank + # @return [BankDetails] + class Destination + attr_accessor :account_type, + :account_number, + :bank_code, + :branch_code, + :iban, + :bban, + :swift_bic, + :country, + :account_holder, + :bank + end + end +end diff --git a/lib/checkout_sdk/common/payment_source_type.rb b/lib/checkout_sdk/common/payment_source_type.rb index af92ce8..b4222eb 100644 --- a/lib/checkout_sdk/common/payment_source_type.rb +++ b/lib/checkout_sdk/common/payment_source_type.rb @@ -52,6 +52,11 @@ module PaymentSourceType TRUSTLY = 'trustly' ILLICADO = 'illicado' SEPA = 'sepa' + ACH = 'ach' + BIZUM = 'bizum' + OCTOPUS = 'octopus' + PLAID = 'plaid' + SEQURA = 'sequra' end end end diff --git a/lib/checkout_sdk/payments/exemption.rb b/lib/checkout_sdk/payments/exemption.rb index 5950de0..232791b 100644 --- a/lib/checkout_sdk/payments/exemption.rb +++ b/lib/checkout_sdk/payments/exemption.rb @@ -12,6 +12,8 @@ module Exemption OUT_OF_SCA_SCOPE = 'out_of_sca_scope' OTHER = 'other' LOW_RISK_PROGRAM = 'low_risk_program' + DATA_SHARE = 'data_share' + RECURRING_OPERATION = 'recurring_operation' end end end diff --git a/lib/checkout_sdk/payments/hosted/hosted_payments_session.rb b/lib/checkout_sdk/payments/hosted/hosted_payments_session.rb index 4c62674..ca39617 100644 --- a/lib/checkout_sdk/payments/hosted/hosted_payments_session.rb +++ b/lib/checkout_sdk/payments/hosted/hosted_payments_session.rb @@ -16,6 +16,8 @@ module Payments # @return [String] # @!attribute description # @return [String] + # @!attribute display_name + # @return [String] # @!attribute customer # @return [CheckoutSdk::Common::CustomerRequest] # @!attribute shipping @@ -34,6 +36,10 @@ module Payments # @return [Array(CheckoutSdk::Common::Product)] # @!attribute risk # @return [RiskRequest] + # @!attribute customer_retry + # @return [PaymentRetryRequest] + # @!attribute sender + # @return [CheckoutSdk::Payments::Sender] # @!attribute success_url # @return [String] # @!attribute cancel_url @@ -57,11 +63,13 @@ module Payments class HostedPaymentsSession attr_accessor :amount, :currency, - :payment_type, :payment_ip, :billing_descriptor, :reference, :description, + :display_name, + :processing_channel_id, + :amount_allocations, :customer, :shipping, :billing, @@ -71,6 +79,8 @@ class HostedPaymentsSession :disabled_payment_methods, :products, :risk, + :customer_retry, + :sender, :success_url, :cancel_url, :failure_url, @@ -78,9 +88,11 @@ class HostedPaymentsSession :locale, :three_ds, :capture, - :capture_on, - :processing_channel_id, - :amount_allocations + :capture_on + + def initialize(payment_type: 'REGULAR') + @payment_type = payment_type + end end end end diff --git a/lib/checkout_sdk/payments/links/payment_link.rb b/lib/checkout_sdk/payments/links/payment_link.rb index 8ac9127..13b1c1d 100644 --- a/lib/checkout_sdk/payments/links/payment_link.rb +++ b/lib/checkout_sdk/payments/links/payment_link.rb @@ -16,6 +16,8 @@ module Payments # @return [String] # @!attribute description # @return [String] + # @!attribute display_name + # @return [String] # @!attribute processing_channel_id # @return [String] - Not available on Previous. # @!attribute amount_allocations @@ -34,6 +36,8 @@ module Payments # @return [ProcessingSettings] # @!attribute allow_payment_methods # @return [Array(CheckoutSdk::Common::PaymentSourceType)] + # @!attribute disabled_payment_methods + # @return [Array(CheckoutSdk::Common::PaymentSourceType)] # @!attribute products # @return [Array(CheckoutSdk::Common::Product)] # @!attribute metadata @@ -42,6 +46,10 @@ module Payments # @return [ThreeDSRequest] # @!attribute risk # @return [RiskRequest] + # @!attribute customer_retry + # @return [CheckoutSdk::Common::CustomerRetry] + # @!attribute sender + # @return [CheckoutSdk::Payments::Sender] # @!attribute return_url # @return [String] # @!attribute locale @@ -58,6 +66,7 @@ class PaymentLink :billing_descriptor, :reference, :description, + :display_name, :processing_channel_id, :amount_allocations, :expires_in, @@ -67,14 +76,21 @@ class PaymentLink :recipient, :processing, :allow_payment_methods, + :disabled_payment_methods, :products, :metadata, :three_ds, :risk, + :customer_retry, + :sender, :return_url, :locale, :capture, :capture_on + + def initialize(payment_type: 'REGULAR') + @payment_type = payment_type + end end end end diff --git a/lib/checkout_sdk/payments/partial_authorization.rb b/lib/checkout_sdk/payments/partial_authorization.rb new file mode 100644 index 0000000..9854516 --- /dev/null +++ b/lib/checkout_sdk/payments/partial_authorization.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module CheckoutSdk + module Payments + # @!attribute enabled + # @return [TrueClass, FalseClass] + class PartialAuthorization + attr_accessor :enabled + end + end +end diff --git a/lib/checkout_sdk/payments/payment_request.rb b/lib/checkout_sdk/payments/payment_request.rb index 56d795e..f2bb2d2 100644 --- a/lib/checkout_sdk/payments/payment_request.rb +++ b/lib/checkout_sdk/payments/payment_request.rb @@ -18,6 +18,8 @@ module Payments # @return [String] # @!attribute description # @return [String] + # @!attribute partial_authorization + # @return [PartialAuthorization] # @!attribute authorization_type # @return [String] {AuthorizationType} # @!attribute capture @@ -74,6 +76,7 @@ class PaymentRequest :merchant_initiated, :reference, :description, + :partial_authorization, :authorization_type, :capture, :capture_on, diff --git a/lib/checkout_sdk/payments/payments.rb b/lib/checkout_sdk/payments/payments.rb index e20cdb7..61d44c5 100644 --- a/lib/checkout_sdk/payments/payments.rb +++ b/lib/checkout_sdk/payments/payments.rb @@ -82,7 +82,11 @@ require 'checkout_sdk/payments/source/apm/trustly_source' require 'checkout_sdk/payments/source/apm/illicado_source' require 'checkout_sdk/payments/source/apm/sepa_source' - +require 'checkout_sdk/payments/source/apm/ach_source' +require 'checkout_sdk/payments/source/apm/bizum_source' +require 'checkout_sdk/payments/source/apm/octopus_source' +require 'checkout_sdk/payments/source/apm/plaid_source' +require 'checkout_sdk/payments/source/apm/sequra_source' # Sender require 'checkout_sdk/payments/sender/sender' require 'checkout_sdk/payments/sender/sender_type' diff --git a/lib/checkout_sdk/payments/sender/government_sender.rb b/lib/checkout_sdk/payments/sender/government_sender.rb index 82d4e0d..ee6fee5 100644 --- a/lib/checkout_sdk/payments/sender/government_sender.rb +++ b/lib/checkout_sdk/payments/sender/government_sender.rb @@ -6,6 +6,8 @@ module Payments # @return [String] # @!attribute address # @return [CheckoutSdk::Common::Address] + # @!attribute reference + # @return [String] # @!attribute reference_type # @return [String] # @!attribute source_of_funds @@ -15,6 +17,7 @@ module Payments class GovernmentSender < Sender attr_accessor :company_name, :address, + :reference, :reference_type, :source_of_funds, :identification diff --git a/lib/checkout_sdk/payments/sender/individual_sender.rb b/lib/checkout_sdk/payments/sender/individual_sender.rb index a9a7987..f5b041c 100644 --- a/lib/checkout_sdk/payments/sender/individual_sender.rb +++ b/lib/checkout_sdk/payments/sender/individual_sender.rb @@ -14,6 +14,8 @@ module Payments # @return [CheckoutSdk::Common::Address] # @!attribute identification # @return [CheckoutSdk::Common::AccountHolderIdentification] + # @!attribute reference + # @return [String] # @!attribute reference_type # @return [String] # @!attribute date_of_birth @@ -31,6 +33,7 @@ class IndividualSender < Sender :dob, :address, :identification, + :reference, :reference_type, :date_of_birth, :source_of_funds, diff --git a/lib/checkout_sdk/payments/sessions/payment_sessions_request.rb b/lib/checkout_sdk/payments/sessions/payment_sessions_request.rb index 50d3ea1..a73b07e 100644 --- a/lib/checkout_sdk/payments/sessions/payment_sessions_request.rb +++ b/lib/checkout_sdk/payments/sessions/payment_sessions_request.rb @@ -60,6 +60,8 @@ module Payments # @return [TrueClass, FalseClass] # @!attribute ip_address # @return [String] + # @!attribute capture_on + # @return [Time] # @!attribute tax_amount # @return [Integer] class PaymentSessionsRequest @@ -92,6 +94,7 @@ class PaymentSessionsRequest :sender, :capture, :ip_address, + :capture_on, :tax_amount end end diff --git a/lib/checkout_sdk/payments/source/apm/ach_source.rb b/lib/checkout_sdk/payments/source/apm/ach_source.rb new file mode 100644 index 0000000..6c0637c --- /dev/null +++ b/lib/checkout_sdk/payments/source/apm/ach_source.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +module CheckoutSdk + module Payments + # @!attribute account_type + # @return [CheckoutSdk::Common::AccountType] + # @!attribute country + # @return [CheckoutSdk::Common::Country] + # @!attribute account_number + # @return [String] + # @!attribute bank_code + # @return [String] + # @!attribute account_holder + # @return [CheckoutSdk::Common::AccountHolder] + class AchSource < PaymentSource + attr_accessor :account_type, + :country, + :account_number, + :bank_code, + :account_holder + + def initialize + super CheckoutSdk::Common::PaymentSourceType::ACH + end + end + end +end diff --git a/lib/checkout_sdk/payments/source/apm/bizum_source.rb b/lib/checkout_sdk/payments/source/apm/bizum_source.rb new file mode 100644 index 0000000..ae7b3f8 --- /dev/null +++ b/lib/checkout_sdk/payments/source/apm/bizum_source.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module CheckoutSdk + module Payments + # @!attribute mobile_number + # @return [String] + class BizumSource < PaymentSource + attr_accessor :mobile_number + + def initialize + super CheckoutSdk::Common::PaymentSourceType::BIZUM + end + end + end +end diff --git a/lib/checkout_sdk/payments/source/apm/octopus_source.rb b/lib/checkout_sdk/payments/source/apm/octopus_source.rb new file mode 100644 index 0000000..c801cd7 --- /dev/null +++ b/lib/checkout_sdk/payments/source/apm/octopus_source.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module CheckoutSdk + module Payments + class OctopusSource < PaymentSource + def initialize + super CheckoutSdk::Common::PaymentSourceType::OCTOPUS + end + end + end +end diff --git a/lib/checkout_sdk/payments/source/apm/plaid_source.rb b/lib/checkout_sdk/payments/source/apm/plaid_source.rb new file mode 100644 index 0000000..defe922 --- /dev/null +++ b/lib/checkout_sdk/payments/source/apm/plaid_source.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module CheckoutSdk + module Payments + # @!attribute token + # @return [String] + # @!attribute account_holder + # @return [CheckoutSdk::Common::AccountHolder] + class PlaidSource < PaymentSource + attr_accessor :token, :account_holder + + def initialize + super CheckoutSdk::Common::PaymentSourceType::PLAID + end + end + end +end diff --git a/lib/checkout_sdk/payments/source/apm/sequra_source.rb b/lib/checkout_sdk/payments/source/apm/sequra_source.rb new file mode 100644 index 0000000..1113349 --- /dev/null +++ b/lib/checkout_sdk/payments/source/apm/sequra_source.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module CheckoutSdk + module Payments + # @!attribute billing_address + # @return [CheckoutSdk::Common::Address] + class SequraSource < PaymentSource + attr_accessor :billing_address + + def initialize + super CheckoutSdk::Common::PaymentSourceType::SEQURA + end + end + end +end diff --git a/lib/checkout_sdk/payments/source/card_source.rb b/lib/checkout_sdk/payments/source/card_source.rb index f33c314..afdf6fd 100644 --- a/lib/checkout_sdk/payments/source/card_source.rb +++ b/lib/checkout_sdk/payments/source/card_source.rb @@ -20,6 +20,8 @@ module Payments # @return [CheckoutSdk::Common::Address] # @!attribute phone # @return [CheckoutSdk::Common::Phone] + # @!attribute account_holder + # @return [CheckoutSdk::Common::AccountHolder] class CardSource < PaymentSource attr_accessor :number, :expiry_month, @@ -29,7 +31,8 @@ class CardSource < PaymentSource :stored, :store_for_future_use, :billing_address, - :phone + :phone, + :account_holder def initialize super CheckoutSdk::Common::PaymentSourceType::CARD diff --git a/lib/checkout_sdk/payments/source/customer_source.rb b/lib/checkout_sdk/payments/source/customer_source.rb index 566e3bf..0d0eb9d 100644 --- a/lib/checkout_sdk/payments/source/customer_source.rb +++ b/lib/checkout_sdk/payments/source/customer_source.rb @@ -4,8 +4,11 @@ module CheckoutSdk module Payments # @!attribute id # @return [String] + # @!attribute account_holder + # @return [CheckoutSdk::Common::AccountHolder] class CustomerSource < PaymentSource - attr_accessor :id + attr_accessor :id, + :account_holder def initialize super CheckoutSdk::Common::PaymentSourceType::CUSTOMER diff --git a/lib/checkout_sdk/payments/source/id_source.rb b/lib/checkout_sdk/payments/source/id_source.rb index c1c7fb9..1df59d8 100644 --- a/lib/checkout_sdk/payments/source/id_source.rb +++ b/lib/checkout_sdk/payments/source/id_source.rb @@ -12,12 +12,15 @@ module Payments # @return [TrueClass, FalseClass] # @!attribute store_for_future_use # @return [TrueClass, FalseClass] + # @!attribute account_holder + # @return [CheckoutSdk::Common::AccountHolder] class IdSource < PaymentSource attr_accessor :id, :cvv, :payment_method, :stored, - :store_for_future_use + :store_for_future_use, + :account_holder def initialize super CheckoutSdk::Common::PaymentSourceType::ID diff --git a/lib/checkout_sdk/payments/source/network_token_source.rb b/lib/checkout_sdk/payments/source/network_token_source.rb index a913396..26fc720 100644 --- a/lib/checkout_sdk/payments/source/network_token_source.rb +++ b/lib/checkout_sdk/payments/source/network_token_source.rb @@ -24,6 +24,8 @@ module Payments # @return [CheckoutSdk::Common::Address] # @!attribute phone # @return [CheckoutSdk::Common::Phone] + # @!attribute account_holder + # @return [CheckoutSdk::Common::AccountHolder] class NetworkTokenSource < PaymentSource attr_accessor :token, :expiry_month, @@ -35,7 +37,8 @@ class NetworkTokenSource < PaymentSource :name, :cvv, :billing_address, - :phone + :phone, + :account_holder def initialize super CheckoutSdk::Common::PaymentSourceType::NETWORK_TOKEN diff --git a/lib/checkout_sdk/payments/source/token_source.rb b/lib/checkout_sdk/payments/source/token_source.rb index 7464a10..5a2aa24 100644 --- a/lib/checkout_sdk/payments/source/token_source.rb +++ b/lib/checkout_sdk/payments/source/token_source.rb @@ -12,12 +12,15 @@ module Payments # @return [TrueClass, FalseClass] # @!attribute store_for_future_use # @return [TrueClass, FalseClass] + # @!attribute account_holder + # @return [CheckoutSdk::Common::AccountHolder] class TokenSource < PaymentSource attr_accessor :token, :billing_address, :phone, :stored, - :store_for_future_use + :store_for_future_use, + :account_holder def initialize super CheckoutSdk::Common::PaymentSourceType::TOKEN diff --git a/lib/checkout_sdk/sessions/authentication_method.rb b/lib/checkout_sdk/sessions/authentication_method.rb index 5e8febc..2e6cd48 100644 --- a/lib/checkout_sdk/sessions/authentication_method.rb +++ b/lib/checkout_sdk/sessions/authentication_method.rb @@ -3,12 +3,12 @@ module CheckoutSdk module Sessions module AuthenticationMethod - NO_AUTHENTICATION = 'no_authentication' - OWN_CREDENTIALS = 'own_credentials' FEDERATED_ID = 'federated_id' + FIDO = 'fido' ISSUER_CREDENTIALS = 'issuer_credentials' + NO_AUTHENTICATION = 'no_authentication' + OWN_CREDENTIALS = 'own_credentials' THIRD_PARTY_AUTHENTICATION = 'third_party_authentication' - FIDO = 'fido' end end end diff --git a/lib/checkout_sdk/sessions/authentication_type.rb b/lib/checkout_sdk/sessions/authentication_type.rb index 19c8496..eaf8b48 100644 --- a/lib/checkout_sdk/sessions/authentication_type.rb +++ b/lib/checkout_sdk/sessions/authentication_type.rb @@ -3,11 +3,11 @@ module CheckoutSdk module Sessions module AuthenticationType - REGULAR = 'regular' - RECURRING = 'recurring' + ADD_CARD = 'add_card' INSTALLMENT = 'installment' MAINTAIN_CARD = 'maintain_card' - ADD_CARD = 'add_card' + RECURRING = 'recurring' + REGULAR = 'regular' end end end diff --git a/lib/checkout_sdk/sessions/card_holder_account_info.rb b/lib/checkout_sdk/sessions/card_holder_account_info.rb index 1859e27..2b962f6 100644 --- a/lib/checkout_sdk/sessions/card_holder_account_info.rb +++ b/lib/checkout_sdk/sessions/card_holder_account_info.rb @@ -17,8 +17,32 @@ module Sessions # @!attribute transactions_today # @return [Integer] # @!attribute authentication_method - # @return [String] {AuthenticationMethod} - class CardHolderAccountInfo + # @return [AuthenticationMethod] @deprecated This property will be removed in the future, and should not be used. + # @!attribute cardholder_account_age_indicator + # @return [CheckoutSdk::Common::CardholderAccountAgeIndicatorType] + # @!attribute account_change + # @return [Time] + # @!attribute account_change_indicator + # @return [CheckoutSdk::Common::AccountChangeIndicatorType] + # @!attribute account_date + # @return [Time] + # @!attribute account_password_change + # @return [String] + # @!attribute account_password_change_indicator + # @return [CheckoutSdk::Common::AccountPasswordChangeIndicatorType] + # @!attribute transactions_per_year + # @return [Integer] + # @!attribute payment_account_age + # @return [Time] + # @!attribute shipping_address_usage + # @return [Time] + # @!attribute account_type + # @return [CheckoutSdk::Common::AccountTypeCardProductType] + # @!attribute account_id + # @return [String] + # @!attribute three_ds_requestor_authentication_info + # @return [ThreeDsRequestorAuthenticationInfo] + class CardholderAccountInfo attr_accessor :purchase_count, :account_age, :add_card_attempts, @@ -26,7 +50,19 @@ class CardHolderAccountInfo :account_name_matches_shipping_name, :suspicious_account_activity, :transactions_today, - :authentication_method + :authentication_method, # @deprecated + :cardholder_account_age_indicator, + :account_change, + :account_change_indicator, + :account_date, + :account_password_change, + :account_password_change_indicator, + :transactions_per_year, + :payment_account_age, + :shipping_address_usage, + :account_type, + :account_id, + :three_ds_requestor_authentication_info end end end diff --git a/lib/checkout_sdk/sessions/channel/browser_session.rb b/lib/checkout_sdk/sessions/channel/browser_session.rb index 73b1826..954efc2 100644 --- a/lib/checkout_sdk/sessions/channel/browser_session.rb +++ b/lib/checkout_sdk/sessions/channel/browser_session.rb @@ -37,8 +37,9 @@ class BrowserSession < ChannelData :user_agent, :ip_address - def initialize + def initialize(three_ds_method_completion: 'U') super ChannelDataType::BROWSER + @three_ds_method_completion = three_ds_method_completion end end end diff --git a/lib/checkout_sdk/sessions/channel/channel_data_type.rb b/lib/checkout_sdk/sessions/channel/channel_data_type.rb index fec4121..6dd5e75 100644 --- a/lib/checkout_sdk/sessions/channel/channel_data_type.rb +++ b/lib/checkout_sdk/sessions/channel/channel_data_type.rb @@ -5,6 +5,7 @@ module Sessions module ChannelDataType APP = 'app' BROWSER = 'browser' + MERCHANT_INITIATED = 'merchant_initiated' end end end diff --git a/lib/checkout_sdk/sessions/channel/merchant_initiated_session.rb b/lib/checkout_sdk/sessions/channel/merchant_initiated_session.rb new file mode 100644 index 0000000..eaba387 --- /dev/null +++ b/lib/checkout_sdk/sessions/channel/merchant_initiated_session.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module CheckoutSdk + module Sessions + # @!attribute request_type + # @return [RequestType] + class MerchantInitiatedSession < ChannelData + attr_accessor :request_type + + def initialize + super ChannelDataType::MERCHANT_INITIATED + end + end + end +end diff --git a/lib/checkout_sdk/sessions/channel/request_type.rb b/lib/checkout_sdk/sessions/channel/request_type.rb new file mode 100644 index 0000000..4d5f3d9 --- /dev/null +++ b/lib/checkout_sdk/sessions/channel/request_type.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module CheckoutSdk + module Sessions + module RequestType + ACCOUNT_VERIFICATION = 'account_verification' + ADD_CARD = 'add_card' + INSTALLMENT_TRANSACTION = 'installment_transaction' + MAIL_ORDER = 'mail_order' + MAINTAIN_CARD_INFORMATION = 'maintain_card_information' + OTHER_PAYMENT = 'other_payment' + RECURRING_TRANSACTION = 'recurring_transaction' + SPLIT_OR_DELAYED_SHIPMENT = 'split_or_delayed_shipment' + TELEPHONE_ORDER = 'telephone_order' + TOP_UP = 'top_up' + WHITELIST_STATUS_CHECK = 'whitelist_status_check' + end + end +end diff --git a/lib/checkout_sdk/sessions/channel/sdk_interface_type.rb b/lib/checkout_sdk/sessions/channel/sdk_interface_type.rb index 884ca88..e004dd1 100644 --- a/lib/checkout_sdk/sessions/channel/sdk_interface_type.rb +++ b/lib/checkout_sdk/sessions/channel/sdk_interface_type.rb @@ -3,9 +3,9 @@ module CheckoutSdk module Sessions module SdkInterfaceType - NATIVE = 'native' - HTML = 'html' BOTH = 'both' + HTML = 'html' + NATIVE = 'native' end end end diff --git a/lib/checkout_sdk/sessions/initial_transaction.rb b/lib/checkout_sdk/sessions/initial_transaction.rb new file mode 100644 index 0000000..ed31219 --- /dev/null +++ b/lib/checkout_sdk/sessions/initial_transaction.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +module CheckoutSdk + module Sessions + # @!attribute acs_transaction_id + # @return [String] + # @!attribute authentication_method + # @return [String] + # @!attribute authentication_timestamp + # @return [String] + # @!attribute authentication_data + # @return [String] + # @!attribute initial_session_id + # @return [String] + class InitialTransaction + attr_accessor :acs_transaction_id, + :authentication_method, + :authentication_timestamp, + :authentication_data, + :initial_session_id + end + end +end diff --git a/lib/checkout_sdk/sessions/installment.rb b/lib/checkout_sdk/sessions/installment.rb index 5e3787a..202cb92 100644 --- a/lib/checkout_sdk/sessions/installment.rb +++ b/lib/checkout_sdk/sessions/installment.rb @@ -12,6 +12,11 @@ class Installment attr_accessor :number_of_payments, :days_between_payments, :expiry + + def initialize(days_between_payments: 1, expiry: '99991231') + @days_between_payments = days_between_payments + @expiry = expiry + end end end end diff --git a/lib/checkout_sdk/sessions/merchant_risk_info.rb b/lib/checkout_sdk/sessions/merchant_risk_info.rb index c4dbe8b..42e73e5 100644 --- a/lib/checkout_sdk/sessions/merchant_risk_info.rb +++ b/lib/checkout_sdk/sessions/merchant_risk_info.rb @@ -5,19 +5,37 @@ module Sessions # @!attribute delivery_email # @return [String] # @!attribute delivery_timeframe - # @return [String] {DeliveryTimeframe} + # @return [String] {}DeliveryTimeframe} # @!attribute is_preorder # @return [TrueClass, FalseClass] # @!attribute is_reorder # @return [TrueClass, FalseClass] # @!attribute shipping_indicator # @return [String] {ShippingIndicator} + # @!attribute reorder_items_indicator + # @return [String] {ReorderItemsIndicatorType} + # @!attribute pre_order_purchase_indicator + # @return [String] {PreOrderPurchaseIndicatorType} + # @!attribute pre_order_date + # @return [Time] + # @!attribute gift_card_amount + # @return [String] + # @!attribute gift_card_currency + # @return [String] + # @!attribute gift_card_count + # @return [String] class MerchantRiskInfo attr_accessor :delivery_email, :delivery_timeframe, :is_preorder, :is_reorder, - :shipping_indicator + :shipping_indicator, + :reorder_items_indicator, + :pre_order_purchase_indicator, + :pre_order_date, + :gift_card_amount, + :gift_card_currency, + :gift_card_count end end end diff --git a/lib/checkout_sdk/sessions/optimization.rb b/lib/checkout_sdk/sessions/optimization.rb new file mode 100644 index 0000000..f368744 --- /dev/null +++ b/lib/checkout_sdk/sessions/optimization.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +require 'checkout_sdk/sessions/optimized_properties' + +module CheckoutSdk + module Sessions + # @!attribute optimized + # @return [TrueClass, FalseClass] + # @!attribute framework + # @return [String] + # @!attribute optimized_properties + # @return [Array(OptimizedProperties)] + class Optimization + attr_accessor :optimized, + :framework, + :optimized_properties + end + end +end diff --git a/lib/checkout_sdk/sessions/optimized_properties.rb b/lib/checkout_sdk/sessions/optimized_properties.rb new file mode 100644 index 0000000..14e12f4 --- /dev/null +++ b/lib/checkout_sdk/sessions/optimized_properties.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module CheckoutSdk + module Sessions + # @!attribute field + # @return [String] + # @!attribute original_value + # @return [String] + # @!attribute optimized_value + # @return [String] + class OptimizedProperties + attr_accessor :field, + :original_value, + :optimized_value + end + end +end diff --git a/lib/checkout_sdk/sessions/pre_order_purchase_indicator_type.rb b/lib/checkout_sdk/sessions/pre_order_purchase_indicator_type.rb new file mode 100644 index 0000000..04bfc75 --- /dev/null +++ b/lib/checkout_sdk/sessions/pre_order_purchase_indicator_type.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module CheckoutSdk + module Sessions + module PreOrderPurchaseIndicatorType + FUTURE_AVAILABILITY = 'future_availability' + MERCHANDISE_AVAILABLE = 'merchandise_available' + end + end +end diff --git a/lib/checkout_sdk/sessions/recurring.rb b/lib/checkout_sdk/sessions/recurring.rb index 8f481ad..7e1f728 100644 --- a/lib/checkout_sdk/sessions/recurring.rb +++ b/lib/checkout_sdk/sessions/recurring.rb @@ -9,6 +9,11 @@ module Sessions class Recurring attr_accessor :days_between_payments, :expiry + + def initialize(days_between_payments: 1, expiry: '99991231') + @days_between_payments = days_between_payments + @expiry = expiry + end end end end diff --git a/lib/checkout_sdk/sessions/reorder_items_indicator_type.rb b/lib/checkout_sdk/sessions/reorder_items_indicator_type.rb new file mode 100644 index 0000000..8f6b945 --- /dev/null +++ b/lib/checkout_sdk/sessions/reorder_items_indicator_type.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module CheckoutSdk + module Sessions + module ReorderItemsIndicatorType + FIRST_TIME_ORDERED = 'first_time_ordered' + REORDERED = 'reordered' + end + end +end diff --git a/lib/checkout_sdk/sessions/session_request.rb b/lib/checkout_sdk/sessions/session_request.rb index ae95090..1f1cd21 100644 --- a/lib/checkout_sdk/sessions/session_request.rb +++ b/lib/checkout_sdk/sessions/session_request.rb @@ -35,13 +35,17 @@ module Sessions # @!attribute shipping_address_matches_billing # @return [TrueClass, FalseClass] # @!attribute completion - # @return [CompletionInfo] + # @return [Completion] # @!attribute channel_data # @return [ChannelData] # @!attribute recurring # @return [Recurring] # @!attribute installment # @return [Installment] + # @!attribute optimization + # @return [Optimization] + # @!attribute initial_transaction + # @return [InitialTransaction] class SessionRequest attr_accessor :source, :amount, @@ -62,7 +66,21 @@ class SessionRequest :completion, :channel_data, :recurring, - :installment + :installment, + :optimization, + :initial_transaction + + def initialize(source: CardSource.new, + authentication_type: AuthenticationType::REGULAR, + authentication_category: Category::PAYMENT, + challenge_indicator: CheckoutSdk::Common::ChallengeIndicator::NO_PREFERENCE, + transaction_type: TransactionType::GOODS_SERVICE) + @source = source + @authentication_type = authentication_type + @authentication_category = authentication_category + @challenge_indicator = challenge_indicator + @transaction_type = transaction_type + end end end end diff --git a/lib/checkout_sdk/sessions/sessions.rb b/lib/checkout_sdk/sessions/sessions.rb index 8027ff7..11f03ab 100644 --- a/lib/checkout_sdk/sessions/sessions.rb +++ b/lib/checkout_sdk/sessions/sessions.rb @@ -16,6 +16,13 @@ require 'checkout_sdk/sessions/shipping_indicator' require 'checkout_sdk/sessions/transaction_type' require 'checkout_sdk/sessions/three_ds_method_completion_request' +require 'checkout_sdk/sessions/three_ds_req_auth_method' +require 'checkout_sdk/sessions/three_ds_requestor_authentication_info' +require 'checkout_sdk/sessions/reorder_items_indicator_type' +require 'checkout_sdk/sessions/pre_order_purchase_indicator_type' +require 'checkout_sdk/sessions/optimized_properties' +require 'checkout_sdk/sessions/optimization' +require 'checkout_sdk/sessions/initial_transaction' # channel require 'checkout_sdk/sessions/channel/channel_data' @@ -26,6 +33,8 @@ require 'checkout_sdk/sessions/channel/uie_elements' require 'checkout_sdk/sessions/channel/app_session' require 'checkout_sdk/sessions/channel/browser_session' +require 'checkout_sdk/sessions/channel/request_type' +require 'checkout_sdk/sessions/channel/merchant_initiated_session' # completion require 'checkout_sdk/sessions/completion/completion_info' diff --git a/lib/checkout_sdk/sessions/source/card_source.rb b/lib/checkout_sdk/sessions/source/card_source.rb index 7ea8577..e59a3e1 100644 --- a/lib/checkout_sdk/sessions/source/card_source.rb +++ b/lib/checkout_sdk/sessions/source/card_source.rb @@ -22,8 +22,9 @@ class CardSource < SessionSource :stored, :store_for_future_use - def initialize + def initialize(stored: false) super SessionSourceType::CARD + @stored = stored end end end diff --git a/lib/checkout_sdk/sessions/three_ds_req_auth_method.rb b/lib/checkout_sdk/sessions/three_ds_req_auth_method.rb new file mode 100644 index 0000000..31e9f40 --- /dev/null +++ b/lib/checkout_sdk/sessions/three_ds_req_auth_method.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module CheckoutSdk + module Sessions + module ThreeDsReqAuthMethod + NO_THREEDS_REQUESTOR_AUTHENTICATION_OCCURRED = 'no_threeds_requestor_authentication_occurred' + THREE3DS_REQUESTOR_OWN_CREDENTIALS = 'three3ds_requestor_own_credentials' + FEDERATED_ID = 'federated_id' + ISSUER_CREDENTIALS = 'issuer_credentials' + THIRD_PARTY_AUTHENTICATION = 'third_party_authentication' + FIDO_AUTHENTICATOR = 'fido_authenticator' + FIDO_AUTHENTICATOR_FIDO_ASSURANCE_DATA_SIGNED = 'fido_authenticator_fido_assurance_data_signed' + SRC_ASSURANCE_DATA = 'src_assurance_data' + end + end +end diff --git a/lib/checkout_sdk/sessions/three_ds_requestor_authentication_info.rb b/lib/checkout_sdk/sessions/three_ds_requestor_authentication_info.rb new file mode 100644 index 0000000..ca1e7b9 --- /dev/null +++ b/lib/checkout_sdk/sessions/three_ds_requestor_authentication_info.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module CheckoutSdk + module Sessions + # @!attribute three_ds_req_auth_method + # @return [String] {ThreeDsReqAuthMethod} + # @!attribute three_ds_req_auth_timestamp + # @return [Time] + # @!attribute three_ds_req_auth_data + # @return [String] + class ThreeDsRequestorAuthenticationInfo + attr_accessor :three_ds_req_auth_method, + :three_ds_req_auth_timestamp, + :three_ds_req_auth_data + end + end +end diff --git a/lib/checkout_sdk/sessions/transaction_type.rb b/lib/checkout_sdk/sessions/transaction_type.rb index a6833ad..0a1a621 100644 --- a/lib/checkout_sdk/sessions/transaction_type.rb +++ b/lib/checkout_sdk/sessions/transaction_type.rb @@ -3,11 +3,11 @@ module CheckoutSdk module Sessions module TransactionType - GOODS_SERVICE = 'goods_service' - CHECK_ACCEPTANCE = 'check_acceptance' ACCOUNT_FUNDING = 'account_funding' - QUASHI_CARD_TRANSACTION = 'quashi_card_transaction' + CHECK_ACCEPTANCE = 'check_acceptance' + GOODS_SERVICE = 'goods_service' PREPAID_ACTIVATION_AND_LOAD = 'prepaid_activation_and_load' + QUASHI_CARD_TRANSACTION = 'quashi_card_transaction' end end end diff --git a/spec/checkout_sdk/payments/request_apm_payments_integration_spec.rb b/spec/checkout_sdk/payments/request_apm_payments_integration_spec.rb index 0d8e9c3..5a57399 100644 --- a/spec/checkout_sdk/payments/request_apm_payments_integration_spec.rb +++ b/spec/checkout_sdk/payments/request_apm_payments_integration_spec.rb @@ -71,7 +71,8 @@ request.failure_url = 'https://testing.checkout.com/failure' expect { default_sdk.payments.request_payment(request) } - .to raise_error(CheckoutSdk::CheckoutApiException) { |e| expect(e.error_details[:error_codes].first).to eq 'payee_not_onboarded' } + .to raise_error(CheckoutSdk::CheckoutApiException) { |e| + expect(e.error_details[:error_codes].first).to eq 'payee_not_onboarded' } end end @@ -90,7 +91,8 @@ request.failure_url = 'https://testing.checkout.com/failure' expect { default_sdk.payments.request_payment(request) } - .to raise_error(CheckoutSdk::CheckoutApiException) { |e| expect(e.error_details[:error_codes].first).to eq 'payee_not_onboarded' } + .to raise_error(CheckoutSdk::CheckoutApiException) { |e| + expect(e.error_details[:error_codes].first).to eq 'payee_not_onboarded' } end end @@ -115,7 +117,8 @@ request.failure_url = 'https://testing.checkout.com/failure' expect { default_sdk.payments.request_payment(request) } - .to raise_error(CheckoutSdk::CheckoutApiException) { |e| expect(e.error_details[:error_codes].first).to eq 'payee_not_onboarded' } + .to raise_error(CheckoutSdk::CheckoutApiException) { |e| + expect(e.error_details[:error_codes].first).to eq 'payee_not_onboarded' } end end @@ -166,7 +169,8 @@ request.failure_url = 'https://testing.checkout.com/failure' expect { default_sdk.payments.request_payment(request) } - .to raise_error(CheckoutSdk::CheckoutApiException) { |e| expect(e.error_details[:error_codes].first).to eq 'payee_not_onboarded' } + .to raise_error(CheckoutSdk::CheckoutApiException) { |e| + expect(e.error_details[:error_codes].first).to eq 'payee_not_onboarded' } end end @@ -185,7 +189,8 @@ request.failure_url = 'https://testing.checkout.com/failure' expect { default_sdk.payments.request_payment(request) } - .to raise_error(CheckoutSdk::CheckoutApiException) { |e| expect(e.error_details[:error_codes].first).to eq 'apm_service_unavailable' } + .to raise_error(CheckoutSdk::CheckoutApiException) { |e| + expect(e.error_details[:error_codes].first).to eq 'apm_service_unavailable' } end end end @@ -207,7 +212,8 @@ request.failure_url = 'https://testing.checkout.com/failure' expect { default_sdk.payments.request_payment(request) } - .to raise_error(CheckoutSdk::CheckoutApiException) { |e| expect(e.error_details[:error_codes].first).to eq 'payee_not_onboarded' } + .to raise_error(CheckoutSdk::CheckoutApiException) { |e| + expect(e.error_details[:error_codes].first).to eq 'payee_not_onboarded' } end end @@ -229,7 +235,8 @@ request.failure_url = 'https://testing.checkout.com/failure' expect { default_sdk.payments.request_payment(request) } - .to raise_error(CheckoutSdk::CheckoutApiException) { |e| expect(e.error_details[:error_codes].first).to eq 'payee_not_onboarded' } + .to raise_error(CheckoutSdk::CheckoutApiException) { |e| + expect(e.error_details[:error_codes].first).to eq 'payee_not_onboarded' } end end @@ -250,7 +257,8 @@ request.failure_url = 'https://testing.checkout.com/failure' expect { default_sdk.payments.request_payment(request) } - .to raise_error(CheckoutSdk::CheckoutApiException) { |e| expect(e.error_details[:error_codes].first).to eq 'payee_not_onboarded' } + .to raise_error(CheckoutSdk::CheckoutApiException) { |e| + expect(e.error_details[:error_codes].first).to eq 'payee_not_onboarded' } end end @@ -272,7 +280,8 @@ request.failure_url = 'https://testing.checkout.com/failure' expect { default_sdk.payments.request_payment(request) } - .to raise_error(CheckoutSdk::CheckoutApiException) { |e| expect(e.error_details[:error_codes].first).to eq 'payee_not_onboarded' } + .to raise_error(CheckoutSdk::CheckoutApiException) { |e| + expect(e.error_details[:error_codes].first).to eq 'payee_not_onboarded' } end end @@ -333,7 +342,8 @@ request.failure_url = 'https://testing.checkout.com/failure' expect { default_sdk.payments.request_payment(request) } - .to raise_error(CheckoutSdk::CheckoutApiException) { |e| expect(e.error_details[:error_codes].first).to eq 'payee_not_onboarded' } + .to raise_error(CheckoutSdk::CheckoutApiException) { |e| + expect(e.error_details[:error_codes].first).to eq 'payee_not_onboarded' } end end @@ -352,7 +362,8 @@ request.failure_url = 'https://testing.checkout.com/failure' expect { default_sdk.payments.request_payment(request) } - .to raise_error(CheckoutSdk::CheckoutApiException) { |e| expect(e.error_details[:error_codes].first).to eq 'payee_not_onboarded' } + .to raise_error(CheckoutSdk::CheckoutApiException) { |e| + expect(e.error_details[:error_codes].first).to eq 'payee_not_onboarded' } end end @@ -371,7 +382,8 @@ request.failure_url = 'https://testing.checkout.com/failure' expect { default_sdk.payments.request_payment(request) } - .to raise_error(CheckoutSdk::CheckoutApiException) { |e| expect(e.error_details[:error_codes].first).to eq 'amount_and_item_total_amounts_mismatch' } + .to raise_error(CheckoutSdk::CheckoutApiException) { |e| + expect(e.error_details[:error_codes].first).to eq 'amount_and_item_total_amounts_mismatch' } end end @@ -401,7 +413,8 @@ request.items = [product] expect { default_sdk.payments.request_payment(request) } - .to raise_error(CheckoutSdk::CheckoutApiException) { |e| expect(e.error_details[:error_codes].first).to eq 'payee_not_onboarded' } + .to raise_error(CheckoutSdk::CheckoutApiException) { |e| + expect(e.error_details[:error_codes].first).to eq 'payee_not_onboarded' } end end @@ -429,7 +442,8 @@ request.failure_url = 'https://testing.checkout.com/failure' expect { default_sdk.payments.request_payment(request) } - .to raise_error(CheckoutSdk::CheckoutApiException) { |e| expect(e.error_details[:error_codes].first).to eq 'payee_not_onboarded' } + .to raise_error(CheckoutSdk::CheckoutApiException) { |e| + expect(e.error_details[:error_codes].first).to eq 'payee_not_onboarded' } end end end @@ -449,7 +463,7 @@ expect { default_sdk.payments.request_payment(request) } .to raise_error(CheckoutSdk::CheckoutApiException) { |e| - expect(e.error_details[:error_codes].first).to eq 'payee_not_onboarded' } + expect(e.error_details[:error_codes].first).to eq 'payee_not_onboarded' } end end @@ -516,4 +530,99 @@ end end + context 'when requesting EPS source payment' do + it 'raises an error (payee_not_onboarded)' do + source = CheckoutSdk::Payments::EPSSource.new + source.purpose = 'Mens black t-shirt L' + source.account_holder = common_account_holder + + request = CheckoutSdk::Payments::PaymentRequest.new + request.source = source + request.amount = 100 + request.currency = CheckoutSdk::Common::Currency::EUR + request.capture = true + request.success_url = Helpers::DataFactory::SUCCESS_URL + request.failure_url = Helpers::DataFactory::FAILURE_URL + + expect { default_sdk.payments.request_payment(request) } + .to raise_error(CheckoutSdk::CheckoutApiException) { |e| + expect(e.error_details[:error_codes].first).to eq 'payee_not_onboarded' } + end + end + + context 'when requesting Bizum source payment' do + it 'raises an error (apm_service_unavailable)' do + source = CheckoutSdk::Payments::BizumSource.new + source.mobile_number = '+447700900986' + + request = CheckoutSdk::Payments::PaymentRequest.new + request.source = source + request.amount = 10 + request.currency = CheckoutSdk::Common::Currency::EUR + request.capture = true + request.success_url = Helpers::DataFactory::SUCCESS_URL + request.failure_url = Helpers::DataFactory::FAILURE_URL + + expect { default_sdk.payments.request_payment(request) } + .to raise_error(CheckoutSdk::CheckoutApiException) { |e| + expect(e.error_details[:error_codes].first).to eq 'apm_service_unavailable' } + end + end + + context 'when requesting Octopus source payment' do + it 'raises an error (apm_currency_not_supported)' do + source = CheckoutSdk::Payments::OctopusSource.new + + request = CheckoutSdk::Payments::PaymentRequest.new + request.source = source + request.amount = 10 + request.currency = CheckoutSdk::Common::Currency::USD + request.capture = true + request.success_url = Helpers::DataFactory::SUCCESS_URL + request.failure_url = Helpers::DataFactory::FAILURE_URL + + expect { default_sdk.payments.request_payment(request) } + .to raise_error(CheckoutSdk::CheckoutApiException) { |e| + expect(e.error_details[:error_codes].first).to eq 'apm_currency_not_supported' } + end + end + + context 'when requesting Plaid source payment' do + it 'raises an error (payee_not_onboarded)' do + source = CheckoutSdk::Payments::PlaidSource.new + source.token = 'token' + source.account_holder = common_account_holder + + request = CheckoutSdk::Payments::PaymentRequest.new + request.source = source + request.amount = 10 + request.currency = CheckoutSdk::Common::Currency::USD + request.capture = true + request.success_url = Helpers::DataFactory::SUCCESS_URL + request.failure_url = Helpers::DataFactory::FAILURE_URL + + expect { default_sdk.payments.request_payment(request) } + .to raise_error(CheckoutSdk::CheckoutApiException) { |e| + expect(e.error_details[:error_codes].first).to eq 'payee_not_onboarded' } + end + end + + context 'when requesting Sequra source payment' do + it 'raises an error (payee_not_onboarded)' do + source = CheckoutSdk::Payments::SequraSource.new + request = CheckoutSdk::Payments::PaymentRequest.new + request.source = source + request.billing_address = address + request.amount = 10 + request.currency = CheckoutSdk::Common::Currency::EUR + request.capture = true + request.success_url = Helpers::DataFactory::SUCCESS_URL + request.failure_url = Helpers::DataFactory::FAILURE_URL + + expect { default_sdk.payments.request_payment(request) } + .to raise_error(CheckoutSdk::CheckoutApiException) { |e| + expect(e.error_details[:error_codes].first).to eq 'payee_not_onboarded' } + end + end + end diff --git a/spec/checkout_sdk/sessions/sessions_helper.rb b/spec/checkout_sdk/sessions/sessions_helper.rb index 2f4e0ba..692c05b 100644 --- a/spec/checkout_sdk/sessions/sessions_helper.rb +++ b/spec/checkout_sdk/sessions/sessions_helper.rb @@ -38,6 +38,12 @@ def get_app_session app_session end + def get_merchant_initiated_session + merchant_initiated_session = CheckoutSdk::Sessions::MerchantInitiatedSession.new + merchant_initiated_session.request_type = CheckoutSdk::Sessions::RequestType::RECURRING_TRANSACTION + merchant_initiated_session + end + def get_non_hosted_session(channel_data, authentication_category, challenge_indicator_type, transaction_type) billing_address = CheckoutSdk::Sessions::SessionAddress.new billing_address.address_line1 = 'CheckoutSdk.com' diff --git a/spec/checkout_sdk/sessions/sessions_integration_spec.rb b/spec/checkout_sdk/sessions/sessions_integration_spec.rb index abe0ba6..5dac46c 100644 --- a/spec/checkout_sdk/sessions/sessions_integration_spec.rb +++ b/spec/checkout_sdk/sessions/sessions_integration_spec.rb @@ -33,6 +33,29 @@ session_secret] end end + + context 'when requesting card session using merchant initiated session', skip: 'unavailable' do + it 'creates a merchant initiated session and retrieves session details' do + + browser_session = get_merchant_initiated_session + request = get_non_hosted_session(browser_session, + CheckoutSdk::Sessions::Category::PAYMENT, + CheckoutSdk::Common::ChallengeIndicator::NO_PREFERENCE, + CheckoutSdk::Sessions::TransactionType::GOODS_SERVICE) + + response = oauth_sdk.sessions.request_session(request) + assert_response(response, %w[id session_secret]) + + session_id = response.id + session_secret = response.session_secret + + response_with_id = oauth_sdk.sessions.get_session_details(session_id) + assert_response(response_with_id, %w[id session_secret]) + + response_with_secret = oauth_sdk.sessions.get_session_details(session_id, session_secret) + assert_response(response_with_secret, %w[id]) + end + end end describe '.get_session_details' do