gotransverse-tract-api 0.3.4 → 0.4.0

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.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/lib/gotransverse-tract-api.rb +51 -1
  3. data/lib/gotransverse-tract-api/api_data.rb +259 -0
  4. data/lib/gotransverse-tract-api/billing_account/adjustment.rb +205 -5
  5. data/lib/gotransverse-tract-api/billing_account/billing_account.rb +146 -13
  6. data/lib/gotransverse-tract-api/billing_account/invoice.rb +2 -1
  7. data/lib/gotransverse-tract-api/billing_account/payment.rb +90 -9
  8. data/lib/gotransverse-tract-api/billing_account/refund.rb +15 -1
  9. data/lib/gotransverse-tract-api/order/order_item.rb +179 -7
  10. data/lib/gotransverse-tract-api/order/organization.rb +15 -1
  11. data/lib/gotransverse-tract-api/order/people.rb +14 -16
  12. data/lib/gotransverse-tract-api/order/sales_order.rb +253 -6
  13. data/lib/gotransverse-tract-api/service/service.rb +273 -24
  14. data/lib/gotransverse-tract-api/service/service_resource.rb +65 -7
  15. data/lib/gotransverse-tract-api/usage/usage_event.rb +58 -3
  16. data/lib/gotransverse-tract-api/usage/usage_main.rb +19 -0
  17. data/lib/gotransverse-tract-api/usage/usage_some.rb +24 -0
  18. data/lib/gotransverse-tract-api/version.rb +1 -1
  19. data/spec/gotransverse-tract-api/billing_account/adjustment_spec.rb +190 -0
  20. data/spec/gotransverse-tract-api/billing_account/billing_account_spec.rb +380 -0
  21. data/spec/gotransverse-tract-api/billing_account/invoice_spec.rb +43 -0
  22. data/spec/gotransverse-tract-api/billing_account/payment_spec.rb +104 -2
  23. data/spec/gotransverse-tract-api/billing_account/refund_spec.rb +30 -0
  24. data/spec/gotransverse-tract-api/order/order_item_spec.rb +169 -0
  25. data/spec/gotransverse-tract-api/order/organization_spec.rb +32 -0
  26. data/spec/gotransverse-tract-api/order/people_spec.rb +32 -0
  27. data/spec/gotransverse-tract-api/order/sales_order_spec.rb +209 -0
  28. data/spec/gotransverse-tract-api/service/service_resource_spec.rb +83 -0
  29. data/spec/gotransverse-tract-api/service/service_spec.rb +194 -0
  30. data/spec/gotransverse-tract-api/usage/usage_event_spec.rb +57 -0
  31. metadata +27 -2
@@ -126,7 +126,8 @@ module GoTransverseTractApi
126
126
  # @param {Hash} billing_account
127
127
  #
128
128
  def apply_payment eid, billing_account
129
- GoTransverseTractApi.post_request_for(self, {eid: eid}, billing_account, "applyPayment")
129
+ xml_data = GoTransverseTractApi::ApiData.new.payment_details(billing_account, 'Y')
130
+ GoTransverseTractApi.post_request_for(self, {eid: eid}, xml_data, "applyPayment")
130
131
  end
131
132
 
132
133
  #
@@ -134,7 +135,8 @@ module GoTransverseTractApi
134
135
  # @param {Hash} billing_account
135
136
  #
136
137
  def suspend eid, billing_account
137
- GoTransverseTractApi.post_request_for(self, {eid: eid}, billing_account, "suspend")
138
+ xml_data = GoTransverseTractApi::ApiData.new.shutdown(billing_account, eid, 'suspendBillingAccount')
139
+ GoTransverseTractApi.post_request_for(self, {eid: eid}, xml_data, "suspend")
138
140
  end
139
141
 
140
142
  #
@@ -142,7 +144,15 @@ module GoTransverseTractApi
142
144
  # @param {Hash} billing_account
143
145
  #
144
146
  def resume eid, billing_account
