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



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

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



33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/tessitura_rest/web/cart.rb', line 33

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



191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
# File 'lib/tessitura_rest/web/cart.rb', line 191

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



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

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



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

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



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

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



168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# File 'lib/tessitura_rest/web/cart.rb', line 168

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



214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
# File 'lib/tessitura_rest/web/cart.rb', line 214

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



51
52
53
54
55
56
57
58
59
60
# File 'lib/tessitura_rest/web/cart.rb', line 51

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

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



23
24
25
26
27
28
29
30
31
# File 'lib/tessitura_rest/web/cart.rb', line 23

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



294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
# File 'lib/tessitura_rest/web/cart.rb', line 294

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

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



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

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



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

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

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



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

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

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



18
19
20
21
# File 'lib/tessitura_rest/web/cart.rb', line 18

def order_confirm_text(session_key, options={})
  options.merge!(basic_auth: @auth, headers: @headers)
  self.class.get(base_api_endpoint("Web/Cart/#{session_key}?messageTypes=#{ENV['ORDER_CONFIRM_TEXT']}&savedCart=true"), options)
end


237
238
239
240
241
242
243
244
245
246
247
248
249
# File 'lib/tessitura_rest/web/cart.rb', line 237

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



81
82
83
84
# File 'lib/tessitura_rest/web/cart.rb', line 81

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



46
47
48
49
# File 'lib/tessitura_rest/web/cart.rb', line 46

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



209
210
211
212
# File 'lib/tessitura_rest/web/cart.rb', line 209

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



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

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



186
187
188
189
# File 'lib/tessitura_rest/web/cart.rb', line 186

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



232
233
234
235
# File 'lib/tessitura_rest/web/cart.rb', line 232

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



251
252
253
254
# File 'lib/tessitura_rest/web/cart.rb', line 251

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



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

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

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



157
158
159
160
161
162
163
164
165
166
# File 'lib/tessitura_rest/web/cart.rb', line 157

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



62
63
64
65
# File 'lib/tessitura_rest/web/cart.rb', line 62

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



282
283
284
285
286
287
288
289
290
291
292
# File 'lib/tessitura_rest/web/cart.rb', line 282

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, category = 0, solicitor = 'webapi', channel = 0, options = {}) ⇒ Object



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

def update_properties(session_key, category=0, solicitor='webapi', channel=0, options={})
  options.merge!(basic_auth: @auth, headers: @headers)
  parameters =
  {
    "Solicitor": solicitor,
    "ChannelId": channel
  }
  parameters["CategoryId"] = category if category != 0
  options.merge!(:body => parameters)
  self.class.put(base_api_endpoint("Web/Cart/#{session_key}/Properties"), options)
end

#update_source(session_key, source_no, solicitor = 'webapi', options = {}) ⇒ Object



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

def update_source(session_key, source_no, solicitor='webapi', options={})
  options.merge!(basic_auth: @auth, headers: @headers)
  parameters =
  {
    "Solicitor": solicitor,
    "SourceId": source_no
  }
  options.merge!(:body => parameters)
  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



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

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

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



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

def web_cart_text(session_key, options={})
  options.merge!(basic_auth: @auth, headers: @headers)
  self.class.get(base_api_endpoint("Web/Cart/#{session_key}/Messages?messageTypes=#{ENV['WEB_CART_TEXT']}&savedCart=false"), options)
end