square_connect 2.0.2.69 → 2.1.0.beta
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +133 -21
- data/docs/ChargeRequest.md +1 -1
- data/docs/CheckoutApi.md +8 -6
- data/docs/CustomersApi.md +389 -0
- data/docs/Device.md +11 -0
- data/docs/LocationsApi.md +55 -0
- data/docs/TransactionsApi.md +417 -0
- data/docs/V1AdjustInventoryRequest.md +12 -0
- data/docs/V1BankAccount.md +17 -0
- data/docs/V1CashDrawerEvent.md +15 -0
- data/docs/V1CashDrawerShift.md +28 -0
- data/docs/V1Category.md +11 -0
- data/docs/V1CreateRefundRequest.md +14 -0
- data/docs/V1Discount.md +16 -0
- data/docs/V1Employee.md +21 -0
- data/docs/V1EmployeeRole.md +15 -0
- data/docs/V1EmployeesApi.md +915 -0
- data/docs/V1Fee.md +18 -0
- data/docs/V1InventoryEntry.md +11 -0
- data/docs/V1Item.md +23 -0
- data/docs/V1ItemImage.md +11 -0
- data/docs/V1ItemsApi.md +2297 -0
- data/docs/V1LocationApi.md +102 -0
- data/docs/V1LocationsApi.md +102 -0
- data/docs/V1Merchant.md +26 -0
- data/docs/V1MerchantLocationDetails.md +12 -0
- data/docs/V1ModifierList.md +13 -0
- data/docs/V1ModifierOption.md +15 -0
- data/docs/V1Money.md +13 -0
- data/docs/V1Order.md +34 -0
- data/docs/V1OrderHistoryEntry.md +11 -0
- data/docs/V1Page.md +13 -0
- data/docs/V1PageCell.md +15 -0
- data/docs/V1Payment.md +33 -0
- data/docs/V1PaymentDiscount.md +12 -0
- data/docs/V1PaymentItemDetail.md +13 -0
- data/docs/V1PaymentItemization.md +23 -0
- data/docs/V1PaymentModifier.md +12 -0
- data/docs/V1PaymentTax.md +15 -0
- data/docs/V1PhoneNumber.md +13 -0
- data/docs/V1Refund.md +16 -0
- data/docs/V1Settlement.md +15 -0
- data/docs/V1SettlementEntry.md +13 -0
- data/docs/V1Tender.md +22 -0
- data/docs/V1Timecard.md +20 -0
- data/docs/V1TimecardEvent.md +14 -0
- data/docs/V1TransactionsApi.md +650 -0
- data/docs/V1UpdateModifierListRequest.md +11 -0
- data/docs/V1UpdateOrderRequest.md +14 -0
- data/docs/V1Variation.md +20 -0
- data/lib/.DS_Store +0 -0
- data/lib/square_connect.rb +46 -5
- data/lib/square_connect/.DS_Store +0 -0
- data/lib/square_connect/api/checkout_api.rb +4 -9
- data/lib/square_connect/api/{customer_api.rb → customers_api.rb} +150 -61
- data/lib/square_connect/api/{location_api.rb → locations_api.rb} +7 -12
- data/lib/square_connect/api/{transaction_api.rb → transactions_api.rb} +169 -65
- data/lib/square_connect/api/v1_employees_api.rb +974 -0
- data/lib/square_connect/api/v1_items_api.rb +2365 -0
- data/lib/square_connect/api/v1_locations_api.rb +118 -0
- data/lib/square_connect/api/v1_transactions_api.rb +707 -0
- data/lib/square_connect/api_client.rb +1 -1
- data/lib/square_connect/models/charge_request.rb +1 -1
- data/lib/square_connect/models/device.rb +196 -0
- data/lib/square_connect/models/v1_adjust_inventory_request.rb +206 -0
- data/lib/square_connect/models/v1_bank_account.rb +289 -0
- data/lib/square_connect/models/v1_cash_drawer_event.rb +269 -0
- data/lib/square_connect/models/v1_cash_drawer_shift.rb +403 -0
- data/lib/square_connect/models/v1_category.rb +196 -0
- data/lib/square_connect/models/v1_create_refund_request.rb +274 -0
- data/lib/square_connect/models/v1_discount.rb +291 -0
- data/lib/square_connect/models/v1_employee.rb +323 -0
- data/lib/square_connect/models/v1_employee_role.rb +269 -0
- data/lib/square_connect/models/v1_fee.rb +335 -0
- data/lib/square_connect/models/v1_inventory_entry.rb +196 -0
- data/lib/square_connect/models/v1_item.rb +379 -0
- data/lib/square_connect/models/v1_item_image.rb +196 -0
- data/lib/square_connect/models/v1_merchant.rb +372 -0
- data/lib/square_connect/models/v1_merchant_location_details.rb +186 -0
- data/lib/square_connect/models/v1_modifier_list.rb +251 -0
- data/lib/square_connect/models/v1_modifier_option.rb +236 -0
- data/lib/square_connect/models/v1_money.rb +229 -0
- data/lib/square_connect/models/v1_order.rb +463 -0
- data/lib/square_connect/models/v1_order_history_entry.rb +229 -0
- data/lib/square_connect/models/v1_page.rb +218 -0
- data/lib/square_connect/models/v1_page_cell.rb +261 -0
- data/lib/square_connect/models/v1_payment.rb +423 -0
- data/lib/square_connect/models/v1_payment_discount.rb +206 -0
- data/lib/square_connect/models/v1_payment_item_detail.rb +216 -0
- data/lib/square_connect/models/v1_payment_itemization.rb +355 -0
- data/lib/square_connect/models/v1_payment_modifier.rb +206 -0
- data/lib/square_connect/models/v1_payment_tax.rb +271 -0
- data/lib/square_connect/models/v1_phone_number.rb +206 -0
- data/lib/square_connect/models/v1_refund.rb +279 -0
- data/lib/square_connect/models/v1_settlement.rb +271 -0
- data/lib/square_connect/models/v1_settlement_entry.rb +249 -0
- data/lib/square_connect/models/v1_tender.rb +363 -0
- data/lib/square_connect/models/v1_timecard.rb +271 -0
- data/lib/square_connect/models/v1_timecard_event.rb +259 -0
- data/lib/square_connect/models/v1_update_modifier_list_request.rb +229 -0
- data/lib/square_connect/models/v1_update_order_request.rb +264 -0
- data/lib/square_connect/models/v1_variation.rb +331 -0
- data/lib/square_connect/version.rb +1 -1
- data/spec/.DS_Store +0 -0
- data/spec/api/checkout_api_spec.rb +4 -12
- data/spec/api/{customer_api_spec.rb → customers_api_spec.rb} +39 -41
- data/spec/api/{location_api_spec.rb → locations_api_spec.rb} +9 -15
- data/spec/api/{transaction_api_spec.rb → transactions_api_spec.rb} +43 -41
- data/spec/api/v1_employees_api_spec.rb +250 -0
- data/spec/api/v1_items_api_spec.rb +568 -0
- data/spec/api/v1_locations_api_spec.rb +54 -0
- data/spec/api/v1_transactions_api_spec.rb +186 -0
- data/spec/models/address_spec.rb +22 -81
- data/spec/models/capture_transaction_request_spec.rb +3 -6
- data/spec/models/capture_transaction_response_spec.rb +4 -11
- data/spec/models/card_brand_spec.rb +3 -6
- data/spec/models/card_spec.rb +14 -41
- data/spec/models/charge_request_spec.rb +14 -61
- data/spec/models/charge_response_spec.rb +5 -16
- data/spec/models/checkout_spec.rb +12 -51
- data/spec/models/country_spec.rb +3 -6
- data/spec/models/create_checkout_request_spec.rb +10 -41
- data/spec/models/create_checkout_response_spec.rb +5 -16
- data/spec/models/create_customer_card_request_spec.rb +6 -21
- data/spec/models/create_customer_card_response_spec.rb +5 -16
- data/spec/models/create_customer_request_spec.rb +12 -51
- data/spec/models/create_customer_response_spec.rb +5 -16
- data/spec/models/create_order_request_line_item_spec.rb +6 -21
- data/spec/models/create_order_request_order_spec.rb +5 -16
- data/spec/models/create_order_request_spec.rb +5 -16
- data/spec/models/create_refund_request_spec.rb +7 -26
- data/spec/models/create_refund_response_spec.rb +5 -16
- data/spec/models/currency_spec.rb +3 -6
- data/spec/models/customer_group_info_spec.rb +5 -16
- data/spec/models/customer_preferences_spec.rb +4 -11
- data/spec/models/customer_spec.rb +18 -81
- data/spec/models/delete_customer_card_request_spec.rb +3 -6
- data/spec/models/delete_customer_card_response_spec.rb +4 -11
- data/spec/models/delete_customer_request_spec.rb +3 -6
- data/spec/models/delete_customer_response_spec.rb +4 -11
- data/spec/models/device_spec.rb +45 -0
- data/spec/models/error_category_spec.rb +3 -6
- data/spec/models/error_code_spec.rb +3 -6
- data/spec/models/error_spec.rb +15 -26
- data/spec/models/list_customers_request_spec.rb +4 -11
- data/spec/models/list_customers_response_spec.rb +6 -21
- data/spec/models/list_locations_request_spec.rb +3 -6
- data/spec/models/list_locations_response_spec.rb +5 -16
- data/spec/models/list_refunds_request_spec.rb +11 -26
- data/spec/models/list_refunds_response_spec.rb +6 -21
- data/spec/models/list_transactions_request_spec.rb +11 -26
- data/spec/models/list_transactions_response_spec.rb +6 -21
- data/spec/models/location_capability_spec.rb +3 -6
- data/spec/models/location_spec.rb +12 -31
- data/spec/models/money_spec.rb +9 -16
- data/spec/models/order_line_item_spec.rb +8 -31
- data/spec/models/order_spec.rb +8 -31
- data/spec/models/refund_spec.rb +16 -51
- data/spec/models/refund_status_spec.rb +3 -6
- data/spec/models/retrieve_customer_request_spec.rb +3 -6
- data/spec/models/retrieve_customer_response_spec.rb +5 -16
- data/spec/models/retrieve_transaction_request_spec.rb +3 -6
- data/spec/models/retrieve_transaction_response_spec.rb +5 -16
- data/spec/models/sort_order_spec.rb +3 -6
- data/spec/models/tender_card_details_entry_method_spec.rb +3 -6
- data/spec/models/tender_card_details_spec.rb +14 -21
- data/spec/models/tender_card_details_status_spec.rb +3 -6
- data/spec/models/tender_cash_details_spec.rb +5 -16
- data/spec/models/tender_spec.rb +18 -61
- data/spec/models/tender_type_spec.rb +3 -6
- data/spec/models/transaction_product_spec.rb +3 -6
- data/spec/models/transaction_spec.rb +17 -56
- data/spec/models/update_customer_request_spec.rb +12 -51
- data/spec/models/update_customer_response_spec.rb +5 -16
- data/spec/models/v1_adjust_inventory_request_spec.rb +51 -0
- data/spec/models/v1_bank_account_spec.rb +85 -0
- data/spec/models/v1_cash_drawer_event_spec.rb +73 -0
- data/spec/models/v1_cash_drawer_shift_spec.rb +151 -0
- data/spec/models/v1_category_spec.rb +45 -0
- data/spec/models/v1_create_refund_request_spec.rb +67 -0
- data/spec/models/v1_discount_spec.rb +83 -0
- data/spec/models/v1_employee_role_spec.rb +73 -0
- data/spec/models/v1_employee_spec.rb +97 -0
- data/spec/models/v1_fee_spec.rb +103 -0
- data/spec/models/v1_inventory_entry_spec.rb +45 -0
- data/spec/models/v1_item_image_spec.rb +45 -0
- data/spec/models/v1_item_spec.rb +129 -0
- data/spec/models/v1_merchant_location_details_spec.rb +39 -0
- data/spec/models/v1_merchant_spec.rb +131 -0
- data/spec/models/v1_modifier_list_spec.rb +61 -0
- data/spec/models/v1_modifier_option_spec.rb +69 -0
- data/spec/models/v1_money_spec.rb +49 -0
- data/spec/models/v1_order_history_entry_spec.rb +49 -0
- data/spec/models/v1_order_spec.rb +187 -0
- data/spec/models/v1_page_cell_spec.rb +77 -0
- data/spec/models/v1_page_spec.rb +57 -0
- data/spec/models/v1_payment_discount_spec.rb +51 -0
- data/spec/models/v1_payment_item_detail_spec.rb +57 -0
- data/spec/models/v1_payment_itemization_spec.rb +121 -0
- data/spec/models/v1_payment_modifier_spec.rb +51 -0
- data/spec/models/v1_payment_spec.rb +177 -0
- data/spec/models/v1_payment_tax_spec.rb +73 -0
- data/spec/models/v1_phone_number_spec.rb +45 -0
- data/spec/models/v1_refund_spec.rb +79 -0
- data/spec/models/v1_settlement_entry_spec.rb +61 -0
- data/spec/models/v1_settlement_spec.rb +73 -0
- data/spec/models/v1_tender_spec.rb +123 -0
- data/spec/models/v1_timecard_event_spec.rb +67 -0
- data/spec/models/v1_timecard_spec.rb +87 -0
- data/spec/models/v1_update_modifier_list_request_spec.rb +49 -0
- data/spec/models/v1_update_order_request_spec.rb +67 -0
- data/spec/models/v1_variation_spec.rb +107 -0
- data/spec/models/void_transaction_request_spec.rb +3 -6
- data/spec/models/void_transaction_response_spec.rb +4 -11
- data/spec/spec_helper.rb +10 -0
- data/square_connect-2.0.2.gem +0 -0
- data/square_connect-2.1.0.gem +0 -0
- data/square_connect-2.1.0beta.gem +0 -0
- data/square_connect.gemspec +1 -1
- data/travis-ci/accounts.enc +0 -0
- metadata +197 -26
- data/docs/CustomerApi.md +0 -267
- data/docs/CustomerCardApi.md +0 -116
- data/docs/LocationApi.md +0 -56
- data/docs/RefundApi.md +0 -126
- data/docs/TransactionApi.md +0 -285
- data/lib/square_connect/api/customer_card_api.rb +0 -144
- data/lib/square_connect/api/refund_api.rb +0 -159
- data/spec/api/customer_card_api_spec.rb +0 -71
- data/spec/api/refund_api_spec.rb +0 -75
@@ -0,0 +1,423 @@
|
|
1
|
+
=begin
|
2
|
+
#Square Connect API
|
3
|
+
|
4
|
+
OpenAPI spec version: 2.0
|
5
|
+
Contact: developers@squareup.com
|
6
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
7
|
+
|
8
|
+
=end
|
9
|
+
|
10
|
+
require 'date'
|
11
|
+
|
12
|
+
module SquareConnect
|
13
|
+
|
14
|
+
class V1Payment
|
15
|
+
# The payment's unique identifier.
|
16
|
+
attr_accessor :id
|
17
|
+
|
18
|
+
# The unique identifier of the merchant that took the payment.
|
19
|
+
attr_accessor :merchant_id
|
20
|
+
|
21
|
+
# The time when the payment was created, in ISO 8601 format.
|
22
|
+
attr_accessor :created_at
|
23
|
+
|
24
|
+
# The unique identifier of the Square account that took the payment.
|
25
|
+
attr_accessor :creator_id
|
26
|
+
|
27
|
+
# The device that took the payment.
|
28
|
+
attr_accessor :device
|
29
|
+
|
30
|
+
# The URL of the payment's detail page in the merchant dashboard. The merchant must be signed in to the merchant dashboard to view this page.
|
31
|
+
attr_accessor :payment_url
|
32
|
+
|
33
|
+
# The URL of the receipt for the payment. Note that for split tender payments, this URL corresponds to the receipt for the first tender listed in the payment's tender field. Each Tender object has its own receipt_url field you can use to get the other receipts associated with a split tender payment.
|
34
|
+
attr_accessor :receipt_url
|
35
|
+
|
36
|
+
# The sum of all inclusive taxes associated with the payment.
|
37
|
+
attr_accessor :inclusive_tax_money
|
38
|
+
|
39
|
+
# The sum of all additive taxes associated with the payment.
|
40
|
+
attr_accessor :additive_tax_money
|
41
|
+
|
42
|
+
# The total of all taxes applied to the payment. This is always the sum of inclusive_tax_money and additive_tax_money.
|
43
|
+
attr_accessor :tax_money
|
44
|
+
|
45
|
+
# The total of all tips applied to the payment.
|
46
|
+
attr_accessor :tip_money
|
47
|
+
|
48
|
+
# The total of all discounts applied to the payment.
|
49
|
+
attr_accessor :discount_money
|
50
|
+
|
51
|
+
# The total of all discounts applied to the payment.
|
52
|
+
attr_accessor :total_collected_money
|
53
|
+
|
54
|
+
# The total of all processing fees collected by Square for the payment.
|
55
|
+
attr_accessor :processing_fee_money
|
56
|
+
|
57
|
+
# The amount to be deposited into the merchant's bank account for the payment.
|
58
|
+
attr_accessor :net_total_money
|
59
|
+
|
60
|
+
# The total of all refunds applied to the payment.
|
61
|
+
attr_accessor :refunded_money
|
62
|
+
|
63
|
+
attr_accessor :swedish_rounding_money
|
64
|
+
|
65
|
+
attr_accessor :gross_sales_money
|
66
|
+
|
67
|
+
attr_accessor :net_sales_money
|
68
|
+
|
69
|
+
# All of the inclusive taxes associated with the payment.
|
70
|
+
attr_accessor :inclusive_tax
|
71
|
+
|
72
|
+
# All of the additive taxes associated with the payment.
|
73
|
+
attr_accessor :additive_tax
|
74
|
+
|
75
|
+
# All of the additive taxes associated with the payment.
|
76
|
+
attr_accessor :tender
|
77
|
+
|
78
|
+
# All of the refunds applied to the payment.
|
79
|
+
attr_accessor :refunds
|
80
|
+
|
81
|
+
# The items purchased in the payment.
|
82
|
+
attr_accessor :itemizations
|
83
|
+
|
84
|
+
|
85
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
86
|
+
def self.attribute_map
|
87
|
+
{
|
88
|
+
:'id' => :'id',
|
89
|
+
:'merchant_id' => :'merchant_id',
|
90
|
+
:'created_at' => :'created_at',
|
91
|
+
:'creator_id' => :'creator_id',
|
92
|
+
:'device' => :'device',
|
93
|
+
:'payment_url' => :'payment_url',
|
94
|
+
:'receipt_url' => :'receipt_url',
|
95
|
+
:'inclusive_tax_money' => :'inclusive_tax_money',
|
96
|
+
:'additive_tax_money' => :'additive_tax_money',
|
97
|
+
:'tax_money' => :'tax_money',
|
98
|
+
:'tip_money' => :'tip_money',
|
99
|
+
:'discount_money' => :'discount_money',
|
100
|
+
:'total_collected_money' => :'total_collected_money',
|
101
|
+
:'processing_fee_money' => :'processing_fee_money',
|
102
|
+
:'net_total_money' => :'net_total_money',
|
103
|
+
:'refunded_money' => :'refunded_money',
|
104
|
+
:'swedish_rounding_money' => :'swedish_rounding_money',
|
105
|
+
:'gross_sales_money' => :'gross_sales_money',
|
106
|
+
:'net_sales_money' => :'net_sales_money',
|
107
|
+
:'inclusive_tax' => :'inclusive_tax',
|
108
|
+
:'additive_tax' => :'additive_tax',
|
109
|
+
:'tender' => :'tender',
|
110
|
+
:'refunds' => :'refunds',
|
111
|
+
:'itemizations' => :'itemizations'
|
112
|
+
}
|
113
|
+
end
|
114
|
+
|
115
|
+
# Attribute type mapping.
|
116
|
+
def self.swagger_types
|
117
|
+
{
|
118
|
+
:'id' => :'String',
|
119
|
+
:'merchant_id' => :'String',
|
120
|
+
:'created_at' => :'String',
|
121
|
+
:'creator_id' => :'BOOLEAN',
|
122
|
+
:'device' => :'Device',
|
123
|
+
:'payment_url' => :'String',
|
124
|
+
:'receipt_url' => :'String',
|
125
|
+
:'inclusive_tax_money' => :'V1Money',
|
126
|
+
:'additive_tax_money' => :'V1Money',
|
127
|
+
:'tax_money' => :'V1Money',
|
128
|
+
:'tip_money' => :'V1Money',
|
129
|
+
:'discount_money' => :'V1Money',
|
130
|
+
:'total_collected_money' => :'V1Money',
|
131
|
+
:'processing_fee_money' => :'V1Money',
|
132
|
+
:'net_total_money' => :'V1Money',
|
133
|
+
:'refunded_money' => :'V1Money',
|
134
|
+
:'swedish_rounding_money' => :'V1Money',
|
135
|
+
:'gross_sales_money' => :'V1Money',
|
136
|
+
:'net_sales_money' => :'V1Money',
|
137
|
+
:'inclusive_tax' => :'Array<V1PaymentTax>',
|
138
|
+
:'additive_tax' => :'Array<V1PaymentTax>',
|
139
|
+
:'tender' => :'Array<V1Tender>',
|
140
|
+
:'refunds' => :'Array<V1Refund>',
|
141
|
+
:'itemizations' => :'Array<V1PaymentItemization>'
|
142
|
+
}
|
143
|
+
end
|
144
|
+
|
145
|
+
# Initializes the object
|
146
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
147
|
+
def initialize(attributes = {})
|
148
|
+
return unless attributes.is_a?(Hash)
|
149
|
+
|
150
|
+
# convert string to symbol for hash key
|
151
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
152
|
+
|
153
|
+
if attributes.has_key?(:'id')
|
154
|
+
self.id = attributes[:'id']
|
155
|
+
end
|
156
|
+
|
157
|
+
if attributes.has_key?(:'merchant_id')
|
158
|
+
self.merchant_id = attributes[:'merchant_id']
|
159
|
+
end
|
160
|
+
|
161
|
+
if attributes.has_key?(:'created_at')
|
162
|
+
self.created_at = attributes[:'created_at']
|
163
|
+
end
|
164
|
+
|
165
|
+
if attributes.has_key?(:'creator_id')
|
166
|
+
self.creator_id = attributes[:'creator_id']
|
167
|
+
end
|
168
|
+
|
169
|
+
if attributes.has_key?(:'device')
|
170
|
+
self.device = attributes[:'device']
|
171
|
+
end
|
172
|
+
|
173
|
+
if attributes.has_key?(:'payment_url')
|
174
|
+
self.payment_url = attributes[:'payment_url']
|
175
|
+
end
|
176
|
+
|
177
|
+
if attributes.has_key?(:'receipt_url')
|
178
|
+
self.receipt_url = attributes[:'receipt_url']
|
179
|
+
end
|
180
|
+
|
181
|
+
if attributes.has_key?(:'inclusive_tax_money')
|
182
|
+
self.inclusive_tax_money = attributes[:'inclusive_tax_money']
|
183
|
+
end
|
184
|
+
|
185
|
+
if attributes.has_key?(:'additive_tax_money')
|
186
|
+
self.additive_tax_money = attributes[:'additive_tax_money']
|
187
|
+
end
|
188
|
+
|
189
|
+
if attributes.has_key?(:'tax_money')
|
190
|
+
self.tax_money = attributes[:'tax_money']
|
191
|
+
end
|
192
|
+
|
193
|
+
if attributes.has_key?(:'tip_money')
|
194
|
+
self.tip_money = attributes[:'tip_money']
|
195
|
+
end
|
196
|
+
|
197
|
+
if attributes.has_key?(:'discount_money')
|
198
|
+
self.discount_money = attributes[:'discount_money']
|
199
|
+
end
|
200
|
+
|
201
|
+
if attributes.has_key?(:'total_collected_money')
|
202
|
+
self.total_collected_money = attributes[:'total_collected_money']
|
203
|
+
end
|
204
|
+
|
205
|
+
if attributes.has_key?(:'processing_fee_money')
|
206
|
+
self.processing_fee_money = attributes[:'processing_fee_money']
|
207
|
+
end
|
208
|
+
|
209
|
+
if attributes.has_key?(:'net_total_money')
|
210
|
+
self.net_total_money = attributes[:'net_total_money']
|
211
|
+
end
|
212
|
+
|
213
|
+
if attributes.has_key?(:'refunded_money')
|
214
|
+
self.refunded_money = attributes[:'refunded_money']
|
215
|
+
end
|
216
|
+
|
217
|
+
if attributes.has_key?(:'swedish_rounding_money')
|
218
|
+
self.swedish_rounding_money = attributes[:'swedish_rounding_money']
|
219
|
+
end
|
220
|
+
|
221
|
+
if attributes.has_key?(:'gross_sales_money')
|
222
|
+
self.gross_sales_money = attributes[:'gross_sales_money']
|
223
|
+
end
|
224
|
+
|
225
|
+
if attributes.has_key?(:'net_sales_money')
|
226
|
+
self.net_sales_money = attributes[:'net_sales_money']
|
227
|
+
end
|
228
|
+
|
229
|
+
if attributes.has_key?(:'inclusive_tax')
|
230
|
+
if (value = attributes[:'inclusive_tax']).is_a?(Array)
|
231
|
+
self.inclusive_tax = value
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
if attributes.has_key?(:'additive_tax')
|
236
|
+
if (value = attributes[:'additive_tax']).is_a?(Array)
|
237
|
+
self.additive_tax = value
|
238
|
+
end
|
239
|
+
end
|
240
|
+
|
241
|
+
if attributes.has_key?(:'tender')
|
242
|
+
if (value = attributes[:'tender']).is_a?(Array)
|
243
|
+
self.tender = value
|
244
|
+
end
|
245
|
+
end
|
246
|
+
|
247
|
+
if attributes.has_key?(:'refunds')
|
248
|
+
if (value = attributes[:'refunds']).is_a?(Array)
|
249
|
+
self.refunds = value
|
250
|
+
end
|
251
|
+
end
|
252
|
+
|
253
|
+
if attributes.has_key?(:'itemizations')
|
254
|
+
if (value = attributes[:'itemizations']).is_a?(Array)
|
255
|
+
self.itemizations = value
|
256
|
+
end
|
257
|
+
end
|
258
|
+
|
259
|
+
end
|
260
|
+
|
261
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
262
|
+
# @return Array for valid properies with the reasons
|
263
|
+
def list_invalid_properties
|
264
|
+
invalid_properties = Array.new
|
265
|
+
return invalid_properties
|
266
|
+
end
|
267
|
+
|
268
|
+
# Check to see if the all the properties in the model are valid
|
269
|
+
# @return true if the model is valid
|
270
|
+
def valid?
|
271
|
+
return true
|
272
|
+
end
|
273
|
+
|
274
|
+
# Checks equality by comparing each attribute.
|
275
|
+
# @param [Object] Object to be compared
|
276
|
+
def ==(o)
|
277
|
+
return true if self.equal?(o)
|
278
|
+
self.class == o.class &&
|
279
|
+
id == o.id &&
|
280
|
+
merchant_id == o.merchant_id &&
|
281
|
+
created_at == o.created_at &&
|
282
|
+
creator_id == o.creator_id &&
|
283
|
+
device == o.device &&
|
284
|
+
payment_url == o.payment_url &&
|
285
|
+
receipt_url == o.receipt_url &&
|
286
|
+
inclusive_tax_money == o.inclusive_tax_money &&
|
287
|
+
additive_tax_money == o.additive_tax_money &&
|
288
|
+
tax_money == o.tax_money &&
|
289
|
+
tip_money == o.tip_money &&
|
290
|
+
discount_money == o.discount_money &&
|
291
|
+
total_collected_money == o.total_collected_money &&
|
292
|
+
processing_fee_money == o.processing_fee_money &&
|
293
|
+
net_total_money == o.net_total_money &&
|
294
|
+
refunded_money == o.refunded_money &&
|
295
|
+
swedish_rounding_money == o.swedish_rounding_money &&
|
296
|
+
gross_sales_money == o.gross_sales_money &&
|
297
|
+
net_sales_money == o.net_sales_money &&
|
298
|
+
inclusive_tax == o.inclusive_tax &&
|
299
|
+
additive_tax == o.additive_tax &&
|
300
|
+
tender == o.tender &&
|
301
|
+
refunds == o.refunds &&
|
302
|
+
itemizations == o.itemizations
|
303
|
+
end
|
304
|
+
|
305
|
+
# @see the `==` method
|
306
|
+
# @param [Object] Object to be compared
|
307
|
+
def eql?(o)
|
308
|
+
self == o
|
309
|
+
end
|
310
|
+
|
311
|
+
# Calculates hash code according to all attributes.
|
312
|
+
# @return [Fixnum] Hash code
|
313
|
+
def hash
|
314
|
+
[id, merchant_id, created_at, creator_id, device, payment_url, receipt_url, inclusive_tax_money, additive_tax_money, tax_money, tip_money, discount_money, total_collected_money, processing_fee_money, net_total_money, refunded_money, swedish_rounding_money, gross_sales_money, net_sales_money, inclusive_tax, additive_tax, tender, refunds, itemizations].hash
|
315
|
+
end
|
316
|
+
|
317
|
+
# Builds the object from hash
|
318
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
319
|
+
# @return [Object] Returns the model itself
|
320
|
+
def build_from_hash(attributes)
|
321
|
+
return nil unless attributes.is_a?(Hash)
|
322
|
+
self.class.swagger_types.each_pair do |key, type|
|
323
|
+
if type =~ /\AArray<(.*)>/i
|
324
|
+
# check to ensure the input is an array given that the the attribute
|
325
|
+
# is documented as an array but the input is not
|
326
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
327
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
328
|
+
end
|
329
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
330
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
331
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
332
|
+
end
|
333
|
+
|
334
|
+
self
|
335
|
+
end
|
336
|
+
|
337
|
+
# Deserializes the data based on type
|
338
|
+
# @param string type Data type
|
339
|
+
# @param string value Value to be deserialized
|
340
|
+
# @return [Object] Deserialized data
|
341
|
+
def _deserialize(type, value)
|
342
|
+
case type.to_sym
|
343
|
+
when :DateTime
|
344
|
+
DateTime.parse(value)
|
345
|
+
when :Date
|
346
|
+
Date.parse(value)
|
347
|
+
when :String
|
348
|
+
value.to_s
|
349
|
+
when :Integer
|
350
|
+
value.to_i
|
351
|
+
when :Float
|
352
|
+
value.to_f
|
353
|
+
when :BOOLEAN
|
354
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
355
|
+
true
|
356
|
+
else
|
357
|
+
false
|
358
|
+
end
|
359
|
+
when :Object
|
360
|
+
# generic object (usually a Hash), return directly
|
361
|
+
value
|
362
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
363
|
+
inner_type = Regexp.last_match[:inner_type]
|
364
|
+
value.map { |v| _deserialize(inner_type, v) }
|
365
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
366
|
+
k_type = Regexp.last_match[:k_type]
|
367
|
+
v_type = Regexp.last_match[:v_type]
|
368
|
+
{}.tap do |hash|
|
369
|
+
value.each do |k, v|
|
370
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
371
|
+
end
|
372
|
+
end
|
373
|
+
else # model
|
374
|
+
temp_model = SquareConnect.const_get(type).new
|
375
|
+
temp_model.build_from_hash(value)
|
376
|
+
end
|
377
|
+
end
|
378
|
+
|
379
|
+
# Returns the string representation of the object
|
380
|
+
# @return [String] String presentation of the object
|
381
|
+
def to_s
|
382
|
+
to_hash.to_s
|
383
|
+
end
|
384
|
+
|
385
|
+
# to_body is an alias to to_hash (backward compatibility)
|
386
|
+
# @return [Hash] Returns the object in the form of hash
|
387
|
+
def to_body
|
388
|
+
to_hash
|
389
|
+
end
|
390
|
+
|
391
|
+
# Returns the object in the form of hash
|
392
|
+
# @return [Hash] Returns the object in the form of hash
|
393
|
+
def to_hash
|
394
|
+
hash = {}
|
395
|
+
self.class.attribute_map.each_pair do |attr, param|
|
396
|
+
value = self.send(attr)
|
397
|
+
next if value.nil?
|
398
|
+
hash[param] = _to_hash(value)
|
399
|
+
end
|
400
|
+
hash
|
401
|
+
end
|
402
|
+
|
403
|
+
# Outputs non-array value in the form of hash
|
404
|
+
# For object, use to_hash. Otherwise, just return the value
|
405
|
+
# @param [Object] value Any valid value
|
406
|
+
# @return [Hash] Returns the value in the form of hash
|
407
|
+
def _to_hash(value)
|
408
|
+
if value.is_a?(Array)
|
409
|
+
value.compact.map{ |v| _to_hash(v) }
|
410
|
+
elsif value.is_a?(Hash)
|
411
|
+
{}.tap do |hash|
|
412
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
413
|
+
end
|
414
|
+
elsif value.respond_to? :to_hash
|
415
|
+
value.to_hash
|
416
|
+
else
|
417
|
+
value
|
418
|
+
end
|
419
|
+
end
|
420
|
+
|
421
|
+
end
|
422
|
+
|
423
|
+
end
|
@@ -0,0 +1,206 @@
|
|
1
|
+
=begin
|
2
|
+
#Square Connect API
|
3
|
+
|
4
|
+
OpenAPI spec version: 2.0
|
5
|
+
Contact: developers@squareup.com
|
6
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
7
|
+
|
8
|
+
=end
|
9
|
+
|
10
|
+
require 'date'
|
11
|
+
|
12
|
+
module SquareConnect
|
13
|
+
|
14
|
+
class V1PaymentDiscount
|
15
|
+
# The discount's name.
|
16
|
+
attr_accessor :name
|
17
|
+
|
18
|
+
# The amount of money that this discount adds to the payment (note that this value is always negative or zero).
|
19
|
+
attr_accessor :applied_money
|
20
|
+
|
21
|
+
# The ID of the applied discount, if available. Discounts applied in older versions of Square Register might not have an ID.
|
22
|
+
attr_accessor :discount_id
|
23
|
+
|
24
|
+
|
25
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
26
|
+
def self.attribute_map
|
27
|
+
{
|
28
|
+
:'name' => :'name',
|
29
|
+
:'applied_money' => :'applied_money',
|
30
|
+
:'discount_id' => :'discount_id'
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
# Attribute type mapping.
|
35
|
+
def self.swagger_types
|
36
|
+
{
|
37
|
+
:'name' => :'String',
|
38
|
+
:'applied_money' => :'V1Money',
|
39
|
+
:'discount_id' => :'String'
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
# Initializes the object
|
44
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
45
|
+
def initialize(attributes = {})
|
46
|
+
return unless attributes.is_a?(Hash)
|
47
|
+
|
48
|
+
# convert string to symbol for hash key
|
49
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
50
|
+
|
51
|
+
if attributes.has_key?(:'name')
|
52
|
+
self.name = attributes[:'name']
|
53
|
+
end
|
54
|
+
|
55
|
+
if attributes.has_key?(:'applied_money')
|
56
|
+
self.applied_money = attributes[:'applied_money']
|
57
|
+
end
|
58
|
+
|
59
|
+
if attributes.has_key?(:'discount_id')
|
60
|
+
self.discount_id = attributes[:'discount_id']
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
66
|
+
# @return Array for valid properies with the reasons
|
67
|
+
def list_invalid_properties
|
68
|
+
invalid_properties = Array.new
|
69
|
+
return invalid_properties
|
70
|
+
end
|
71
|
+
|
72
|
+
# Check to see if the all the properties in the model are valid
|
73
|
+
# @return true if the model is valid
|
74
|
+
def valid?
|
75
|
+
return true
|
76
|
+
end
|
77
|
+
|
78
|
+
# Checks equality by comparing each attribute.
|
79
|
+
# @param [Object] Object to be compared
|
80
|
+
def ==(o)
|
81
|
+
return true if self.equal?(o)
|
82
|
+
self.class == o.class &&
|
83
|
+
name == o.name &&
|
84
|
+
applied_money == o.applied_money &&
|
85
|
+
discount_id == o.discount_id
|
86
|
+
end
|
87
|
+
|
88
|
+
# @see the `==` method
|
89
|
+
# @param [Object] Object to be compared
|
90
|
+
def eql?(o)
|
91
|
+
self == o
|
92
|
+
end
|
93
|
+
|
94
|
+
# Calculates hash code according to all attributes.
|
95
|
+
# @return [Fixnum] Hash code
|
96
|
+
def hash
|
97
|
+
[name, applied_money, discount_id].hash
|
98
|
+
end
|
99
|
+
|
100
|
+
# Builds the object from hash
|
101
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
102
|
+
# @return [Object] Returns the model itself
|
103
|
+
def build_from_hash(attributes)
|
104
|
+
return nil unless attributes.is_a?(Hash)
|
105
|
+
self.class.swagger_types.each_pair do |key, type|
|
106
|
+
if type =~ /\AArray<(.*)>/i
|
107
|
+
# check to ensure the input is an array given that the the attribute
|
108
|
+
# is documented as an array but the input is not
|
109
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
110
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
111
|
+
end
|
112
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
113
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
114
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
115
|
+
end
|
116
|
+
|
117
|
+
self
|
118
|
+
end
|
119
|
+
|
120
|
+
# Deserializes the data based on type
|
121
|
+
# @param string type Data type
|
122
|
+
# @param string value Value to be deserialized
|
123
|
+
# @return [Object] Deserialized data
|
124
|
+
def _deserialize(type, value)
|
125
|
+
case type.to_sym
|
126
|
+
when :DateTime
|
127
|
+
DateTime.parse(value)
|
128
|
+
when :Date
|
129
|
+
Date.parse(value)
|
130
|
+
when :String
|
131
|
+
value.to_s
|
132
|
+
when :Integer
|
133
|
+
value.to_i
|
134
|
+
when :Float
|
135
|
+
value.to_f
|
136
|
+
when :BOOLEAN
|
137
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
138
|
+
true
|
139
|
+
else
|
140
|
+
false
|
141
|
+
end
|
142
|
+
when :Object
|
143
|
+
# generic object (usually a Hash), return directly
|
144
|
+
value
|
145
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
146
|
+
inner_type = Regexp.last_match[:inner_type]
|
147
|
+
value.map { |v| _deserialize(inner_type, v) }
|
148
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
149
|
+
k_type = Regexp.last_match[:k_type]
|
150
|
+
v_type = Regexp.last_match[:v_type]
|
151
|
+
{}.tap do |hash|
|
152
|
+
value.each do |k, v|
|
153
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
154
|
+
end
|
155
|
+
end
|
156
|
+
else # model
|
157
|
+
temp_model = SquareConnect.const_get(type).new
|
158
|
+
temp_model.build_from_hash(value)
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
# Returns the string representation of the object
|
163
|
+
# @return [String] String presentation of the object
|
164
|
+
def to_s
|
165
|
+
to_hash.to_s
|
166
|
+
end
|
167
|
+
|
168
|
+
# to_body is an alias to to_hash (backward compatibility)
|
169
|
+
# @return [Hash] Returns the object in the form of hash
|
170
|
+
def to_body
|
171
|
+
to_hash
|
172
|
+
end
|
173
|
+
|
174
|
+
# Returns the object in the form of hash
|
175
|
+
# @return [Hash] Returns the object in the form of hash
|
176
|
+
def to_hash
|
177
|
+
hash = {}
|
178
|
+
self.class.attribute_map.each_pair do |attr, param|
|
179
|
+
value = self.send(attr)
|
180
|
+
next if value.nil?
|
181
|
+
hash[param] = _to_hash(value)
|
182
|
+
end
|
183
|
+
hash
|
184
|
+
end
|
185
|
+
|
186
|
+
# Outputs non-array value in the form of hash
|
187
|
+
# For object, use to_hash. Otherwise, just return the value
|
188
|
+
# @param [Object] value Any valid value
|
189
|
+
# @return [Hash] Returns the value in the form of hash
|
190
|
+
def _to_hash(value)
|
191
|
+
if value.is_a?(Array)
|
192
|
+
value.compact.map{ |v| _to_hash(v) }
|
193
|
+
elsif value.is_a?(Hash)
|
194
|
+
{}.tap do |hash|
|
195
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
196
|
+
end
|
197
|
+
elsif value.respond_to? :to_hash
|
198
|
+
value.to_hash
|
199
|
+
else
|
200
|
+
value
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
end
|
205
|
+
|
206
|
+
end
|