Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/checkout_sdk/sessions/category.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module CheckoutSdk
module Sessions
module Category
PAYMENT = 'payment'
NON_PAYMENT = 'nonPayment'
NON_PAYMENT = 'non_payment'
end
end
end
9 changes: 8 additions & 1 deletion lib/checkout_sdk/sessions/channel/browser_session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ module Sessions
# @return [String]
# @!attribute ip_address
# @return [String]
# @!attribute iframe_payment_allowed
# @return [TrueClass, FalseClass] Whether the Payment API is enabled for all parent frames.
# Required for Google SPA support in hosted sessions.
# @!attribute user_agent_client_hint
# @return [String] The raw Sec-CH-UA header value. This can improve Google SPA support.
class BrowserSession < ChannelData
attr_accessor :three_ds_method_completion,
:accept_header,
Expand All @@ -37,7 +42,9 @@ class BrowserSession < ChannelData
:screen_width,
:timezone,
:user_agent,
:ip_address
:ip_address,
:iframe_payment_allowed,
:user_agent_client_hint

def initialize(three_ds_method_completion: CheckoutSdk::Sessions::ThreeDsMethodCompletion::U)
super(ChannelDataType::BROWSER)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
module CheckoutSdk
module Sessions
module ThreeDsMethodCompletion
Y = 'y'
N = 'n'
U = 'u'
Y = 'Y'
N = 'N'
U = 'U'
end
end
end
18 changes: 18 additions & 0 deletions lib/checkout_sdk/sessions/experience.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# frozen_string_literal: true

module CheckoutSdk
module Sessions
# The authentication experience chosen for a session.
#
# Used by {SessionRequest#preferred_experiences}, which takes an array of these values.
#
# [Optional]
module Experience
# 3D Secure authentication. The constant is named THREE_DS because a Ruby constant cannot
# begin with a digit; the wire value is '3ds'.
THREE_DS = '3ds'
# Google Secure Payment Authentication.
GOOGLE_SPA = 'google_spa'
end
end
end
15 changes: 15 additions & 0 deletions lib/checkout_sdk/sessions/google_spa.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# frozen_string_literal: true

module CheckoutSdk
module Sessions
# This object contains the Google SPA properties (non-hosted only).
#
# @!attribute continue_url
# @return [String] Fully qualified URL for redirecting the user's browser session after
# authentication. For example, this field may be the merchant's website for purchase
# confirmation once payment is complete. Required if in full redirect (not iframe) mode.
class GoogleSpa
attr_accessor :continue_url
end
end
end
31 changes: 31 additions & 0 deletions lib/checkout_sdk/sessions/session_challenge_indicator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# frozen_string_literal: true

module CheckoutSdk
module Sessions
# Indicates whether a challenge is requested for this session.
#
# Used by {SessionRequest#challenge_indicator} for POST /sessions. This is the only field in the
# API that accepts the exemption values below; the 3ds.challenge_indicator field on payments,
# hosted payments, payment links and payment sessions accepts only the first four values and is
# modelled by {CheckoutSdk::Common::ChallengeIndicator}.
#
# The following are requests for exemption: {LOW_VALUE}, {TRUSTED_LISTING},
# {TRUSTED_LISTING_PROMPT} and {TRANSACTION_RISK_ASSESSMENT}. If an exemption cannot be applied,
# then the value {NO_CHALLENGE_REQUESTED} will be used instead.
#
# [Optional]
# Default: {NO_PREFERENCE}
# max 50 characters
module SessionChallengeIndicator
NO_PREFERENCE = 'no_preference'
NO_CHALLENGE_REQUESTED = 'no_challenge_requested'
CHALLENGE_REQUESTED = 'challenge_requested'
CHALLENGE_REQUESTED_MANDATE = 'challenge_requested_mandate'
LOW_VALUE = 'low_value'
TRUSTED_LISTING = 'trusted_listing'
TRUSTED_LISTING_PROMPT = 'trusted_listing_prompt'
TRANSACTION_RISK_ASSESSMENT = 'transaction_risk_assessment'
DATA_SHARE = 'data_share'
end
end
end
19 changes: 12 additions & 7 deletions lib/checkout_sdk/sessions/session_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require 'checkout_sdk/sessions/authentication_type'
require 'checkout_sdk/sessions/category'
require 'checkout_sdk/sessions/transaction_type'
require 'checkout_sdk/common/challenge_indicator'
require 'checkout_sdk/sessions/session_challenge_indicator'