145
- GoTransverseTractApi.post_request_for(self, {eid: eid}, billing_account, "resume")
147
+ data = {
148
+ :resumeBillingAccount => {},
149
+ :billingAccount => {eid: eid},
150
+ :startDate => billing_account[:start_date],
151
+ :notes => billing_account[:notes]
152
+ }
153
+
154
+ xml_data = GoTransverseTractApi.generateXML(data, 'resumeBillingAccount')
155
+ GoTransverseTractApi.post_request_for(self, {eid: eid}, xml_data, "resume")
146
156
  end
147
157
 
148
158
  #
@@ -150,7 +160,23 @@ module GoTransverseTractApi
150
160
  # @param {Hash} billing_account
151
161
  #
152
162
  def add_recurring_payment eid, billing_account
153
- GoTransverseTractApi.post_request_for(self, {eid: eid}, billing_account, "addRecurringPayment")
163
+ data = {
164
+ :addRecurringPaymentToBillingAccount => {},
165
+ :billingAccount => {eid: eid},
166
+ :recurringPayment => {
167
+ :attributes => {},
168
+ :creditCardPaymentMethod => {
169
+ :cardType => billing_account[:recurring_payment][:credit_card_payment_method][:card_type],
170
+ :cardHolderFirstName => billing_account[:recurring_payment][:credit_card_payment_method][:card_holder_first_name],
171
+ :cardHolderLastName => billing_account[:recurring_payment][:credit_card_payment_method][:card_holder_last_name],
172
+ :cardIdentifierNumber => billing_account[:recurring_payment][:credit_card_payment_method][:card_identifier_number],
173
+ :cardExpiration => billing_account[:recurring_payment][:credit_card_payment_method][:card_expiration]
174
+ }
175
+ }
176
+ }
177
+
178
+ xml_data = GoTransverseTractApi.generateXML(data, 'addRecurringPaymentToBillingAccount')
179
+ GoTransverseTractApi.post_request_for(self, {eid: eid}, xml_data, "addRecurringPayment")
154
180
  end
155
181
 
156
182
  #
@@ -158,7 +184,30 @@ module GoTransverseTractApi
158
184
  # @param {Hash} billing_account
159
185
  #
160
186
  def change_service eid, billing_account
161
- GoTransverseTractApi.post_request_for(self, {eid: eid}, billing_account, "changeService")
187
+ data = {
188
+ :changeService => {},
189
+ :service => {
190
+ eid: billing_account[:service][:eid]
191
+ },
192
+ :order => {
193
+ :attributes => {
194
+ :note => billing_account[:order][:note]
195
+ },
196
+ :orderItems => {
197
+ :attributes => {},
198
+ :orderItem => {
199
+ :attributes => {
200
+ :quantity => billing_account[:order][:order_items][:order_item][:quantity],
201
+ :description => billing_account[:order][:order_items][:order_item][:description]
202
+ },
203
+ :products => get_products(billing_account)
204
+ }
205
+ },
206
+ :billingAccount => {eid: eid}
207
+ }
208
+ }
209
+ xml_data = GoTransverseTractApi.generateXML(data, 'changeService')
210
+ GoTransverseTractApi.post_request_for(self, {eid: eid}, xml_data, "changeService")
162
211
  end
163
212
 
164
213
  #
@@ -166,6 +215,14 @@ module GoTransverseTractApi
166
215
  # @param {Hash} billing_account
167
216
  #
168
217
  def add_custom_field_value eid, billing_account
218
+ data = {
219
+ :addCustomFieldValue => {},
220
+ :billingAccount => {eid: eid},
221
+ :customFieldValue => {
222
+ :value => billing_account[:custom_field_value][:value]
223
+ }
224
+ }
225
+ xml_data = GoTransverseTractApi.generateXML(data, 'addCustomFieldValue')
169
226
  GoTransverseTractApi.post_request_for(self, {eid: eid}, billing_account, "addCustomFieldValue")
170
227
  end
171
228
 
@@ -174,7 +231,15 @@ module GoTransverseTractApi
174
231
  # @param {Hash} billing_account
175
232
  #
