gotransverse-tract-api 0.15.0 → 0.16.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ade70bd9064241aa193a7f6345ae4fb9e599287e
|
4
|
+
data.tar.gz: d6d307631ac9f0311d180550a2fc0686660db8fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c415d8bebd84fd852659a4ba1f249feaaf158721c874be40aadebcd60964b22ddfdeabbd8a88942d969e9630c480856bd55571e6e1fd0bdeb3feb4f2deed46c
|
7
|
+
data.tar.gz: eb997a8f6b129821c0e87856ee94b8d95bfe6c9a1998437b846cce0f7d20d297d69a97352f808973e58e2a2e925d920e9f9118f92709f6c3a5e5eee57fc14e80
|
@@ -385,13 +385,42 @@ module GoTransverseTractApi
|
|
385
385
|
# @param {Hash} billing_account
|
386
386
|
#
|
387
387
|
def create_billing_account billing_account
|
388
|
-
|
388
|
+
bill_cycle = {}
|
389
|
+
recurring_payments = {}
|
390
|
+
|
391
|
+
bill_type = {
|
389
392
|
billingAccount: {
|
390
393
|
billType: billing_account[:bill_type]
|
391
|
-
}
|
392
|
-
|
393
|
-
|
394
|
-
|
394
|
+
}
|
395
|
+
}
|
396
|
+
|
397
|
+
if(billing_account.has_key?(:daily_bill_cycle))
|
398
|
+
bill_cycle = {
|
399
|
+
dailyBillCycle: {
|
400
|
+
eid: billing_account[:daily_bill_cycle][:eid]
|
401
|
+
}
|
402
|
+
}
|
403
|
+
elsif(billing_account.has_key?(:monthly_bill_cycle))
|
404
|
+
bill_cycle = {
|
405
|
+
monthlyBillCycle: {
|
406
|
+
eid: billing_account[:monthly_bill_cycle][:eid]
|
407
|
+
}
|
408
|
+
}
|
409
|
+
elsif(billing_account.has_key?(:quarterly_bill_cycle))
|
410
|
+
bill_cycle = {
|
411
|
+
quarterlyBillCycle: {
|
412
|
+
eid: billing_account[:quarterly_bill_cycle][:eid]
|
413
|
+
}
|
414
|
+
}
|
415
|
+
elsif(billing_account.has_key?(:yearly_bill_cycle))
|
416
|
+
bill_cycle = {
|
417
|
+
yearlyBillCycle: {
|
418
|
+
eid: billing_account[:yearly_bill_cycle][:eid]
|
419
|
+
}
|
420
|
+
}
|
421
|
+
end
|
422
|
+
|
423
|
+
data = {
|
395
424
|
organization: {
|
396
425
|
attributes: {
|
397
426
|
name: billing_account[:organization][:name]
|
@@ -406,6 +435,23 @@ module GoTransverseTractApi
|
|
406
435
|
eid: billing_account[:payment_term][:eid]
|
407
436
|
}
|
408
437
|
}
|
438
|
+
|
439
|
+
if(billing_account.has_key?(:recurring_payments))
|
440
|
+
recurring_payments = {
|
441
|
+
recurringPayments: {
|
442
|
+
attributes: {},
|
443
|
+
recurringPayment: {
|
444
|
+
attributes: {},
|
445
|
+
referencedCreditCardPaymentMethod: {
|
446
|
+
referenceKey: billing_account[:recurring_payments][:recurring_payment][:referenced_credit_card_payment_method][:reference_key]
|
447
|
+
}
|
448
|
+
}
|
449
|
+
}
|
450
|
+
}
|
451
|
+
end
|
452
|
+
|
453
|
+
data = GoTransverseTractApi::ApiData.new.compact(bill_type.merge bill_cycle.merge data.merge recurring_payments)
|
454
|
+
|
409
455
|
xml_data = GoTransverseTractApi.generateXML(data, 'billingAccount')
|
410
456
|
GoTransverseTractApi.post_request_for(self, {}, xml_data, "")
|
411
457
|
end
|
@@ -227,6 +227,8 @@ module GoTransverseTractApi
|
|
227
227
|
#
|
228
228
|
|
229
229
|
def self.get_order_item(order_item)
|
230
|
+
|
231
|
+
# The following order item keys are optional in TRACT system
|
230
232
|
if order_item.has_key?(:price_list)
|
231
233
|
price_list = Product::PriceList.get_price_list(order_item[:price_list])
|
232
234
|
end
|
@@ -259,6 +261,10 @@ module GoTransverseTractApi
|
|
259
261
|
agreement_configuration = AgreementConfiguration.get_agreement_conf(order_item[:agreement_configuration])
|
260
262
|
end
|
261
263
|
|
264
|
+
if order_item.has_key?(:selected_agreement)
|
265
|
+
selected_agreement = Agreement.get_selected_agreement(order_item[:selected_agreement])
|
266
|
+
end
|
267
|
+
|
262
268
|
if order_item.has_key?(:onetime_product_price)
|
263
269
|
# We can add later this one as a separate class for getting all other attributes
|
264
270
|
onetime_product_price = {
|
@@ -268,6 +274,13 @@ module GoTransverseTractApi
|
|
268
274
|
}
|
269
275
|
end
|
270
276
|
|
277
|
+
# The parent orderItems may have child orderItems
|
278
|
+
if order_item.has_key?(:order_items)
|
279
|
+
order_items = {
|
280
|
+
attributes: {},
|
281
|
+
orderItem: GoTransverseTractApi::ApiData.new.get_order_items(order_item[:order_items][:order_item])
|
282
|
+
}
|
283
|
+
end
|
271
284
|
|
272
285
|
orderItem = {
|
273
286
|
attributes: {
|
@@ -286,8 +299,9 @@ module GoTransverseTractApi
|
|
286
299
|
onetimeProductPrice: onetime_product_price,
|
287
300
|
customFieldValues: custom_field_values,
|
288
301
|
product: Product::Product.get_product_info(order_item[:product]),
|
302
|
+
orderItems: order_items,
|
289
303
|
priceList: price_list,
|
290
|
-
selectedAgreement:
|
304
|
+
selectedAgreement: selected_agreement,
|
291
305
|
serviceResources: service_resources,
|
292
306
|
inventoryItem: inventory_item,
|
293
307
|
agreementConfiguration: agreement_configuration,
|
@@ -180,26 +180,58 @@ module GoTransverseTractApi
|
|
180
180
|
end
|
181
181
|
end
|
182
182
|
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
183
|
+
describe ".create_billing_account" do
|
184
|
+
context "for daily bill cycle" do
|
185
|
+
it "creates a billing account" do
|
186
|
+
data = {
|
187
|
+
bill_type: 'NONE',
|
188
|
+
daily_bill_cycle: { eid:'38' },
|
189
|
+
organization: {
|
190
|
+
name: 'LMH Services',
|
191
|
+
addresses: addresses.delete_if{|k,v| k == :telecom_address}
|
192
|
+
},
|
193
|
+
billing_account_category: {
|
194
|
+
eid: '6'
|
195
|
+
},
|
196
|
+
payment_term: {
|
197
|
+
name: 'Immediate',
|
198
|
+
eid: '8'
|
199
|
+
}
|
200
|
+
}
|
201
|
+
|
202
|
+
allow(subject).to receive(:create_billing_account).with(data).and_return(response)
|
203
|
+
expect(subject.create_billing_account(data)).to eq(response)
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
context "for monthly bill cycle" do
|
208
|
+
it "creates a billing account" do
|
209
|
+
data = {
|
210
|
+
bill_type: 'EMAIL',
|
211
|
+
monthly_bill_cycle: { eid:'38' },
|
212
|
+
organization: {
|
213
|
+
name: 'LMH Services',
|
214
|
+
addresses: addresses.delete_if{|k,v| k == :telecom_address}
|
215
|
+
},
|
216
|
+
billing_account_category: {
|
217
|
+
eid: '6'
|
218
|
+
},
|
219
|
+
payment_term: {
|
220
|
+
name: 'Immediate',
|
221
|
+
eid: '8'
|
222
|
+
},
|
223
|
+
recurring_payments: {
|
224
|
+
recurring_payment: {
|
225
|
+
referenced_credit_card_payment_method: {
|
226
|
+
reference_key: '2342gjg224g24h1khk1rweyf93'
|
227
|
+
}
|
228
|
+
}
|
229
|
+
}
|
198
230
|
}
|
199
|
-
}
|
200
231
|
|
201
|
-
|
202
|
-
|
232
|
+
allow(subject).to receive(:create_billing_account).with(data).and_return(response)
|
233
|
+
expect(subject.create_billing_account(data)).to eq(response)
|
234
|
+
end
|
203
235
|
end
|
204
236
|
end
|
205
237
|
|
@@ -340,24 +372,70 @@ module GoTransverseTractApi
|
|
340
372
|
}
|
341
373
|
}
|
342
374
|
}
|
343
|
-
|
344
|
-
|
345
|
-
|
375
|
+
|
376
|
+
let(:soi_data) { {
|
377
|
+
sales_order: {
|
378
|
+
referral: '',
|
379
|
+
order_date: '2016-01-28T172213',
|
380
|
+
order_status: 'DRAFT',
|
381
|
+
custom_field_values: {
|
382
|
+
custom_field_value: {
|
383
|
+
value: 'ST',
|
384
|
+
custom_field: {eid: '26'}
|
385
|
+
}
|
386
|
+
},
|
387
|
+
order_items: {
|
388
|
+
order_item: {
|
389
|
+
recurring_unit_price: '0.00',
|
390
|
+
quantity: '1',
|
391
|
+
sequence: '1',
|
392
|
+
description: 'Data Subscription',
|
393
|
+
product: { eid: '111' },
|
394
|
+
recurring_product_price: { eid: '294' },
|
395
|
+
order_items: {
|
396
|
+
order_item: {
|
397
|
+
recurring_unit_price: '0.10',
|
398
|
+
quantity: '1500',
|
399
|
+
sequence: '2',
|
400
|
+
description: 'LAP',
|
401
|
+
product: { eid: '110' },
|
402
|
+
recurring_product_price: { eid: '301' }
|
403
|
+
}
|
404
|
+
}
|
405
|
+
}
|
406
|
+
},
|
407
|
+
billing_account: { eid: eid }
|
408
|
+
}
|
409
|
+
}
|
410
|
+
}
|
411
|
+
|
412
|
+
context "when SOI upsell products" do
|
413
|
+
it "creates a draft sales order without a promo code for the billing account" do
|
414
|
+
allow(subject).to receive(:create_draft_order).with(eid, soi_data).and_return(response)
|
415
|
+
expect(subject.create_draft_order(eid, soi_data)).to eq(response)
|
416
|
+
end
|
346
417
|
end
|
347
418
|
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
419
|
+
context "when no SOI upsell products" do
|
420
|
+
it "creates a draft sales order without a promo code for the billing account" do
|
421
|
+
allow(subject).to receive(:create_draft_order).with(eid, data).and_return(response)
|
422
|
+
expect(subject.create_draft_order(eid, data)).to eq(response)
|
423
|
+
end
|
424
|
+
|
425
|
+
it "creates a draft sales order with promo code for the billing account" do
|
426
|
+
promo_code = {
|
427
|
+
discount_configurations: {
|
428
|
+
discount_configuration: {
|
429
|
+
discount_identifier: { eid:'35' }
|
430
|
+
}
|
353
431
|
}
|
354
432
|
}
|
355
|
-
}
|
356
433
|
|
357
|
-
|
434
|
+
[0,1].each { |i| data[:sales_order][:order_items][:order_item][i].merge! promo_code }
|
358
435
|
|
359
|
-
|
360
|
-
|
436
|
+
allow(subject).to receive(:create_draft_order).with(eid, data).and_return(response)
|
437
|
+
expect(subject.create_draft_order(eid, data)).to eq(response)
|
438
|
+
end
|
361
439
|
end
|
362
440
|
end
|
363
441
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gotransverse-tract-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.16.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julien DeFrance
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-06-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -259,7 +259,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
259
259
|
version: '0'
|
260
260
|
requirements: []
|
261
261
|
rubyforge_project:
|
262
|
-
rubygems_version: 2.4.
|
262
|
+
rubygems_version: 2.4.8
|
263
263
|
signing_key:
|
264
264
|
specification_version: 4
|
265
265
|
summary: A ruby gem allowing developers to conveniently integrate with GoTransverse's
|