bill_forward 1.2014.296

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 (84) hide show
  1. data/.gitignore +27 -0
  2. data/.idea/.name +1 -0
  3. data/.idea/compiler.xml +23 -0
  4. data/.idea/copyright/profiles_settings.xml +3 -0
  5. data/.idea/encodings.xml +5 -0
  6. data/.idea/inspectionProfiles/Project_Default.xml +11 -0
  7. data/.idea/inspectionProfiles/profiles_settings.xml +7 -0
  8. data/.idea/misc.xml +23 -0
  9. data/.idea/modules.xml +9 -0
  10. data/.idea/scopes/scope_settings.xml +5 -0
  11. data/.idea/vcs.xml +7 -0
  12. data/.rspec +2 -0
  13. data/Gemfile +9 -0
  14. data/LICENSE.md +22 -0
  15. data/README.md +227 -0
  16. data/Rakefile +73 -0
  17. data/bill_forward.gemspec +29 -0
  18. data/bill_forward.iml +28 -0
  19. data/lib/bill_forward.rb +18 -0
  20. data/lib/bill_forward/billing_entity.rb +263 -0
  21. data/lib/bill_forward/client.rb +355 -0
  22. data/lib/bill_forward/custom_hash.rb +14 -0
  23. data/lib/bill_forward/deny_method.rb +4 -0
  24. data/lib/bill_forward/entities/account.rb +19 -0
  25. data/lib/bill_forward/entities/address.rb +25 -0
  26. data/lib/bill_forward/entities/amendments/amendment.rb +11 -0
  27. data/lib/bill_forward/entities/amendments/invoice_recalculation_amendment.rb +10 -0
  28. data/lib/bill_forward/entities/api_configuration.rb +11 -0
  29. data/lib/bill_forward/entities/authorize_net_token.rb +9 -0
  30. data/lib/bill_forward/entities/credit_note.rb +13 -0
  31. data/lib/bill_forward/entities/invoice.rb +25 -0
  32. data/lib/bill_forward/entities/invoice_parts/invoice_line.rb +37 -0
  33. data/lib/bill_forward/entities/invoice_parts/invoice_payment.rb +29 -0
  34. data/lib/bill_forward/entities/invoice_parts/tax_line.rb +23 -0
  35. data/lib/bill_forward/entities/invoice_parts/taxation_link.rb +5 -0
  36. data/lib/bill_forward/entities/organisation.rb +37 -0
  37. data/lib/bill_forward/entities/payment_method.rb +5 -0
  38. data/lib/bill_forward/entities/payment_method_subscription_link.rb +5 -0
  39. data/lib/bill_forward/entities/pricing_component.rb +21 -0
  40. data/lib/bill_forward/entities/pricing_component_tier.rb +5 -0
  41. data/lib/bill_forward/entities/pricing_component_value.rb +5 -0
  42. data/lib/bill_forward/entities/pricing_component_value_change.rb +5 -0
  43. data/lib/bill_forward/entities/product.rb +5 -0
  44. data/lib/bill_forward/entities/product_rate_plan.rb +19 -0
  45. data/lib/bill_forward/entities/profile.rb +15 -0
  46. data/lib/bill_forward/entities/role.rb +4 -0
  47. data/lib/bill_forward/entities/subscription.rb +53 -0
  48. data/lib/bill_forward/entities/unit_of_measure.rb +5 -0
  49. data/lib/bill_forward/insertable_entity.rb +32 -0
  50. data/lib/bill_forward/mutable_entity.rb +47 -0
  51. data/lib/bill_forward/resource_path.rb +11 -0
  52. data/lib/bill_forward/type_check.rb +21 -0
  53. data/lib/bill_forward/version.rb +4 -0
  54. data/spec/component/account_spec.rb +200 -0
  55. data/spec/component/billing_entity_spec.rb +153 -0
  56. data/spec/component/invoice_spec.rb +155 -0
  57. data/spec/component/subscription_spec.rb +357 -0
  58. data/spec/functional/account_spec.rb +25 -0
  59. data/spec/functional/bad_citizen/account_spec.rb +103 -0
  60. data/spec/functional/bad_citizen/credit_note_spec.rb +41 -0
  61. data/spec/functional/bad_citizen/payment_method_spec.rb +34 -0
  62. data/spec/functional/bad_citizen/product_rate_plan_spec.rb +105 -0
  63. data/spec/functional/bad_citizen/product_spec.rb +22 -0
  64. data/spec/functional/bad_citizen/situational/authorize_net_token_spec.rb +27 -0
  65. data/spec/functional/bad_citizen/situational/invoice_recalculation_amendment_spec.rb +27 -0
  66. data/spec/functional/bad_citizen/situational/invoice_spec.rb +22 -0
  67. data/spec/functional/bad_citizen/situational/malordered_entity_spec.rb +43 -0
  68. data/spec/functional/bad_citizen/situational/organisation_spec.rb +39 -0
  69. data/spec/functional/bad_citizen/situational/payment_method_spec.rb +47 -0
  70. data/spec/functional/bad_citizen/situational/subscription_chargeable_spec.rb +255 -0
  71. data/spec/functional/bad_citizen/subscription_spec.rb +179 -0
  72. data/spec/functional/bad_citizen/subscription_with_credit_spec.rb +240 -0
  73. data/spec/functional/bad_citizen/unit_of_measure_spec.rb +20 -0
  74. data/spec/functional/billing_entity_spec.rb +22 -0
  75. data/spec/functional/client_spec.rb +24 -0
  76. data/spec/functional/organisation_spec.rb +28 -0
  77. data/spec/setup_test_constants.rb +73 -0
  78. data/spec/spec_helper.rb +11 -0
  79. data/spec/syntax/account_spec.rb +24 -0
  80. data/spec/syntax/address_spec.rb +19 -0
  81. data/spec/syntax/api_configuration_spec.rb +13 -0
  82. data/spec/syntax/billing_entity_spec.rb +93 -0
  83. data/spec/syntax/client_spec.rb +8 -0
  84. metadata +287 -0