176
233
  def remove_custom_field_value eid, billing_account
177
- GoTransverseTractApi.post_request_for(self, {eid: eid}, billing_account, "removeCustomFieldValue")
234
+ data = {
235
+ :removeCustomFieldValue => {},
236
+ :billingAccount => {eid: eid},
237
+ :customFieldValue => {
238
+ eid: billing_account[:custom_field_value][:eid]
239
+ }
240
+ }
241
+ xml_data = GoTransverseTractApi.generateXML(data, 'removeCustomFieldValue')
242
+ GoTransverseTractApi.post_request_for(self, {eid: eid}, xml_data, "removeCustomFieldValue")
178
243
  end
179
244
 
180
245
  #
@@ -182,7 +247,21 @@ module GoTransverseTractApi
182
247
  # @param {Hash} billing_account
183
248
  #
184
249
  def add_person eid, billing_account
185
- GoTransverseTractApi.post_request_for(self, {eid: eid}, billing_account, "addPerson")
250
+ data = {
251
+ :addPersonToBillingAccount => {},
252
+ :billingAccount => {eid: eid},
253
+ :person => {
254
+ :attributes => {
255
+ :firstName => billing_account[:person][:first_name],
256
+ :lastName => billing_account[:person][:last_name],
257
+ :middleName => billing_account[:person][:middle_name]
258
+ },
259
+ :addresses => GoTransverseTractApi::ApiData.new.get_addresses(billing_account[:person])
260
+ }
261
+ }
262
+
263
+ xml_data = GoTransverseTractApi.generateXML(data, 'addPersonToBillingAccount')
264
+ GoTransverseTractApi.post_request_for(self, {eid: eid}, xml_data, "addPerson")
186
265
  end
187
266
 
188
267
  #
@@ -190,7 +269,14 @@ module GoTransverseTractApi
190
269
  # @param {Hash} billing_account
191
270
  #
192
271
  def remove_billing_account eid, billing_account
193
- GoTransverseTractApi.post_request_for(self, {eid: eid}, billing_account, "removePerson")
272
+ data = {
273
+ :removePersonFromBillingAccount => {},
274
+ :billingAccount => { eid: eid },
275
+ :person => { eid: billing_account[:person][:eid] }
276
+ }
277
+
278
+ xml_data = GoTransverseTractApi.generateXML(data, 'removePersonFromBillingAccount')
279
+ GoTransverseTractApi.post_request_for(self, {eid: eid}, xml_data, "removePerson")
194
280
  end
195
281
 
196
282
  #
@@ -198,7 +284,13 @@ module GoTransverseTractApi
198
284
  # @param {Hash} billing_account
199
285
  #
200
286
  def create_draft_order eid, billing_account
201
- GoTransverseTractApi.post_request_for(self, {eid: eid}, billing_account, "createDraftOrder")
287
+ data = {
288
+ :createDraftOrder => {},
289
+ :salesOrder => GoTransverseTractApi::ApiData.new.sales_order_details(billing_account[:sales_order])
290
+ }
291
+
292
+ xml_data = GoTransverseTractApi.generateXML(data, 'createDraftOrder')
293
+ GoTransverseTractApi.post_request_for(self, {eid: eid}, xml_data, "createDraftOrder")
202
294
  end
203
295
 
204
296
  #
@@ -206,7 +298,13 @@ module GoTransverseTractApi
206
298
  # @param {Hash} billing_account
207
299
  #
208
300
  def void_draft_order eid, billing_account
209
- GoTransverseTractApi.post_request_for(self, {eid: eid}, billing_account, "voidDraftOrder")
301
+ data = {
302
+ :voidDraftOrder => {},
303
+ :salesOrder => GoTransverseTractApi::ApiData.new.sales_order_details(billing_account[:sales_order])
304
+ }
305
+
306
+ xml_data = GoTransverseTractApi.generateXML(data, 'voidDraftOrder')
307
+ GoTransverseTractApi.post_request_for(self, {eid: eid}, xml_data, "voidDraftOrder")
210
308
  end
