Module: Cart

Included in:
TessituraRest
Defined in:
lib/tessitura_rest/web/cart.rb

Instance Method Summary collapse

Instance Method Details

#add_contribution(session_key, amount, fund, membership_level, renew = false, upgrade = false, options = {}) ⇒ Object



82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/tessitura_rest/web/cart.rb', line 82

def add_contribution(session_key, amount, fund, membership_level, renew = false, upgrade = false, options = {})
  parameters =
    {
      'Amount': amount,
      'FundId': fund,
      'Upgrade': upgrade,
      'Renew': renew,
      'MembershipLevelId': membership_level,
    }
  options.merge!(basic_auth: @auth, headers: @headers)
  options.merge!(:body => parameters.to_json)
  self.class.post(base_api_endpoint("Web/Cart/#{session_key}/Contributions"), options)
end

#add_gift(session_key, amount, fund, options = {}) ⇒ Object



61
62
63
64
65
66
67
68
69
# File 'lib/tessitura_rest/web/cart.rb', line 61

def add_gift(session_key, amount, fund, options = {})
  parameters = {
    'Amount': amount,
    'FundId': fund,
  }
  options.merge!(basic_auth: @auth, headers: @headers)
  options.merge!(:body => parameters.to_json)
  self.class.post(base_api_endpoint("Web/Cart/#{session_key}/Gifts"), options)
end

#add_gift_certificate(session_key, amount, name, notes, gift_certificate_type, options = {}) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/tessitura_rest/web/cart.rb', line 27

def add_gift_certificate(session_key, amount, name, notes, gift_certificate_type, options = {})
  parameters =
    {
      'Amount': amount,
      'PaymentMethodId': gift_certificate_type,
      'Notes': notes,
      'Name': name,
    }
  options.merge!(basic_auth: @auth, headers: @headers)
  options.merge!(:body => parameters.to_json)
  self.class.post(base_api_endpoint("Web/Cart/#{session_key}/GiftCertificates"), options)
end

#add_membership_by_amount(session_key, amount, fund, options = {}) ⇒ Object



71
72
73
74
75
76
77
78
79
80
# File 'lib/tessitura_rest/web/cart.rb', line 71

def add_membership_by_amount(session_key, amount, fund, options = {})
  parameters =
    {
      'MembershipAmount': amount,
      'FundId': fund,
    }
  options.merge!(basic_auth: @auth, headers: @headers)
  options.merge!(:body => parameters.to_json)
  self.class.post(base_api_endpoint("Web/Cart/#{session_key}/Memberships/AmountFirst"), options)
end

#add_nfs_package_item(session_key, nfs_package_line_item_id, performance_id, performance_group_id, price_type, package_id, number_of_seats, zone_id, leave_single_seats, unseated, options = {}) ⇒ Object



196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
# File 'lib/tessitura_rest/web/cart.rb', line 196

def add_nfs_package_item(session_key, nfs_package_line_item_id, performance_id, performance_group_id, price_type, package_id, number_of_seats, zone_id, leave_single_seats, unseated, options = {})
  parameters =
    {
      'NFSPackageLineItemId': nfs_package_line_item_id,
      'PriceType': price_type,
      'PackageId': package_id,
      'PerformanceId': performance_id,
      'PerformanceGroupId': performance_group_id,
      'NumberOfSeats': number_of_seats,
      'ZoneId': zone_id,
      'LeaveSingleSeats': leave_single_seats,
      'Unseated': unseated,
    }
  options.merge!(basic_auth: @auth, headers: @headers)
  options.merge!(:body => parameters.to_json)
  self.class.post(base_api_endpoint("Web/Cart/#{session_key}/Packages/Nfs"), options)
end

#add_on_account(session_key, amount, payment_method_id, options = {}) ⇒ Object



106
107
108
109
110
111
112
113
114
115
# File 'lib/tessitura_rest/web/cart.rb', line 106

def (session_key, amount, payment_method_id, options = {})
  parameters =
    {
      'Amount': amount,
      'PaymentMethodId': payment_method_id,
    }
  options.merge!(basic_auth: @auth, headers: @headers)
  options.merge!(:body => parameters.to_json)
  self.class.post(base_api_endpoint("Web/Cart/#{session_key}/OnAccount"), options)
end

#add_or_update_fee(session_key, action, fee_id, item_fee_id = nil, amount = nil, options = {}) ⇒ Object



