hamza-payments-query-sdk 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +28 -0
- data/README.md +136 -0
- data/lib/payments/api_helper.rb +10 -0
- data/lib/payments/client.rb +78 -0
- data/lib/payments/configuration.rb +145 -0
- data/lib/payments/controllers/base_controller.rb +60 -0
- data/lib/payments/controllers/m3_ds_actions_controller.rb +97 -0
- data/lib/payments/controllers/manage_payments_controller.rb +272 -0
- data/lib/payments/controllers/payment_controller.rb +51 -0
- data/lib/payments/controllers/payment_queries_controller.rb +134 -0
- data/lib/payments/exceptions/api_exception.rb +21 -0
- data/lib/payments/exceptions/error_response_exception.rb +51 -0
- data/lib/payments/exceptions/header_error_response_exception.rb +58 -0
- data/lib/payments/exceptions/pq_querybydaterange400_response_exception.rb +51 -0
- data/lib/payments/exceptions/pq_querybypaymentid404_response_error_exception.rb +51 -0
- data/lib/payments/exceptions/pq_queryhistoricalpayments400_response_exception.rb +51 -0
- data/lib/payments/exceptions/validation_error_response_exception.rb +58 -0
- data/lib/payments/http/auth/basic_auth.rb +50 -0
- data/lib/payments/http/http_call_back.rb +10 -0
- data/lib/payments/http/http_method_enum.rb +10 -0
- data/lib/payments/http/http_request.rb +10 -0
- data/lib/payments/http/http_response.rb +10 -0
- data/lib/payments/http/proxy_settings.rb +13 -0
- data/lib/payments/models/accept_enum.rb +21 -0
- data/lib/payments/models/account_history.rb +110 -0
- data/lib/payments/models/account_updater_message1_enum.rb +44 -0
- data/lib/payments/models/account_updater_message_enum.rb +41 -0
- data/lib/payments/models/advice.rb +62 -0
- data/lib/payments/models/applepay_payments_instruction.rb +151 -0
- data/lib/payments/models/authentication.rb +161 -0
- data/lib/payments/models/authorization_action_list.rb +90 -0
- data/lib/payments/models/authorization_failed.rb +103 -0
- data/lib/payments/models/authorization_refused.rb +124 -0
- data/lib/payments/models/authorization_requested.rb +94 -0
- data/lib/payments/models/authorization_succeeded.rb +104 -0
- data/lib/payments/models/authorization_timed_out.rb +94 -0
- data/lib/payments/models/authorization_type1_enum.rb +23 -0
- data/lib/payments/models/authorization_type_enum.rb +23 -0
- data/lib/payments/models/avs_not_matched_enum.rb +25 -0
- data/lib/payments/models/base_model.rb +110 -0
- data/lib/payments/models/billing_address.rb +147 -0
- data/lib/payments/models/browser_color_depth_enum.rb +41 -0
- data/lib/payments/models/cancel_response.rb +71 -0
- data/lib/payments/models/cancellation.rb +88 -0
- data/lib/payments/models/cancellation_failed.rb +94 -0
- data/lib/payments/models/cancellation_request_submitted.rb +94 -0
- data/lib/payments/models/cancellation_requested.rb +94 -0
- data/lib/payments/models/cancellation_timed_out.rb +94 -0
- data/lib/payments/models/card.rb +159 -0
- data/lib/payments/models/card1.rb +106 -0
- data/lib/payments/models/card3.rb +72 -0
- data/lib/payments/models/card_authorized_payment_response.rb +195 -0
- data/lib/payments/models/card_payment_instrument.rb +76 -0
- data/lib/payments/models/card_payments_instruction.rb +164 -0
- data/lib/payments/models/category_enum.rb +23 -0
- data/lib/payments/models/challenge.rb +100 -0
- data/lib/payments/models/challenge_info.rb +91 -0
- data/lib/payments/models/challenge_response201.rb +75 -0
- data/lib/payments/models/challenge_response202.rb +62 -0
- data/lib/payments/models/challenged_action_list.rb +65 -0
- data/lib/payments/models/challenged_response.rb +96 -0
- data/lib/payments/models/channel1_enum.rb +27 -0
- data/lib/payments/models/channel_enum.rb +24 -0
- data/lib/payments/models/conflict_payment_instrument.rb +104 -0
- data/lib/payments/models/content_type_enum.rb +20 -0
- data/lib/payments/models/custom.rb +241 -0
- data/lib/payments/models/customer.rb +146 -0
- data/lib/payments/models/customer_agreement.rb +120 -0
- data/lib/payments/models/cvc_not_matched_enum.rb +24 -0
- data/lib/payments/models/detail_enum.rb +23 -0
- data/lib/payments/models/device_data.rb +200 -0
- data/lib/payments/models/device_data_collection.rb +79 -0
- data/lib/payments/models/device_data_request.rb +71 -0
- data/lib/payments/models/device_data_required_action_list.rb +66 -0
- data/lib/payments/models/device_data_required_response.rb +89 -0
- data/lib/payments/models/device_data_response201.rb +95 -0
- data/lib/payments/models/embedded.rb +71 -0
- data/lib/payments/models/embedded1.rb +71 -0
- data/lib/payments/models/error.rb +81 -0
- data/lib/payments/models/exemption.rb +106 -0
- data/lib/payments/models/expiry_date.rb +90 -0
- data/lib/payments/models/expiry_date1.rb +84 -0
- data/lib/payments/models/fraud.rb +73 -0
- data/lib/payments/models/fraud_high_risk_response.rb +88 -0
- data/lib/payments/models/funding_type_enum.rb +32 -0
- data/lib/payments/models/googlepay_payments_instruction.rb +151 -0
- data/lib/payments/models/identifier_type_enum.rb +26 -0
- data/lib/payments/models/installment_plan.rb +76 -0
- data/lib/payments/models/installment_type_enum.rb +26 -0
- data/lib/payments/models/issuer.rb +63 -0
- data/lib/payments/models/issuer1.rb +76 -0
- data/lib/payments/models/issuer_response_enum.rb +23 -0
- data/lib/payments/models/last_event_enum.rb +95 -0
- data/lib/payments/models/links.rb +123 -0
- data/lib/payments/models/links1.rb +70 -0
- data/lib/payments/models/links2.rb +60 -0
- data/lib/payments/models/links3.rb +97 -0
- data/lib/payments/models/merchant.rb +88 -0
- data/lib/payments/models/message_enum.rb +34 -0
- data/lib/payments/models/method_enum.rb +38 -0
- data/lib/payments/models/mnext.rb +62 -0
- data/lib/payments/models/mself.rb +62 -0
- data/lib/payments/models/name_enum.rb +51 -0
- data/lib/payments/models/narrative.rb +86 -0
- data/lib/payments/models/narrative1.rb +87 -0
- data/lib/payments/models/narrative2.rb +71 -0
- data/lib/payments/models/number.rb +85 -0
- data/lib/payments/models/number3.rb +62 -0
- data/lib/payments/models/outcome16_enum.rb +21 -0
- data/lib/payments/models/outcome17_enum.rb +21 -0
- data/lib/payments/models/outcome6_enum.rb +42 -0
- data/lib/payments/models/outcome7_enum.rb +26 -0
- data/lib/payments/models/outcome_enum.rb +50 -0
- data/lib/payments/models/partial_refund_action_list.rb +64 -0
- data/lib/payments/models/partial_refund_response.rb +81 -0
- data/lib/payments/models/partial_settle_action_list.rb +102 -0
- data/lib/payments/models/partial_settle_response.rb +81 -0
- data/lib/payments/models/payment.rb +192 -0
- data/lib/payments/models/payment1.rb +86 -0
- data/lib/payments/models/payment_instrument.rb +62 -0
- data/lib/payments/models/payment_instrument4.rb +81 -0
- data/lib/payments/models/payment_instrument6.rb +71 -0
- data/lib/payments/models/payment_instrument7.rb +171 -0
- data/lib/payments/models/payment_refused_response.rb +187 -0
- data/lib/payments/models/payment_request.rb +96 -0
- data/lib/payments/models/payments_action_cancel.rb +71 -0
- data/lib/payments/models/payments_action_complete3ds_challenge.rb +72 -0
- data/lib/payments/models/payments_action_partial_refund.rb +71 -0
- data/lib/payments/models/payments_action_partial_settle.rb +73 -0
- data/lib/payments/models/payments_action_refund.rb +71 -0
- data/lib/payments/models/payments_action_settle.rb +71 -0
- data/lib/payments/models/payments_action_supply3ds_device_data.rb +73 -0
- data/lib/payments/models/payments_bank_account.rb +119 -0
- data/lib/payments/models/payments_cancel.rb +72 -0
- data/lib/payments/models/payments_card_account.rb +69 -0
- data/lib/payments/models/payments_card_on_file_customer_agreement.rb +85 -0
- data/lib/payments/models/payments_card_plain_payment_instrument.rb +149 -0
- data/lib/payments/models/payments_customer_agreement.rb +79 -0
- data/lib/payments/models/payments_email_account.rb +69 -0
- data/lib/payments/models/payments_events.rb +72 -0
- data/lib/payments/models/payments_exemption.rb +102 -0
- data/lib/payments/models/payments_fraud.rb +107 -0
- data/lib/payments/models/payments_funds_recipient.rb +139 -0
- data/lib/payments/models/payments_funds_sender.rb +120 -0
- data/lib/payments/models/payments_funds_transfer.rb +108 -0
- data/lib/payments/models/payments_gift_cards_purchase.rb +81 -0
- data/lib/payments/models/payments_installment_customer_agreement.rb +133 -0
- data/lib/payments/models/payments_instruction.rb +309 -0
- data/lib/payments/models/payments_link.rb +62 -0
- data/lib/payments/models/payments_network_token_payment_instrument.rb +126 -0
- data/lib/payments/models/payments_partial_refund_request.rb +68 -0
- data/lib/payments/models/payments_partial_settle.rb +72 -0
- data/lib/payments/models/payments_partial_settle_request.rb +81 -0
- data/lib/payments/models/payments_payment_facilitator.rb +88 -0
- data/lib/payments/models/payments_payment_instrument.rb +78 -0
- data/lib/payments/models/payments_phone_account.rb +69 -0
- data/lib/payments/models/payments_recipient.rb +110 -0
- data/lib/payments/models/payments_recipient_account.rb +81 -0
- data/lib/payments/models/payments_recipient_address.rb +72 -0
- data/lib/payments/models/payments_response.rb +69 -0
- data/lib/payments/models/payments_response202.rb +90 -0
- data/lib/payments/models/payments_response_payment_instrument.rb +158 -0
- data/lib/payments/models/payments_sequence.rb +69 -0
- data/lib/payments/models/payments_settle.rb +72 -0
- data/lib/payments/models/payments_shipping_address.rb +148 -0
- data/lib/payments/models/payments_social_network_account.rb +71 -0
- data/lib/payments/models/payments_sub_merchant.rb +108 -0
- data/lib/payments/models/payments_sub_merchant_address.rb +99 -0
- data/lib/payments/models/payments_subscription_customer_agreement.rb +106 -0
- data/lib/payments/models/payments_three_ds.rb +217 -0
- data/lib/payments/models/payments_transfer_address.rb +112 -0
- data/lib/payments/models/payments_unscheduled_customer_agreement.rb +87 -0
- data/lib/payments/models/payments_wallet_account.rb +70 -0
- data/lib/payments/models/placement_enum.rb +21 -0
- data/lib/payments/models/pq_querybydaterange200_response.rb +68 -0
- data/lib/payments/models/pq_querybypaymentid200_response.rb +230 -0
- data/lib/payments/models/pq_queryhistoricalpayments200_response.rb +72 -0
- data/lib/payments/models/preference_enum.rb +29 -0
- data/lib/payments/models/preferred_card_brand_enum.rb +51 -0
- data/lib/payments/models/purpose_enum.rb +78 -0
- data/lib/payments/models/query_action_list.rb +114 -0
- data/lib/payments/models/query_events_response.rb +71 -0
- data/lib/payments/models/reason_enum.rb +50 -0
- data/lib/payments/models/refund_failed.rb +94 -0
- data/lib/payments/models/refund_request_submitted.rb +94 -0
- data/lib/payments/models/refund_requested.rb +124 -0
- data/lib/payments/models/refund_response.rb +71 -0
- data/lib/payments/models/refund_timed_out.rb +94 -0
- data/lib/payments/models/result_enum.rb +29 -0
- data/lib/payments/models/reversal_failed.rb +94 -0
- data/lib/payments/models/reversal_request_submitted.rb +94 -0
- data/lib/payments/models/reversal_requested.rb +103 -0
- data/lib/payments/models/reversal_timed_out.rb +94 -0
- data/lib/payments/models/risk_enum.rb +29 -0
- data/lib/payments/models/risk_factor.rb +82 -0
- data/lib/payments/models/routing.rb +74 -0
- data/lib/payments/models/sale_failed.rb +103 -0
- data/lib/payments/models/sale_refused.rb +124 -0
- data/lib/payments/models/sale_requested.rb +94 -0
- data/lib/payments/models/sale_succeeded.rb +104 -0
- data/lib/payments/models/sale_timed_out.rb +94 -0
- data/lib/payments/models/scheme.rb +75 -0
- data/lib/payments/models/self1.rb +72 -0
- data/lib/payments/models/self2.rb +62 -0
- data/lib/payments/models/self3.rb +62 -0
- data/lib/payments/models/sent_for_cancellation_response.rb +185 -0
- data/lib/payments/models/sent_for_settlement_action_list.rb +76 -0
- data/lib/payments/models/sent_for_settlement_response.rb +195 -0
- data/lib/payments/models/session_payment_instrument.rb +119 -0
- data/lib/payments/models/settle_action_list.rb +76 -0
- data/lib/payments/models/settle_response.rb +81 -0
- data/lib/payments/models/settlement.rb +88 -0
- data/lib/payments/models/settlement_failed.rb +94 -0
- data/lib/payments/models/settlement_request_submitted.rb +94 -0
- data/lib/payments/models/settlement_requested.rb +125 -0
- data/lib/payments/models/settlement_timed_out.rb +94 -0
- data/lib/payments/models/shipping.rb +130 -0
- data/lib/payments/models/stored_card_usage1_enum.rb +24 -0
- data/lib/payments/models/stored_card_usage_enum.rb +24 -0
- data/lib/payments/models/time_frame_enum.rb +29 -0
- data/lib/payments/models/token.rb +168 -0
- data/lib/payments/models/token_creation.rb +95 -0
- data/lib/payments/models/token_payment_instrument.rb +118 -0
- data/lib/payments/models/token_response_conflicts.rb +90 -0
- data/lib/payments/models/transaction_history.rb +127 -0
- data/lib/payments/models/transaction_type1_enum.rb +26 -0
- data/lib/payments/models/transaction_type_enum.rb +26 -0
- data/lib/payments/models/type10_enum.rb +23 -0
- data/lib/payments/models/type12_enum.rb +35 -0
- data/lib/payments/models/type1_enum.rb +26 -0
- data/lib/payments/models/type2_enum.rb +23 -0
- data/lib/payments/models/type3_enum.rb +20 -0
- data/lib/payments/models/type4_enum.rb +20 -0
- data/lib/payments/models/type5_enum.rb +41 -0
- data/lib/payments/models/type6_enum.rb +29 -0
- data/lib/payments/models/type7_enum.rb +23 -0
- data/lib/payments/models/type8_enum.rb +23 -0
- data/lib/payments/models/type9_enum.rb +35 -0
- data/lib/payments/models/type_enum.rb +23 -0
- data/lib/payments/models/unsuccessful_authentication_response.rb +76 -0
- data/lib/payments/models/updated_payment_instrument.rb +159 -0
- data/lib/payments/models/updated_payment_instrument1.rb +93 -0
- data/lib/payments/models/user_type_enum.rb +35 -0
- data/lib/payments/models/value.rb +94 -0
- data/lib/payments/models/value1.rb +91 -0
- data/lib/payments/models/value2.rb +91 -0
- data/lib/payments/models/value3.rb +91 -0
- data/lib/payments/models/value4.rb +91 -0
- data/lib/payments/models/verification.rb +173 -0
- data/lib/payments/models/wallet_payment_instrument.rb +100 -0
- data/lib/payments/models/window_size_enum.rb +34 -0
- data/lib/payments/models/wp_api_version_enum.rb +20 -0
- data/lib/payments/utilities/date_time_helper.rb +11 -0
- data/lib/payments/utilities/file_wrapper.rb +28 -0
- data/lib/payments/utilities/union_type_lookup.rb +78 -0
- data/lib/payments.rb +280 -0
- data/test/controllers/controller_test_base.rb +29 -0
- data/test/controllers/test_payment_controller.rb +161 -0
- data/test/controllers/test_payment_queries_controller.rb +68 -0
- data/test/http_response_catcher.rb +19 -0
- metadata +374 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# payments
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0 (
|
|
4
|
+
# https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module Payments
|
|
7
|
+
# Self link to the page.
|
|
8
|
+
class Self2 < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# First page as per the pageSize.
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_accessor :href
|
|
15
|
+
|
|
16
|
+
# A mapping from model property names to API property names.
|
|
17
|
+
def self.names
|
|
18
|
+
@_hash = {} if @_hash.nil?
|
|
19
|
+
@_hash['href'] = 'href'
|
|
20
|
+
@_hash
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# An array for optional fields
|
|
24
|
+
def self.optionals
|
|
25
|
+
%w[
|
|
26
|
+
href
|
|
27
|
+
]
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# An array for nullable fields
|
|
31
|
+
def self.nullables
|
|
32
|
+
[]
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def initialize(href = SKIP)
|
|
36
|
+
@href = href unless href == SKIP
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Creates an instance of the object from a hash.
|
|
40
|
+
def self.from_hash(hash)
|
|
41
|
+
return nil unless hash
|
|
42
|
+
|
|
43
|
+
# Extract variables from the hash.
|
|
44
|
+
href = hash.key?('href') ? hash['href'] : SKIP
|
|
45
|
+
|
|
46
|
+
# Create object from extracted values.
|
|
47
|
+
Self2.new(href)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Provides a human-readable string representation of the object.
|
|
51
|
+
def to_s
|
|
52
|
+
class_name = self.class.name.split('::').last
|
|
53
|
+
"<#{class_name} href: #{@href}>"
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
57
|
+
def inspect
|
|
58
|
+
class_name = self.class.name.split('::').last
|
|
59
|
+
"<#{class_name} href: #{@href.inspect}>"
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# payments
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0 (
|
|
4
|
+
# https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module Payments
|
|
7
|
+
# Self link to retrieveByPaymentId.
|
|
8
|
+
class Self3 < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# RetrieveByPaymentId provides event history and next action links.
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_accessor :href
|
|
15
|
+
|
|
16
|
+
# A mapping from model property names to API property names.
|
|
17
|
+
def self.names
|
|
18
|
+
@_hash = {} if @_hash.nil?
|
|
19
|
+
@_hash['href'] = 'href'
|
|
20
|
+
@_hash
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# An array for optional fields
|
|
24
|
+
def self.optionals
|
|
25
|
+
%w[
|
|
26
|
+
href
|
|
27
|
+
]
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# An array for nullable fields
|
|
31
|
+
def self.nullables
|
|
32
|
+
[]
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def initialize(href = SKIP)
|
|
36
|
+
@href = href unless href == SKIP
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Creates an instance of the object from a hash.
|
|
40
|
+
def self.from_hash(hash)
|
|
41
|
+
return nil unless hash
|
|
42
|
+
|
|
43
|
+
# Extract variables from the hash.
|
|
44
|
+
href = hash.key?('href') ? hash['href'] : SKIP
|
|
45
|
+
|
|
46
|
+
# Create object from extracted values.
|
|
47
|
+
Self3.new(href)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Provides a human-readable string representation of the object.
|
|
51
|
+
def to_s
|
|
52
|
+
class_name = self.class.name.split('::').last
|
|
53
|
+
"<#{class_name} href: #{@href}>"
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
57
|
+
def inspect
|
|
58
|
+
class_name = self.class.name.split('::').last
|
|
59
|
+
"<#{class_name} href: #{@href.inspect}>"
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
# payments
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0 (
|
|
4
|
+
# https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
require_relative 'device_data_response201'
|
|
7
|
+
|
|
8
|
+
module Payments
|
|
9
|
+
# SentForCancellationResponse Model.
|
|
10
|
+
class SentForCancellationResponse < DeviceDataResponse201
|
|
11
|
+
# TODO: Write general description for this method
|
|
12
|
+
# @return [PaymentsResponsePaymentInstrument]
|
|
13
|
+
attr_accessor :payment_instrument
|
|
14
|
+
|
|
15
|
+
# Details of the updated payment instrument.
|
|
16
|
+
# @return [UpdatedPaymentInstrument]
|
|
17
|
+
attr_accessor :updated_payment_instrument
|
|
18
|
+
|
|
19
|
+
# An object containing information returned by the issuer.
|
|
20
|
+
# @return [Issuer]
|
|
21
|
+
attr_accessor :issuer
|
|
22
|
+
|
|
23
|
+
# Any risk factors which have been identified for the authorization. This
|
|
24
|
+
# section will not appear if no risks are identified.
|
|
25
|
+
# @return [Array[RiskFactor]]
|
|
26
|
+
attr_accessor :risk_factors
|
|
27
|
+
|
|
28
|
+
# Details of the outcome of the Fraud assessment
|
|
29
|
+
# @return [Fraud]
|
|
30
|
+
attr_accessor :fraud
|
|
31
|
+
|
|
32
|
+
# Details of the outcome of the 3DS authentication
|
|
33
|
+
# @return [Verification]
|
|
34
|
+
attr_accessor :three_ds
|
|
35
|
+
|
|
36
|
+
# An object containing information about the exemption.
|
|
37
|
+
# @return [PaymentsExemption]
|
|
38
|
+
attr_accessor :exemption
|
|
39
|
+
|
|
40
|
+
# An object containing information returned by the scheme.
|
|
41
|
+
# @return [String]
|
|
42
|
+
attr_accessor :scheme_reference
|
|
43
|
+
|
|
44
|
+
# Details of the token created
|
|
45
|
+
# @return [Token]
|
|
46
|
+
attr_accessor :token
|
|
47
|
+
|
|
48
|
+
# Return details about the status of the payment
|
|
49
|
+
# @return [PaymentsLink]
|
|
50
|
+
attr_accessor :links
|
|
51
|
+
|
|
52
|
+
# A mapping from model property names to API property names.
|
|
53
|
+
def self.names
|
|
54
|
+
@_hash = {} if @_hash.nil?
|
|
55
|
+
@_hash['payment_instrument'] = 'paymentInstrument'
|
|
56
|
+
@_hash['updated_payment_instrument'] = 'updatedPaymentInstrument'
|
|
57
|
+
@_hash['issuer'] = 'issuer'
|
|
58
|
+
@_hash['risk_factors'] = 'riskFactors'
|
|
59
|
+
@_hash['fraud'] = 'fraud'
|
|
60
|
+
@_hash['three_ds'] = 'threeDS'
|
|
61
|
+
@_hash['exemption'] = 'exemption'
|
|
62
|
+
@_hash['scheme_reference'] = 'schemeReference'
|
|
63
|
+
@_hash['token'] = 'token'
|
|
64
|
+
@_hash['links'] = '_links'
|
|
65
|
+
@_hash = super().merge(@_hash)
|
|
66
|
+
@_hash
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# An array for optional fields
|
|
70
|
+
def self.optionals
|
|
71
|
+
_arr = %w[
|
|
72
|
+
payment_instrument
|
|
73
|
+
updated_payment_instrument
|
|
74
|
+
issuer
|
|
75
|
+
risk_factors
|
|
76
|
+
fraud
|
|
77
|
+
three_ds
|
|
78
|
+
exemption
|
|
79
|
+
scheme_reference
|
|
80
|
+
token
|
|
81
|
+
links
|
|
82
|
+
]
|
|
83
|
+
(_arr << super()).flatten!
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# An array for nullable fields
|
|
87
|
+
def self.nullables
|
|
88
|
+
_arr = []
|
|
89
|
+
(_arr << super()).flatten!
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def initialize(payment_instrument = SKIP, updated_payment_instrument = SKIP,
|
|
93
|
+
issuer = SKIP, risk_factors = SKIP, fraud = SKIP,
|
|
94
|
+
three_ds = SKIP, exemption = SKIP, scheme_reference = SKIP,
|
|
95
|
+
token = SKIP, links = SKIP, outcome = 'sentForCancellation',
|
|
96
|
+
transaction_reference = SKIP)
|
|
97
|
+
@payment_instrument = payment_instrument unless payment_instrument == SKIP
|
|
98
|
+
unless updated_payment_instrument == SKIP
|
|
99
|
+
@updated_payment_instrument =
|
|
100
|
+
updated_payment_instrument
|
|
101
|
+
end
|
|
102
|
+
@issuer = issuer unless issuer == SKIP
|
|
103
|
+
@risk_factors = risk_factors unless risk_factors == SKIP
|
|
104
|
+
@fraud = fraud unless fraud == SKIP
|
|
105
|
+
@three_ds = three_ds unless three_ds == SKIP
|
|
106
|
+
@exemption = exemption unless exemption == SKIP
|
|
107
|
+
@scheme_reference = scheme_reference unless scheme_reference == SKIP
|
|
108
|
+
@token = token unless token == SKIP
|
|
109
|
+
@links = links unless links == SKIP
|
|
110
|
+
|
|
111
|
+
# Call the constructor of the base class
|
|
112
|
+
super(outcome,
|
|
113
|
+
transaction_reference)
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
# Creates an instance of the object from a hash.
|
|
117
|
+
def self.from_hash(hash)
|
|
118
|
+
return nil unless hash
|
|
119
|
+
|
|
120
|
+
# Extract variables from the hash.
|
|
121
|
+
payment_instrument = PaymentsResponsePaymentInstrument.from_hash(hash['paymentInstrument']) if
|
|
122
|
+
hash['paymentInstrument']
|
|
123
|
+
if hash['updatedPaymentInstrument']
|
|
124
|
+
updated_payment_instrument = UpdatedPaymentInstrument.from_hash(hash['updatedPaymentInstrument'])
|
|
125
|
+
end
|
|
126
|
+
issuer = Issuer.from_hash(hash['issuer']) if hash['issuer']
|
|
127
|
+
# Parameter is an array, so we need to iterate through it
|
|
128
|
+
risk_factors = nil
|
|
129
|
+
unless hash['riskFactors'].nil?
|
|
130
|
+
risk_factors = []
|
|
131
|
+
hash['riskFactors'].each do |structure|
|
|
132
|
+
risk_factors << (RiskFactor.from_hash(structure) if structure)
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
risk_factors = SKIP unless hash.key?('riskFactors')
|
|
137
|
+
fraud = Fraud.from_hash(hash['fraud']) if hash['fraud']
|
|
138
|
+
three_ds = Verification.from_hash(hash['threeDS']) if hash['threeDS']
|
|
139
|
+
exemption = PaymentsExemption.from_hash(hash['exemption']) if hash['exemption']
|
|
140
|
+
scheme_reference =
|
|
141
|
+
hash.key?('schemeReference') ? hash['schemeReference'] : SKIP
|
|
142
|
+
token = Token.from_hash(hash['token']) if hash['token']
|
|
143
|
+
links = PaymentsLink.from_hash(hash['_links']) if hash['_links']
|
|
144
|
+
outcome = hash['outcome'] ||= 'sentForCancellation'
|
|
145
|
+
transaction_reference =
|
|
146
|
+
hash.key?('transactionReference') ? hash['transactionReference'] : SKIP
|
|
147
|
+
|
|
148
|
+
# Create object from extracted values.
|
|
149
|
+
SentForCancellationResponse.new(payment_instrument,
|
|
150
|
+
updated_payment_instrument,
|
|
151
|
+
issuer,
|
|
152
|
+
risk_factors,
|
|
153
|
+
fraud,
|
|
154
|
+
three_ds,
|
|
155
|
+
exemption,
|
|
156
|
+
scheme_reference,
|
|
157
|
+
token,
|
|
158
|
+
links,
|
|
159
|
+
outcome,
|
|
160
|
+
transaction_reference)
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
# Provides a human-readable string representation of the object.
|
|
164
|
+
def to_s
|
|
165
|
+
class_name = self.class.name.split('::').last
|
|
166
|
+
super_string = super().sub(/^<[^ ]+ /, '').sub(/>$/, '')
|
|
167
|
+
"<#{class_name} #{super_string}, payment_instrument: #{@payment_instrument},"\
|
|
168
|
+
" updated_payment_instrument: #{@updated_payment_instrument}, issuer: #{@issuer},"\
|
|
169
|
+
" risk_factors: #{@risk_factors}, fraud: #{@fraud}, three_ds: #{@three_ds}, exemption:"\
|
|
170
|
+
" #{@exemption}, scheme_reference: #{@scheme_reference}, token: #{@token}, links:"\
|
|
171
|
+
" #{@links}>"
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
175
|
+
def inspect
|
|
176
|
+
class_name = self.class.name.split('::').last
|
|
177
|
+
super_string = super().inspect.sub(/^<[^ ]+ /, '').sub(/>$/, '')
|
|
178
|
+
"<#{class_name} #{super_string}, payment_instrument: #{@payment_instrument.inspect},"\
|
|
179
|
+
" updated_payment_instrument: #{@updated_payment_instrument.inspect}, issuer:"\
|
|
180
|
+
" #{@issuer.inspect}, risk_factors: #{@risk_factors.inspect}, fraud: #{@fraud.inspect},"\
|
|
181
|
+
" three_ds: #{@three_ds.inspect}, exemption: #{@exemption.inspect}, scheme_reference:"\
|
|
182
|
+
" #{@scheme_reference.inspect}, token: #{@token.inspect}, links: #{@links.inspect}>"
|
|
183
|
+
end
|
|
184
|
+
end
|
|
185
|
+
end
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# payments
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0 (
|
|
4
|
+
# https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module Payments
|
|
7
|
+
# SentForSettlementActionList Model.
|
|
8
|
+
class SentForSettlementActionList < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# Fully refund the payment. See [details](../payments-lifecycle/refund)
|
|
13
|
+
# @return [PaymentsActionRefund]
|
|
14
|
+
attr_accessor :refund_payment
|
|
15
|
+
|
|
16
|
+
# Partially refund the payment.
|
|
17
|
+
# @return [PaymentsActionPartialRefund]
|
|
18
|
+
attr_accessor :partially_refund_payment
|
|
19
|
+
|
|
20
|
+
# A mapping from model property names to API property names.
|
|
21
|
+
def self.names
|
|
22
|
+
@_hash = {} if @_hash.nil?
|
|
23
|
+
@_hash['refund_payment'] = 'refundPayment'
|
|
24
|
+
@_hash['partially_refund_payment'] = 'partiallyRefundPayment'
|
|
25
|
+
@_hash
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# An array for optional fields
|
|
29
|
+
def self.optionals
|
|
30
|
+
%w[
|
|
31
|
+
refund_payment
|
|
32
|
+
partially_refund_payment
|
|
33
|
+
]
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# An array for nullable fields
|
|
37
|
+
def self.nullables
|
|
38
|
+
[]
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def initialize(refund_payment = SKIP, partially_refund_payment = SKIP)
|
|
42
|
+
@refund_payment = refund_payment unless refund_payment == SKIP
|
|
43
|
+
@partially_refund_payment = partially_refund_payment unless partially_refund_payment == SKIP
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Creates an instance of the object from a hash.
|
|
47
|
+
def self.from_hash(hash)
|
|
48
|
+
return nil unless hash
|
|
49
|
+
|
|
50
|
+
# Extract variables from the hash.
|
|
51
|
+
refund_payment = PaymentsActionRefund.from_hash(hash['refundPayment']) if
|
|
52
|
+
hash['refundPayment']
|
|
53
|
+
if hash['partiallyRefundPayment']
|
|
54
|
+
partially_refund_payment = PaymentsActionPartialRefund.from_hash(hash['partiallyRefundPayment'])
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Create object from extracted values.
|
|
58
|
+
SentForSettlementActionList.new(refund_payment,
|
|
59
|
+
partially_refund_payment)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# Provides a human-readable string representation of the object.
|
|
63
|
+
def to_s
|
|
64
|
+
class_name = self.class.name.split('::').last
|
|
65
|
+
"<#{class_name} refund_payment: #{@refund_payment}, partially_refund_payment:"\
|
|
66
|
+
" #{@partially_refund_payment}>"
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
70
|
+
def inspect
|
|
71
|
+
class_name = self.class.name.split('::').last
|
|
72
|
+
"<#{class_name} refund_payment: #{@refund_payment.inspect}, partially_refund_payment:"\
|
|
73
|
+
" #{@partially_refund_payment.inspect}>"
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
# payments
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0 (
|
|
4
|
+
# https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
require_relative 'device_data_response201'
|
|
7
|
+
|
|
8
|
+
module Payments
|
|
9
|
+
# SentForSettlementResponse Model.
|
|
10
|
+
class SentForSettlementResponse < DeviceDataResponse201
|
|
11
|
+
# TODO: Write general description for this method
|
|
12
|
+
# @return [PaymentsResponsePaymentInstrument]
|
|
13
|
+
attr_accessor :payment_instrument
|
|
14
|
+
|
|
15
|
+
# Details of the updated payment instrument.
|
|
16
|
+
# @return [UpdatedPaymentInstrument]
|
|
17
|
+
attr_accessor :updated_payment_instrument
|
|
18
|
+
|
|
19
|
+
# An object containing information returned by the issuer.
|
|
20
|
+
# @return [Issuer]
|
|
21
|
+
attr_accessor :issuer
|
|
22
|
+
|
|
23
|
+
# Any risk factors which have been identified for the authorization. This
|
|
24
|
+
# section will not appear if no risks are identified.
|
|
25
|
+
# @return [Array[RiskFactor]]
|
|
26
|
+
attr_accessor :risk_factors
|
|
27
|
+
|
|
28
|
+
# Details of the outcome of the Fraud assessment
|
|
29
|
+
# @return [Fraud]
|
|
30
|
+
attr_accessor :fraud
|
|
31
|
+
|
|
32
|
+
# Details of the outcome of the 3DS authentication
|
|
33
|
+
# @return [Verification]
|
|
34
|
+
attr_accessor :three_ds
|
|
35
|
+
|
|
36
|
+
# An object containing information about the exemption.
|
|
37
|
+
# @return [PaymentsExemption]
|
|
38
|
+
attr_accessor :exemption
|
|
39
|
+
|
|
40
|
+
# An object containing information returned by the scheme.
|
|
41
|
+
# @return [String]
|
|
42
|
+
attr_accessor :scheme_reference
|
|
43
|
+
|
|
44
|
+
# Details of the token created
|
|
45
|
+
# @return [Token]
|
|
46
|
+
attr_accessor :token
|
|
47
|
+
|
|
48
|
+
# Return details about the status of the payment
|
|
49
|
+
# @return [PaymentsLink]
|
|
50
|
+
attr_accessor :links
|
|
51
|
+
|
|
52
|
+
# Return details about the status of the payment
|
|
53
|
+
# @return [SentForSettlementActionList]
|
|
54
|
+
attr_accessor :actions
|
|
55
|
+
|
|
56
|
+
# A mapping from model property names to API property names.
|
|
57
|
+
def self.names
|
|
58
|
+
@_hash = {} if @_hash.nil?
|
|
59
|
+
@_hash['payment_instrument'] = 'paymentInstrument'
|
|
60
|
+
@_hash['updated_payment_instrument'] = 'updatedPaymentInstrument'
|
|
61
|
+
@_hash['issuer'] = 'issuer'
|
|
62
|
+
@_hash['risk_factors'] = 'riskFactors'
|
|
63
|
+
@_hash['fraud'] = 'fraud'
|
|
64
|
+
@_hash['three_ds'] = 'threeDS'
|
|
65
|
+
@_hash['exemption'] = 'exemption'
|
|
66
|
+
@_hash['scheme_reference'] = 'schemeReference'
|
|
67
|
+
@_hash['token'] = 'token'
|
|
68
|
+
@_hash['links'] = '_links'
|
|
69
|
+
@_hash['actions'] = '_actions'
|
|
70
|
+
@_hash = super().merge(@_hash)
|
|
71
|
+
@_hash
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# An array for optional fields
|
|
75
|
+
def self.optionals
|
|
76
|
+
_arr = %w[
|
|
77
|
+
payment_instrument
|
|
78
|
+
updated_payment_instrument
|
|
79
|
+
issuer
|
|
80
|
+
risk_factors
|
|
81
|
+
fraud
|
|
82
|
+
three_ds
|
|
83
|
+
exemption
|
|
84
|
+
scheme_reference
|
|
85
|
+
token
|
|
86
|
+
links
|
|
87
|
+
actions
|
|
88
|
+
]
|
|
89
|
+
(_arr << super()).flatten!
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# An array for nullable fields
|
|
93
|
+
def self.nullables
|
|
94
|
+
_arr = []
|
|
95
|
+
(_arr << super()).flatten!
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def initialize(payment_instrument = SKIP, updated_payment_instrument = SKIP,
|
|
99
|
+
issuer = SKIP, risk_factors = SKIP, fraud = SKIP,
|
|
100
|
+
three_ds = SKIP, exemption = SKIP, scheme_reference = SKIP,
|
|
101
|
+
token = SKIP, links = SKIP, actions = SKIP,
|
|
102
|
+
outcome = 'sentForSettlement', transaction_reference = SKIP)
|
|
103
|
+
@payment_instrument = payment_instrument unless payment_instrument == SKIP
|
|
104
|
+
unless updated_payment_instrument == SKIP
|
|
105
|
+
@updated_payment_instrument =
|
|
106
|
+
updated_payment_instrument
|
|
107
|
+
end
|
|
108
|
+
@issuer = issuer unless issuer == SKIP
|
|
109
|
+
@risk_factors = risk_factors unless risk_factors == SKIP
|
|
110
|
+
@fraud = fraud unless fraud == SKIP
|
|
111
|
+
@three_ds = three_ds unless three_ds == SKIP
|
|
112
|
+
@exemption = exemption unless exemption == SKIP
|
|
113
|
+
@scheme_reference = scheme_reference unless scheme_reference == SKIP
|
|
114
|
+
@token = token unless token == SKIP
|
|
115
|
+
@links = links unless links == SKIP
|
|
116
|
+
@actions = actions unless actions == SKIP
|
|
117
|
+
|
|
118
|
+
# Call the constructor of the base class
|
|
119
|
+
super(outcome,
|
|
120
|
+
transaction_reference)
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
# Creates an instance of the object from a hash.
|
|
124
|
+
def self.from_hash(hash)
|
|
125
|
+
return nil unless hash
|
|
126
|
+
|
|
127
|
+
# Extract variables from the hash.
|
|
128
|
+
payment_instrument = PaymentsResponsePaymentInstrument.from_hash(hash['paymentInstrument']) if
|
|
129
|
+
hash['paymentInstrument']
|
|
130
|
+
if hash['updatedPaymentInstrument']
|
|
131
|
+
updated_payment_instrument = UpdatedPaymentInstrument.from_hash(hash['updatedPaymentInstrument'])
|
|
132
|
+
end
|
|
133
|
+
issuer = Issuer.from_hash(hash['issuer']) if hash['issuer']
|
|
134
|
+
# Parameter is an array, so we need to iterate through it
|
|
135
|
+
risk_factors = nil
|
|
136
|
+
unless hash['riskFactors'].nil?
|
|
137
|
+
risk_factors = []
|
|
138
|
+
hash['riskFactors'].each do |structure|
|
|
139
|
+
risk_factors << (RiskFactor.from_hash(structure) if structure)
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
risk_factors = SKIP unless hash.key?('riskFactors')
|
|
144
|
+
fraud = Fraud.from_hash(hash['fraud']) if hash['fraud']
|
|
145
|
+
three_ds = Verification.from_hash(hash['threeDS']) if hash['threeDS']
|
|
146
|
+
exemption = PaymentsExemption.from_hash(hash['exemption']) if hash['exemption']
|
|
147
|
+
scheme_reference =
|
|
148
|
+
hash.key?('schemeReference') ? hash['schemeReference'] : SKIP
|
|
149
|
+
token = Token.from_hash(hash['token']) if hash['token']
|
|
150
|
+
links = PaymentsLink.from_hash(hash['_links']) if hash['_links']
|
|
151
|
+
actions = SentForSettlementActionList.from_hash(hash['_actions']) if hash['_actions']
|
|
152
|
+
outcome = hash['outcome'] ||= 'sentForSettlement'
|
|
153
|
+
transaction_reference =
|
|
154
|
+
hash.key?('transactionReference') ? hash['transactionReference'] : SKIP
|
|
155
|
+
|
|
156
|
+
# Create object from extracted values.
|
|
157
|
+
SentForSettlementResponse.new(payment_instrument,
|
|
158
|
+
updated_payment_instrument,
|
|
159
|
+
issuer,
|
|
160
|
+
risk_factors,
|
|
161
|
+
fraud,
|
|
162
|
+
three_ds,
|
|
163
|
+
exemption,
|
|
164
|
+
scheme_reference,
|
|
165
|
+
token,
|
|
166
|
+
links,
|
|
167
|
+
actions,
|
|
168
|
+
outcome,
|
|
169
|
+
transaction_reference)
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
# Provides a human-readable string representation of the object.
|
|
173
|
+
def to_s
|
|
174
|
+
class_name = self.class.name.split('::').last
|
|
175
|
+
super_string = super().sub(/^<[^ ]+ /, '').sub(/>$/, '')
|
|
176
|
+
"<#{class_name} #{super_string}, payment_instrument: #{@payment_instrument},"\
|
|
177
|
+
" updated_payment_instrument: #{@updated_payment_instrument}, issuer: #{@issuer},"\
|
|
178
|
+
" risk_factors: #{@risk_factors}, fraud: #{@fraud}, three_ds: #{@three_ds}, exemption:"\
|
|
179
|
+
" #{@exemption}, scheme_reference: #{@scheme_reference}, token: #{@token}, links: #{@links},"\
|
|
180
|
+
" actions: #{@actions}>"
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
184
|
+
def inspect
|
|
185
|
+
class_name = self.class.name.split('::').last
|
|
186
|
+
super_string = super().inspect.sub(/^<[^ ]+ /, '').sub(/>$/, '')
|
|
187
|
+
"<#{class_name} #{super_string}, payment_instrument: #{@payment_instrument.inspect},"\
|
|
188
|
+
" updated_payment_instrument: #{@updated_payment_instrument.inspect}, issuer:"\
|
|
189
|
+
" #{@issuer.inspect}, risk_factors: #{@risk_factors.inspect}, fraud: #{@fraud.inspect},"\
|
|
190
|
+
" three_ds: #{@three_ds.inspect}, exemption: #{@exemption.inspect}, scheme_reference:"\
|
|
191
|
+
" #{@scheme_reference.inspect}, token: #{@token.inspect}, links: #{@links.inspect}, actions:"\
|
|
192
|
+
" #{@actions.inspect}>"
|
|
193
|
+
end
|
|
194
|
+
end
|
|
195
|
+
end
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# payments
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0 (
|
|
4
|
+
# https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
require_relative 'payments_payment_instrument'
|
|
7
|
+
|
|
8
|
+
module Payments
|
|
9
|
+
# SessionPaymentInstrument Model.
|
|
10
|
+
class SessionPaymentInstrument < PaymentsPaymentInstrument
|
|
11
|
+
# An http address that contains your Checkout session providing the card
|
|
12
|
+
# details.
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_accessor :session_href
|
|
15
|
+
|
|
16
|
+
# The name on your customer's card. Required if instruction.tokenCreation
|
|
17
|
+
# is present. However we recommend that you supply this to improve
|
|
18
|
+
# authentication rates.
|
|
19
|
+
# @return [String]
|
|
20
|
+
attr_accessor :card_holder_name
|
|
21
|
+
|
|
22
|
+
# Contains the billing address information.
|
|
23
|
+
# @return [BillingAddress]
|
|
24
|
+
attr_accessor :billing_address
|
|
25
|
+
|
|
26
|
+
# An object containing specific routing preferences.
|
|
27
|
+
# @return [Routing]
|
|
28
|
+
attr_accessor :routing
|
|
29
|
+
|
|
30
|
+
# A mapping from model property names to API property names.
|
|
31
|
+
def self.names
|
|
32
|
+
@_hash = {} if @_hash.nil?
|
|
33
|
+
@_hash['session_href'] = 'sessionHref'
|
|
34
|
+
@_hash['card_holder_name'] = 'cardHolderName'
|
|
35
|
+
@_hash['billing_address'] = 'billingAddress'
|
|
36
|
+
@_hash['routing'] = 'routing'
|
|
37
|
+
@_hash = super().merge(@_hash)
|
|
38
|
+
@_hash
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# An array for optional fields
|
|
42
|
+
def self.optionals
|
|
43
|
+
_arr = %w[
|
|
44
|
+
card_holder_name
|
|
45
|
+
billing_address
|
|
46
|
+
routing
|
|
47
|
+
]
|
|
48
|
+
(_arr << super()).flatten!
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# An array for nullable fields
|
|
52
|
+
def self.nullables
|
|
53
|
+
_arr = []
|
|
54
|
+
(_arr << super()).flatten!
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def initialize(session_href = nil, card_holder_name = SKIP,
|
|
58
|
+
billing_address = SKIP, routing = SKIP, type = 'checkout')
|
|
59
|
+
@session_href = session_href
|
|
60
|
+
@card_holder_name = card_holder_name unless card_holder_name == SKIP
|
|
61
|
+
@billing_address = billing_address unless billing_address == SKIP
|
|
62
|
+
@routing = routing unless routing == SKIP
|
|
63
|
+
|
|
64
|
+
# Call the constructor of the base class
|
|
65
|
+
super(type)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# Creates an instance of the object from a hash.
|
|
69
|
+
def self.from_hash(hash)
|
|
70
|
+
return nil unless hash
|
|
71
|
+
|
|
72
|
+
# Extract variables from the hash.
|
|
73
|
+
session_href = hash.key?('sessionHref') ? hash['sessionHref'] : nil
|
|
74
|
+
card_holder_name =
|
|
75
|
+
hash.key?('cardHolderName') ? hash['cardHolderName'] : SKIP
|
|
76
|
+
billing_address = BillingAddress.from_hash(hash['billingAddress']) if hash['billingAddress']
|
|
77
|
+
routing = Routing.from_hash(hash['routing']) if hash['routing']
|
|
78
|
+
type = hash['type'] ||= 'checkout'
|
|
79
|
+
|
|
80
|
+
# Create object from extracted values.
|
|
81
|
+
SessionPaymentInstrument.new(session_href,
|
|
82
|
+
card_holder_name,
|
|
83
|
+
billing_address,
|
|
84
|
+
routing,
|
|
85
|
+
type)
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# Validates an instance of the object from a given value.
|
|
89
|
+
# @param [SessionPaymentInstrument | Hash] The value against the validation is performed.
|
|
90
|
+
def self.validate(value)
|
|
91
|
+
if value.instance_of? self
|
|
92
|
+
return APIHelper.valid_type?(value.session_href,
|
|
93
|
+
->(val) { val.instance_of? String })
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
return false unless value.instance_of? Hash
|
|
97
|
+
|
|
98
|
+
APIHelper.valid_type?(value['sessionHref'],
|
|
99
|
+
->(val) { val.instance_of? String })
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# Provides a human-readable string representation of the object.
|
|
103
|
+
def to_s
|
|
104
|
+
class_name = self.class.name.split('::').last
|
|
105
|
+
super_string = super().sub(/^<[^ ]+ /, '').sub(/>$/, '')
|
|
106
|
+
"<#{class_name} #{super_string}, session_href: #{@session_href}, card_holder_name:"\
|
|
107
|
+
" #{@card_holder_name}, billing_address: #{@billing_address}, routing: #{@routing}>"
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
111
|
+
def inspect
|
|
112
|
+
class_name = self.class.name.split('::').last
|
|
113
|
+
super_string = super().inspect.sub(/^<[^ ]+ /, '').sub(/>$/, '')
|
|
114
|
+
"<#{class_name} #{super_string}, session_href: #{@session_href.inspect}, card_holder_name:"\
|
|
115
|
+
" #{@card_holder_name.inspect}, billing_address: #{@billing_address.inspect}, routing:"\
|
|
116
|
+
" #{@routing.inspect}>"
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
end
|