211
309
 
212
310
  #
@@ -214,17 +312,36 @@ module GoTransverseTractApi
214
312
  # @param {Hash} billing_account
215
313
  #
216
314
  def deactivate eid, billing_account
217
- GoTransverseTractApi.post_request_for(self, {eid: eid}, billing_account, "deactivate")
315
+ xml_data = GoTransverseTractApi::ApiData.new.shutdown(billing_account, eid, 'deactivateBillingAccount')
316
+ GoTransverseTractApi.post_request_for(self, {eid: eid}, xml_data, "deactivate")
218
317
  end
219
318
 
220
319
  #
221
320
  # @param {Hash} billing_account
222
321
  #
223
322
  def create_billing_account billing_account
224
- GoTransverseTractApi.post_request_for(self, {}, billing_account, "")
323
+ data = {
324
+ :billingAccount => {
325
+ :billType => billing_account[:bill_type]
326
+ },
327
+ :dailyBillCycle => {
328
+ eid: billing_account[:daily_bill_cycle][:eid]
329
+ },
330
+ :organization => {
331
+ :attributes => {
332
+ :name => billing_account[:organization][:name]
333
+ },
334
+ :addresses => GoTransverseTractApi::ApiData.new.get_addresses(billing_account[:organization])
335
+ },
336
+ :billingAccountCategory => {
337
+ eid: billing_account[:billing_account_category][:eid]
338
+ }
339
+ }
340
+ xml_data = GoTransverseTractApi.generateXML(data, 'billingAccount')
341
+ GoTransverseTractApi.post_request_for(self, {}, xml_data, "")
225
342
  end
226
343
 
227
- #
344
+
228
345
  # @param {Long} eid
229
346
  # @param {Hash} billing_account
230
347
  #
@@ -232,6 +349,22 @@ module GoTransverseTractApi
232
349
  GoTransverseTractApi.put_request_for(self, {eid: eid}, billing_account)
233
350
  end
234
351
 
352
+ private
353
+
354
+ def get_products(billing_account)
355
+ products = []
356
+ qty = billing_account[:order][:order_items][:order_item][:quantity]
357
+
358
+ (0..qty - 1).each do|i|
359
+ products << {
360
+ :product => {
361
+ eid: billing_account[:order][:order_items][:order_item][:products][i][:eid]
362
+ }
363
+ }
364
+ end
365
+
366
+ products
367
+ end
235
368
  end
236
369
 
237
370
  end
@@ -76,7 +76,8 @@ module GoTransverseTractApi
76
76
  # @param {Hash} invoice
77
77
  #
78
78
  def apply_payment eid, invoice
79
- GoTransverseTractApi.post_request_for(self, {eid: eid}, invoice, "applyPayment")
79
+ xml_data = GoTransverseTractApi::ApiData.new.payment_details(invoice)
80
+ GoTransverseTractApi.post_request_for(self, {eid: eid}, xml_data, "applyPayment")
80
81
  end
81
82
 
82
83
  end
@@ -59,13 +59,15 @@ module GoTransverseTractApi
59
59
  # @param {String} complete_url
60
60
  #
61
61
  def self.referrer_token error_url, cancel_url, complete_url
62
- body = "<generatePaymentCollectionReferrerToken xmlns='http://www.tractbilling.com/billing/1_28/domain'>
63
- <errorUrl>#{error_url}</errorUrl>
64
- <cancelUrl>#{cancel_url}</cancelUrl>
65
- <completeUrl>#{complete_url}</completeUrl>
66
- </generatePaymentCollectionReferrerToken>"
67
-
68
- GoTransverseTractApi.post_request_for(self, body, "referrerToken")[:referrer][:referrerToken]
62
+ data = {
63
+ :generatePaymentCollectionReferrerToken => {},
64
+ :errorUrl => error_url,
65
+ :completeUrl => complete_url,
66
+ :cancelUrl => cancel_url
67
+ }
68
+ xml_data = GoTransverseTractApi.generateXML(data, 'generatePaymentCollectionReferrerToken' )
69
+
70
+ GoTransverseTractApi.post_request_for(self, xml_data, "referrerToken")[:referrer][:referrerToken]
69
71
  end