261
262
263
264
265
266
267
268
269
270
271
272
# File 'lib/tessitura_rest/web/cart.rb', line 261

def add_or_update_fee(session_key, action, fee_id, item_fee_id = nil, amount = nil, options = {})
  parameters =
    {
      'Action': action,
      'ItemFeeId': item_fee_id,
      'FeeId': fee_id,
      'Amount': amount,
    }
  options.merge!(basic_auth: @auth, headers: @headers)
  options.merge!(:body => parameters.to_json)
  self.class.post(base_api_endpoint("Web/Cart/#{session_key}/Fees"), options)
end

#add_package_item(session_key, price_type, package_id, number_of_seats, zone_id, leave_single_seats, parent_package_line_item_id, unseated, requested_seats = nil, options = {}) ⇒ Object



172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
# File 'lib/tessitura_rest/web/cart.rb', line 172

def add_package_item(session_key, price_type, package_id, number_of_seats, zone_id, leave_single_seats, parent_package_line_item_id, unseated, requested_seats = nil, options = {})
  zone_id = 0 if requested_seats.present? || zone_id.nil?
  parent_package_line_item_id = 0 if parent_package_line_item_id.nil?
  parameters =
    {
      'PriceType': price_type,
      'PackageId': package_id,
      'NumberOfSeats': number_of_seats,
      'ZoneId': zone_id,
      'RequestedSeats': requested_seats,
      'LeaveSingleSeats': leave_single_seats,
      'ParentPackageLineItemId': parent_package_line_item_id,
      'Unseated': unseated,
    }
  options.merge!(basic_auth: @auth, headers: @headers)
  options.merge!(:body => parameters.to_json)
  self.class.post(base_api_endpoint("Web/Cart/#{session_key}/Packages/Fixed"), options)
end

#add_sub_package_item(session_key, price_type, sub_package_id, number_of_seats, zone_id, leave_single_seats, parent_super_line_item_id, super_line_item_id, unseated, requested_seats = nil, options = {}) ⇒ Object



219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
# File 'lib/tessitura_rest/web/cart.rb', line 219

def add_sub_package_item(session_key, price_type, sub_package_id, number_of_seats, zone_id, leave_single_seats, parent_super_line_item_id, super_line_item_id, unseated, requested_seats = nil, options = {})
  parameters =
    {
      'ParentSuperPackageLineItemId': parent_super_line_item_id,
      'SuperPackageLineItemId': super_line_item_id,
      'PriceType': price_type,
      'SubPackageId': sub_package_id,
      'NumberOfSeats': number_of_seats,
      'ZoneId': zone_id,
      'RequestedSeats': requested_seats,
      'LeaveSingleSeats': leave_single_seats,
      'Unseated': unseated,
    }
  options.merge!(basic_auth: @auth, headers: @headers)
  options.merge!(:body => parameters.to_json)
  self.class.post(base_api_endpoint("Web/Cart/#{session_key}/Packages/Super"), options)
end

#apply_gift_certificate(session_key, gift_certificate_number, amount, options = {}) ⇒ Object



45
46
47
48
49
50
51
52
53
54
# File 'lib/tessitura_rest/web/cart.rb', line 45

def apply_gift_certificate(session_key, gift_certificate_number, amount, options = {})
  parameters =
    {
      'Amount': amount,
      'GiftCertificateNumber': gift_certificate_number,
    }
  options.merge!(basic_auth: @auth, headers: @headers)
  options.merge!(:body => parameters.to_json)
  self.class.post(base_api_endpoint("Web/Cart/#{session_key}/Payments/GiftCertificate"), options)
end

#apply_on_account(session_key, amount, payment_method_id, options = {}) ⇒ Object



117
118
119
120
121
122
123
124
125
126
# File 'lib/tessitura_rest/web/cart.rb', line 117

def (session_key, amount, payment_method_id, options = {})
  parameters =
    {
      'Amount': amount,
      'PaymentMethodId': payment_method_id,
    }
  options.merge!(basic_auth: @auth, headers: @headers)
  options.merge!(:body => parameters.to_json)
  self.class.post(base_api_endpoint("Web/Cart/#{session_key}/Payments/OnAccount"), options)
end

#change_mode_of_sale(session_key, code, options = {}) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/tessitura_rest/web/cart.rb', line 17