module CheckoutSdk
module Sessions
Expand All @@ -24,15 +24,13 @@ module Sessions
# @!attribute account_info
# @return [CardHolderAccountInfo]
# @!attribute challenge_indicator
# @return [String] {CheckoutSdk::Common::ChallengeIndicator}
# @return [String] {SessionChallengeIndicator}
# @!attribute billing_descriptor
# @return [SessionsBillingDescriptor]
# @!attribute reference
# @return [String]
# @!attribute merchant_risk_info
# @return [MerchantRiskInfo]
# @!attribute prior_transaction_reference
# @return [String]
# @!attribute transaction_type
# @return [String] {TransactionType}
# @!attribute shipping_address
Expand All @@ -51,6 +49,12 @@ module Sessions
# @return [Optimization]
# @!attribute initial_transaction
# @return [InitialTransaction]
# @!attribute device_information
# @return [DeviceInformation]
# @!attribute google_spa
# @return [GoogleSpa] Google SPA properties (non-hosted only).
# @!attribute preferred_experiences
# @return [Array<String>] The chosen experience(s) for this session. {Experience}
class SessionRequest
attr_accessor :source,
:amount,
Expand All @@ -64,7 +68,6 @@ class SessionRequest
:billing_descriptor,
:reference,
:merchant_risk_info,
:prior_transaction_reference,
:transaction_type,
:shipping_address,
:shipping_address_matches_billing,
Expand All @@ -74,12 +77,14 @@ class SessionRequest
:installment,
:optimization,
:initial_transaction,
:device_information
:device_information,
:google_spa,
:preferred_experiences

def initialize(source: CardSource.new,
authentication_type: CheckoutSdk::Sessions::AuthenticationType::REGULAR,
authentication_category: CheckoutSdk::Sessions::Category::PAYMENT,
challenge_indicator: CheckoutSdk::Common::ChallengeIndicator::NO_PREFERENCE,
challenge_indicator: CheckoutSdk::Sessions::SessionChallengeIndicator::NO_PREFERENCE,
transaction_type: CheckoutSdk::Sessions::TransactionType::GOODS_SERVICE)
@source = source
@authentication_type = authentication_type
Expand Down
3 changes: 3 additions & 0 deletions lib/checkout_sdk/sessions/sessions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@
require 'checkout_sdk/sessions/category'
require 'checkout_sdk/sessions/delivery_timeframe'
require 'checkout_sdk/sessions/device_information'
require 'checkout_sdk/sessions/experience'
require 'checkout_sdk/sessions/google_spa'
require 'checkout_sdk/sessions/installment'
require 'checkout_sdk/sessions/merchant_risk_info'
require 'checkout_sdk/sessions/recurring'
require 'checkout_sdk/sessions/session_address'
require 'checkout_sdk/sessions/session_challenge_indicator'
require 'checkout_sdk/sessions/session_marketplace_data'
require 'checkout_sdk/sessions/session_request'
require 'checkout_sdk/sessions/session_source_type'
Expand Down
14 changes: 13 additions & 1 deletion lib/checkout_sdk/sessions/shipping_indicator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,20 @@

module CheckoutSdk
module Sessions
# Indicates the shipping method chosen for the transaction.
#
# Used by {MerchantRiskInfo#shipping_indicator}. Choose the option that accurately describes the
# cardholder's specific transaction.
#
# [Optional]
module ShippingIndicator
VISA = 'visa'
BILLING_ADDRESS = 'billing_address'
ANOTHER_ADDRESS_ON_FILE = 'another_address_on_file'
NOT_ON_FILE = 'not_on_file'
STORE_PICK_UP = 'store_pick_up'
DIGITAL_GOODS = 'digital_goods'
TRAVEL_AND_EVENT_NO_SHIPPING = 'travel_and_event_no_shipping'
OTHER = 'other'
end
end
end
5 changes: 1 addition & 4 deletions lib/checkout_sdk/sessions/source/card_source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,12 @@ module Sessions
# @return [String]
# @!attribute stored
# @return [TrueClass, FalseClass]
# @!attribute store_for_future_use
# @return [TrueClass, FalseClass]
class CardSource < SessionSource
attr_accessor :number,
:expiry_month,
:expiry_year,
:name,
:stored,
:store_for_future_use
:stored

def initialize(stored: false)
super(SessionSourceType::CARD)
Expand Down
2 changes: 2 additions & 0 deletions lib/checkout_sdk/sessions/source/session_scheme.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ module SessionScheme
AMEX = 'amex'
DINERS = 'diners'
CARTES_BANCAIRES = 'cartes_bancaires'
DISCOVER = 'discover'
UPI = 'upi'
end
end
end
2 changes: 1 addition & 1 deletion lib/checkout_sdk/sessions/transaction_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module TransactionType
CHECK_ACCEPTANCE = 'check_acceptance'
GOODS_SERVICE = 'goods_service'
PREPAID_ACTIVATION_AND_LOAD = 'prepaid_activation_and_load'
QUASHI_CARD_TRANSACTION = 'quashi_card_transaction'
QUASI_CARD_TRANSACTION = 'quasi_card_transaction'
end
end
end
Loading
Loading