Skip to content

Commit

Permalink
Update Payment Components (#144)
Browse files Browse the repository at this point in the history
  • Loading branch information
armando-rodriguez-cko authored May 30, 2024
1 parent 15d1b1f commit f790bf7
Show file tree
Hide file tree
Showing 8 changed files with 157 additions and 1 deletion.
5 changes: 5 additions & 0 deletions lib/checkout_sdk/payments/payments.rb
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,8 @@

# Payment Sessions
require 'checkout_sdk/payments/sessions/payment_sessions_client'
require 'checkout_sdk/payments/sessions/payment_sessions_request'
require 'checkout_sdk/payments/sessions/payment_methods_type'
require 'checkout_sdk/payments/sessions/payment_method_configuration'
require 'checkout_sdk/payments/sessions/card'
require 'checkout_sdk/payments/sessions/store_payment_details_type'
11 changes: 11 additions & 0 deletions lib/checkout_sdk/payments/sessions/card.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# frozen_string_literal: true

module CheckoutSdk
module Payments
# @!attribute store_payment_details
# @return [String] {StorePaymentDetailsType}
class Card
attr_accessor :store_payment_details
end
end
end
11 changes: 11 additions & 0 deletions lib/checkout_sdk/payments/sessions/payment_method_configuration.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# frozen_string_literal: true

module CheckoutSdk
module Payments
# @!attribute card
# @return [Card]
class PaymentMethodConfiguration
attr_accessor :card
end
end
end
20 changes: 20 additions & 0 deletions lib/checkout_sdk/payments/sessions/payment_methods_type.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# frozen_string_literal: true

module CheckoutSdk
module Payments
module PaymentMethodsType
APPLEPAY = 'applepay'
BANCONTACT = 'bancontact'
CARD = 'card'
EPS = 'eps'
GIROPAY = 'giropay'
GOOGLEPAY = 'googlepay'
IDEAL = 'ideal'
KNET = 'knet'
MULTIBANCO = 'multibanco'
PRZELEWY24 = 'p24'
PAYPAL = 'paypal'
SOFORT = 'sofort'
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def initialize(api_client, configuration)
super api_client, configuration, CheckoutSdk::AuthorizationType::SECRET_KEY
end

# @param [Hash] payment_sessions
# @param [Hash, PaymentSessionsRequest] payment_sessions
def create_payment_sessions(payment_sessions)
api_client.invoke_post(PAYMENT_SESSIONS, sdk_authorization, payment_sessions)
end
Expand Down
98 changes: 98 additions & 0 deletions lib/checkout_sdk/payments/sessions/payment_sessions_request.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# frozen_string_literal: true

module CheckoutSdk
module Payments
# @!attribute amount
# @return [Integer]
# @!attribute currency
# @return [String] {CheckoutSdk::Common::Currency}
# @!attribute payment_type
# @return [TrueClass, FalseClass]
# @!attribute billing
# @return [BillingInformation]
# @!attribute billing_descriptor
# @return [BillingDescriptor]
# @!attribute reference
# @return [String]
# @!attribute description
# @return [String]
# @!attribute customer
# @return [CheckoutSdk::Common::CustomerRequest]
# @!attribute shipping
# @return [ShippingDetails]
# @!attribute recipient
# @return [PaymentRecipient]
# @!attribute processing
# @return [ProcessingSettings]
# @!attribute processing_channel_id
# @return [String]
# @!attribute expires_on
# @return [Time]
# @!attribute payment_method_configuration
# @return [PaymentMethodConfiguration]
# @!attribute enabled_payment_methods
# @return [Array(PaymentMethodsType)]
# @!attribute disabled_payment_methods
# @return [Array(PaymentMethodsType)]
# @!attribute items
# @return [Array(Product)]
# @!attribute amount_allocations
# @return [Array(CheckoutSdk::Common::AmountAllocations)]
# @!attribute risk
# @return [RiskRequest]
# @!attribute retry
# @return [PaymentRetryRequest]
# @!attribute display_name
# @return [String]
# @!attribute success_url
# @return [String]
# @!attribute failure_url
# @return [String]
# @!attribute metadata
# @return [Hash{String => Object}]
# @!attribute locale
# @return [String]
# @!attribute three_ds
# @return [ThreeDSRequest]
# @!attribute sender
# @return [Sender]
# @!attribute capture
# @return [TrueClass, FalseClass]
# @!attribute ip_address
# @return [String]
# @!attribute tax_amount
# @return [Integer]
class PaymentSessionsRequest
attr_accessor :amount,
:currency,
:payment_type,
:billing,
:billing_descriptor,
:reference,
:description,
:customer,
:shipping,
:recipient,
:processing,
:processing_channel_id,
:expires_on,
:payment_method_configuration,
:enabled_payment_methods,
:disabled_payment_methods,
:items,
:amount_allocations,
:risk,
:retry,
:display_name,
:success_url,
:failure_url,
:metadata,
:locale,
:three_ds,
:sender,
:capture,
:ip_address,
:tax_amount
end
end
end
10 changes: 10 additions & 0 deletions lib/checkout_sdk/payments/sessions/store_payment_details_type.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# frozen_string_literal: true

module CheckoutSdk
module Payments
module StorePaymentDetailsType
DISABLED = 'disabled'
ENABLED = 'enabled'
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

def is_valid_payment_sessions(payment_sessions)
assert_response payment_sessions, %w[id
payment_session_token
_links
_links.self]

Expand Down

0 comments on commit f790bf7

Please sign in to comment.