def change_mode_of_sale(session_key, code, options = {})
  parameters =
    {
      'ModeOfSaleId': code,
    }
  options.merge!(basic_auth: @auth, headers: @headers)
  options.merge!(:body => parameters.to_json)
  self.class.put(base_api_endpoint("Web/Cart/#{session_key}/Properties"), options)
end

#checkout(session_key, name_on_card, credit_card_number, cvv_number, credit_card_type, expiration_month, expiration_year, is_order_authorized, order_authorization_code, order_amount, allow_under_payment, options = {}) ⇒ Object



299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
# File 'lib/tessitura_rest/web/cart.rb', line 299

def checkout(session_key, name_on_card, credit_card_number, cvv_number, credit_card_type, expiration_month, expiration_year, is_order_authorized, order_authorization_code, order_amount, allow_under_payment, options = {})
  parameters =
    {
      'CreditCardOwner': name_on_card,
      'CreditCardNumber': credit_card_number,
      'CreditCardType': credit_card_type,
      'CreditCardMonth': expiration_month,
      'CreditCardYear': expiration_year,
      'Amount': order_amount,
      'AllowUnderPayment': allow_under_payment,
      'CreditCardAuthenticationCode': cvv_number,
      'Authorize': is_order_authorized,
      'AuthorizationCode': order_authorization_code,
    }
  options.merge!(basic_auth: @auth, headers: @headers)
  options.merge!(:body => parameters.to_json)
  self.class.post(base_api_endpoint("Web/Cart/#{session_key}/Checkout"), options)
end

#checkout_with_tms(session_key, order_authorization_code, order_amount, allow_under_payment, payment_method_id, payment_id, payment_reference, authorize, options = {}) ⇒ Object



318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
# File 'lib/tessitura_rest/web/cart.rb', line 318

def checkout_with_tms(session_key, order_authorization_code, order_amount, allow_under_payment, payment_method_id, payment_id, payment_reference, authorize, options = {})
  parameters =
    {
      'CreditCardType': payment_method_id,
      'Amount': order_amount,
      'AllowUnderPayment': allow_under_payment,
      'Authorize': authorize,
      'ECommerce': true,
      'AuthorizationCode': order_authorization_code,
      'PaymentId': payment_id,
      'PaymentReference': payment_reference,
    }
  options.merge!(basic_auth: @auth, headers: @headers)
  options.merge!(:body => parameters.to_json)
  self.class.post(base_api_endpoint("Web/Cart/#{session_key}/Checkout"), options)
end

#checkout_with_zip(session_key, name_on_card, credit_card_number, cvv_number, credit_card_type, expiration_month, expiration_year, zip_code, is_order_authorized, order_authorization_code, order_amount, allow_under_payment, options = {}) ⇒ Object



335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
# File 'lib/tessitura_rest/web/cart.rb', line 335

def checkout_with_zip(session_key, name_on_card, credit_card_number, cvv_number, credit_card_type, expiration_month, expiration_year, zip_code, is_order_authorized, order_authorization_code, order_amount, allow_under_payment,
                      options = {})
  parameters =
    {
      'CreditCardOwner': name_on_card,
      'CreditCardNumber': credit_card_number,
      'CreditCardType': credit_card_type,
      'CreditCardMonth': expiration_month,
      'CreditCardYear': expiration_year,
      'Amount': order_amount,
      'AllowUnderPayment': allow_under_payment,
      'CreditCardAuthenticationCode': cvv_number,
      'Authorize': is_order_authorized,
      'AuthorizationCode': order_authorization_code,
      'ZipCode': zip_code,
    }
  options.merge!(basic_auth: @auth, headers: @headers)
  options.merge!(:body => parameters.to_json)
  self.class.post(base_api_endpoint("Web/Cart/#{session_key}/Checkout"), options)
end

#empty_cart(session_key, options = {}) ⇒ Object



12
13
14
15
# File 'lib/tessitura_rest/web/cart.rb', line 12

def empty_cart(session_key, options = {})
  options.merge!(basic_auth: @auth, headers: @headers)
  self.class.delete(base_api_endpoint("Web/Cart/#{session_key}"), options)
end

#get_cart(session_key, options = {}) ⇒ Object



2
3
4
5
# File 'lib/tessitura_rest/web/cart.rb', line 2

def get_cart(session_key, options = {})
  options.merge!(basic_auth: @auth, headers: @headers)
  self.class.get(base_api_endpoint("Web/Cart/#{session_key}?messageTypes=-11"), options)
end

