Skip to content
Merged
1 change: 1 addition & 0 deletions lib/checkout_sdk/payments/payments.rb
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@
require 'checkout_sdk/payments/setups/payment_setup_device_os'
require 'checkout_sdk/payments/setups/payment_setup_payment_method_initialization'
require 'checkout_sdk/payments/setups/payment_setup_payment_method_status'
require 'checkout_sdk/payments/setups/payment_setup_payment_type'
require 'checkout_sdk/payments/setups/stablecoin_payment_method'
require 'checkout_sdk/payments/setups/payment_setups_client'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,20 @@

module CheckoutSdk
module Payments
# Sender identification details of an Account Funding Transaction on a Payment Setup.
# Maps swagger `PaymentSetup.account_funding_transaction.sender.identification`.
#
# @!attribute type
# @return [String] {AccountFundingTransactionIdentificationType}
# The type of identification used to identify the sender.
# [Optional]
# @return [String] One of {AccountFundingTransactionIdentificationType}.
# @!attribute number
# The identification number.
# [Optional]
# @return [String]
# @!attribute issuing_country
# The two-letter ISO country code of the country that issued the identification.
# [Optional]
# @return [String] {CheckoutSdk::Common::Country}
class AccountFundingTransactionIdentification
attr_accessor :type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@

module CheckoutSdk
module Payments
# Identification document type used by the sender of an Account Funding Transaction
# on a Payment Setup.
# The type of identification used to identify the sender of an Account Funding Transaction on a
# Payment Setup. Maps swagger `PaymentSetup.account_funding_transaction.sender.identification.type`.
module AccountFundingTransactionIdentificationType
# A driving license.
DRIVING_LICENSE = 'driving_license'
# A passport.
PASSPORT = 'passport'
# A national identity document.
NATIONAL_ID = 'national_id'
TAX_ID = 'tax_id'
OTHER = 'other'
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,45 @@

module CheckoutSdk
module Payments
# Account funding transaction recipient details on a Payment Setup.
# Maps swagger `PaymentSetup.account_funding_transaction.recipient`.
#
# @!attribute first_name
# The recipient's first name.
# [Optional]
# max 50 characters
# @return [String]
# @!attribute last_name
# The recipient's last name.
# [Optional]
# max 50 characters
# @return [String]
# @!attribute account_number
# Any identifier like part of the PAN (first six digits and last four digits), an IBAN, an internal
# account number, or a phone number related to the primary recipient's account.
# [Optional]
# max 34 characters
# @return [String]
# @!attribute account_type
# The type of the recipient's account.
# [Optional]
# @deprecated Not part of the Recipient schema of the Payment Setups account funding transaction; the
# API ignores it on requests. There is no replacement. Will be removed in the next major version.
# @return [String]
# @!attribute date_of_birth
# @return [String] Format: YYYY-MM-DD
# Date of birth of the recipient (yyyy-mm-dd).
# [Optional]
# Format: date
# @return [String]
# @!attribute address
# The recipient's address. Maps swagger `PaymentSetupAddress`; all keys are optional:
# - `address_line1`: The first line of the address. max 200 characters
# - `address_line2`: The second line of the address. max 200 characters
# - `city`: The address city. max 50 characters
# - `state`: The address state or county. max 50 characters
# - `zip`: The postal or zip code. max 50 characters
# - `country`: The address country, in ISO 3166-1 alpha-2 format. max 2 characters
# [Optional]
# @return [CheckoutSdk::Common::Address]
class AccountFundingTransactionRecipient
attr_accessor :first_name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,51 @@

