Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Payment Components #144

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
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
Loading