70
72
 
71
73
  #
@@ -73,7 +75,27 @@ module GoTransverseTractApi
73
75
  # @param {Hash} payment
74
76
  #
75
77
  def self.apply_refund eid, payment
76
- GoTransverseTractApi.post_request_for(self, {eid: eid}, payment, "applyRefund")
78
+ data = {
79
+ :applyRefund => {},
80
+ :payment => {
81
+ eid: payment[:payment][:eid]
82
+ },
83
+ :refund => {
84
+ :attributes => {
85
+ :amount => payment[:refund][:amount],
86
+ :description => payment[:refund][:description]
87
+ },
88
+ :originalPayment => {
89
+ eid: payment[:refund][:original_payment][:eid]
90
+ },
91
+ :refundReason => {
92
+ eid: payment[:refund][:refund_reason][:eid]
93
+ }
94
+ }
95
+ }
96
+
97
+ xml_data = GoTransverseTractApi.generateXML(data, 'applyRefund')
98
+ GoTransverseTractApi.post_request_for(self, {eid: eid}, xml_data, "applyRefund")
77
99
  end
78
100
 
79
101
  #
@@ -81,6 +103,19 @@ module GoTransverseTractApi
81
103
  # @param {Hash} payment
82
104
  #
83
105
  def self.cancel eid, payment
106
+ data = {
107
+ :cancelPayment => {
108
+ :description => payment[:description]
109
+ },
110
+ :payment => {
111
+ eid: payment[:payment][:eid]
112
+ },
113
+ :reason => {
114
+ eid: payment[:reason][:eid]
115
+ }
116
+ }
117
+
118
+ GoTransverseTractApi.generateXML(data, 'cancelPayment')
84
119
  GoTransverseTractApi.post_request_for(self, {eid: eid}, payment, "cancel")
85
120
  end
86
121
 
@@ -89,6 +124,23 @@ module GoTransverseTractApi
89
124
  # @param {Hash} payment
90
125
  #
91
126
  def self.reallocate eid, payment
127
+ data = {
128
+ :reallocatePayment => {
129
+ :description => payment[:description]
130
+ },
131
+ :payment => {
132
+ eid: payment[:payment][:eid]
133
+ },
134
+ :reason => {
135
+ eid: payment[:reason][:eid]
136
+ },
137
+ :invoices => {
138
+ :attributes => {},
139
+ :invoice => payment[:invoices]
140
+ }
141
+ }
142
+
143
+ GoTransverseTractApi.generateXML(data, 'reallocatePayment')
92
144
  GoTransverseTractApi.post_request_for(self, {eid: eid}, payment, "reallocate")
93
145
  end
94
146
 
@@ -96,7 +148,36 @@ module GoTransverseTractApi
96
148
  # @param {Hash} payment
97
149
  #
98
150
  def self.create_payment payment
99
- GoTransverseTractApi.post_request_for(self, {}, payment, "")
151
+ data = {
152
+ :payment => {
153
+ :amount => payment[:amount],
154
+ :description => payment[:description]
155
+ },
156
+ :billingAccount => {
157
+ eid: payment[:billing_account][:eid]
158
+ },
159
+ :creditCardPayment => {
160
+ :cardType => payment[:credit_card_payment][:card_type],
161
+ :cardHolderFirstName => payment[:credit_card_payment][:card_holder_first_name],
162
+ :cardHolderLastName => payment[:credit_card_payment][:card_holder_last_name],
163
+ :cardIdentifierNumber => payment[:credit_card_payment][:card_identifier_number],
164
+ :cardExpiration => payment[:credit_card_payment][:card_expiration]
165
+ },
166
+ :phoneNumber => {
167
+ :countryCode => payment[:phone_number][:country_code],
168
+ :areaCode => payment[:phone_number][:area_code],
169
+ :number => payment[:phone_number][:number],
170
+ :extension => payment[:phone_number][:extension],
171
+ :purpose => payment[:phone_number][:purpose]
172
+ },
173
+ :emailAddress => {
174
+ :email => payment[:email_address][:email],
175
+ :purpose => payment[:email_address][:purpose]
176
+ }
177
+ }
178
+
179
+ xml_data = GoTransverseTractApi.generateXML(data, 'payment')
180
+ GoTransverseTractApi.post_request_for(self, {}, xml_data, "")
100
181
  end
