killbill-client 4.0.2 → 4.0.3
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.
- checksums.yaml +4 -4
- data/lib/killbill_client/models/account.rb +21 -0
- data/lib/killbill_client/models/admin.rb +17 -9
- data/lib/killbill_client/models/catalog.rb +16 -0
- data/lib/killbill_client/models/custom_field.rb +3 -2
- data/lib/killbill_client/models/gen/subscription_attributes.rb +1 -0
- data/lib/killbill_client/models/invoice.rb +43 -6
- data/lib/killbill_client/models/payment.rb +8 -5
- data/lib/killbill_client/models/payment_method.rb +8 -2
- data/lib/killbill_client/models/role_definition.rb +19 -0
- data/lib/killbill_client/models/subscription.rb +28 -8
- data/lib/killbill_client/models/tenant.rb +93 -2
- data/lib/killbill_client/models/transaction.rb +25 -2
- data/lib/killbill_client/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0b014a03675df00b0ecc8905bc7e2f87d3a66b8
|
4
|
+
data.tar.gz: b00efcc489669f9d3dde0fd3ed3f4ad43484ae4d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ca5f7216fc9715cf80ee0aad0de09fb3ce090c5310b6138d221a4142f4261b25e98429ae77566e906de88e55720cbf61c2deee20687a46da532c9e8e724f870
|
7
|
+
data.tar.gz: d07ae44a92648d46ed01403cf3ee367f52c187cbc3302dc0e12ef9aafee15fba648173019f9b162250a866e2887eda8f7cae4df0999602f186f18014d081e10e
|
@@ -73,6 +73,27 @@ module KillBillClient
|
|
73
73
|
AuditLog
|
74
74
|
end
|
75
75
|
|
76
|
+
def paginated_bundles(account_id, offset = 0, limit = 100, audit = "NONE", options = {})
|
77
|
+
get "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/bundles/pagination",
|
78
|
+
{
|
79
|
+
:offset => offset,
|
80
|
+
:limit => limit,
|
81
|
+
:audit => audit
|
82
|
+
},
|
83
|
+
options,
|
84
|
+
Bundle
|
85
|
+
end
|
86
|
+
|
87
|
+
def paginated_invoices(account_id, offset = 0, limit = 100, audit = "NONE", options = {})
|
88
|
+
get "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/invoices/pagination",
|
89
|
+
{
|
90
|
+
:offset => offset,
|
91
|
+
:limit => limit,
|
92
|
+
:audit => audit
|
93
|
+
},
|
94
|
+
options,
|
95
|
+
Invoice
|
96
|
+
end
|
76
97
|
end
|
77
98
|
|
78
99
|
def create(user = nil, reason = nil, comment = nil, options = {})
|
@@ -8,22 +8,27 @@ module KillBillClient
|
|
8
8
|
KILLBILL_API_CLOCK_PREFIX = "#{KILLBILL_API_PREFIX}/test/clock"
|
9
9
|
|
10
10
|
class << self
|
11
|
-
def get_queues_entries(account_id, options = {})
|
11
|
+
def get_queues_entries(account_id, queue_name = '', service_name = '', with_history = true, min_date = '', max_date = '', with_in_processing = true, with_bus_events = true, with_notifications = true, options = {})
|
12
12
|
get KILLBILL_API_QUEUES_PREFIX,
|
13
13
|
{
|
14
14
|
:accountId => account_id,
|
15
|
-
:
|
16
|
-
:
|
17
|
-
:
|
15
|
+
:queueName => queue_name,
|
16
|
+
:serviceName => service_name,
|
17
|
+
:withHistory => with_history,
|
18
|
+
:minDate => min_date,
|
19
|
+
:maxDate => max_date,
|
20
|
+
:withInProcessing => with_in_processing,
|
21
|
+
:withBusEvents => with_bus_events,
|
22
|
+
:withNotifications => with_notifications
|
18
23
|
},
|
19
24
|
{
|
20
25
|
:accept => 'application/octet-stream'
|
21
26
|
}.merge(options)
|
22
27
|
end
|
23
28
|
|
24
|
-
def fix_transaction_state(payment_id, transaction_id, transaction_status, user = nil, reason = nil, comment = nil, options = {})
|
29
|
+
def fix_transaction_state(payment_id, transaction_id, transaction_status, payment_state_param = {}, user = nil, reason = nil, comment = nil, options = {})
|
25
30
|
put "#{KILLBILL_API_ADMIN_PREFIX}/payments/#{payment_id}/transactions/#{transaction_id}",
|
26
|
-
{:transactionStatus => transaction_status}.to_json,
|
31
|
+
{:transactionStatus => transaction_status}.merge(payment_state_param).to_json,
|
27
32
|
{},
|
28
33
|
{
|
29
34
|
:user => user,
|
@@ -32,15 +37,18 @@ module KillBillClient
|
|
32
37
|
}.merge(options)
|
33
38
|
end
|
34
39
|
|
35
|
-
def trigger_invoice_generation_for_parked_accounts(offset = 0, limit = 100, user =nil, options = {})
|
40
|
+
def trigger_invoice_generation_for_parked_accounts(offset = 0, limit = 100, plugin_property = [], user = nil, reason = nil, comment = nil, options = {})
|
36
41
|
post "#{KILLBILL_API_ADMIN_PREFIX}/invoices",
|
37
42
|
{},
|
38
43
|
{
|
39
44
|
:offset => offset,
|
40
|
-
:limit => limit
|
45
|
+
:limit => limit,
|
46
|
+
:pluginProperty => plugin_property
|
41
47
|
},
|
42
48
|
{
|
43
|
-
|
49
|
+
:user => user,
|
50
|
+
:reason => reason,
|
51
|
+
:comment => comment,
|
44
52
|
}.merge(options)
|
45
53
|
end
|
46
54
|
|
@@ -178,6 +178,22 @@ module KillBillClient
|
|
178
178
|
:comment => comment,
|
179
179
|
}.merge(options)
|
180
180
|
end
|
181
|
+
|
182
|
+
def validate_catalog(catalog_xml, user = nil, reason = nil, comment = nil, options = {})
|
183
|
+
|
184
|
+
require_multi_tenant_options!(options, "Validating a catalog is only supported in multi-tenant mode")
|
185
|
+
|
186
|
+
errors = post "#{KILLBILL_API_CATALOG_PREFIX}/xml/validate",
|
187
|
+
catalog_xml,
|
188
|
+
{},
|
189
|
+
{
|
190
|
+
:head => {'Accept' => 'application/json'},
|
191
|
+
:content_type => 'text/xml',
|
192
|
+
:user => user,
|
193
|
+
:reason => reason,
|
194
|
+
:comment => comment,
|
195
|
+
}.merge(options)
|
196
|
+
end
|
181
197
|
end
|
182
198
|
end
|
183
199
|
end
|
@@ -11,11 +11,12 @@ module KillBillClient
|
|
11
11
|
has_audit_logs_with_history KILLBILL_API_CUSTOM_FIELDS_PREFIX, :custom_field_id
|
12
12
|
|
13
13
|
class << self
|
14
|
-
def find_in_batches(offset = 0, limit = 100, options = {})
|
14
|
+
def find_in_batches(offset = 0, limit = 100, audit = 'NONE', options = {})
|
15
15
|
get "#{KILLBILL_API_CUSTOM_FIELDS_PREFIX}/#{Resource::KILLBILL_API_PAGINATION_PREFIX}",
|
16
16
|
{
|
17
17
|
:offset => offset,
|
18
|
-
:limit => limit
|
18
|
+
:limit => limit,
|
19
|
+
:audit => audit
|
19
20
|
},
|
20
21
|
options
|
21
22
|
end
|
@@ -19,17 +19,19 @@ module KillBillClient
|
|
19
19
|
|
20
20
|
|
21
21
|
class << self
|
22
|
-
def find_by_id(invoice_id, audit = "NONE", options = {})
|
22
|
+
def find_by_id(invoice_id, with_children_items = false, audit = "NONE", options = {})
|
23
23
|
get "#{KILLBILL_API_INVOICES_PREFIX}/#{invoice_id}",
|
24
24
|
{
|
25
|
+
:withChildrenItems => with_children_items,
|
25
26
|
:audit => audit
|
26
27
|
},
|
27
28
|
options
|
28
29
|
end
|
29
30
|
|
30
|
-
def find_by_number(number, audit = "NONE", options = {})
|
31
|
+
def find_by_number(number, with_children_items = false, audit = "NONE", options = {})
|
31
32
|
get "#{KILLBILL_API_INVOICES_PREFIX}/byNumber/#{number}",
|
32
33
|
{
|
34
|
+
:withChildrenItems => with_children_items,
|
33
35
|
:audit => audit
|
34
36
|
},
|
35
37
|
options
|
@@ -92,21 +94,22 @@ module KillBillClient
|
|
92
94
|
end
|
93
95
|
end
|
94
96
|
|
95
|
-
def trigger_invoice_dry_run(account_id, target_date, upcoming_invoice_target_date, options = {})
|
97
|
+
def trigger_invoice_dry_run(account_id, target_date, upcoming_invoice_target_date, plugin_property = [], user = nil, reason = nil, comment = nil, options = {})
|
96
98
|
|
97
99
|
dry_run = InvoiceDryRunAttributes.new
|
98
100
|
dry_run.dry_run_type = upcoming_invoice_target_date ? 'UPCOMING_INVOICE' : 'TARGET_DATE'
|
99
101
|
|
100
102
|
query_map = {:accountId => account_id}
|
101
103
|
query_map[:targetDate] = target_date if target_date != nil
|
104
|
+
query_map[:pluginProperty] = plugin_property unless plugin_property.empty?
|
102
105
|
|
103
106
|
res = post "#{KILLBILL_API_DRY_RUN_INVOICES_PREFIX}",
|
104
107
|
dry_run.to_json,
|
105
108
|
query_map,
|
106
109
|
{
|
107
|
-
:user => 'trigger_invoice_dry_run',
|
108
|
-
:reason =>
|
109
|
-
:comment =>
|
110
|
+
:user => user || 'trigger_invoice_dry_run',
|
111
|
+
:reason => reason,
|
112
|
+
:comment => comment,
|
110
113
|
}.merge(options),
|
111
114
|
Invoice
|
112
115
|
|
@@ -318,6 +321,40 @@ module KillBillClient
|
|
318
321
|
}.merge(options)
|
319
322
|
end
|
320
323
|
|
324
|
+
def trigger_invoice_group_run(account_id, target_date = nil, plugin_property = nil, user = nil, reason = nil, comment = nil, options = {})
|
325
|
+
query_map = {:accountId => account_id}
|
326
|
+
query_map[:targetDate] = target_date if !target_date.nil?
|
327
|
+
query_map[:pluginProperty] = plugin_property if !plugin_property.nil?
|
328
|
+
|
329
|
+
res = post "#{KILLBILL_API_INVOICES_PREFIX}/group",
|
330
|
+
{},
|
331
|
+
query_map,
|
332
|
+
{
|
333
|
+
:user => user,
|
334
|
+
:reason => reason,
|
335
|
+
:comment => comment,
|
336
|
+
}.merge(options)
|
337
|
+
end
|
338
|
+
|
339
|
+
def retrieve_invoice_group(account_id, group_id, with_children_items = false, audit = "NONE", options = {})
|
340
|
+
res = get "#{KILLBILL_API_INVOICES_PREFIX}/#{group_id}/group",
|
341
|
+
{
|
342
|
+
:accountId => account_id,
|
343
|
+
:withChildrenItems => with_children_items,
|
344
|
+
:audit => audit
|
345
|
+
},
|
346
|
+
options
|
347
|
+
end
|
348
|
+
|
349
|
+
def retrieve_payments_for_invoice(invoice_id, with_plugin_info = false, with_attempts = false, audit = "NONE", options = {})
|
350
|
+
res = get "#{KILLBILL_API_INVOICES_PREFIX}/#{invoice_id}/payments",
|
351
|
+
{
|
352
|
+
:withPluginInfo => with_plugin_info,
|
353
|
+
:withAttempts => with_attempts,
|
354
|
+
:audit => audit
|
355
|
+
},
|
356
|
+
options
|
357
|
+
end
|
321
358
|
end
|
322
359
|
|
323
360
|
def commit(user = nil, reason = nil, comment = nil, options = {})
|
@@ -36,22 +36,25 @@ module KillBillClient
|
|
36
36
|
options
|
37
37
|
end
|
38
38
|
|
39
|
-
def find_by_transaction_id(transaction_id, with_plugin_info = false, with_attempts = false, options = {})
|
39
|
+
def find_by_transaction_id(transaction_id, with_plugin_info = false, with_attempts = false, plugin_property = [], audit = 'NONE', options = {})
|
40
40
|
get "#{Transaction::KILLBILL_API_TRANSACTIONS_PREFIX}/#{transaction_id}",
|
41
41
|
{
|
42
|
+
:withPluginInfo => with_plugin_info,
|
42
43
|
:withAttempts => with_attempts,
|
43
|
-
:
|
44
|
+
:pluginProperty => plugin_property,
|
45
|
+
:audit => audit
|
44
46
|
},
|
45
47
|
options
|
46
48
|
end
|
47
49
|
|
48
|
-
def find_by_transaction_external_key(external_key, with_plugin_info = false, with_attempts = false, audit='NONE', options = {})
|
50
|
+
def find_by_transaction_external_key(external_key, with_plugin_info = false, with_attempts = false, plugin_property = [], audit = 'NONE', options = {})
|
49
51
|
get "#{Transaction::KILLBILL_API_TRANSACTIONS_PREFIX}",
|
50
52
|
{
|
51
|
-
:audit => audit,
|
52
53
|
:transactionExternalKey => external_key,
|
54
|
+
:withPluginInfo => with_plugin_info,
|
53
55
|
:withAttempts => with_attempts,
|
54
|
-
:
|
56
|
+
:pluginProperty => plugin_property,
|
57
|
+
:audit => audit
|
55
58
|
},
|
56
59
|
options
|
57
60
|
end
|
@@ -2,6 +2,7 @@ module KillBillClient
|
|
2
2
|
module Model
|
3
3
|
class PaymentMethod < PaymentMethodAttributes
|
4
4
|
|
5
|
+
include KillBillClient::Model::CustomFieldHelper
|
5
6
|
include KillBillClient::Model::AuditLogWithHistoryHelper
|
6
7
|
|
7
8
|
KILLBILL_API_PAYMENT_METHODS_PREFIX = "#{KILLBILL_API_PREFIX}/paymentMethods"
|
@@ -10,11 +11,15 @@ module KillBillClient
|
|
10
11
|
has_many :audit_logs, KillBillClient::Model::AuditLog
|
11
12
|
|
12
13
|
has_audit_logs_with_history KILLBILL_API_PAYMENT_METHODS_PREFIX, :payment_method_id
|
14
|
+
has_custom_fields KILLBILL_API_PAYMENT_METHODS_PREFIX, :payment_method_id
|
13
15
|
|
14
16
|
class << self
|
15
|
-
def find_by_id(payment_method_id, with_plugin_info = false, options = {})
|
17
|
+
def find_by_id(payment_method_id, included_deleted = false, with_plugin_info = false, plugin_property = [], audit = 'NONE', options = {})
|
16
18
|
get "#{KILLBILL_API_PAYMENT_METHODS_PREFIX}/#{payment_method_id}",
|
17
19
|
{
|
20
|
+
:pluginProperty => plugin_property,
|
21
|
+
:includedDeleted => included_deleted,
|
22
|
+
:audit => audit,
|
18
23
|
:withPluginInfo => with_plugin_info
|
19
24
|
},
|
20
25
|
options
|
@@ -46,10 +51,11 @@ module KillBillClient
|
|
46
51
|
options
|
47
52
|
end
|
48
53
|
|
49
|
-
def find_by_external_key(external_key, included_deleted = false, with_plugin_info = false, audit='NONE', options = {})
|
54
|
+
def find_by_external_key(external_key, included_deleted = false, with_plugin_info = false, plugin_property = [], audit = 'NONE', options = {})
|
50
55
|
get "#{KILLBILL_API_PAYMENT_METHODS_PREFIX}",
|
51
56
|
{
|
52
57
|
:externalKey => external_key,
|
58
|
+
:pluginProperty => plugin_property,
|
53
59
|
:includedDeleted => included_deleted,
|
54
60
|
:audit => audit,
|
55
61
|
:withPluginInfo => with_plugin_info
|
@@ -2,6 +2,14 @@ module KillBillClient
|
|
2
2
|
module Model
|
3
3
|
class RoleDefinition < RoleDefinitionAttributes
|
4
4
|
|
5
|
+
class << self
|
6
|
+
def find_by_name(role_name, options = {})
|
7
|
+
role = get "#{Security::KILLBILL_API_SECURITY_PREFIX}/roles/#{role_name}",
|
8
|
+
{},
|
9
|
+
options
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
5
13
|
def create(user = nil, reason = nil, comment = nil, options = {})
|
6
14
|
created_role = self.class.post "#{Security::KILLBILL_API_SECURITY_PREFIX}/roles",
|
7
15
|
to_json,
|
@@ -13,6 +21,17 @@ module KillBillClient
|
|
13
21
|
}.merge(options)
|
14
22
|
created_role.refresh(options)
|
15
23
|
end
|
24
|
+
|
25
|
+
def update(user = nil, reason = nil, comment = nil, options = {})
|
26
|
+
self.class.put "#{Security::KILLBILL_API_SECURITY_PREFIX}/roles",
|
27
|
+
to_json,
|
28
|
+
{},
|
29
|
+
{
|
30
|
+
:user => user,
|
31
|
+
:reason => reason,
|
32
|
+
:comment => comment,
|
33
|
+
}.merge(options)
|
34
|
+
end
|
16
35
|
end
|
17
36
|
end
|
18
37
|
end
|
@@ -10,6 +10,7 @@ module KillBillClient
|
|
10
10
|
|
11
11
|
has_many :events, KillBillClient::Model::EventSubscription
|
12
12
|
has_many :price_overrides, KillBillClient::Model::PhasePriceAttributes
|
13
|
+
has_many :audit_logs, KillBillClient::Model::AuditLog
|
13
14
|
|
14
15
|
has_custom_fields KILLBILL_API_ENTITLEMENT_PREFIX, :subscription_id
|
15
16
|
has_tags KILLBILL_API_ENTITLEMENT_PREFIX, :subscription_id
|
@@ -17,18 +18,20 @@ module KillBillClient
|
|
17
18
|
has_audit_logs_with_history KILLBILL_API_ENTITLEMENT_PREFIX, :subscription_id
|
18
19
|
|
19
20
|
class << self
|
20
|
-
def find_by_id(subscription_id, options = {})
|
21
|
+
def find_by_id(subscription_id, audit = "NONE", options = {})
|
21
22
|
get "#{KILLBILL_API_ENTITLEMENT_PREFIX}/#{subscription_id}",
|
22
|
-
{
|
23
|
+
{
|
24
|
+
:audit => audit
|
25
|
+
},
|
23
26
|
options
|
24
27
|
end
|
25
28
|
|
26
|
-
def find_by_external_key(external_key, options = {})
|
27
|
-
params = {}
|
28
|
-
params[:externalKey] = external_key
|
29
|
-
|
29
|
+
def find_by_external_key(external_key, audit = "NONE", options = {})
|
30
30
|
get "#{KILLBILL_API_ENTITLEMENT_PREFIX}",
|
31
|
-
|
31
|
+
{
|
32
|
+
:externalKey => external_key,
|
33
|
+
:audit => audit
|
34
|
+
},
|
32
35
|
options
|
33
36
|
end
|
34
37
|
|
@@ -94,7 +97,7 @@ module KillBillClient
|
|
94
97
|
:reason => reason,
|
95
98
|
:comment => comment,
|
96
99
|
}.merge(options)
|
97
|
-
self.class.find_by_id(@subscription_id, options)
|
100
|
+
self.class.find_by_id(@subscription_id, "NONE", options)
|
98
101
|
end
|
99
102
|
|
100
103
|
#
|
@@ -218,6 +221,23 @@ module KillBillClient
|
|
218
221
|
}.merge(options)
|
219
222
|
end
|
220
223
|
|
224
|
+
#
|
225
|
+
# Update Subscription Quantity
|
226
|
+
#
|
227
|
+
def update_quantity(user = nil, reason = nil, comment = nil, effective_from_date = nil, force_new_quantity_with_past_effective_date = nil, options = {})
|
228
|
+
params = {}
|
229
|
+
params[:effectiveFromDate] = effective_from_date unless effective_from_date.nil?
|
230
|
+
params[:forceNewQuantityWithPastEffectiveDate] = force_new_quantity_with_past_effective_date unless force_new_quantity_with_past_effective_date.nil?
|
231
|
+
|
232
|
+
return self.class.put "#{KILLBILL_API_ENTITLEMENT_PREFIX}/#{subscription_id}/quantity",
|
233
|
+
self.to_json,
|
234
|
+
params,
|
235
|
+
{
|
236
|
+
:user => user,
|
237
|
+
:reason => reason,
|
238
|
+
:comment => comment,
|
239
|
+
}.merge(options)
|
240
|
+
end
|
221
241
|
end
|
222
242
|
end
|
223
243
|
end
|
@@ -2,6 +2,9 @@ module KillBillClient
|
|
2
2
|
module Model
|
3
3
|
class Tenant < TenantAttributes
|
4
4
|
KILLBILL_API_TENANTS_PREFIX = "#{KILLBILL_API_PREFIX}/tenants"
|
5
|
+
KILLBILL_API_TENANTS_NOTIFICATION = "#{KILLBILL_API_TENANTS_PREFIX}/registerNotificationCallback"
|
6
|
+
KILLBILL_API_TENANTS_SYSTEM_CONFIGURATION = "#{KILLBILL_API_TENANTS_PREFIX}/uploadPerTenantConfig"
|
7
|
+
KILLBILL_API_TENANTS_PLUGIN_PAYMENT_STATE_MACHINE = "#{KILLBILL_API_TENANTS_PREFIX}/uploadPluginPaymentStateMachineConfig"
|
5
8
|
|
6
9
|
has_many :audit_logs, KillBillClient::Model::AuditLog
|
7
10
|
|
@@ -87,7 +90,6 @@ module KillBillClient
|
|
87
90
|
send(get_method.to_sym, key_name, options)
|
88
91
|
end
|
89
92
|
|
90
|
-
|
91
93
|
def delete_tenant_key_value(key_name, key_path, error_id_str, user = nil, reason = nil, comment = nil, options = {})
|
92
94
|
|
93
95
|
require_multi_tenant_options!(options, "Deleting a #{error_id_str} is only supported in multi-tenant mode")
|
@@ -105,13 +107,102 @@ module KillBillClient
|
|
105
107
|
}.merge(options)
|
106
108
|
|
107
109
|
end
|
110
|
+
|
111
|
+
def register_push_notification(cb, user = nil, reason = nil, comment = nil, options = {})
|
112
|
+
require_multi_tenant_options!(options, "Push notification is only supported in multi-tenant mode")
|
113
|
+
post "#{KILLBILL_API_TENANTS_NOTIFICATION}",
|
114
|
+
{},
|
115
|
+
{:cb => cb},
|
116
|
+
{
|
117
|
+
:user => user,
|
118
|
+
:reason => reason,
|
119
|
+
:comment => comment,
|
120
|
+
}.merge(options)
|
121
|
+
end
|
122
|
+
|
123
|
+
def retrieve_push_notification(options = {})
|
124
|
+
require_multi_tenant_options!(options, "Push notification is only supported in multi-tenant mode")
|
125
|
+
get "#{KILLBILL_API_TENANTS_NOTIFICATION}", {}, options
|
126
|
+
end
|
127
|
+
|
128
|
+
def delete_push_notification(user = nil, reason = nil, comment = nil, options = {})
|
129
|
+
require_multi_tenant_options!(options, "Push notification is only supported in multi-tenant mode")
|
130
|
+
delete "#{KILLBILL_API_TENANTS_NOTIFICATION}",
|
131
|
+
{},
|
132
|
+
{},
|
133
|
+
{
|
134
|
+
:user => user,
|
135
|
+
:reason => reason,
|
136
|
+
:comment => comment,
|
137
|
+
}.merge(options)
|
138
|
+
end
|
139
|
+
|
140
|
+
def add_system_configuration(configuration, user = nil, reason = nil, comment = nil, options = {})
|
141
|
+
require_multi_tenant_options!(options, "System configuration is only supported in multi-tenant mode")
|
142
|
+
post "#{KILLBILL_API_TENANTS_SYSTEM_CONFIGURATION}",
|
143
|
+
configuration,
|
144
|
+
{},
|
145
|
+
{
|
146
|
+
:content_type => 'text/plain',
|
147
|
+
:user => user,
|
148
|
+
:reason => reason,
|
149
|
+
:comment => comment,
|
150
|
+
}.merge(options)
|
151
|
+
end
|
152
|
+
|
153
|
+
def retrieve_system_configurations(options = {})
|
154
|
+
require_multi_tenant_options!(options, "System configuration is only supported in multi-tenant mode")
|
155
|
+
get "#{KILLBILL_API_TENANTS_SYSTEM_CONFIGURATION}", {}, options
|
156
|
+
end
|
157
|
+
|
158
|
+
def delete_system_configurations(user = nil, reason = nil, comment = nil, options = {})
|
159
|
+
require_multi_tenant_options!(options, "System configuration is only supported in multi-tenant mode")
|
160
|
+
delete "#{KILLBILL_API_TENANTS_SYSTEM_CONFIGURATION}",
|
161
|
+
{},
|
162
|
+
{},
|
163
|
+
{
|
164
|
+
:user => user,
|
165
|
+
:reason => reason,
|
166
|
+
:comment => comment,
|
167
|
+
}.merge(options)
|
168
|
+
end
|
169
|
+
|
170
|
+
def add_payment_state_machine(plugin_name, state_machine_config, user = nil, reason = nil, comment = nil, options = {})
|
171
|
+
require_multi_tenant_options!(options, "Payment state machine is only supported in multi-tenant mode")
|
172
|
+
post "#{KILLBILL_API_TENANTS_PLUGIN_PAYMENT_STATE_MACHINE}/#{plugin_name}",
|
173
|
+
state_machine_config,
|
174
|
+
{},
|
175
|
+
{
|
176
|
+
:content_type => 'text/plain',
|
177
|
+
:user => user,
|
178
|
+
:reason => reason,
|
179
|
+
:comment => comment,
|
180
|
+
}.merge(options)
|
181
|
+
end
|
182
|
+
|
183
|
+
def retrieve_payment_state_machine(plugin_name, options = {})
|
184
|
+
require_multi_tenant_options!(options, "Payment state machine is only supported in multi-tenant mode")
|
185
|
+
get "#{KILLBILL_API_TENANTS_PLUGIN_PAYMENT_STATE_MACHINE}/#{plugin_name}", {}, options
|
186
|
+
end
|
187
|
+
|
188
|
+
def delete_payment_state_machine(plugin_name, user = nil, reason = nil, comment = nil, options = {})
|
189
|
+
require_multi_tenant_options!(options, "Payment state machine is only supported in multi-tenant mode")
|
190
|
+
delete "#{KILLBILL_API_TENANTS_PLUGIN_PAYMENT_STATE_MACHINE}/#{plugin_name}",
|
191
|
+
{},
|
192
|
+
{},
|
193
|
+
{
|
194
|
+
:user => user,
|
195
|
+
:reason => reason,
|
196
|
+
:comment => comment,
|
197
|
+
}.merge(options)
|
198
|
+
end
|
108
199
|
end
|
109
200
|
|
110
201
|
|
111
202
|
def create(use_global_default=true, user = nil, reason = nil, comment = nil, options = {})
|
112
203
|
|
113
204
|
created_tenant = self.class.post KILLBILL_API_TENANTS_PREFIX,
|
114
|
-
to_json,
|
205
|
+
to_json,
|
115
206
|
{:useGlobalDefault => use_global_default},
|
116
207
|
{
|
117
208
|
:user => user,
|
@@ -4,7 +4,9 @@ module KillBillClient
|
|
4
4
|
module Model
|
5
5
|
class Transaction < PaymentTransactionAttributes
|
6
6
|
|
7
|
+
include KillBillClient::Model::CustomFieldHelper
|
7
8
|
include KillBillClient::Model::AuditLogWithHistoryHelper
|
9
|
+
include KillBillClient::Model::TagHelper
|
8
10
|
|
9
11
|
KILLBILL_API_TRANSACTIONS_PREFIX = "#{KILLBILL_API_PREFIX}/paymentTransactions"
|
10
12
|
|
@@ -12,6 +14,8 @@ module KillBillClient
|
|
12
14
|
has_many :audit_logs, KillBillClient::Model::AuditLog
|
13
15
|
|
14
16
|
has_audit_logs_with_history KILLBILL_API_TRANSACTIONS_PREFIX, :transaction_id
|
17
|
+
has_custom_fields KILLBILL_API_TRANSACTIONS_PREFIX, :transaction_id
|
18
|
+
has_tags KILLBILL_API_TRANSACTIONS_PREFIX, :transaction_id
|
15
19
|
|
16
20
|
def auth(account_id, payment_method_id = nil, user = nil, reason = nil, comment = nil, options = {}, refresh_options = nil)
|
17
21
|
@transaction_type = 'AUTHORIZE'
|
@@ -121,7 +125,11 @@ module KillBillClient
|
|
121
125
|
:reason => reason,
|
122
126
|
:comment => comment,
|
123
127
|
}.merge(options)
|
124
|
-
|
128
|
+
if payment_external_key
|
129
|
+
KillBillClient::Model::Payment.find_by_external_key(payment_external_key, false, false, options)
|
130
|
+
else
|
131
|
+
KillBillClient::Model::Payment.find_by_id(payment_id, false, false, options)
|
132
|
+
end
|
125
133
|
end
|
126
134
|
end
|
127
135
|
|
@@ -185,6 +193,17 @@ module KillBillClient
|
|
185
193
|
end
|
186
194
|
end
|
187
195
|
|
196
|
+
def update_transaction_state(status, control_plugin_name = nil, user, reason, comment, options)
|
197
|
+
self.class.post "KILLBILL_API_TRANSACTIONS_PREFIX/#{transaction_id}",
|
198
|
+
{:paymentId => payment_id, :status => status}.to_json,
|
199
|
+
{:controlPluginName => (control_plugin_name || [])},
|
200
|
+
{
|
201
|
+
:user => user,
|
202
|
+
:reason => reason,
|
203
|
+
:comment => comment
|
204
|
+
}.merge(options)
|
205
|
+
end
|
206
|
+
|
188
207
|
private
|
189
208
|
|
190
209
|
|
@@ -221,7 +240,11 @@ module KillBillClient
|
|
221
240
|
:reason => reason,
|
222
241
|
:comment => comment
|
223
242
|
}.merge(options)
|
224
|
-
|
243
|
+
if payment_external_key
|
244
|
+
KillBillClient::Model::Payment.find_by_external_key(payment_external_key, false, false, options)
|
245
|
+
else
|
246
|
+
KillBillClient::Model::Payment.find_by_id(payment_id, false, false, options)
|
247
|
+
end
|
225
248
|
end
|
226
249
|
end
|
227
250
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: killbill-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Killbill core team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-05-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gem-release
|