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,108 @@
|
|
|
1
|
+
# payments
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0 (
|
|
4
|
+
# https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module Payments
|
|
7
|
+
# Your sub-merchant's details.
|
|
8
|
+
class PaymentsSubMerchant < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# The name of your subMerchant's company.
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_accessor :name
|
|
15
|
+
|
|
16
|
+
# Unique merchant reference.
|
|
17
|
+
# @return [String]
|
|
18
|
+
attr_accessor :reference
|
|
19
|
+
|
|
20
|
+
# Contains the subMerchant address information.
|
|
21
|
+
# @return [PaymentsSubMerchantAddress]
|
|
22
|
+
attr_accessor :address
|
|
23
|
+
|
|
24
|
+
# Phone number of your subMerchant's company.
|
|
25
|
+
# @return [String]
|
|
26
|
+
attr_accessor :phone_number
|
|
27
|
+
|
|
28
|
+
# Tax Reference of your subMerchant's company.
|
|
29
|
+
# @return [String]
|
|
30
|
+
attr_accessor :tax_reference
|
|
31
|
+
|
|
32
|
+
# Email address of your subMerchant's company.
|
|
33
|
+
# @return [String]
|
|
34
|
+
attr_accessor :email
|
|
35
|
+
|
|
36
|
+
# A mapping from model property names to API property names.
|
|
37
|
+
def self.names
|
|
38
|
+
@_hash = {} if @_hash.nil?
|
|
39
|
+
@_hash['name'] = 'name'
|
|
40
|
+
@_hash['reference'] = 'reference'
|
|
41
|
+
@_hash['address'] = 'address'
|
|
42
|
+
@_hash['phone_number'] = 'phoneNumber'
|
|
43
|
+
@_hash['tax_reference'] = 'taxReference'
|
|
44
|
+
@_hash['email'] = 'email'
|
|
45
|
+
@_hash
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# An array for optional fields
|
|
49
|
+
def self.optionals
|
|
50
|
+
%w[
|
|
51
|
+
phone_number
|
|
52
|
+
tax_reference
|
|
53
|
+
email
|
|
54
|
+
]
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# An array for nullable fields
|
|
58
|
+
def self.nullables
|
|
59
|
+
[]
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def initialize(name = nil, reference = nil, address = nil,
|
|
63
|
+
phone_number = SKIP, tax_reference = SKIP, email = SKIP)
|
|
64
|
+
@name = name
|
|
65
|
+
@reference = reference
|
|
66
|
+
@address = address
|
|
67
|
+
@phone_number = phone_number unless phone_number == SKIP
|
|
68
|
+
@tax_reference = tax_reference unless tax_reference == SKIP
|
|
69
|
+
@email = email unless email == SKIP
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# Creates an instance of the object from a hash.
|
|
73
|
+
def self.from_hash(hash)
|
|
74
|
+
return nil unless hash
|
|
75
|
+
|
|
76
|
+
# Extract variables from the hash.
|
|
77
|
+
name = hash.key?('name') ? hash['name'] : nil
|
|
78
|
+
reference = hash.key?('reference') ? hash['reference'] : nil
|
|
79
|
+
address = PaymentsSubMerchantAddress.from_hash(hash['address']) if hash['address']
|
|
80
|
+
phone_number = hash.key?('phoneNumber') ? hash['phoneNumber'] : SKIP
|
|
81
|
+
tax_reference = hash.key?('taxReference') ? hash['taxReference'] : SKIP
|
|
82
|
+
email = hash.key?('email') ? hash['email'] : SKIP
|
|
83
|
+
|
|
84
|
+
# Create object from extracted values.
|
|
85
|
+
PaymentsSubMerchant.new(name,
|
|
86
|
+
reference,
|
|
87
|
+
address,
|
|
88
|
+
phone_number,
|
|
89
|
+
tax_reference,
|
|
90
|
+
email)
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
# Provides a human-readable string representation of the object.
|
|
94
|
+
def to_s
|
|
95
|
+
class_name = self.class.name.split('::').last
|
|
96
|
+
"<#{class_name} name: #{@name}, reference: #{@reference}, address: #{@address},"\
|
|
97
|
+
" phone_number: #{@phone_number}, tax_reference: #{@tax_reference}, email: #{@email}>"
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
101
|
+
def inspect
|
|
102
|
+
class_name = self.class.name.split('::').last
|
|
103
|
+
"<#{class_name} name: #{@name.inspect}, reference: #{@reference.inspect}, address:"\
|
|
104
|
+
" #{@address.inspect}, phone_number: #{@phone_number.inspect}, tax_reference:"\
|
|
105
|
+
" #{@tax_reference.inspect}, email: #{@email.inspect}>"
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
end
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# payments
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0 (
|
|
4
|
+
# https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module Payments
|
|
7
|
+
# Contains the subMerchant address information.
|
|
8
|
+
class PaymentsSubMerchantAddress < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# Post code/Zip code of your subMerchant's company.
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_accessor :postal_code
|
|
15
|
+
|
|
16
|
+
# Street name of your subMerchant's company.
|
|
17
|
+
# @return [String]
|
|
18
|
+
attr_accessor :street
|
|
19
|
+
|
|
20
|
+
# City of your subMerchant's company.
|
|
21
|
+
# @return [String]
|
|
22
|
+
attr_accessor :city
|
|
23
|
+
|
|
24
|
+
# State of your subMerchant's company.
|
|
25
|
+
# @return [String]
|
|
26
|
+
attr_accessor :state
|
|
27
|
+
|
|
28
|
+
# Country code of your subMerchant's company in [ISO 3166-1 Alpha-2
|
|
29
|
+
# format](/products/reference/supported-countries-currencies#iso-country-cod
|
|
30
|
+
# es).
|
|
31
|
+
# @return [String]
|
|
32
|
+
attr_accessor :country_code
|
|
33
|
+
|
|
34
|
+
# A mapping from model property names to API property names.
|
|
35
|
+
def self.names
|
|
36
|
+
@_hash = {} if @_hash.nil?
|
|
37
|
+
@_hash['postal_code'] = 'postalCode'
|
|
38
|
+
@_hash['street'] = 'street'
|
|
39
|
+
@_hash['city'] = 'city'
|
|
40
|
+
@_hash['state'] = 'state'
|
|
41
|
+
@_hash['country_code'] = 'countryCode'
|
|
42
|
+
@_hash
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# An array for optional fields
|
|
46
|
+
def self.optionals
|
|
47
|
+
%w[
|
|
48
|
+
state
|
|
49
|
+
]
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# An array for nullable fields
|
|
53
|
+
def self.nullables
|
|
54
|
+
[]
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def initialize(postal_code = nil, street = nil, city = nil,
|
|
58
|
+
country_code = nil, state = SKIP)
|
|
59
|
+
@postal_code = postal_code
|
|
60
|
+
@street = street
|
|
61
|
+
@city = city
|
|
62
|
+
@state = state unless state == SKIP
|
|
63
|
+
@country_code = country_code
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# Creates an instance of the object from a hash.
|
|
67
|
+
def self.from_hash(hash)
|
|
68
|
+
return nil unless hash
|
|
69
|
+
|
|
70
|
+
# Extract variables from the hash.
|
|
71
|
+
postal_code = hash.key?('postalCode') ? hash['postalCode'] : nil
|
|
72
|
+
street = hash.key?('street') ? hash['street'] : nil
|
|
73
|
+
city = hash.key?('city') ? hash['city'] : nil
|
|
74
|
+
country_code = hash.key?('countryCode') ? hash['countryCode'] : nil
|
|
75
|
+
state = hash.key?('state') ? hash['state'] : SKIP
|
|
76
|
+
|
|
77
|
+
# Create object from extracted values.
|
|
78
|
+
PaymentsSubMerchantAddress.new(postal_code,
|
|
79
|
+
street,
|
|
80
|
+
city,
|
|
81
|
+
country_code,
|
|
82
|
+
state)
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# Provides a human-readable string representation of the object.
|
|
86
|
+
def to_s
|
|
87
|
+
class_name = self.class.name.split('::').last
|
|
88
|
+
"<#{class_name} postal_code: #{@postal_code}, street: #{@street}, city: #{@city}, state:"\
|
|
89
|
+
" #{@state}, country_code: #{@country_code}>"
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
93
|
+
def inspect
|
|
94
|
+
class_name = self.class.name.split('::').last
|
|
95
|
+
"<#{class_name} postal_code: #{@postal_code.inspect}, street: #{@street.inspect}, city:"\
|
|
96
|
+
" #{@city.inspect}, state: #{@state.inspect}, country_code: #{@country_code.inspect}>"
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
end
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# payments
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0 (
|
|
4
|
+
# https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
require_relative 'payments_customer_agreement'
|
|
7
|
+
|
|
8
|
+
module Payments
|
|
9
|
+
# PaymentsSubscriptionCustomerAgreement Model.
|
|
10
|
+
class PaymentsSubscriptionCustomerAgreement < PaymentsCustomerAgreement
|
|
11
|
+
# Set to `first` to store a card or `subsequent` to use a previously stored
|
|
12
|
+
# card.
|
|
13
|
+
# @return [StoredCardUsageEnum]
|
|
14
|
+
attr_accessor :stored_card_usage
|
|
15
|
+
|
|
16
|
+
# Optional field available only for `subsequent` storedCardUsage. Unique
|
|
17
|
+
# reference provided by card schemes used to link the `first` and
|
|
18
|
+
# `subsequent` payments. If a Worldpay token was created as part of the
|
|
19
|
+
# first payment, this value is bundled with the token and does not need to
|
|
20
|
+
# be provided again. If you manage multiple agreements for a single
|
|
21
|
+
# cardholder using a token, please use the `schemeReference` returned to
|
|
22
|
+
# you. This allows you to distinguish and manage each separate agreement
|
|
23
|
+
# appropriately.
|
|
24
|
+
# @return [String]
|
|
25
|
+
attr_accessor :scheme_reference
|
|
26
|
+
|
|
27
|
+
# A mapping from model property names to API property names.
|
|
28
|
+
def self.names
|
|
29
|
+
@_hash = {} if @_hash.nil?
|
|
30
|
+
@_hash['stored_card_usage'] = 'storedCardUsage'
|
|
31
|
+
@_hash['scheme_reference'] = 'schemeReference'
|
|
32
|
+
@_hash = super().merge(@_hash)
|
|
33
|
+
@_hash
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# An array for optional fields
|
|
37
|
+
def self.optionals
|
|
38
|
+
_arr = %w[
|
|
39
|
+
scheme_reference
|
|
40
|
+
]
|
|
41
|
+
(_arr << super()).flatten!
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# An array for nullable fields
|
|
45
|
+
def self.nullables
|
|
46
|
+
_arr = []
|
|
47
|
+
(_arr << super()).flatten!
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def initialize(stored_card_usage = nil, scheme_reference = SKIP,
|
|
51
|
+
type = 'subscription')
|
|
52
|
+
@stored_card_usage = stored_card_usage
|
|
53
|
+
@scheme_reference = scheme_reference unless scheme_reference == SKIP
|
|
54
|
+
|
|
55
|
+
# Call the constructor of the base class
|
|
56
|
+
super(type)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# Creates an instance of the object from a hash.
|
|
60
|
+
def self.from_hash(hash)
|
|
61
|
+
return nil unless hash
|
|
62
|
+
|
|
63
|
+
# Extract variables from the hash.
|
|
64
|
+
stored_card_usage =
|
|
65
|
+
hash.key?('storedCardUsage') ? hash['storedCardUsage'] : nil
|
|
66
|
+
scheme_reference =
|
|
67
|
+
hash.key?('schemeReference') ? hash['schemeReference'] : SKIP
|
|
68
|
+
type = hash['type'] ||= 'subscription'
|
|
69
|
+
|
|
70
|
+
# Create object from extracted values.
|
|
71
|
+
PaymentsSubscriptionCustomerAgreement.new(stored_card_usage,
|
|
72
|
+
scheme_reference,
|
|
73
|
+
type)
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# Validates an instance of the object from a given value.
|
|
77
|
+
# @param [PaymentsSubscriptionCustomerAgreement | Hash] The value against the validation is performed.
|
|
78
|
+
def self.validate(value)
|
|
79
|
+
if value.instance_of? self
|
|
80
|
+
return APIHelper.valid_type?(value.stored_card_usage,
|
|
81
|
+
->(val) { StoredCardUsageEnum.validate(val) })
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
return false unless value.instance_of? Hash
|
|
85
|
+
|
|
86
|
+
APIHelper.valid_type?(value['storedCardUsage'],
|
|
87
|
+
->(val) { StoredCardUsageEnum.validate(val) })
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# Provides a human-readable string representation of the object.
|
|
91
|
+
def to_s
|
|
92
|
+
class_name = self.class.name.split('::').last
|
|
93
|
+
super_string = super().sub(/^<[^ ]+ /, '').sub(/>$/, '')
|
|
94
|
+
"<#{class_name} #{super_string}, stored_card_usage: #{@stored_card_usage},"\
|
|
95
|
+
" scheme_reference: #{@scheme_reference}>"
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
99
|
+
def inspect
|
|
100
|
+
class_name = self.class.name.split('::').last
|
|
101
|
+
super_string = super().inspect.sub(/^<[^ ]+ /, '').sub(/>$/, '')
|
|
102
|
+
"<#{class_name} #{super_string}, stored_card_usage: #{@stored_card_usage.inspect},"\
|
|
103
|
+
" scheme_reference: #{@scheme_reference.inspect}>"
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
end
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
# payments
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0 (
|
|
4
|
+
# https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module Payments
|
|
7
|
+
# An object containing 3DS authentication preferences. Read more on how to set
|
|
8
|
+
# it up under our [__3DS
|
|
9
|
+
# Authentication__](/products/payments/enable-features/3ds-authentication)
|
|
10
|
+
# guide.
|
|
11
|
+
class PaymentsThreeDS < BaseModel
|
|
12
|
+
SKIP = Object.new
|
|
13
|
+
private_constant :SKIP
|
|
14
|
+
|
|
15
|
+
# TODO: Write general description for this method
|
|
16
|
+
# @return [String]
|
|
17
|
+
attr_reader :type
|
|
18
|
+
|
|
19
|
+
# TODO: Write general description for this method
|
|
20
|
+
# @return [String]
|
|
21
|
+
attr_reader :mode
|
|
22
|
+
|
|
23
|
+
# An object containing 3DS challenge preferences and configuration.
|
|
24
|
+
# @return [Challenge]
|
|
25
|
+
attr_accessor :challenge
|
|
26
|
+
|
|
27
|
+
# An object containing device data for 3DS & Fraud assessment.
|
|
28
|
+
# @return [DeviceData]
|
|
29
|
+
attr_accessor :device_data
|
|
30
|
+
|
|
31
|
+
# Attempt authorization (without liability shift) using an authentication
|
|
32
|
+
# outage exemption in the event of a 3DS network failure. Even with this
|
|
33
|
+
# boolean set it is not currently part of default merchant setup. See [how
|
|
34
|
+
# to enable authentication outage
|
|
35
|
+
# exemptions](/products/payments/enable-features/3ds-authentication#how-to-e
|
|
36
|
+
# nable-authentication-outage-exemptions)
|
|
37
|
+
# @return [TrueClass | FalseClass]
|
|
38
|
+
attr_accessor :exemption_on_outage
|
|
39
|
+
|
|
40
|
+
# Has the account been flagged for suspicious activity.
|
|
41
|
+
# @return [TrueClass | FalseClass]
|
|
42
|
+
attr_accessor :previous_suspicious_activity
|
|
43
|
+
|
|
44
|
+
# Has the account been flagged for suspicious activity.
|
|
45
|
+
# @return [UserTypeEnum]
|
|
46
|
+
attr_accessor :user_type
|
|
47
|
+
|
|
48
|
+
# Customer account history.
|
|
49
|
+
# @return [AccountHistory]
|
|
50
|
+
attr_accessor :account_history
|
|
51
|
+
|
|
52
|
+
# Repeat of a previous order.
|
|
53
|
+
# @return [TrueClass | FalseClass]
|
|
54
|
+
attr_accessor :reorder
|
|
55
|
+
|
|
56
|
+
# Expected date that a pre-ordered purchase will be available.
|
|
57
|
+
# @return [String]
|
|
58
|
+
attr_accessor :pre_order_date
|
|
59
|
+
|
|
60
|
+
# Object containing details of the last transaction.
|
|
61
|
+
# @return [TransactionHistory]
|
|
62
|
+
attr_accessor :transaction_history
|
|
63
|
+
|
|
64
|
+
# If the order is being used to purchase a gift card.
|
|
65
|
+
# @return [PaymentsGiftCardsPurchase]
|
|
66
|
+
attr_accessor :gift_cards_purchase
|
|
67
|
+
|
|
68
|
+
# A mapping from model property names to API property names.
|
|
69
|
+
def self.names
|
|
70
|
+
@_hash = {} if @_hash.nil?
|
|
71
|
+
@_hash['type'] = 'type'
|
|
72
|
+
@_hash['mode'] = 'mode'
|
|
73
|
+
@_hash['challenge'] = 'challenge'
|
|
74
|
+
@_hash['device_data'] = 'deviceData'
|
|
75
|
+
@_hash['exemption_on_outage'] = 'exemptionOnOutage'
|
|
76
|
+
@_hash['previous_suspicious_activity'] = 'previousSuspiciousActivity'
|
|
77
|
+
@_hash['user_type'] = 'userType'
|
|
78
|
+
@_hash['account_history'] = 'accountHistory'
|
|
79
|
+
@_hash['reorder'] = 'reorder'
|
|
80
|
+
@_hash['pre_order_date'] = 'preOrderDate'
|
|
81
|
+
@_hash['transaction_history'] = 'transactionHistory'
|
|
82
|
+
@_hash['gift_cards_purchase'] = 'giftCardsPurchase'
|
|
83
|
+
@_hash
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# An array for optional fields
|
|
87
|
+
def self.optionals
|
|
88
|
+
%w[
|
|
89
|
+
exemption_on_outage
|
|
90
|
+
previous_suspicious_activity
|
|
91
|
+
user_type
|
|
92
|
+
account_history
|
|
93
|
+
reorder
|
|
94
|
+
pre_order_date
|
|
95
|
+
transaction_history
|
|
96
|
+
gift_cards_purchase
|
|
97
|
+
]
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
# An array for nullable fields
|
|
101
|
+
def self.nullables
|
|
102
|
+
[]
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def initialize(challenge = nil, device_data = nil,
|
|
106
|
+
exemption_on_outage = false,
|
|
107
|
+
previous_suspicious_activity = SKIP, user_type = SKIP,
|
|
108
|
+
account_history = SKIP, reorder = SKIP,
|
|
109
|
+
pre_order_date = SKIP, transaction_history = SKIP,
|
|
110
|
+
gift_cards_purchase = SKIP)
|
|
111
|
+
@type = 'integrated'
|
|
112
|
+
@mode = 'always'
|
|
113
|
+
@challenge = challenge
|
|
114
|
+
@device_data = device_data
|
|
115
|
+
@exemption_on_outage = exemption_on_outage unless exemption_on_outage == SKIP
|
|
116
|
+
unless previous_suspicious_activity == SKIP
|
|
117
|
+
@previous_suspicious_activity =
|
|
118
|
+
previous_suspicious_activity
|
|
119
|
+
end
|
|
120
|
+
@user_type = user_type unless user_type == SKIP
|
|
121
|
+
@account_history = account_history unless account_history == SKIP
|
|
122
|
+
@reorder = reorder unless reorder == SKIP
|
|
123
|
+
@pre_order_date = pre_order_date unless pre_order_date == SKIP
|
|
124
|
+
@transaction_history = transaction_history unless transaction_history == SKIP
|
|
125
|
+
@gift_cards_purchase = gift_cards_purchase unless gift_cards_purchase == SKIP
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
# Creates an instance of the object from a hash.
|
|
129
|
+
def self.from_hash(hash)
|
|
130
|
+
return nil unless hash
|
|
131
|
+
|
|
132
|
+
# Extract variables from the hash.
|
|
133
|
+
challenge = Challenge.from_hash(hash['challenge']) if hash['challenge']
|
|
134
|
+
device_data = DeviceData.from_hash(hash['deviceData']) if hash['deviceData']
|
|
135
|
+
exemption_on_outage = hash['exemptionOnOutage'] ||= false
|
|
136
|
+
previous_suspicious_activity =
|
|
137
|
+
hash.key?('previousSuspiciousActivity') ? hash['previousSuspiciousActivity'] : SKIP
|
|
138
|
+
user_type = hash.key?('userType') ? hash['userType'] : SKIP
|
|
139
|
+
account_history = AccountHistory.from_hash(hash['accountHistory']) if hash['accountHistory']
|
|
140
|
+
reorder = hash.key?('reorder') ? hash['reorder'] : SKIP
|
|
141
|
+
pre_order_date = hash.key?('preOrderDate') ? hash['preOrderDate'] : SKIP
|
|
142
|
+
transaction_history = TransactionHistory.from_hash(hash['transactionHistory']) if
|
|
143
|
+
hash['transactionHistory']
|
|
144
|
+
gift_cards_purchase = PaymentsGiftCardsPurchase.from_hash(hash['giftCardsPurchase']) if
|
|
145
|
+
hash['giftCardsPurchase']
|
|
146
|
+
|
|
147
|
+
# Create object from extracted values.
|
|
148
|
+
PaymentsThreeDS.new(challenge,
|
|
149
|
+
device_data,
|
|
150
|
+
exemption_on_outage,
|
|
151
|
+
previous_suspicious_activity,
|
|
152
|
+
user_type,
|
|
153
|
+
account_history,
|
|
154
|
+
reorder,
|
|
155
|
+
pre_order_date,
|
|
156
|
+
transaction_history,
|
|
157
|
+
gift_cards_purchase)
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
# Validates an instance of the object from a given value.
|
|
161
|
+
# @param [PaymentsThreeDS | Hash] The value against the validation is performed.
|
|
162
|
+
def self.validate(value)
|
|
163
|
+
if value.instance_of? self
|
|
164
|
+
return (
|
|
165
|
+
APIHelper.valid_type?(value.type,
|
|
166
|
+
->(val) { val.instance_of? String }) and
|
|
167
|
+
APIHelper.valid_type?(value.mode,
|
|
168
|
+
->(val) { val.instance_of? String }) and
|
|
169
|
+
APIHelper.valid_type?(value.challenge,
|
|
170
|
+
->(val) { Challenge.validate(val) },
|
|
171
|
+
is_model_hash: true) and
|
|
172
|
+
APIHelper.valid_type?(value.device_data,
|
|
173
|
+
->(val) { DeviceData.validate(val) },
|
|
174
|
+
is_model_hash: true)
|
|
175
|
+
)
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
return false unless value.instance_of? Hash
|
|
179
|
+
|
|
180
|
+
(
|
|
181
|
+
APIHelper.valid_type?(value['type'],
|
|
182
|
+
->(val) { val.instance_of? String }) and
|
|
183
|
+
APIHelper.valid_type?(value['mode'],
|
|
184
|
+
->(val) { val.instance_of? String }) and
|
|
185
|
+
APIHelper.valid_type?(value['challenge'],
|
|
186
|
+
->(val) { Challenge.validate(val) },
|
|
187
|
+
is_model_hash: true) and
|
|
188
|
+
APIHelper.valid_type?(value['deviceData'],
|
|
189
|
+
->(val) { DeviceData.validate(val) },
|
|
190
|
+
is_model_hash: true)
|
|
191
|
+
)
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
# Provides a human-readable string representation of the object.
|
|
195
|
+
def to_s
|
|
196
|
+
class_name = self.class.name.split('::').last
|
|
197
|
+
"<#{class_name} type: #{@type}, mode: #{@mode}, challenge: #{@challenge}, device_data:"\
|
|
198
|
+
" #{@device_data}, exemption_on_outage: #{@exemption_on_outage},"\
|
|
199
|
+
" previous_suspicious_activity: #{@previous_suspicious_activity}, user_type: #{@user_type},"\
|
|
200
|
+
" account_history: #{@account_history}, reorder: #{@reorder}, pre_order_date:"\
|
|
201
|
+
" #{@pre_order_date}, transaction_history: #{@transaction_history}, gift_cards_purchase:"\
|
|
202
|
+
" #{@gift_cards_purchase}>"
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
206
|
+
def inspect
|
|
207
|
+
class_name = self.class.name.split('::').last
|
|
208
|
+
"<#{class_name} type: #{@type.inspect}, mode: #{@mode.inspect}, challenge:"\
|
|
209
|
+
" #{@challenge.inspect}, device_data: #{@device_data.inspect}, exemption_on_outage:"\
|
|
210
|
+
" #{@exemption_on_outage.inspect}, previous_suspicious_activity:"\
|
|
211
|
+
" #{@previous_suspicious_activity.inspect}, user_type: #{@user_type.inspect},"\
|
|
212
|
+
" account_history: #{@account_history.inspect}, reorder: #{@reorder.inspect},"\
|
|
213
|
+
" pre_order_date: #{@pre_order_date.inspect}, transaction_history:"\
|
|
214
|
+
" #{@transaction_history.inspect}, gift_cards_purchase: #{@gift_cards_purchase.inspect}>"
|
|
215
|
+
end
|
|
216
|
+
end
|
|
217
|
+
end
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# payments
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0 (
|
|
4
|
+
# https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module Payments
|
|
7
|
+
# Sender's address.
|
|
8
|
+
class PaymentsTransferAddress < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# Must be supplied if `city` is provided.
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_accessor :address1
|
|
15
|
+
|
|
16
|
+
# Must be supplied if `city` is provided.
|
|
17
|
+
# @return [String]
|
|
18
|
+
attr_accessor :address2
|
|
19
|
+
|
|
20
|
+
# Must be supplied if `address1` is provided.
|
|
21
|
+
# @return [String]
|
|
22
|
+
attr_accessor :city
|
|
23
|
+
|
|
24
|
+
# Must be supplied if `address1` is provided.
|
|
25
|
+
# @return [String]
|
|
26
|
+
attr_accessor :postal_code
|
|
27
|
+
|
|
28
|
+
# 1-3 alphanumeric characters and spaces.
|
|
29
|
+
# @return [String]
|
|
30
|
+
attr_accessor :state
|
|
31
|
+
|
|
32
|
+
# Country code in [ISO 3166-1 Alpha-2
|
|
33
|
+
# format](/products/reference/supported-countries-currencies#iso-country-cod
|
|
34
|
+
# es).
|
|
35
|
+
# @return [String]
|
|
36
|
+
attr_accessor :country_code
|
|
37
|
+
|
|
38
|
+
# A mapping from model property names to API property names.
|
|
39
|
+
def self.names
|
|
40
|
+
@_hash = {} if @_hash.nil?
|
|
41
|
+
@_hash['address1'] = 'address1'
|
|
42
|
+
@_hash['address2'] = 'address2'
|
|
43
|
+
@_hash['city'] = 'city'
|
|
44
|
+
@_hash['postal_code'] = 'postalCode'
|
|
45
|
+
@_hash['state'] = 'state'
|
|
46
|
+
@_hash['country_code'] = 'countryCode'
|
|
47
|
+
@_hash
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# An array for optional fields
|
|
51
|
+
def self.optionals
|
|
52
|
+
%w[
|
|
53
|
+
address1
|
|
54
|
+
address2
|
|
55
|
+
city
|
|
56
|
+
postal_code
|
|
57
|
+
state
|
|
58
|
+
]
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# An array for nullable fields
|
|
62
|
+
def self.nullables
|
|
63
|
+
[]
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def initialize(country_code = nil, address1 = SKIP, address2 = SKIP,
|
|
67
|
+
city = SKIP, postal_code = SKIP, state = SKIP)
|
|
68
|
+
@address1 = address1 unless address1 == SKIP
|
|
69
|
+
@address2 = address2 unless address2 == SKIP
|
|
70
|
+
@city = city unless city == SKIP
|
|
71
|
+
@postal_code = postal_code unless postal_code == SKIP
|
|
72
|
+
@state = state unless state == SKIP
|
|
73
|
+
@country_code = country_code
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# Creates an instance of the object from a hash.
|
|
77
|
+
def self.from_hash(hash)
|
|
78
|
+
return nil unless hash
|
|
79
|
+
|
|
80
|
+
# Extract variables from the hash.
|
|
81
|
+
country_code = hash.key?('countryCode') ? hash['countryCode'] : nil
|
|
82
|
+
address1 = hash.key?('address1') ? hash['address1'] : SKIP
|
|
83
|
+
address2 = hash.key?('address2') ? hash['address2'] : SKIP
|
|
84
|
+
city = hash.key?('city') ? hash['city'] : SKIP
|
|
85
|
+
postal_code = hash.key?('postalCode') ? hash['postalCode'] : SKIP
|
|
86
|
+
state = hash.key?('state') ? hash['state'] : SKIP
|
|
87
|
+
|
|
88
|
+
# Create object from extracted values.
|
|
89
|
+
PaymentsTransferAddress.new(country_code,
|
|
90
|
+
address1,
|
|
91
|
+
address2,
|
|
92
|
+
city,
|
|
93
|
+
postal_code,
|
|
94
|
+
state)
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# Provides a human-readable string representation of the object.
|
|
98
|
+
def to_s
|
|
99
|
+
class_name = self.class.name.split('::').last
|
|
100
|
+
"<#{class_name} address1: #{@address1}, address2: #{@address2}, city: #{@city},"\
|
|
101
|
+
" postal_code: #{@postal_code}, state: #{@state}, country_code: #{@country_code}>"
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
105
|
+
def inspect
|
|
106
|
+
class_name = self.class.name.split('::').last
|
|
107
|
+
"<#{class_name} address1: #{@address1.inspect}, address2: #{@address2.inspect}, city:"\
|
|
108
|
+
" #{@city.inspect}, postal_code: #{@postal_code.inspect}, state: #{@state.inspect},"\
|
|
109
|
+
" country_code: #{@country_code.inspect}>"
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
end
|