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 = nil, upgrade = nil, options = {}) ⇒ Object



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

def add_contribution(session_key, amount, fund, membership_level, renew = nil, upgrade = nil, options = {})
  parameters =
    {
      'Amount': amount,
      'FundId': fund,
      'Upgrade': upgrade,
      'Renew': renew,
      'MembershipLevelId': membership_level,
    }
  options.merge!(basic_auth: @auth, headers: @headers)
  options.merge!(:body => parameters)
  self.class.post(base_api_endpoint("Web/Cart/#{session_key}/Contributions"), 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)
  self.class.post(base_api_endpoint("Web/Cart/#{session_key}/GiftCertificates"), 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



178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# File 'lib/tessitura_rest/web/cart.rb', line 178

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, :headers => { 'Content-Type' => 'application/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



80
81
82
83
84
85
86
87
88
89
# File 'lib/tessitura_rest/web/cart.rb', line 80

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)
  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



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

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)
  self.class.post(base_api_endpoint("Web/Cart/#{session_key}/Fees"), options)
end

#add_order_comment(session_key, notes, solicitor = 'webapi', options = {}) ⇒ Object



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

def add_order_comment(session_key, notes, solicitor = 'webapi', options = {})
  options.merge!(basic_auth: @auth, headers: @headers)
  parameters =
    {
      'Solicitor': solicitor,
      'Notes': notes,
    }
  options.merge!(:body => parameters)
  self.class.put(base_api_endpoint("Web/Cart/#{session_key}/Properties"), 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



156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# File 'lib/tessitura_rest/web/cart.rb', line 156

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 = {})
  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, :headers => { 'Content-Type' => 'application/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



201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
# File 'lib/tessitura_rest/web/cart.rb', line 201

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, :headers => { 'Content-Type' => 'application/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, :headers => { 'Content-Type' => 'application/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



91
92
93
94
95
96
97
98
99
100
# File 'lib/tessitura_rest/web/cart.rb', line 91

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, :headers => { 'Content-Type' => 'application/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)
  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



281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
# File 'lib/tessitura_rest/web/cart.rb', line 281

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, :headers => { 'Content-Type' => 'application/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_reference, authorize, options = {}) ⇒ Object



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

def checkout_with_tms(session_key, order_authorization_code, order_amount, allow_under_payment, payment_method_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,
      'PaymentReference': payment_reference
    }
  options.merge!(basic_auth: @auth, headers: @headers)
  options.merge!(:body => parameters.to_json, :headers => { 'Content-Type' => 'application/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



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

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, :headers => { 'Content-Type' => 'application/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



107
108
109
110
# File 'lib/tessitura_rest/web/cart.rb', line 107

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


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

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)
  self.class.post(base_api_endpoint("/Web/Cart/#{session_key}/Print/TicketElements"), options)
end

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



75
76
77
78
# File 'lib/tessitura_rest/web/cart.rb', line 75

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_nfs_package_item(session_key, line_item_id, options = {}) ⇒ Object



196
197
198
199
# File 'lib/tessitura_rest/web/cart.rb', line 196

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



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

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



173
174
175
176
# File 'lib/tessitura_rest/web/cart.rb', line 173

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



219
220
221
222
# File 'lib/tessitura_rest/web/cart.rb', line 219

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



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

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



129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/tessitura_rest/web/cart.rb', line 129

def reserve_tickets(session_key, number_of_seats, perf_id, price_type, zone_id, unseated, requested_seats = nil, special_requests = nil, options = {})
  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, :headers => { 'Content-Type' => 'application/json' })
  self.class.post(base_api_endpoint("/Web/Cart/#{session_key}/Tickets"), options)
end

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



145
146
147
148
149
150
151
152
153
154
# File 'lib/tessitura_rest/web/cart.rb', line 145

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)
  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



269
270
271
272
273
274
275
276
277
278
279
# File 'lib/tessitura_rest/web/cart.rb', line 269

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)
  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



112
113
114
115
116
# File 'lib/tessitura_rest/web/cart.rb', line 112

def update_properties(session_key, get_properties_response, options = {})
  options.merge!(basic_auth: @auth, headers: @headers)
  options.merge!(:body => get_properties_response)
  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



256
257
258
259
260
261
262
263
264
265
266
267
# File 'lib/tessitura_rest/web/cart.rb', line 256

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)
  self.class.post(base_api_endpoint("Web/Cart/#{session_key}/Validate"), options)
end