#get_checkout_complete(session_key, options = {}) ⇒ Object



7
8
9
10
# File 'lib/tessitura_rest/web/cart.rb', line 7

def get_checkout_complete(session_key, options = {})
  options.merge!(basic_auth: @auth, headers: @headers)
  self.class.get(base_api_endpoint("Web/Cart/#{session_key}&savedCart=true"), options)
end

#get_properties(session_key, options = {}) ⇒ Object



133
134
135
136
# File 'lib/tessitura_rest/web/cart.rb', line 133

def get_properties(session_key, options = {})
  options.merge!(basic_auth: @auth, headers: @headers)
  self.class.get(base_api_endpoint("Web/Cart/#{session_key}/Properties"), options)
end


242
243
244
245
246
247
248
249
250
251
252
253
254
# File 'lib/tessitura_rest/web/cart.rb', line 242

def print_ticket_elements(session_key, order_id, ticket_design, reprint, mode, new_ticket_no = false, options = {})
  parameters =
    {
      'NewTicketNoForReprints': new_ticket_no,
      'ReprintTickets': reprint,
      'OrderId': order_id,
      'TicketDesignId': ticket_design,
      'Mode': mode,
    }
  options.merge!(basic_auth: @auth, headers: @headers)
  options.merge!(:body => parameters.to_json)
  self.class.post(base_api_endpoint("Web/Cart/#{session_key}/Print/TicketElements"), options)
end

#remove_contribution(session_key, line_item_id, options = {}) ⇒ Object



96
97
98
99
# File 'lib/tessitura_rest/web/cart.rb', line 96

def remove_contribution(session_key, line_item_id, options = {})
  options.merge!(basic_auth: @auth, headers: @headers)
  self.class.delete(base_api_endpoint("Web/Cart/#{session_key}/Contributions/#{line_item_id}"), options)
end

#remove_gift_certificate(session_key, gift_certificate_number, options = {}) ⇒ Object



40
41
42
43
# File 'lib/tessitura_rest/web/cart.rb', line 40

def remove_gift_certificate(session_key, gift_certificate_number, options = {})
  options.merge!(basic_auth: @auth, headers: @headers)
  self.class.delete(base_api_endpoint("Web/Cart/#{session_key}/GiftCertificates/#{gift_certificate_number}"), options)
end

#remove_membership(session_key, membership_id, options = {}) ⇒ Object



101
102
103
104
# File 'lib/tessitura_rest/web/cart.rb', line 101

def remove_membership(session_key, membership_id, options = {})
  options.merge!(basic_auth: @auth, headers: @headers)
  self.class.delete(base_api_endpoint("Web/Cart/#{session_key}/Memberships/#{membership_id}"), options)
end

#remove_nfs_package_item(session_key, line_item_id, options = {}) ⇒ Object



214
215
216
217
# File 'lib/tessitura_rest/web/cart.rb', line 214

def remove_nfs_package_item(session_key, line_item_id, options = {})
  options.merge!(basic_auth: @auth, headers: @headers)
  self.class.delete(base_api_endpoint("Web/Cart/#{session_key}/Packages/Nfs/#{line_item_id}"), options)
end

#remove_on_account(session_key, payment_id, options = {}) ⇒ Object



128
129
130
131
# File 'lib/tessitura_rest/web/cart.rb', line 128

def (session_key, payment_id, options = {})
  options.merge!(basic_auth: @auth, headers: @headers)
  self.class.delete(base_api_endpoint("Web/Cart/#{session_key}/OnAccount/#{payment_id}"), options)
end

#remove_package_item(session_key, package_id, line_item_id, options = {}) ⇒ Object



191
192
193
194
# File 'lib/tessitura_rest/web/cart.rb', line 191

def remove_package_item(session_key, package_id, line_item_id, options = {})
  options.merge!(basic_auth: @auth, headers: @headers)
  self.class.delete(base_api_endpoint("Web/Cart/#{session_key}/Packages/Fixed/#{package_id}/#{line_item_id}"), options)
end

#remove_sub_package_item(session_key, super_package_id, super_package_line_item_id, options = {}) ⇒ Object



237
238
239
240
# File 'lib/tessitura_rest/web/cart.rb', line 237

def remove_sub_package_item(session_key, super_package_id, super_package_line_item_id, options = {})
  options.merge!(basic_auth: @auth, headers: @headers)
  self.class.delete(base_api_endpoint("Web/Cart/#{session_key}/Packages/Super/#{super_package_id}/#{super_package_line_item_id}"), options)