module CheckoutSdk
module Payments
# Account funding transaction sender details on a Payment Setup.
# Maps swagger `PaymentSetup.account_funding_transaction.sender`.
#
# @!attribute first_name
# The sender's first name.
# [Optional]
# @deprecated Not part of the Sender schema of the Payment Setups account funding transaction; the
# API ignores it on requests. There is no replacement. Will be removed in the next major version.
# @return [String]
# @!attribute last_name
# The sender's last name.
# [Optional]
# @deprecated Not part of the Sender schema of the Payment Setups account funding transaction; the
# API ignores it on requests. There is no replacement. Will be removed in the next major version.
# @return [String]
# @!attribute date_of_birth
# @return [String] Format: YYYY-MM-DD
# Date of birth of the sender (yyyy-mm-dd).
# [Optional]
# Format: date
# @return [String]
# @!attribute country_of_birth
# The sender's country of birth, as an ISO 3166-1 alpha-2 code.
# [Optional]
# @deprecated Not part of the Sender schema of the Payment Setups account funding transaction; the
# API ignores it on requests. There is no replacement. Will be removed in the next major version.
# @return [String] {CheckoutSdk::Common::Country}
# @!attribute nationality
# The sender's nationality, as an ISO 3166-1 alpha-2 code.
# [Optional]
# @deprecated Not part of the Sender schema of the Payment Setups account funding transaction; the
# API ignores it on requests. There is no replacement. Will be removed in the next major version.
# @return [String] {CheckoutSdk::Common::Country}
# @!attribute address
# The sender's address.
# [Optional]
# @deprecated Not part of the Sender schema of the Payment Setups account funding transaction; the
# API ignores it on requests. There is no replacement. Will be removed in the next major version.
# @return [CheckoutSdk::Common::Address]
# @!attribute reference
# The unique reference for the sender of the payment.
# [Optional]
# @return [String]
# @!attribute identification
# Sender identification details.
# [Optional]
# @return [AccountFundingTransactionIdentification]
class AccountFundingTransactionSender
attr_accessor :first_name,
Expand All @@ -23,6 +55,7 @@ class AccountFundingTransactionSender
:country_of_birth,
:nationality,
:address,
:reference,
:identification
end
end
Expand Down
104 changes: 70 additions & 34 deletions lib/checkout_sdk/payments/setups/bacs_payment_method.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,77 @@

module CheckoutSdk
module Payments
# Bacs payment method configuration on a Payment Setup. Maps swagger `Bacs`.
#
# @!attribute status
# @return [String] (response-only) Payment method status, one of
# {PaymentSetupPaymentMethodStatus} (e.g. "ready").
# @!attribute flags
# @return [Array(String)] (response-only) Diagnostic flags returned by the API.
# @!attribute initialization
# @return [String] The initialization type for the payment method.
# @!attribute instrument_id
# @return [String] (response-only) The ID of the Bacs instrument used for the payment.
# @!attribute account_holder
# @return [Hash] The account holder details (`type`, `first_name`, `last_name`,
# `company_name`, `email`).
# @!attribute account_number
# @return [String] The account number of the Bacs Direct Debit account.
# @!attribute bank_code
# @return [String] The bank code (sort code) of the Bacs Direct Debit account.
# @!attribute country
# @return [String] {CheckoutSdk::Common::Country}
# @!attribute currency
# @return [String] {CheckoutSdk::Common::Currency}
# @!attribute allow_partial_match
# @return [TrueClass, FalseClass] Whether to allow a partial match of the account holder details.
# The Bacs payment method's details and configuration on a Payment Setup. Maps swagger `Bacs`.
# Sent under the `payment_methods.bacs` key.
class BacsPaymentMethod
attr_accessor :status,
:flags,
:initialization,
:instrument_id,
:account_holder,
:account_number,
:bank_code,
:country,
:currency,
:allow_partial_match
# The payment method status.
# [Optional]
# Read only.
# @return [String] One of {PaymentSetupPaymentMethodStatus}.
attr_accessor :status

# The list of error codes or indicators that highlight missing or invalid information.
# [Optional]
# Read only.
# @return [Array(String)]
attr_accessor :flags

# The initialization state of the payment method.
# When you create a Payment Setup, this defaults to `disabled`.
# On update the API replaces the payment methods, so send `enabled` again to keep the method enabled.
# The specification does not state this; it is the API's behaviour.
# [Optional]
# Default: disabled
# @return [String] One of {PaymentSetupPaymentMethodInitialization}.
attr_accessor :initialization

# The ID of the Bacs instrument used for the payment.
# [Optional]
# Read only.
# @return [String]
attr_accessor :instrument_id

# The account holder details.
# [Optional]
# Keys:
# - `type` (String): The type of account holder. Enum: "individual" "corporate".
# - `first_name` (String): The first name of the account holder.
# - `last_name` (String): The last name of the account holder.
# - `company_name` (String): The legal name of a registered company that holds the account.
# - `email` (String): The email address of the account holder.
# @return [Hash]
attr_accessor :account_holder

# The account number of the Bacs Direct Debit account.
# [Optional]
# Write only.
# @return [String]
attr_accessor :account_number