@@ -0,0 +1,155 @@
1
+ require File.join(File.expand_path(File.dirname(__FILE__)), "..", "spec_helper")
2
+
3
+ describe BillForward::Invoice do
4
+ before :all do
5
+ @client = BillForwardTest::TEST_CLIENT
6
+ BillForward::Client.default_client = @client
7
+ end
8
+ before :each do
9
+ # skip OAuth request
10
+ allow_any_instance_of(BillForward::Client).to receive(:get_token).and_return('fake token')
11
+ end
12
+ describe '::get_by_id' do
13
+ context 'where invoice exists' do
14
+ it "gets the invoice" do
15
+ invoice_id = 'BAE03D0F-68B6-46AA-B5D5-26BD83453C05'
16
+
17
+ response = double
18
+ allow(response).to receive(:to_str).and_return(canned_invoice_get)
19
+ allow(RestClient::Request).to receive(:execute).and_return(response)
20
+
21
+ invoice = BillForward::Invoice.get_by_id invoice_id
22
+
23
+ expect(invoice.id).to eq(invoice_id)
24
+ end
25
+ end
26
+ end
27
+ end
28
+
29
+ def canned_invoice_get
30
+ '{
31
+ "nextPage" : "/invoices/BAE03D0F-68B6-46AA-B5D5-26BD83453C05?format=JSON&offset=10&records=10&include_retired=true&order_by=created&order=DESC",
32
+ "totalPages" : 1,
33
+ "currentPage" : 1,
34
+ "currentOffset" : 0,
35
+ "recordsRequested" : 10,
36
+ "recordsReturned" : 1,
37
+ "totalRecords" : 1,
38
+ "executionTime" : 3729707,
39
+ "results" : [ {
40
+ "@type" : "invoice",
41
+ "created" : "2014-09-23T16:36:32Z",
42
+ "changedBy" : "System",
43
+ "updated" : "2014-09-23T16:36:34Z",
44
+ "versionID" : "BAE03D0F-68B6-46AA-B5D5-26BD83453C05",
45
+ "id" : "BAE03D0F-68B6-46AA-B5D5-26BD83453C05",
46
+ "subscriptionID" : "94956988-697E-4D06-8466-59F42255FECD",
47
+ "accountID" : "C82E3F28-0831-4F37-BDA3-8BF3D924E54B",
48
+ "organizationID" : "F60667D7-583A-4A01-B4DC-F74CC45ACAE3",
49
+ "state" : "Paid",
50
+ "periodStart" : "2014-09-23T16:36:28Z",
51
+ "periodEnd" : "2014-10-21T16:36:28Z",
52
+ "deleted" : false,
53
+ "totalExecutionAttempts" : 1,
54
+ "lastExecutionAttempt" : "2014-09-23T16:36:34Z",
55
+ "nextExecutionAttempt" : "2014-09-23T16:36:28Z",
56
+ "finalExecutionAttempt" : "2014-09-23T16:36:34Z",
57
+ "paymentReceived" : "2014-09-23T16:36:34Z",
58
+ "currency" : "USD",
59
+ "costExcludingTax" : 31.00,
60
+ "invoiceCost" : 31.00,
61
+ "invoicePaid" : 0.00,
62
+ "discountAmount" : 0.00,
63
+ "invoiceRefunded" : 0.00,
64
+ "type" : "Subscription",
65
+ "managedBy" : "BillForward",
66
+ "initialInvoice" : true,
67
+ "versionNumber" : 1,
68
+ "invoiceLines" : [ {
69
+ "created" : "2014-09-23T16:36:32Z",
70
+ "changedBy" : "System",
71
+ "updated" : "2014-09-23T16:36:32Z",
72
+ "id" : "0E0DC183-11BA-493C-86E1-E245726184A2",
73
+ "invoiceID" : "BAE03D0F-68B6-46AA-B5D5-26BD83453C05",
74
+ "unitOfMeasureID" : "FC015845-E829-4100-949F-44F3F2C63587",
75
+ "unitOfMeasure" : {
76
+ "created" : "2014-09-23T16:36:02Z",
77
+ "changedBy" : "7872F2F4-ED96-4038-BC82-39F7DDFECE60",
78
+ "updated" : "2014-09-23T16:36:02Z",
79
+ "id" : "FC015845-E829-4100-949F-44F3F2C63587",
80
+ "name" : "Devices",
81
+ "organizationID" : "F60667D7-583A-4A01-B4DC-F74CC45ACAE3",
82
+ "displayedAs" : "Devices",
83
+ "roundingScheme" : "UP",
84
+ "deleted" : false
85
+ },
86
+ "organizationID" : "F60667D7-583A-4A01-B4DC-F74CC45ACAE3",
87
+ "name" : "Devices used, tiered",
88
+ "description" : "How many devices you use, but with a tiering system",
89
+ "calculation" : "1 items at flat cost 10.00000\t4 items at 5.00000 each, cost 20.00000\t",
90
+ "cost" : 30.00,
91
+ "tax" : 0.00,
92
+ "componentValue" : 5
93
+ }, {
94
+ "created" : "2014-09-23T16:36:32Z",
95
+ "changedBy" : "System",
96
+ "updated" : "2014-09-23T16:36:32Z",
97
+ "id" : "D0349A38-067F-49CA-A756-A4C545A443EB",
98
+ "invoiceID" : "BAE03D0F-68B6-46AA-B5D5-26BD83453C05",
99
+ "unitOfMeasureID" : "FC015845-E829-4100-949F-44F3F2C63587",
100
+ "unitOfMeasure" : {
101
+ "created" : "2014-09-23T16:36:02Z",
102
+ "changedBy" : "7872F2F4-ED96-4038-BC82-39F7DDFECE60",
103
+ "updated" : "2014-09-23T16:36:02Z",
104
+ "id" : "FC015845-E829-4100-949F-44F3F2C63587",
105
+ "name" : "Devices",
106
+ "organizationID" : "F60667D7-583A-4A01-B4DC-F74CC45ACAE3",
107
+ "displayedAs" : "Devices",
108
+ "roundingScheme" : "UP",
109
+ "deleted" : false
110
+ },
111
+ "organizationID" : "F60667D7-583A-4A01-B4DC-F74CC45ACAE3",
112
+ "name" : "Devices used, fixed",
113
+ "description" : "How many devices you use, I guess",
114
+ "calculation" : "Items at flat cost 1.00000\t",
115
+ "cost" : 1.00,
116
+ "tax" : 0.00,
117
+ "componentValue" : 1
118
+ } ],
119
+ "taxLines" : [ ],
120
+ "invoicePayments" : [ {
121
+ "created" : "2014-09-23T16:36:34Z",
122
+ "changedBy" : "System",
123
+ "updated" : "2014-09-23T16:36:34Z",
124
+ "id" : "FCB1FF2C-84FC-417D-A9DB-77D899842C7E",
125
+ "paymentID" : "AD677566-5D58-4E1D-9D56-03C83F2BB987",
126
+ "invoiceID" : "BAE03D0F-68B6-46AA-B5D5-26BD83453C05",
127
+ "organizationID" : "F60667D7-583A-4A01-B4DC-F74CC45ACAE3",
128
+ "currency" : "USD",
129
+ "nominalAmount" : 31.00,
130
+ "actualAmount" : 0.00,
131
+ "refundedAmount" : 0.00,
132
+ "payment" : {
133
+ "@type" : "creditNotePayment",
134
+ "created" : "2014-09-23T16:36:34Z",
135
+ "changedBy" : "System",
136
+ "updated" : "2014-09-23T16:36:34Z",
137
+ "id" : "AD677566-5D58-4E1D-9D56-03C83F2BB987",
138
+ "paymentMethodID" : "A1F0B567-1E63-4A22-9B6C-0C81A7E7F709",
139
+ "invoiceID" : "BAE03D0F-68B6-46AA-B5D5-26BD83453C05",
140
+ "organizationID" : "F60667D7-583A-4A01-B4DC-F74CC45ACAE3",
141
+ "gateway" : "credit_note",
142
+ "currency" : "USD",
143
+ "nominalValue" : 31.00,
144
+ "actualValue" : 0.00,
145
+ "remainingNominalValue" : 0.00,
146
+ "paymentReceived" : "2014-09-23T16:36:34Z",
147
+ "refundedValue" : 0.00,
148
+ "type" : "debit"
149
+ }
150
+ } ],
151
+ "invoiceRefunds" : [ ],
152
+ "invoiceCreditNotes" : [ ]
153
+ } ]
154
+ }'
155
+ end
@@ -0,0 +1,357 @@
1
+ require File.join(File.expand_path(File.dirname(__FILE__)), "..", "spec_helper")
2
+
3
+ describe BillForward::Subscription do
4
+ before :all do
5
+ @client = BillForwardTest::TEST_CLIENT
6
+ BillForward::Client.default_client = @client
7
+ end
8
+ before :each do
9
+ # skip OAuth request
10
+ allow_any_instance_of(BillForward::Client).to receive(:get_token).and_return('fake token')
11
+ end
12
+ describe '::get_by_id' do
13
+ context 'where subscription exists' do
14
+ describe 'the unserialized subscription' do
15
+ describe '.to_ordered_hash' do
16
+ context 'using array access' do
17
+ it "has @type at top" do
18
+ subscription_id = 'ACD66517-6F32-44CB-AF8C-3097F97E1E67'
19
+
20
+ response = double
21
+ allow(response).to receive(:to_str).and_return(canned_subscription_get)
22
+ allow(RestClient::Request).to receive(:execute).and_return(response)
23
+
24
+ subscription = BillForward::Subscription.get_by_id subscription_id
25
+
26
+ # mainly just confirm that unserialization is reasonably healthy.
27
+ expect(subscription.id).to eq(subscription_id)
28
+
29
+ # check that @type is the first key on subscription (we use ordered hashes)
30
+ payload = subscription.to_ordered_hash
31
+ payload_first_kvp = payload.first
32
+ kvp_key = payload_first_kvp.first
33
+ expect(kvp_key).to eq('@type')
34
+
35
+ # check that @type is the first key on nested entities (we use ordered hashes)
36
+ a_pricing_component = payload['productRatePlan']['pricingComponents'].first
37
+ pricing_component_first_kvp = a_pricing_component.first
38
+ kvp_key = pricing_component_first_kvp.first
39
+ expect(kvp_key).to eq('@type')
40
+ end
41
+ end
42
+ context 'using dot access' do
43
+ it "has @type at top" do
44
+ subscription_id = 'ACD66517-6F32-44CB-AF8C-3097F97E1E67'
45
+
46
+ response = double
47
+ allow(response).to receive(:to_str).and_return(canned_subscription_get)
48
+ allow(RestClient::Request).to receive(:execute).and_return(response)
49
+
50
+ subscription = BillForward::Subscription.get_by_id subscription_id
51
+
52
+ # mainly just confirm that unserialization is reasonably healthy.
53
+ expect(subscription.id).to eq(subscription_id)
54
+
55
+ # check that @type is the first key on subscription (we use ordered hashes)
56
+ payload = subscription.to_ordered_hash
57
+ payload_first_kvp = payload.first
58
+ kvp_key = payload_first_kvp.first
59
+ expect(kvp_key).to eq('@type')
60
+
61
+ # check that @type is the first key on nested entities (we use ordered hashes)
62
+ a_pricing_component = payload.productRatePlan.pricingComponents.first
63
+ pricing_component_first_kvp = a_pricing_component.first
64
+ kvp_key = pricing_component_first_kvp.first
65
+ expect(kvp_key).to eq('@type')
66
+ end
67
+ end
68
+ end
69
+ # NOTE: ideally no anonymous entity would exist, because we would register all known nested entities.
70
+ # they're sort of a 'last resort' for when the API has more fields than we realized (ie version change, or lack of parity).
71
+ # this test will soon self-deprecate, because we aim to register all entities that we support anyway.
72
+ # more it exists to confirm the world works at the time of writing -- but it shouldn't be used as a lasting regression test,
73
+ # since that means leaving known nested anonymous entities in on purpose!
74
+ describe 'nested anonymous entity' do
75
+ context 'using dot access' do
76
+ it "can be read" do
77
+ subscription_id = 'ACD66517-6F32-44CB-AF8C-3097F97E1E67'
78
+
79
+ response = double
80
+ allow(response).to receive(:to_str).and_return(canned_subscription_get)
81
+ allow(RestClient::Request).to receive(:execute).and_return(response)
82
+
83
+ subscription = BillForward::Subscription.get_by_id subscription_id
84
+
85
+ a_pricing_component = subscription.productRatePlan.pricingComponents.first
86
+ expect(a_pricing_component.name).to eq('Devices used, fixed')
87
+ end
88
+ it "can be changed" do
89
+ subscription_id = 'ACD66517-6F32-44CB-AF8C-3097F97E1E67'
90
+
91
+ response = double
92
+ allow(response).to receive(:to_str).and_return(canned_subscription_get)
93
+ allow(RestClient::Request).to receive(:execute).and_return(response)
94
+
95
+ subscription = BillForward::Subscription.get_by_id subscription_id
96
+
97
+ a_pricing_component = subscription.productRatePlan.pricingComponents.first
98
+ expect(a_pricing_component.name).to eq('Devices used, fixed')
99
+
100
+ new_name = 'bob'
101
+ a_pricing_component.name = new_name
102
+ expect(a_pricing_component.name).to eq(new_name)
103
+ expect(subscription.productRatePlan.pricingComponents.first.name).to eq(new_name)
104
+ end
105
+ end
106
+ context 'using array access' do
107
+ it "can be read" do
108
+ subscription_id = 'ACD66517-6F32-44CB-AF8C-3097F97E1E67'
109
+
110
+ response = double
111
+ allow(response).to receive(:to_str).and_return(canned_subscription_get)
112
+ allow(RestClient::Request).to receive(:execute).and_return(response)
113
+
114
+ subscription = BillForward::Subscription.get_by_id subscription_id
115
+
116
+ a_pricing_component = subscription['productRatePlan']['pricingComponents'].first
117
+ expect(a_pricing_component['name']).to eq('Devices used, fixed')
118
+ end
119
+ it "can be changed" do
120
+ subscription_id = 'ACD66517-6F32-44CB-AF8C-3097F97E1E67'
121
+
122
+ response = double
123
+ allow(response).to receive(:to_str).and_return(canned_subscription_get)
124
+ allow(RestClient::Request).to receive(:execute).and_return(response)
125
+
126
+ subscription = BillForward::Subscription.get_by_id subscription_id
127
+
128
+ a_pricing_component = subscription['productRatePlan']['pricingComponents'].first
129
+ expect(a_pricing_component['name']).to eq('Devices used, fixed')
130
+
131
+ new_name = 'bob'
132
+ a_pricing_component.name = new_name
133
+ expect(a_pricing_component['name']).to eq(new_name)
134
+ expect(subscription['productRatePlan']['pricingComponents'].first['name']).to eq(new_name)
135
+ end
136
+ end
137
+ end
138
+ end
139
+ end
140
+ end
141
+ end
142
+
143
+ def canned_subscription_get
144
+ '{
145
+ "executionTime" : 702594685,
146
+ "results" : [ {
147
+ "@type" : "subscription",
148
+ "created" : "2014-09-24T17:21:02Z",
149
+ "changedBy" : "System",
150
+ "updated" : "2014-09-24T17:22:04Z",
151
+ "id" : "ACD66517-6F32-44CB-AF8C-3097F97E1E67",
152
+ "accountID" : "14384081-3A24-460A-AE67-40E0488B267A",
153
+ "organizationID" : "7F3D3A3C-BAA4-4698-9645-EC33F853B3D8",
154
+ "productID" : "0CE0A471-A8B1-4E33-B5F4-115947DE8C55",
155
+ "productRatePlanID" : "BFE95484-D1D0-4296-ABB8-C2A3D4CE95EF",
156
+ "name" : "Memorable Subscription",
157
+ "description" : "Memorable Subscription Description",
158
+ "type" : "Subscription",
159
+ "state" : "Expired",
160
+ "currentPeriodStart" : "2014-09-24T17:21:02Z",
161
+ "currentPeriodEnd" : "2014-09-24T17:22:02Z",
162
+ "subscriptionEnd" : "2014-09-24T17:22:02Z",
163
+ "initialPeriodStart" : "2014-09-24T17:21:02Z",
164
+ "successfulPeriods" : 1,
165
+ "managedBy" : "BillForward",
166
+ "productRatePlan" : {
167
+ "created" : "2014-09-24T17:21:00Z",
168
+ "changedBy" : "614E626E-72BF-4B69-B40E-0B72A1BB7CF4",
169
+ "updated" : "2014-09-24T17:21:00Z",
170
+ "id" : "BFE95484-D1D0-4296-ABB8-C2A3D4CE95EF",
171
+ "productID" : "0CE0A471-A8B1-4E33-B5F4-115947DE8C55",
172
+ "organizationID" : "7F3D3A3C-BAA4-4698-9645-EC33F853B3D8",
173
+ "currency" : "USD",
174
+ "taxStatus" : "inclusive",
175
+ "proRataMode" : "WithCoupon",
176
+ "name" : "A sound plan",
177
+ "validFrom" : "2014-09-24T17:21:00Z",
178
+ "taxation" : [ ],
179
+ "fixedTermDefinitions" : [ ],
180
+ "product" : {
181
+ "created" : "2014-09-24T17:20:59Z",
182
+ "changedBy" : "614E626E-72BF-4B69-B40E-0B72A1BB7CF4",
183
+ "updated" : "2014-09-24T17:20:59Z",
184
+ "id" : "0CE0A471-A8B1-4E33-B5F4-115947DE8C55",
185
+ "organizationID" : "7F3D3A3C-BAA4-4698-9645-EC33F853B3D8",
186
+ "name" : "Month of Paracetamoxyfrusebendroneomycin",
187
+ "description" : "It can cure the common cold and being struck by lightning",
188
+ "duration" : 1,
189
+ "durationPeriod" : "minutes",
190
+ "trial" : 0,
191
+ "trialPeriod" : "none",
192
+ "productType" : "non-recurring",
193
+ "deleted" : false,
194
+ "state" : "prod"
195
+ },
196
+ "pricingComponents" : [ {
197
+ "@type" : "flatPricingComponent",
198
+ "created" : "2014-09-24T17:21:01Z",
199
+ "changedBy" : "614E626E-72BF-4B69-B40E-0B72A1BB7CF4",
200
+ "updated" : "2014-09-24T17:21:01Z",
201
+ "versionID" : "71753C8E-E477-4DF6-8C32-20FACA3E5B20",
202
+ "id" : "71753C8E-E477-4DF6-8C32-20FACA3E5B20",
203
+ "productRatePlanID" : "BFE95484-D1D0-4296-ABB8-C2A3D4CE95EF",
204
+ "unitOfMeasureID" : "6EB5B013-AFD3-4FC6-BDED-73FC681F23EE",
205
+ "organizationID" : "7F3D3A3C-BAA4-4698-9645-EC33F853B3D8",
206
+ "name" : "Devices used, fixed",
207
+ "description" : "How many devices you use, I guess",
208
+ "chargeType" : "subscription",
209
+ "chargeModel" : "flat",
210
+ "upgradeMode" : "immediate",
211
+ "downgradeMode" : "immediate",
212
+ "defaultQuantity" : 1,
213
+ "minQuantity" : 0,
214
+ "validFrom" : "2014-09-24T17:21:00Z",
215
+ "tiers" : [ {
216
+ "created" : "2014-09-24T17:21:01Z",
217
+ "changedBy" : "614E626E-72BF-4B69-B40E-0B72A1BB7CF4",
218
+ "id" : "EA6A046F-B436-4D5F-A4CE-14638E2A574C",
219
+ "pricingComponentVersionID" : "71753C8E-E477-4DF6-8C32-20FACA3E5B20",
220
+ "pricingComponentID" : "71753C8E-E477-4DF6-8C32-20FACA3E5B20",
221
+ "productRatePlanID" : "BFE95484-D1D0-4296-ABB8-C2A3D4CE95EF",
222
+ "organizationID" : "7F3D3A3C-BAA4-4698-9645-EC33F853B3D8",
223
+ "lowerThreshold" : 1,
224
+ "upperThreshold" : 1,
225
+ "pricingType" : "fixed",
226
+ "price" : 1.00000
227
+ } ],
228
+ "unitOfMeasure" : {
229
+ "created" : "2014-09-24T17:20:58Z",
230
+ "changedBy" : "614E626E-72BF-4B69-B40E-0B72A1BB7CF4",
231
+ "updated" : "2014-09-24T17:20:58Z",
232
+ "id" : "6EB5B013-AFD3-4FC6-BDED-73FC681F23EE",
233
+ "name" : "Devices",
234
+ "organizationID" : "7F3D3A3C-BAA4-4698-9645-EC33F853B3D8",
235
+ "displayedAs" : "Devices",
236
+ "roundingScheme" : "UP",
237
+ "deleted" : false
238
+ }
239
+ }, {
240
+ "@type" : "tieredPricingComponent",
241
+ "created" : "2014-09-24T17:21:01Z",
242
+ "changedBy" : "614E626E-72BF-4B69-B40E-0B72A1BB7CF4",
243
+ "updated" : "2014-09-24T17:21:01Z",
244
+ "versionID" : "C37D16B1-5E39-4B75-BEC0-03AB4085941E",
245
+ "id" : "C37D16B1-5E39-4B75-BEC0-03AB4085941E",
246
+ "productRatePlanID" : "BFE95484-D1D0-4296-ABB8-C2A3D4CE95EF",
247
+ "unitOfMeasureID" : "6EB5B013-AFD3-4FC6-BDED-73FC681F23EE",
248
+ "organizationID" : "7F3D3A3C-BAA4-4698-9645-EC33F853B3D8",
249
+ "name" : "Devices used, tiered",
250
+ "description" : "How many devices you use, but with a tiering system",
251
+ "chargeType" : "usage",
252
+ "chargeModel" : "tiered",
253
+ "upgradeMode" : "immediate",
254
+ "downgradeMode" : "immediate",
255
+ "defaultQuantity" : 10,
256
+ "minQuantity" : 0,
257
+ "validFrom" : "2014-09-24T17:21:00Z",
258
+ "tiers" : [ {
259
+ "created" : "2014-09-24T17:21:01Z",
260
+ "changedBy" : "614E626E-72BF-4B69-B40E-0B72A1BB7CF4",
261
+ "id" : "7B86D8A6-CFB1-4CD9-B438-617F4E060C3A",
262
+ "pricingComponentVersionID" : "C37D16B1-5E39-4B75-BEC0-03AB4085941E",
263
+ "pricingComponentID" : "C37D16B1-5E39-4B75-BEC0-03AB4085941E",
264
+ "productRatePlanID" : "BFE95484-D1D0-4296-ABB8-C2A3D4CE95EF",
265
+ "organizationID" : "7F3D3A3C-BAA4-4698-9645-EC33F853B3D8",
266
+ "lowerThreshold" : 2,
267
+ "upperThreshold" : 10,
268
+ "pricingType" : "unit",
269
+ "price" : 5.00000
270
+ }, {
271
+ "created" : "2014-09-24T17:21:01Z",
272
+ "changedBy" : "614E626E-72BF-4B69-B40E-0B72A1BB7CF4",
273
+ "id" : "B3E8C950-A71E-434D-8988-1F964430768B",
274
+ "pricingComponentVersionID" : "C37D16B1-5E39-4B75-BEC0-03AB4085941E",
275
+ "pricingComponentID" : "C37D16B1-5E39-4B75-BEC0-03AB4085941E",
276
+ "productRatePlanID" : "BFE95484-D1D0-4296-ABB8-C2A3D4CE95EF",
277
+ "organizationID" : "7F3D3A3C-BAA4-4698-9645-EC33F853B3D8",
278
+ "lowerThreshold" : 1,
279
+ "upperThreshold" : 1,
280
+ "pricingType" : "fixed",
281
+ "price" : 10.00000
282
+ }, {
283
+ "created" : "2014-09-24T17:21:01Z",
284
+ "changedBy" : "614E626E-72BF-4B69-B40E-0B72A1BB7CF4",
285
+ "id" : "D05839BB-8E35-48FD-AB66-F1CDF0E59D9C",
286
+ "pricingComponentVersionID" : "C37D16B1-5E39-4B75-BEC0-03AB4085941E",
287
+ "pricingComponentID" : "C37D16B1-5E39-4B75-BEC0-03AB4085941E",
288
+ "productRatePlanID" : "BFE95484-D1D0-4296-ABB8-C2A3D4CE95EF",
289
+ "organizationID" : "7F3D3A3C-BAA4-4698-9645-EC33F853B3D8",
290
+ "lowerThreshold" : 11,
291
+ "upperThreshold" : 100,
292
+ "pricingType" : "unit",
293
+ "price" : 2.00000
294
+ } ],
295
+ "unitOfMeasure" : {
296
+ "created" : "2014-09-24T17:20:58Z",
297
+ "changedBy" : "614E626E-72BF-4B69-B40E-0B72A1BB7CF4",
298
+ "updated" : "2014-09-24T17:20:58Z",
299
+ "id" : "6EB5B013-AFD3-4FC6-BDED-73FC681F23EE",
300
+ "name" : "Devices",
301
+ "organizationID" : "7F3D3A3C-BAA4-4698-9645-EC33F853B3D8",
302
+ "displayedAs" : "Devices",
303
+ "roundingScheme" : "UP",
304
+ "deleted" : false
305
+ }
306
+ } ]
307
+ },
308
+ "pricingComponentValueChanges" : [ ],
309
+ "pricingComponentValues" : [ {
310
+ "created" : "2014-09-24T17:21:02Z",
311
+ "changedBy" : "614E626E-72BF-4B69-B40E-0B72A1BB7CF4",
312
+ "updated" : "2014-09-24T17:21:02Z",
313
+ "id" : "29F353B6-BE3E-4E31-8E26-84F70F3FB0F3",
314
+ "pricingComponentID" : "71753C8E-E477-4DF6-8C32-20FACA3E5B20",
315
+ "subscriptionID" : "ACD66517-6F32-44CB-AF8C-3097F97E1E67",
316
+ "organizationID" : "7F3D3A3C-BAA4-4698-9645-EC33F853B3D8",
317
+ "value" : 1
318
+ }, {
319
+ "created" : "2014-09-24T17:21:02Z",
320
+ "changedBy" : "614E626E-72BF-4B69-B40E-0B72A1BB7CF4",
321
+ "updated" : "2014-09-24T17:21:02Z",
322
+ "id" : "8597315B-A9F7-45C4-B145-DF6584528B02",
323
+ "pricingComponentID" : "C37D16B1-5E39-4B75-BEC0-03AB4085941E",
324
+ "subscriptionID" : "ACD66517-6F32-44CB-AF8C-3097F97E1E67",
325
+ "organizationID" : "7F3D3A3C-BAA4-4698-9645-EC33F853B3D8",
326
+ "value" : 5
327
+ } ],
328
+ "paymentMethodSubscriptionLinks" : [ {
329
+ "created" : "2014-09-24T17:21:02Z",
330
+ "changedBy" : "614E626E-72BF-4B69-B40E-0B72A1BB7CF4",
331
+ "updated" : "2014-09-24T17:21:02Z",
332
+ "id" : "1A89116E-D17D-4610-B139-6E4559CC85FD",
333
+ "subscriptionID" : "ACD66517-6F32-44CB-AF8C-3097F97E1E67",
334
+ "organizationID" : "7F3D3A3C-BAA4-4698-9645-EC33F853B3D8",
335
+ "paymentMethodID" : "612D5A60-4F6A-455D-9C03-685A6D96A8D4",
336
+ "deleted" : false,
337
+ "paymentMethod" : {
338
+ "created" : "2014-09-24T17:20:56Z",
339
+ "changedBy" : "614E626E-72BF-4B69-B40E-0B72A1BB7CF4",
340
+ "updated" : "2014-09-24T17:20:56Z",
341
+ "id" : "612D5A60-4F6A-455D-9C03-685A6D96A8D4",
342
+ "accountID" : "14384081-3A24-460A-AE67-40E0488B267A",
343
+ "organizationID" : "7F3D3A3C-BAA4-4698-9645-EC33F853B3D8",
344
+ "name" : "Credit Notes",
345
+ "description" : "Pay using credit",
346
+ "linkID" : "",
347
+ "gateway" : "credit_note",
348
+ "priority" : 100,
349
+ "userEditable" : false,
350
+ "reusable" : true,
351
+ "deleted" : false
352
+ }
353
+ } ],
354
+ "fixedTerms" : [ ]
355
+ } ]
356
+ }'
357
+ end