101
182
 
102
183
  end
@@ -68,7 +68,21 @@ module GoTransverseTractApi
68
68
  # @param {Hash} refund
69
69
  #
70
70
  def self.create_refund refund
71
- GoTransverseTractApi.post_request_for(self, {}, refund, "")
71
+ data = {
72
+ refund: {
73
+ amount: refund[:amount],
74
+ description: refund[:description]
75
+ },
76
+ originalPayment: {
77
+ eid: refund[:original_payment][:eid]
78
+ },
79
+ refundReason: {
80
+ eid: refund[:refund_reason][:eid]
81
+ }
82
+ }
83
+
84
+ xml_data = GoTransverseTractApi.generateXML(data, 'refund')
85
+ GoTransverseTractApi.post_request_for(self, {}, xml_data, "")
72
86
  end
73
87
 
74
88
  end
@@ -62,18 +62,190 @@ module GoTransverseTractApi
62
62
 
63
63
  #
64
64
  # @param {Long} eid
65
- # @param {Hash} approve
66
- #
67
- def self.approve eid, approve
68
- GoTransverseTractApi.post_request_for(self, {eid: eid}, approve, "approve")
65
+ # @param {Hash} order_item
66
+ #
67
+ def self.approve eid, order_item
68
+ data = {
69
+ :approveOrderItem => {
70
+ :approvalDate => order_item[:approval_date],
71
+ },
72
+ :orderItem => {
73
+ :attributes => {
74
+ :xsitype => order_item[:type],
75
+ :awaitingApproval => order_item[:awaiting_approval],
76
+ :requestedEffectiveDate => order_item[:requested_effective_date],
77
+ :unitPrice => order_item[:unit_price],
78
+ :recurringUnitPrice => order_item[:recurring_unit_price],
79
+ :quantity => order_item[:quantity],
80
+ :sequence => order_item[:sequence],
81
+ :approvalDate => order_item[:date_approval],
82
+ :description => order_item[:description],
83
+ eid: eid
84
+ },
85
+ :orderItems => {
86
+ :pageNumber => order_item[:order_items][:page_number],
87
+ :pageSize => order_item[:order_items][:page_size],
88
+ :totalElements => order_item[:order_items][:total_elements],
89
+ :elementCount => order_item[:order_items][:element_count],
90
+ :totalPages => order_item[:order_items][:total_pages]
91
+ },
92
+ :orderItemUsageRules => {
93
+ :pageNumber => order_item[:order_item_usage_rules][:page_number],
94
+ :pageNumber => order_item[:order_item_usage_rules][:page_number],
95
+ :totalElements => order_item[:order_item_usage_rules][:total_elements],
96
+ :elementCount => order_item[:order_item_usage_rules][:element_count],
97
+ :totalPages => order_item[:order_item_usage_rules][:total_pages]
98
+ },
99
+ :recurringProductPrice => {
100
+ :attributes => {
101
+ :fromDate => order_item[:recurring_product_price][:from_date],
102
+ :priceOverride => order_item[:recurring_product_price][:price_override],
103
+ :type => order_item[:recurring_product_price][:type],
104
+ :paymentOnPurchaseRequired => order_item[:recurring_product_price][:payment_on_purchase_required],
105
+ :recurringPaymentRequired => order_item[:recurring_product_price][:recurring_payment_required],
106
+ :recurrencePeriod => order_item[:recurring_product_price][:recurrence_period],
107
+ eid: order_item[:recurring_product_price][:eid]
108
+ },
109
+ :priceRanges => {
110
+ :attributes => {
111
+ :pageNumber => order_item[:recurring_product_price][:price_ranges][:page_number],
112
+ :pageSize => order_item[:recurring_product_price][:price_ranges][:page_size],
113
+ :totalElements => order_item[:recurring_product_price][:price_ranges][:total_elements],
114
+ :elementCount => order_item[:recurring_product_price][:price_ranges][:element_count],
115
+ :totalPages => order_item[:recurring_product_price][:price_ranges][:total_pages]
116
+ },
117
+ :priceRange => {
118
+ :quantityBeginRange => order_item[:recurring_product_price][:price_ranges][:price_range][:quantity_begin_range],
119
+ :price => order_item[:recurring_product_price][:price_ranges][:price_range][:price],
120
+ :level => order_item[:recurring_product_price][:price_ranges][:price_range][:level],
121
+ eid: order_item[:recurring_product_price][:price_ranges][:price_range][:eid]
122
+ }
123
+ }
124
+ },
125
+ :product => {
126
+ :attributes => {
127
+ :name => order_item[:product][:name],
128
+ :description => order_item[:product][:description],
129
+ :shortDescription => order_item[:product][:short_description],
130
+ :productTypeCode => order_item[:product][:product_type_code],
131
+ :productState => order_item[:product][:product_state],
132
+ :requiresAgreement => order_item[:product][:requires_agreement],
133
+ :serialized => order_item[:product][:serialized],
134
+ :taxable => order_item[:product][:taxable],
135
+ :trial => order_item[:product][:trial],
136
+ :defaultQuantity => order_item[:product][:default_quantity],
137
+ :internalName => order_item[:product][:internal_name],
138
+ :minServiceResources => order_item[:product][:min_service_resources],
139
+ :maxServiceResources => order_item[:product][:max_service_resources],
140
+ :trialOverride => order_item[:product][:trial_override],
141
+ eid: order_item[:product][:eid]
142
+ },
143
+ :productPrices => {
144
+ :attributes => {
145
+ :pageNumber => order_item[:product][:product_prices][:page_number],
146
+ :pageSize => order_item[:product][:product_prices][:page_size],
147
+ :totalElements => order_item[:product][:product_prices][:total_elements],
148
+ :elementCount => order_item[:product][:product_prices][:element_count],
149
+ :totalPages => order_item[:product][:product_prices][:total_pages]
150
+ },
151
+ :productPrice => {
152
+ :attributes => {
153
+ :fromDate => order_item[:product][:product_prices][:product_price][:from_date],
154
+ :priceOverride => order_item[:product][:product_prices][:product_price][:price_override],
155
+ :type => order_item[:product][:product_prices][:product_price][:type],
156
+ :paymentOnPurchaseRequired => order_item[:product][:product_prices][:product_price][:payment_on_purchase_required],
157
+ :recurringPaymentRequired => order_item[:product][:product_prices][:product_price][:recurring_payment_required],
158
+ :recurrencePeriod => order_item[:product][:product_prices][:product_price][:recurrence_period],
159
+ eid: order_item[:product][:product_prices][:product_price][:eid]
160
+ },
161
+ :priceRanges => {
162
+ :attributes => {
163
+ :pageNumber => order_item[:product][:product_prices][:product_price][:price_ranges][:page_number],
164
+ :pageSize => order_item[:product][:product_prices][:product_price][:price_ranges][:page_size],
165
+ :totalElements => order_item[:product][:product_prices][:product_price][:price_ranges][:total_elements],
166
+ :elementCount => order_item[:product][:product_prices][:product_price][:price_ranges][:element_count],
167
+ :totalPages => order_item[:product][:product_prices][:product_price][:price_ranges][:total_pages]
168
+ },
169
+ :priceRange => {
170
+ :quantityBeginRange => order_item[:product][:product_prices][:product_price][:price_ranges][:price_range][:quantity_begin_range],
171
+ :price => order_item[:product][:product_prices][:product_price][:price_ranges][:price_range][:price],
172
+ :level => order_item[:product][:product_prices][:product_price][:price_ranges][:price_range][:level],
173
+ eid: order_item[:product][:product_prices][:product_price][:price_ranges][:price_range][:eid]
174
+ }
175
+ }
176
+ }
177
+ },
178
+ :productCategory => {
179
+ :name => order_item[:product][:product_category][:name],
180
+ :description => order_item[:product][:product_category][:description],
181
+ :status => order_item[:product][:product_category][:status],
182
+ eid: order_item[:product][:product_category][:eid]
183
+ },
184
+ :serviceResourceCategory => {
185
+ :name => order_item[:product][:service_resource_category][:name],
186
+ :type => order_item[:product][:service_resource_category][:type],
187
+ :status => order_item[:product][:service_resource_category][:status],
188
+ eid: order_item[:product][:service_resource_category][:eid]
189
+ },
190
+ :actions => {
191
+ :pageNumber => order_item[:product][:actions][:page_number],
192
+ :pageSize => order_item[:product][:actions][:page_size],
193
+ :totalElements => order_item[:product][:actions][:total_elements],
194
+ :elementCount => order_item[:product][:actions][:element_count],
195
+ :totalPages => order_item[:product][:actions][:total_pages]
196
+ },
197
+ :productUsageRules => {
198
+ :pageNumber => order_item[:product][:product_usage_rules][:page_number],
199
+ :pageNumber => order_item[:product][:product_usage_rules][:page_number],
200
+ :totalElements => order_item[:product][:product_usage_rules][:total_elements],
201
+ :elementCount => order_item[:product][:product_usage_rules][:element_count],
202
+ :totalPages => order_item[:product][:product_usage_rules][:total_pages]
203
+ }
204
+ },
205
+ :priceList => {
206
+ :name => order_item[:price_list][:name],
207
+ eid: order_item[:price_list][:eid]
208
+ },
209
+ :serviceResources => {
210
+ :pageNumber => order_item[:service_resources][:page_number],
211
+ :pageNumber => order_item[:service_resources][:page_number],
212
+ :totalElements => order_item[:service_resources][:total_elements],
213
+ :elementCount => order_item[:service_resources][:element_count],
214
+ :totalPages => order_item[:service_resources][:total_pages]
215
+ },
216
+ :operationAttributes => {
217
+ :pageNumber => order_item[:operation_attributes][:page_number],
218
+ :pageNumber => order_item[:operation_attributes][:page_number],
219
+ :totalElements => order_item[:operation_attributes][:total_elements],
220
+ :elementCount => order_item[:operation_attributes][:element_count],
221
+ :totalPages => order_item[:operation_attributes][:total_pages]
222
+ },
223
+ :scheduledCharges => {
224
+ :pageNumber => order_item[:scheduled_charges][:page_number],
225
+ :pageNumber => order_item[:scheduled_charges][:page_number],
226
+ :totalElements => order_item[:scheduled_charges][:total_elements],
227
+ :elementCount => order_item[:scheduled_charges][:element_count],
228
+ :totalPages => order_item[:scheduled_charges][:total_pages]
229
+ }
230
+ }
231
+ }
232
+
233
+ xml_data = GoTransverseTractApi.generateXML(data, 'approveOrderItem')
234
+ GoTransverseTractApi.post_request_for(self, {eid: eid}, xml_data, "approve")
69
235
  end
70
236
 
71
237
  #
72
238
  # @param {Long} eid
73
- # @param {Hash} deny
239
+ # @param {Hash} orderitem
74
240
  #
75
- def self.deny eid, deny
76
- GoTransverseTractApi.post_request_for(self, {eid: eid}, deny, "deny")
241
+ def self.deny eid, orderitem
242
+ data = {
243
+ :denyOrderItem => {},
244
+ :orderItem => {eid: eid}
245
+ }
246
+
247
+ xml_data = GoTransverseTractApi.generateXML(data, 'denyOrderItem')
248
+ GoTransverseTractApi.post_request_for(self, {eid: eid}, xml_data, "deny")
77
249
  end
78
250
 
79
251
  end