# The sort code of the Bacs Direct Debit account.
# [Optional]
# Write only.
# @return [String]
attr_accessor :bank_code

# The account's country, as an ISO 3166-1 alpha-2 code.
# [Optional]
# min 2 characters, max 2 characters
# @return [String] {CheckoutSdk::Common::Country}
attr_accessor :country

# The account holder's account currency.
# [Optional]
# @return [String] {CheckoutSdk::Common::Currency}
attr_accessor :currency

# Indicates whether the Bacs instrument is created when account validation returns a partial
# match. When `true`, the instrument is created on a partial match; when `false`, instrument
# creation fails on a partial match.
# [Optional]
# Default: false
# @return [TrueClass, FalseClass]
attr_accessor :allow_partial_match
end
end
end
6 changes: 3 additions & 3 deletions lib/checkout_sdk/payments/setups/cash_app_payment_method.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class CashAppPaymentMethod
# The payment method status.
# [Optional]
# Read only.
# Enum: "unavailable" "action_required" "ready" "initialization_required" "invalid"
# @return [String] One of {PaymentSetupPaymentMethodStatus}.
attr_accessor :status

Expand All @@ -30,9 +29,10 @@ class CashAppPaymentMethod

# The initialization state of the payment method.
# When you create a Payment Setup, this defaults to `disabled`.
# On update the API replaces the payment methods, so send `enabled` again to keep the method enabled.
# The specification does not state this; it is the API's behaviour.
# [Optional]
# Default: "disabled"
# Enum: "disabled" "enabled"
# Default: disabled
# @return [String] One of {PaymentSetupPaymentMethodInitialization}.
attr_accessor :initialization

Expand Down
19 changes: 19 additions & 0 deletions lib/checkout_sdk/payments/setups/payment_setup_payment_type.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# frozen_string_literal: true

module CheckoutSdk
module Payments
# The type of payment on a Payment Setup. Maps swagger `PaymentSetup.payment_type`.
#
# The Payment Setups API declares these values in lowercase, unlike {PaymentType}, which is the
# capitalized enum of the payments API. Use this module for the :payment_type key of a Payment
# Setup request. When :payment_type is not sent, the API uses "regular".
module PaymentSetupPaymentType
REGULAR = 'regular'
RECURRING = 'recurring'
MOTO = 'moto'
INSTALLMENT = 'installment'
PAY_LATER = 'pay_later'
UNSCHEDULED = 'unscheduled'
end
end
end
10 changes: 10 additions & 0 deletions lib/checkout_sdk/payments/setups/payment_setups_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ def initialize(api_client, configuration)
# {PaymentSetupRisk}), convert it first with
# CheckoutSdk::JsonSerializer.to_custom_hash(object); a typed object nested directly in the
# Hash is not serialized and is sent as "#<CheckoutSdk::...>".
# :payment_type - String, the type of payment, one of {PaymentSetupPaymentType} (lowercase,
# unlike {PaymentType}): "regular", "recurring", "moto", "installment", "pay_later" or
# "unscheduled". Default "regular". You must provide it for card payments in which the
# cardholder is not present, for example a recurring payment or a mail order/telephone order
# (MOTO) payment.
# :payment_methods may include :cashapp (the key is the single lowercase word `cashapp`), a Hash
# with the keys documented on {CashAppPaymentMethod}; you send :initialization ("disabled" or
# "enabled") and :customer_profile_sharing (Boolean).
Expand Down Expand Up @@ -128,6 +133,11 @@ def create_payment_setup(payment_setups_request)
# {PaymentSetupRisk}), convert it first with
# CheckoutSdk::JsonSerializer.to_custom_hash(object); a typed object nested directly in the
# Hash is not serialized and is sent as "#<CheckoutSdk::...>".
# :payment_type - String, the type of payment, one of {PaymentSetupPaymentType} (lowercase,
# unlike {PaymentType}): "regular", "recurring", "moto", "installment", "pay_later" or
# "unscheduled". Default "regular". You must provide it for card payments in which the
# cardholder is not present, for example a recurring payment or a mail order/telephone order
# (MOTO) payment.
# :payment_methods may include :cashapp (the key is the single lowercase word `cashapp`), a Hash
# with the keys documented on {CashAppPaymentMethod}; you send :initialization ("disabled" or
# "enabled") and :customer_profile_sharing (Boolean).
Expand Down
Loading
Loading