loyalty-sdk 0.0.1
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 +187 -0
- data/bin/console +15 -0
- data/lib/loyalty_ap_is/api_helper.rb +10 -0
- data/lib/loyalty_ap_is/apis/authorization_api.rb +116 -0
- data/lib/loyalty_ap_is/apis/balances_api.rb +96 -0
- data/lib/loyalty_ap_is/apis/base_api.rb +67 -0
- data/lib/loyalty_ap_is/apis/oauth_authorization_api.rb +44 -0
- data/lib/loyalty_ap_is/apis/offer_api.rb +164 -0
- data/lib/loyalty_ap_is/apis/profile_management_api.rb +44 -0
- data/lib/loyalty_ap_is/apis/redemption_api.rb +107 -0
- data/lib/loyalty_ap_is/apis/transaction_api.rb +143 -0
- data/lib/loyalty_ap_is/client.rb +137 -0
- data/lib/loyalty_ap_is/configuration.rb +238 -0
- data/lib/loyalty_ap_is/exceptions/api_exception.rb +21 -0
- data/lib/loyalty_ap_is/exceptions/common_error_exception.rb +98 -0
- data/lib/loyalty_ap_is/exceptions/consumers_balances400_error_exception.rb +57 -0
- data/lib/loyalty_ap_is/exceptions/consumers_balances401_error_exception.rb +57 -0
- data/lib/loyalty_ap_is/exceptions/consumers_balances404_error_exception.rb +57 -0
- data/lib/loyalty_ap_is/exceptions/consumers_balances422_error_exception.rb +57 -0
- data/lib/loyalty_ap_is/exceptions/error_response_exception.rb +57 -0
- data/lib/loyalty_ap_is/exceptions/json_api_error_exception.rb +60 -0
- data/lib/loyalty_ap_is/exceptions/oauth_provider_exception.rb +64 -0
- data/lib/loyalty_ap_is/exceptions/resource_not_found_error_exception.rb +57 -0
- data/lib/loyalty_ap_is/http/api_response.rb +19 -0
- data/lib/loyalty_ap_is/http/auth/client_authorization_token.rb +148 -0
- data/lib/loyalty_ap_is/http/auth/customer_header.rb +52 -0
- data/lib/loyalty_ap_is/http/auth/private_basic_token.rb +52 -0
- data/lib/loyalty_ap_is/http/auth/public_basic_token.rb +52 -0
- data/lib/loyalty_ap_is/http/auth/public_bearer_token.rb +53 -0
- data/lib/loyalty_ap_is/http/http_call_back.rb +10 -0
- data/lib/loyalty_ap_is/http/http_method_enum.rb +10 -0
- data/lib/loyalty_ap_is/http/http_request.rb +10 -0
- data/lib/loyalty_ap_is/http/http_response.rb +10 -0
- data/lib/loyalty_ap_is/http/proxy_settings.rb +22 -0
- data/lib/loyalty_ap_is/logging/configuration/api_logging_configuration.rb +186 -0
- data/lib/loyalty_ap_is/logging/sdk_logger.rb +17 -0
- data/lib/loyalty_ap_is/models/access_code_response.rb +87 -0
- data/lib/loyalty_ap_is/models/assign_offer_channel.rb +26 -0
- data/lib/loyalty_ap_is/models/auth_token_request.rb +75 -0
- data/lib/loyalty_ap_is/models/auth_token_response.rb +106 -0
- data/lib/loyalty_ap_is/models/bad_request_error.rb +63 -0
- data/lib/loyalty_ap_is/models/balance_amount.rb +84 -0
- data/lib/loyalty_ap_is/models/balance_amount_detail.rb +141 -0
- data/lib/loyalty_ap_is/models/balance_currency_amount.rb +93 -0
- data/lib/loyalty_ap_is/models/balance_currency_type.rb +60 -0
- data/lib/loyalty_ap_is/models/balance_state.rb +72 -0
- data/lib/loyalty_ap_is/models/base_model.rb +110 -0
- data/lib/loyalty_ap_is/models/client_auth_token_request.rb +78 -0
- data/lib/loyalty_ap_is/models/currency_data.rb +101 -0
- data/lib/loyalty_ap_is/models/customer_balances.rb +84 -0
- data/lib/loyalty_ap_is/models/error_base_container.rb +82 -0
- data/lib/loyalty_ap_is/models/error_info.rb +84 -0
- data/lib/loyalty_ap_is/models/error_item.rb +105 -0
- data/lib/loyalty_ap_is/models/error_presenter.rb +150 -0
- data/lib/loyalty_ap_is/models/error_source.rb +75 -0
- data/lib/loyalty_ap_is/models/ev_charging_details.rb +151 -0
- data/lib/loyalty_ap_is/models/exchange_access_code_request.rb +77 -0
- data/lib/loyalty_ap_is/models/fault.rb +85 -0
- data/lib/loyalty_ap_is/models/fault_detail.rb +76 -0
- data/lib/loyalty_ap_is/models/json_api_version.rb +75 -0
- data/lib/loyalty_ap_is/models/loyalty_card_info.rb +76 -0
- data/lib/loyalty_ap_is/models/m200_user_partners.rb +109 -0
- data/lib/loyalty_ap_is/models/method_not_allowed_error.rb +62 -0
- data/lib/loyalty_ap_is/models/not_found_error.rb +62 -0
- data/lib/loyalty_ap_is/models/not_found_error_response.rb +90 -0
- data/lib/loyalty_ap_is/models/oauth_provider_error.rb +62 -0
- data/lib/loyalty_ap_is/models/oauth_token.rb +96 -0
- data/lib/loyalty_ap_is/models/offer.rb +155 -0
- data/lib/loyalty_ap_is/models/offer_assignment.rb +172 -0
- data/lib/loyalty_ap_is/models/offer_base.rb +101 -0
- data/lib/loyalty_ap_is/models/offer_info.rb +156 -0
- data/lib/loyalty_ap_is/models/offer_language.rb +100 -0
- data/lib/loyalty_ap_is/models/points_to_cash.rb +99 -0
- data/lib/loyalty_ap_is/models/product_type.rb +53 -0
- data/lib/loyalty_ap_is/models/redeemed_item.rb +221 -0
- data/lib/loyalty_ap_is/models/redeemed_item_product.rb +131 -0
- data/lib/loyalty_ap_is/models/redemption_item.rb +109 -0
- data/lib/loyalty_ap_is/models/redemption_request.rb +107 -0
- data/lib/loyalty_ap_is/models/redemption_response.rb +118 -0
- data/lib/loyalty_ap_is/models/redemption_response_item.rb +111 -0
- data/lib/loyalty_ap_is/models/refresh_token_request.rb +75 -0
- data/lib/loyalty_ap_is/models/refresh_token_response.rb +93 -0
- data/lib/loyalty_ap_is/models/sale_item.rb +262 -0
- data/lib/loyalty_ap_is/models/sale_item_product.rb +135 -0
- data/lib/loyalty_ap_is/models/site_data.rb +121 -0
- data/lib/loyalty_ap_is/models/transaction.rb +351 -0
- data/lib/loyalty_ap_is/models/transaction_balance.rb +91 -0
- data/lib/loyalty_ap_is/models/transaction_balance_amount.rb +82 -0
- data/lib/loyalty_ap_is/models/transaction_balance_state.rb +64 -0
- data/lib/loyalty_ap_is/models/transaction_currency_type.rb +56 -0
- data/lib/loyalty_ap_is/models/transaction_detail_type.rb +53 -0
- data/lib/loyalty_ap_is/models/transaction_type_filter.rb +40 -0
- data/lib/loyalty_ap_is/models/transaction_voucher.rb +109 -0
- data/lib/loyalty_ap_is/models/transactions_response.rb +118 -0
- data/lib/loyalty_ap_is/models/unauthorized_error.rb +62 -0
- data/lib/loyalty_ap_is/models/unit_measure.rb +40 -0
- data/lib/loyalty_ap_is/models/unprocessable_entity_error_response.rb +90 -0
- data/lib/loyalty_ap_is/models/voucher_item.rb +99 -0
- data/lib/loyalty_ap_is/utilities/date_time_helper.rb +11 -0
- data/lib/loyalty_ap_is/utilities/file_wrapper.rb +28 -0
- data/lib/loyalty_ap_is.rb +128 -0
- metadata +189 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# loyalty_ap_is
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0 (
|
|
4
|
+
# https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module LoyaltyApIs
|
|
7
|
+
# SiteData Model.
|
|
8
|
+
class SiteData < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# Two character ISO 3166-1 alpha-2 country code
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_accessor :country_code
|
|
15
|
+
|
|
16
|
+
# Unique Id of the site
|
|
17
|
+
# @return [String]
|
|
18
|
+
attr_accessor :site_id
|
|
19
|
+
|
|
20
|
+
# Name of the site
|
|
21
|
+
# @return [String]
|
|
22
|
+
attr_accessor :name
|
|
23
|
+
|
|
24
|
+
# Postcode of the site
|
|
25
|
+
# @return [String]
|
|
26
|
+
attr_accessor :postcode
|
|
27
|
+
|
|
28
|
+
# City of the site
|
|
29
|
+
# @return [String]
|
|
30
|
+
attr_accessor :city
|
|
31
|
+
|
|
32
|
+
# Address of the site
|
|
33
|
+
# @return [String]
|
|
34
|
+
attr_accessor :address
|
|
35
|
+
|
|
36
|
+
# A mapping from model property names to API property names.
|
|
37
|
+
def self.names
|
|
38
|
+
@_hash = {} if @_hash.nil?
|
|
39
|
+
@_hash['country_code'] = 'countryCode'
|
|
40
|
+
@_hash['site_id'] = 'siteId'
|
|
41
|
+
@_hash['name'] = 'name'
|
|
42
|
+
@_hash['postcode'] = 'postcode'
|
|
43
|
+
@_hash['city'] = 'city'
|
|
44
|
+
@_hash['address'] = 'address'
|
|
45
|
+
@_hash
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# An array for optional fields
|
|
49
|
+
def self.optionals
|
|
50
|
+
%w[
|
|
51
|
+
postcode
|
|
52
|
+
city
|
|
53
|
+
address
|
|
54
|
+
]
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# An array for nullable fields
|
|
58
|
+
def self.nullables
|
|
59
|
+
[]
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def initialize(country_code:, site_id:, name:, postcode: SKIP, city: SKIP,
|
|
63
|
+
address: SKIP, additional_properties: nil)
|
|
64
|
+
# Add additional model properties to the instance
|
|
65
|
+
additional_properties = {} if additional_properties.nil?
|
|
66
|
+
|
|
67
|
+
@country_code = country_code
|
|
68
|
+
@site_id = site_id
|
|
69
|
+
@name = name
|
|
70
|
+
@postcode = postcode unless postcode == SKIP
|
|
71
|
+
@city = city unless city == SKIP
|
|
72
|
+
@address = address unless address == SKIP
|
|
73
|
+
@additional_properties = additional_properties
|
|
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
|
+
site_id = hash.key?('siteId') ? hash['siteId'] : nil
|
|
83
|
+
name = hash.key?('name') ? hash['name'] : nil
|
|
84
|
+
postcode = hash.key?('postcode') ? hash['postcode'] : SKIP
|
|
85
|
+
city = hash.key?('city') ? hash['city'] : SKIP
|
|
86
|
+
address = hash.key?('address') ? hash['address'] : SKIP
|
|
87
|
+
|
|
88
|
+
# Create a new hash for additional properties, removing known properties.
|
|
89
|
+
new_hash = hash.reject { |k, _| names.value?(k) }
|
|
90
|
+
|
|
91
|
+
additional_properties = APIHelper.get_additional_properties(
|
|
92
|
+
new_hash, proc { |value| value }
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
# Create object from extracted values.
|
|
96
|
+
SiteData.new(country_code: country_code,
|
|
97
|
+
site_id: site_id,
|
|
98
|
+
name: name,
|
|
99
|
+
postcode: postcode,
|
|
100
|
+
city: city,
|
|
101
|
+
address: address,
|
|
102
|
+
additional_properties: additional_properties)
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
# Provides a human-readable string representation of the object.
|
|
106
|
+
def to_s
|
|
107
|
+
class_name = self.class.name.split('::').last
|
|
108
|
+
"<#{class_name} country_code: #{@country_code}, site_id: #{@site_id}, name: #{@name},"\
|
|
109
|
+
" postcode: #{@postcode}, city: #{@city}, address: #{@address}, additional_properties:"\
|
|
110
|
+
" #{@additional_properties}>"
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
114
|
+
def inspect
|
|
115
|
+
class_name = self.class.name.split('::').last
|
|
116
|
+
"<#{class_name} country_code: #{@country_code.inspect}, site_id: #{@site_id.inspect}, name:"\
|
|
117
|
+
" #{@name.inspect}, postcode: #{@postcode.inspect}, city: #{@city.inspect}, address:"\
|
|
118
|
+
" #{@address.inspect}, additional_properties: #{@additional_properties}>"
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
end
|
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
# loyalty_ap_is
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0 (
|
|
4
|
+
# https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
require 'date'
|
|
7
|
+
module LoyaltyApIs
|
|
8
|
+
# Transaction Model.
|
|
9
|
+
class Transaction < BaseModel
|
|
10
|
+
SKIP = Object.new
|
|
11
|
+
private_constant :SKIP
|
|
12
|
+
|
|
13
|
+
# Transaction date as Unix epoch (UTC), as requested by MobGen.
|
|
14
|
+
# @return [Integer]
|
|
15
|
+
attr_accessor :transaction_date_time
|
|
16
|
+
|
|
17
|
+
# Transaction date in JSON recommended format: “yyyy-MM-ddTHH:mm:ssZ”
|
|
18
|
+
# @return [DateTime]
|
|
19
|
+
attr_accessor :transaction_date_time_stamp
|
|
20
|
+
|
|
21
|
+
# Transaction date in JSON recommended format: “yyyy-MM-ddTHH:mm:ssZ”
|
|
22
|
+
# @return [SiteData]
|
|
23
|
+
attr_accessor :site_data
|
|
24
|
+
|
|
25
|
+
# Transaction date in JSON recommended format: “yyyy-MM-ddTHH:mm:ssZ”
|
|
26
|
+
# @return [LoyaltyCardInfo]
|
|
27
|
+
attr_accessor :loyalty
|
|
28
|
+
|
|
29
|
+
# Unique Id of the transaction row.
|
|
30
|
+
# @return [String]
|
|
31
|
+
attr_accessor :transaction_id
|
|
32
|
+
|
|
33
|
+
# Unique code identifying the partner
|
|
34
|
+
# @return [String]
|
|
35
|
+
attr_accessor :partner_code
|
|
36
|
+
|
|
37
|
+
# Name of the partner
|
|
38
|
+
# @return [String]
|
|
39
|
+
attr_accessor :partner_name
|
|
40
|
+
|
|
41
|
+
# Name of the partner
|
|
42
|
+
# @return [String]
|
|
43
|
+
attr_accessor :partner_logo
|
|
44
|
+
|
|
45
|
+
# Reference ID for each transaction. It is unique for each partner and
|
|
46
|
+
# transaction.
|
|
47
|
+
# @return [String]
|
|
48
|
+
attr_accessor :reference_id
|
|
49
|
+
|
|
50
|
+
# Total amount of the transaction.
|
|
51
|
+
# @return [Float]
|
|
52
|
+
attr_accessor :total_amount
|
|
53
|
+
|
|
54
|
+
# Total discount amount of the transaction.
|
|
55
|
+
# @return [Float]
|
|
56
|
+
attr_accessor :total_discount_amount
|
|
57
|
+
|
|
58
|
+
# totalAmount - totalDiscountedFullAmount
|
|
59
|
+
# @return [Float]
|
|
60
|
+
attr_accessor :total_discounted_full_amount
|
|
61
|
+
|
|
62
|
+
# Total amount of VAT
|
|
63
|
+
# @return [Float]
|
|
64
|
+
attr_accessor :total_vat_amount
|
|
65
|
+
|
|
66
|
+
# Total amount of VAT
|
|
67
|
+
# @return [Array[TransactionBalance]]
|
|
68
|
+
attr_accessor :balances
|
|
69
|
+
|
|
70
|
+
# Currency using ISO4217 alpha-3 currency code
|
|
71
|
+
# @return [String]
|
|
72
|
+
attr_accessor :currency_code
|
|
73
|
+
|
|
74
|
+
# Currency using ISO4217 alpha-3 currency code
|
|
75
|
+
# @return [Array[SaleItem]]
|
|
76
|
+
attr_accessor :sale_items
|
|
77
|
+
|
|
78
|
+
# Currency using ISO4217 alpha-3 currency code
|
|
79
|
+
# @return [Array[RedeemedItem]]
|
|
80
|
+
attr_accessor :redeemed_items
|
|
81
|
+
|
|
82
|
+
# Currency using ISO4217 alpha-3 currency code
|
|
83
|
+
# @return [Array[TransactionVoucher]]
|
|
84
|
+
attr_accessor :transaction_vouchers
|
|
85
|
+
|
|
86
|
+
# Unique number of transaction's receipt
|
|
87
|
+
# @return [String]
|
|
88
|
+
attr_accessor :receipt_number
|
|
89
|
+
|
|
90
|
+
# Unique number of transaction's receipt
|
|
91
|
+
# @return [PointsToCash]
|
|
92
|
+
attr_accessor :points_to_cash
|
|
93
|
+
|
|
94
|
+
# Partner identifier
|
|
95
|
+
# @return [Integer]
|
|
96
|
+
attr_accessor :company_id
|
|
97
|
+
|
|
98
|
+
# Describes whether the transaction is partner redemption.
|
|
99
|
+
# @return [TrueClass | FalseClass]
|
|
100
|
+
attr_accessor :is_partner_redemption
|
|
101
|
+
|
|
102
|
+
# currencyData is only filled, where there is possible non-same currency
|
|
103
|
+
# cross-border transaction
|
|
104
|
+
# @return [CurrencyData]
|
|
105
|
+
attr_accessor :currency_data
|
|
106
|
+
|
|
107
|
+
# A mapping from model property names to API property names.
|
|
108
|
+
def self.names
|
|
109
|
+
@_hash = {} if @_hash.nil?
|
|
110
|
+
@_hash['transaction_date_time'] = 'transactionDateTime'
|
|
111
|
+
@_hash['transaction_date_time_stamp'] = 'transactionDateTimeStamp'
|
|
112
|
+
@_hash['site_data'] = 'siteData'
|
|
113
|
+
@_hash['loyalty'] = 'loyalty'
|
|
114
|
+
@_hash['transaction_id'] = 'transactionId'
|
|
115
|
+
@_hash['partner_code'] = 'partnerCode'
|
|
116
|
+
@_hash['partner_name'] = 'partnerName'
|
|
117
|
+
@_hash['partner_logo'] = 'partnerLogo'
|
|
118
|
+
@_hash['reference_id'] = 'referenceId'
|
|
119
|
+
@_hash['total_amount'] = 'totalAmount'
|
|
120
|
+
@_hash['total_discount_amount'] = 'totalDiscountAmount'
|
|
121
|
+
@_hash['total_discounted_full_amount'] = 'totalDiscountedFullAmount'
|
|
122
|
+
@_hash['total_vat_amount'] = 'totalVatAmount'
|
|
123
|
+
@_hash['balances'] = 'balances'
|
|
124
|
+
@_hash['currency_code'] = 'currencyCode'
|
|
125
|
+
@_hash['sale_items'] = 'saleItems'
|
|
126
|
+
@_hash['redeemed_items'] = 'redeemedItems'
|
|
127
|
+
@_hash['transaction_vouchers'] = 'transactionVouchers'
|
|
128
|
+
@_hash['receipt_number'] = 'receiptNumber'
|
|
129
|
+
@_hash['points_to_cash'] = 'pointsToCash'
|
|
130
|
+
@_hash['company_id'] = 'companyId'
|
|
131
|
+
@_hash['is_partner_redemption'] = 'isPartnerRedemption'
|
|
132
|
+
@_hash['currency_data'] = 'currencyData'
|
|
133
|
+
@_hash
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
# An array for optional fields
|
|
137
|
+
def self.optionals
|
|
138
|
+
%w[
|
|
139
|
+
transaction_date_time_stamp
|
|
140
|
+
transaction_id
|
|
141
|
+
partner_code
|
|
142
|
+
partner_name
|
|
143
|
+
partner_logo
|
|
144
|
+
reference_id
|
|
145
|
+
total_vat_amount
|
|
146
|
+
balances
|
|
147
|
+
currency_code
|
|
148
|
+
receipt_number
|
|
149
|
+
points_to_cash
|
|
150
|
+
company_id
|
|
151
|
+
is_partner_redemption
|
|
152
|
+
currency_data
|
|
153
|
+
]
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
# An array for nullable fields
|
|
157
|
+
def self.nullables
|
|
158
|
+
[]
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
def initialize(transaction_date_time:, site_data:, loyalty:, total_amount:,
|
|
162
|
+
total_discount_amount:, total_discounted_full_amount:,
|
|
163
|
+
sale_items:, redeemed_items:, transaction_vouchers:,
|
|
164
|
+
transaction_date_time_stamp: SKIP, transaction_id: SKIP,
|
|
165
|
+
partner_code: SKIP, partner_name: SKIP, partner_logo: SKIP,
|
|
166
|
+
reference_id: SKIP, total_vat_amount: SKIP, balances: SKIP,
|
|
167
|
+
currency_code: SKIP, receipt_number: SKIP,
|
|
168
|
+
points_to_cash: SKIP, company_id: SKIP,
|
|
169
|
+
is_partner_redemption: SKIP, currency_data: SKIP,
|
|
170
|
+
additional_properties: nil)
|
|
171
|
+
# Add additional model properties to the instance
|
|
172
|
+
additional_properties = {} if additional_properties.nil?
|
|
173
|
+
|
|
174
|
+
@transaction_date_time = transaction_date_time
|
|
175
|
+
unless transaction_date_time_stamp == SKIP
|
|
176
|
+
@transaction_date_time_stamp =
|
|
177
|
+
transaction_date_time_stamp
|
|
178
|
+
end
|
|
179
|
+
@site_data = site_data
|
|
180
|
+
@loyalty = loyalty
|
|
181
|
+
@transaction_id = transaction_id unless transaction_id == SKIP
|
|
182
|
+
@partner_code = partner_code unless partner_code == SKIP
|
|
183
|
+
@partner_name = partner_name unless partner_name == SKIP
|
|
184
|
+
@partner_logo = partner_logo unless partner_logo == SKIP
|
|
185
|
+
@reference_id = reference_id unless reference_id == SKIP
|
|
186
|
+
@total_amount = total_amount
|
|
187
|
+
@total_discount_amount = total_discount_amount
|
|
188
|
+
@total_discounted_full_amount = total_discounted_full_amount
|
|
189
|
+
@total_vat_amount = total_vat_amount unless total_vat_amount == SKIP
|
|
190
|
+
@balances = balances unless balances == SKIP
|
|
191
|
+
@currency_code = currency_code unless currency_code == SKIP
|
|
192
|
+
@sale_items = sale_items
|
|
193
|
+
@redeemed_items = redeemed_items
|
|
194
|
+
@transaction_vouchers = transaction_vouchers
|
|
195
|
+
@receipt_number = receipt_number unless receipt_number == SKIP
|
|
196
|
+
@points_to_cash = points_to_cash unless points_to_cash == SKIP
|
|
197
|
+
@company_id = company_id unless company_id == SKIP
|
|
198
|
+
@is_partner_redemption = is_partner_redemption unless is_partner_redemption == SKIP
|
|
199
|
+
@currency_data = currency_data unless currency_data == SKIP
|
|
200
|
+
@additional_properties = additional_properties
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
# Creates an instance of the object from a hash.
|
|
204
|
+
def self.from_hash(hash)
|
|
205
|
+
return nil unless hash
|
|
206
|
+
|
|
207
|
+
# Extract variables from the hash.
|
|
208
|
+
transaction_date_time =
|
|
209
|
+
hash.key?('transactionDateTime') ? hash['transactionDateTime'] : nil
|
|
210
|
+
site_data = SiteData.from_hash(hash['siteData']) if hash['siteData']
|
|
211
|
+
loyalty = LoyaltyCardInfo.from_hash(hash['loyalty']) if hash['loyalty']
|
|
212
|
+
total_amount = hash.key?('totalAmount') ? hash['totalAmount'] : nil
|
|
213
|
+
total_discount_amount =
|
|
214
|
+
hash.key?('totalDiscountAmount') ? hash['totalDiscountAmount'] : nil
|
|
215
|
+
total_discounted_full_amount =
|
|
216
|
+
hash.key?('totalDiscountedFullAmount') ? hash['totalDiscountedFullAmount'] : nil
|
|
217
|
+
# Parameter is an array, so we need to iterate through it
|
|
218
|
+
sale_items = nil
|
|
219
|
+
unless hash['saleItems'].nil?
|
|
220
|
+
sale_items = []
|
|
221
|
+
hash['saleItems'].each do |structure|
|
|
222
|
+
sale_items << (SaleItem.from_hash(structure) if structure)
|
|
223
|
+
end
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
sale_items = nil unless hash.key?('saleItems')
|
|
227
|
+
# Parameter is an array, so we need to iterate through it
|
|
228
|
+
redeemed_items = nil
|
|
229
|
+
unless hash['redeemedItems'].nil?
|
|
230
|
+
redeemed_items = []
|
|
231
|
+
hash['redeemedItems'].each do |structure|
|
|
232
|
+
redeemed_items << (RedeemedItem.from_hash(structure) if structure)
|
|
233
|
+
end
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
redeemed_items = nil unless hash.key?('redeemedItems')
|
|
237
|
+
# Parameter is an array, so we need to iterate through it
|
|
238
|
+
transaction_vouchers = nil
|
|
239
|
+
unless hash['transactionVouchers'].nil?
|
|
240
|
+
transaction_vouchers = []
|
|
241
|
+
hash['transactionVouchers'].each do |structure|
|
|
242
|
+
transaction_vouchers << (TransactionVoucher.from_hash(structure) if structure)
|
|
243
|
+
end
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
transaction_vouchers = nil unless hash.key?('transactionVouchers')
|
|
247
|
+
transaction_date_time_stamp = if hash.key?('transactionDateTimeStamp')
|
|
248
|
+
(DateTimeHelper.from_rfc3339(hash['transactionDateTimeStamp']) if hash['transactionDateTimeStamp'])
|
|
249
|
+
else
|
|
250
|
+
SKIP
|
|
251
|
+
end
|
|
252
|
+
transaction_id = hash.key?('transactionId') ? hash['transactionId'] : SKIP
|
|
253
|
+
partner_code = hash.key?('partnerCode') ? hash['partnerCode'] : SKIP
|
|
254
|
+
partner_name = hash.key?('partnerName') ? hash['partnerName'] : SKIP
|
|
255
|
+
partner_logo = hash.key?('partnerLogo') ? hash['partnerLogo'] : SKIP
|
|
256
|
+
reference_id = hash.key?('referenceId') ? hash['referenceId'] : SKIP
|
|
257
|
+
total_vat_amount =
|
|
258
|
+
hash.key?('totalVatAmount') ? hash['totalVatAmount'] : SKIP
|
|
259
|
+
# Parameter is an array, so we need to iterate through it
|
|
260
|
+
balances = nil
|
|
261
|
+
unless hash['balances'].nil?
|
|
262
|
+
balances = []
|
|
263
|
+
hash['balances'].each do |structure|
|
|
264
|
+
balances << (TransactionBalance.from_hash(structure) if structure)
|
|
265
|
+
end
|
|
266
|
+
end
|
|
267
|
+
|
|
268
|
+
balances = SKIP unless hash.key?('balances')
|
|
269
|
+
currency_code = hash.key?('currencyCode') ? hash['currencyCode'] : SKIP
|
|
270
|
+
receipt_number = hash.key?('receiptNumber') ? hash['receiptNumber'] : SKIP
|
|
271
|
+
points_to_cash = PointsToCash.from_hash(hash['pointsToCash']) if hash['pointsToCash']
|
|
272
|
+
company_id = hash.key?('companyId') ? hash['companyId'] : SKIP
|
|
273
|
+
is_partner_redemption =
|
|
274
|
+
hash.key?('isPartnerRedemption') ? hash['isPartnerRedemption'] : SKIP
|
|
275
|
+
currency_data = CurrencyData.from_hash(hash['currencyData']) if hash['currencyData']
|
|
276
|
+
|
|
277
|
+
# Create a new hash for additional properties, removing known properties.
|
|
278
|
+
new_hash = hash.reject { |k, _| names.value?(k) }
|
|
279
|
+
|
|
280
|
+
additional_properties = APIHelper.get_additional_properties(
|
|
281
|
+
new_hash, proc { |value| value }
|
|
282
|
+
)
|
|
283
|
+
|
|
284
|
+
# Create object from extracted values.
|
|
285
|
+
Transaction.new(transaction_date_time: transaction_date_time,
|
|
286
|
+
site_data: site_data,
|
|
287
|
+
loyalty: loyalty,
|
|
288
|
+
total_amount: total_amount,
|
|
289
|
+
total_discount_amount: total_discount_amount,
|
|
290
|
+
total_discounted_full_amount: total_discounted_full_amount,
|
|
291
|
+
sale_items: sale_items,
|
|
292
|
+
redeemed_items: redeemed_items,
|
|
293
|
+
transaction_vouchers: transaction_vouchers,
|
|
294
|
+
transaction_date_time_stamp: transaction_date_time_stamp,
|
|
295
|
+
transaction_id: transaction_id,
|
|
296
|
+
partner_code: partner_code,
|
|
297
|
+
partner_name: partner_name,
|
|
298
|
+
partner_logo: partner_logo,
|
|
299
|
+
reference_id: reference_id,
|
|
300
|
+
total_vat_amount: total_vat_amount,
|
|
301
|
+
balances: balances,
|
|
302
|
+
currency_code: currency_code,
|
|
303
|
+
receipt_number: receipt_number,
|
|
304
|
+
points_to_cash: points_to_cash,
|
|
305
|
+
company_id: company_id,
|
|
306
|
+
is_partner_redemption: is_partner_redemption,
|
|
307
|
+
currency_data: currency_data,
|
|
308
|
+
additional_properties: additional_properties)
|
|
309
|
+
end
|
|
310
|
+
|
|
311
|
+
def to_custom_transaction_date_time_stamp
|
|
312
|
+
DateTimeHelper.to_rfc3339(transaction_date_time_stamp)
|
|
313
|
+
end
|
|
314
|
+
|
|
315
|
+
# Provides a human-readable string representation of the object.
|
|
316
|
+
def to_s
|
|
317
|
+
class_name = self.class.name.split('::').last
|
|
318
|
+
"<#{class_name} transaction_date_time: #{@transaction_date_time},"\
|
|
319
|
+
" transaction_date_time_stamp: #{@transaction_date_time_stamp}, site_data: #{@site_data},"\
|
|
320
|
+
" loyalty: #{@loyalty}, transaction_id: #{@transaction_id}, partner_code: #{@partner_code},"\
|
|
321
|
+
" partner_name: #{@partner_name}, partner_logo: #{@partner_logo}, reference_id:"\
|
|
322
|
+
" #{@reference_id}, total_amount: #{@total_amount}, total_discount_amount:"\
|
|
323
|
+
" #{@total_discount_amount}, total_discounted_full_amount: #{@total_discounted_full_amount},"\
|
|
324
|
+
" total_vat_amount: #{@total_vat_amount}, balances: #{@balances}, currency_code:"\
|
|
325
|
+
" #{@currency_code}, sale_items: #{@sale_items}, redeemed_items: #{@redeemed_items},"\
|
|
326
|
+
" transaction_vouchers: #{@transaction_vouchers}, receipt_number: #{@receipt_number},"\
|
|
327
|
+
" points_to_cash: #{@points_to_cash}, company_id: #{@company_id}, is_partner_redemption:"\
|
|
328
|
+
" #{@is_partner_redemption}, currency_data: #{@currency_data}, additional_properties:"\
|
|
329
|
+
" #{@additional_properties}>"
|
|
330
|
+
end
|
|
331
|
+
|
|
332
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
333
|
+
def inspect
|
|
334
|
+
class_name = self.class.name.split('::').last
|
|
335
|
+
"<#{class_name} transaction_date_time: #{@transaction_date_time.inspect},"\
|
|
336
|
+
" transaction_date_time_stamp: #{@transaction_date_time_stamp.inspect}, site_data:"\
|
|
337
|
+
" #{@site_data.inspect}, loyalty: #{@loyalty.inspect}, transaction_id:"\
|
|
338
|
+
" #{@transaction_id.inspect}, partner_code: #{@partner_code.inspect}, partner_name:"\
|
|
339
|
+
" #{@partner_name.inspect}, partner_logo: #{@partner_logo.inspect}, reference_id:"\
|
|
340
|
+
" #{@reference_id.inspect}, total_amount: #{@total_amount.inspect}, total_discount_amount:"\
|
|
341
|
+
" #{@total_discount_amount.inspect}, total_discounted_full_amount:"\
|
|
342
|
+
" #{@total_discounted_full_amount.inspect}, total_vat_amount: #{@total_vat_amount.inspect},"\
|
|
343
|
+
" balances: #{@balances.inspect}, currency_code: #{@currency_code.inspect}, sale_items:"\
|
|
344
|
+
" #{@sale_items.inspect}, redeemed_items: #{@redeemed_items.inspect}, transaction_vouchers:"\
|
|
345
|
+
" #{@transaction_vouchers.inspect}, receipt_number: #{@receipt_number.inspect},"\
|
|
346
|
+
" points_to_cash: #{@points_to_cash.inspect}, company_id: #{@company_id.inspect},"\
|
|
347
|
+
" is_partner_redemption: #{@is_partner_redemption.inspect}, currency_data:"\
|
|
348
|
+
" #{@currency_data.inspect}, additional_properties: #{@additional_properties}>"
|
|
349
|
+
end
|
|
350
|
+
end
|
|
351
|
+
end
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# loyalty_ap_is
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0 (
|
|
4
|
+
# https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module LoyaltyApIs
|
|
7
|
+
# TransactionBalance Model.
|
|
8
|
+
class TransactionBalance < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# Type of balance
|
|
13
|
+
# @return [TransactionCurrencyType]
|
|
14
|
+
attr_accessor :currency_type
|
|
15
|
+
|
|
16
|
+
# Type of balance
|
|
17
|
+
# @return [Array[TransactionBalanceAmount]]
|
|
18
|
+
attr_accessor :amounts
|
|
19
|
+
|
|
20
|
+
# A mapping from model property names to API property names.
|
|
21
|
+
def self.names
|
|
22
|
+
@_hash = {} if @_hash.nil?
|
|
23
|
+
@_hash['currency_type'] = 'currencyType'
|
|
24
|
+
@_hash['amounts'] = 'amounts'
|
|
25
|
+
@_hash
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# An array for optional fields
|
|
29
|
+
def self.optionals
|
|
30
|
+
[]
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# An array for nullable fields
|
|
34
|
+
def self.nullables
|
|
35
|
+
[]
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def initialize(currency_type:, amounts:, additional_properties: nil)
|
|
39
|
+
# Add additional model properties to the instance
|
|
40
|
+
additional_properties = {} if additional_properties.nil?
|
|
41
|
+
|
|
42
|
+
@currency_type = currency_type
|
|
43
|
+
@amounts = amounts
|
|
44
|
+
@additional_properties = additional_properties
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Creates an instance of the object from a hash.
|
|
48
|
+
def self.from_hash(hash)
|
|
49
|
+
return nil unless hash
|
|
50
|
+
|
|
51
|
+
# Extract variables from the hash.
|
|
52
|
+
currency_type = hash.key?('currencyType') ? hash['currencyType'] : nil
|
|
53
|
+
# Parameter is an array, so we need to iterate through it
|
|
54
|
+
amounts = nil
|
|
55
|
+
unless hash['amounts'].nil?
|
|
56
|
+
amounts = []
|
|
57
|
+
hash['amounts'].each do |structure|
|
|
58
|
+
amounts << (TransactionBalanceAmount.from_hash(structure) if structure)
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
amounts = nil unless hash.key?('amounts')
|
|
63
|
+
|
|
64
|
+
# Create a new hash for additional properties, removing known properties.
|
|
65
|
+
new_hash = hash.reject { |k, _| names.value?(k) }
|
|
66
|
+
|
|
67
|
+
additional_properties = APIHelper.get_additional_properties(
|
|
68
|
+
new_hash, proc { |value| value }
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
# Create object from extracted values.
|
|
72
|
+
TransactionBalance.new(currency_type: currency_type,
|
|
73
|
+
amounts: amounts,
|
|
74
|
+
additional_properties: additional_properties)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Provides a human-readable string representation of the object.
|
|
78
|
+
def to_s
|
|
79
|
+
class_name = self.class.name.split('::').last
|
|
80
|
+
"<#{class_name} currency_type: #{@currency_type}, amounts: #{@amounts},"\
|
|
81
|
+
" additional_properties: #{@additional_properties}>"
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
85
|
+
def inspect
|
|
86
|
+
class_name = self.class.name.split('::').last
|
|
87
|
+
"<#{class_name} currency_type: #{@currency_type.inspect}, amounts: #{@amounts.inspect},"\
|
|
88
|
+
" additional_properties: #{@additional_properties}>"
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# loyalty_ap_is
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v3.0 (
|
|
4
|
+
# https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module LoyaltyApIs
|
|
7
|
+
# TransactionBalanceAmount Model.
|
|
8
|
+
class TransactionBalanceAmount < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# Current value of specified balance
|
|
13
|
+
# @return [Float]
|
|
14
|
+
attr_accessor :amount
|
|
15
|
+
|
|
16
|
+
# State of the amount
|
|
17
|
+
# @return [TransactionBalanceState]
|
|
18
|
+
attr_accessor :state
|
|
19
|
+
|
|
20
|
+
# A mapping from model property names to API property names.
|
|
21
|
+
def self.names
|
|
22
|
+
@_hash = {} if @_hash.nil?
|
|
23
|
+
@_hash['amount'] = 'amount'
|
|
24
|
+
@_hash['state'] = 'state'
|
|
25
|
+
@_hash
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# An array for optional fields
|
|
29
|
+
def self.optionals
|
|
30
|
+
[]
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# An array for nullable fields
|
|
34
|
+
def self.nullables
|
|
35
|
+
[]
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def initialize(amount:, state:, additional_properties: nil)
|
|
39
|
+
# Add additional model properties to the instance
|
|
40
|
+
additional_properties = {} if additional_properties.nil?
|
|
41
|
+
|
|
42
|
+
@amount = amount
|
|
43
|
+
@state = state
|
|
44
|
+
@additional_properties = additional_properties
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Creates an instance of the object from a hash.
|
|
48
|
+
def self.from_hash(hash)
|
|
49
|
+
return nil unless hash
|
|
50
|
+
|
|
51
|
+
# Extract variables from the hash.
|
|
52
|
+
amount = hash.key?('amount') ? hash['amount'] : nil
|
|
53
|
+
state = hash.key?('state') ? hash['state'] : nil
|
|
54
|
+
|
|
55
|
+
# Create a new hash for additional properties, removing known properties.
|
|
56
|
+
new_hash = hash.reject { |k, _| names.value?(k) }
|
|
57
|
+
|
|
58
|
+
additional_properties = APIHelper.get_additional_properties(
|
|
59
|
+
new_hash, proc { |value| value }
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
# Create object from extracted values.
|
|
63
|
+
TransactionBalanceAmount.new(amount: amount,
|
|
64
|
+
state: state,
|
|
65
|
+
additional_properties: additional_properties)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# Provides a human-readable string representation of the object.
|
|
69
|
+
def to_s
|
|
70
|
+
class_name = self.class.name.split('::').last
|
|
71
|
+
"<#{class_name} amount: #{@amount}, state: #{@state}, additional_properties:"\
|
|
72
|
+
" #{@additional_properties}>"
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
76
|
+
def inspect
|
|
77
|
+
class_name = self.class.name.split('::').last
|
|
78
|
+
"<#{class_name} amount: #{@amount.inspect}, state: #{@state.inspect},"\
|
|
79
|
+
" additional_properties: #{@additional_properties}>"
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|