end

#remove_tickets(session_key, performance_id, line_item_id, options = {}) ⇒ Object



256
257
258
259
# File 'lib/tessitura_rest/web/cart.rb', line 256

def remove_tickets(session_key, performance_id, line_item_id, options = {})
  options.merge!(basic_auth: @auth, headers: @headers)
  self.class.delete(base_api_endpoint("Web/Cart/#{session_key}/Tickets/#{performance_id}/#{line_item_id}"), options)
end

#reserve_tickets(session_key, number_of_seats, perf_id, price_type, zone_id, unseated, requested_seats = nil, special_requests = nil, options = {}) ⇒ Object



144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/tessitura_rest/web/cart.rb', line 144

def reserve_tickets(session_key, number_of_seats, perf_id, price_type, zone_id, unseated, requested_seats = nil, special_requests = nil, options = {})
  zone_id = 0 if requested_seats.present? || zone_id.nil?
  parameters =
    {
      'PriceType': price_type,
      'PerformanceId': perf_id,
      'NumberOfSeats': number_of_seats,
      'ZoneId': zone_id,
      'SpecialRequests': special_requests,
      'Unseated': unseated,
      'RequestedSeats': requested_seats,
    }
  options.merge!(basic_auth: @auth, headers: @headers)
  options.merge!(:body => parameters.to_json)
  self.class.post(base_api_endpoint("Web/Cart/#{session_key}/Tickets"), options)
end

#return_tickets(session_key, return_or_donate, id, options = {}) ⇒ Object



161
162
163
164
165
166
167
168
169
170
# File 'lib/tessitura_rest/web/cart.rb', line 161

def return_tickets(session_key, return_or_donate, id, options = {})
  parameters =
    {
      'TicketNumber': id,
      'ReturnOrDonate': return_or_donate,
    }
  options.merge!(basic_auth: @auth, headers: @headers)
  options.merge!(:body => parameters.to_json)
  self.class.post(base_api_endpoint("Web/Cart/#{session_key}/Tickets/Return"), options)
end

#un_apply_gift_certificate(session_key, gift_certificate_number, options = {}) ⇒ Object



56
57
58
59
# File 'lib/tessitura_rest/web/cart.rb', line 56

def un_apply_gift_certificate(session_key, gift_certificate_number, options = {})
  options.merge!(basic_auth: @auth, headers: @headers)
  self.class.delete(base_api_endpoint("Web/Cart/#{session_key}/Payments/GiftCertificate/#{gift_certificate_number}"), options)
end

#update_cart_properties_custom_data(session_key, index, value, options = {}) ⇒ Object



287
288
289
290
291
292
293
294
295
296
297
# File 'lib/tessitura_rest/web/cart.rb', line 287

def update_cart_properties_custom_data(session_key, index, value, options = {})
  parameters =
    {
      'Index': index,
      'Value': value,
    }
  options.merge!(basic_auth: @auth, headers: @headers)
  options.merge!(:body => parameters.to_json)
  put = self.class.put(base_api_endpoint("Web/Cart/#{session_key}/CustomData/#{index}"), options)
  put.success?
end

#update_properties(session_key, get_properties_response, options = {}) ⇒ Object



138
139
140
141
142
# File 'lib/tessitura_rest/web/cart.rb', line 138

def update_properties(session_key, get_properties_response, options = {})
  options.merge!(basic_auth: @auth, headers: @headers)
  options.merge!(:body => get_properties_response.to_json)
  self.class.put(base_api_endpoint("Web/Cart/#{session_key}/Properties"), options)
end

#validate_cart(session_key, super_package = false, fixed = false, flex = false, plan = false, options = {}) ⇒ Object



274
275
276
277
278
279
280
281
282
283
284
285
# File 'lib/tessitura_rest/web/cart.rb', line 274

def validate_cart(session_key, super_package = false, fixed = false, flex = false, plan = false, options = {})
  parameters =
    {
      'ValidateSuperPackages': super_package,
      'ValidateFSPackages': fixed,
      'ValidateNFSPackages': flex,
      'ValidatePaymentPlan': plan,
    }
  options.merge!(basic_auth: @auth, headers: @headers)
  options.merge!(:body => parameters.to_json)
  self.class.post(base_api_endpoint("Web/Cart/#{session_key}/Validate"), options)
end