killbill 3.1.3 → 3.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Jarfile +7 -5
- data/NEWS +3 -0
- data/README.md +41 -17
- data/VERSION +1 -1
- data/generators/active_merchant/templates/Jarfile.rb +7 -5
- data/generators/active_merchant/templates/config.yml.rb +3 -3
- data/generators/active_merchant/templates/db/ddl.sql.rb +4 -0
- data/generators/active_merchant/templates/db/schema.rb +4 -0
- data/generators/active_merchant/templates/lib/api.rb +42 -22
- data/generators/active_merchant/templates/lib/models/response.rb +3 -1
- data/generators/active_merchant/templates/plugin.gemspec.rb +1 -1
- data/lib/killbill.rb +7 -4
- data/lib/killbill/gen/api/account.rb +4 -3
- data/lib/killbill/gen/api/account_api_exception.rb +4 -3
- data/lib/killbill/gen/api/account_audit_logs.rb +12 -68
- data/lib/killbill/gen/api/account_audit_logs_for_object_type.rb +4 -3
- data/lib/killbill/gen/api/account_data.rb +4 -3
- data/lib/killbill/gen/api/account_email.rb +4 -3
- data/lib/killbill/gen/api/account_user_api.rb +4 -3
- data/lib/killbill/gen/api/audit_log.rb +4 -3
- data/lib/killbill/gen/api/audit_user_api.rb +4 -3
- data/lib/killbill/gen/api/billing_exception_base.rb +4 -3
- data/lib/killbill/gen/api/block.rb +4 -3
- data/lib/killbill/gen/api/blockable.rb +4 -3
- data/lib/killbill/gen/api/blocking_api_exception.rb +4 -3
- data/lib/killbill/gen/api/blocking_state.rb +4 -3
- data/lib/killbill/gen/api/call_context.rb +4 -3
- data/lib/killbill/gen/api/catalog.rb +4 -3
- data/lib/killbill/gen/api/catalog_api_exception.rb +4 -3
- data/lib/killbill/gen/api/catalog_user_api.rb +4 -3
- data/lib/killbill/gen/api/column_info.rb +4 -3
- data/lib/killbill/gen/api/control_tag.rb +4 -3
- data/lib/killbill/gen/api/currency_conversion.rb +4 -3
- data/lib/killbill/gen/api/currency_conversion_api.rb +4 -3
- data/lib/killbill/gen/api/currency_conversion_exception.rb +4 -3
- data/lib/killbill/gen/api/currency_value_null.rb +4 -3
- data/lib/killbill/gen/api/custom_field.rb +4 -3
- data/lib/killbill/gen/api/custom_field_api_exception.rb +4 -3
- data/lib/killbill/gen/api/custom_field_user_api.rb +4 -3
- data/lib/killbill/gen/api/database_export_output_stream.rb +4 -3
- data/lib/killbill/gen/api/direct_payment.rb +39 -11
- data/lib/killbill/gen/api/direct_payment_api.rb +643 -31
- data/lib/killbill/gen/api/direct_payment_transaction.rb +37 -12
- data/lib/killbill/gen/api/duration.rb +4 -3
- data/lib/killbill/gen/api/entitlement.rb +4 -3
- data/lib/killbill/gen/api/entitlement_ao_status_dry_run.rb +4 -3
- data/lib/killbill/gen/api/entitlement_api.rb +4 -3
- data/lib/killbill/gen/api/entitlement_api_exception.rb +4 -3
- data/lib/killbill/gen/api/entity.rb +4 -3
- data/lib/killbill/gen/api/fixed.rb +4 -3
- data/lib/killbill/gen/api/illegal_plan_change.rb +4 -3
- data/lib/killbill/gen/api/international_price.rb +4 -3
- data/lib/killbill/gen/api/invalid_config_exception.rb +4 -3
- data/lib/killbill/gen/api/invoice.rb +4 -3
- data/lib/killbill/gen/api/invoice_api_exception.rb +4 -3
- data/lib/killbill/gen/api/invoice_creation_event.rb +4 -3
- data/lib/killbill/gen/api/invoice_formatter.rb +4 -3
- data/lib/killbill/gen/api/invoice_item.rb +4 -3
- data/lib/killbill/gen/api/invoice_item_formatter.rb +4 -3
- data/lib/killbill/gen/api/invoice_payment.rb +7 -7
- data/lib/killbill/gen/api/invoice_payment_api.rb +7 -153
- data/lib/killbill/gen/api/invoice_user_api.rb +22 -3
- data/lib/killbill/gen/api/limit.rb +4 -3
- data/lib/killbill/gen/api/listing.rb +4 -3
- data/lib/killbill/gen/api/migration_plan.rb +4 -3
- data/lib/killbill/gen/api/mutable_account_data.rb +4 -3
- data/lib/killbill/gen/api/osgi_killbill.rb +15 -7
- data/lib/killbill/gen/api/osgi_plugin_properties.rb +4 -3
- data/lib/killbill/gen/api/pagination.rb +4 -3
- data/lib/killbill/gen/api/payment_api_exception.rb +4 -3
- data/lib/killbill/gen/api/payment_gateway_api.rb +4 -3
- data/lib/killbill/gen/api/payment_method.rb +11 -4
- data/lib/killbill/gen/api/payment_method_plugin.rb +5 -76
- data/lib/killbill/gen/api/payment_options.rb +68 -0
- data/lib/killbill/gen/api/plan.rb +4 -3
- data/lib/killbill/gen/api/plan_change_result.rb +4 -3
- data/lib/killbill/gen/api/plan_phase.rb +4 -3
- data/lib/killbill/gen/api/plan_phase_specifier.rb +4 -3
- data/lib/killbill/gen/api/plan_specifier.rb +4 -3
- data/lib/killbill/gen/api/plugin_config_service_api.rb +4 -3
- data/lib/killbill/gen/api/plugin_property.rb +4 -3
- data/lib/killbill/gen/api/price.rb +4 -3
- data/lib/killbill/gen/api/price_list.rb +4 -3
- data/lib/killbill/gen/api/price_list_set.rb +4 -3
- data/lib/killbill/gen/api/product.rb +4 -3
- data/lib/killbill/gen/api/rate.rb +4 -3
- data/lib/killbill/gen/api/record_id_api.rb +4 -3
- data/lib/killbill/gen/api/recurring.rb +4 -3
- data/lib/killbill/gen/api/refund.rb +7 -6
- data/lib/killbill/gen/api/require_gen.rb +5 -6
- data/lib/killbill/gen/api/rolled_up_usage.rb +4 -3
- data/lib/killbill/gen/api/security_api_exception.rb +4 -3
- data/lib/killbill/gen/api/static_catalog.rb +4 -3
- data/lib/killbill/gen/api/subscription.rb +4 -3
- data/lib/killbill/gen/api/subscription_api.rb +4 -3
- data/lib/killbill/gen/api/subscription_api_exception.rb +4 -3
- data/lib/killbill/gen/api/subscription_bundle.rb +4 -3
- data/lib/killbill/gen/api/subscription_bundle_timeline.rb +4 -3
- data/lib/killbill/gen/api/subscription_event.rb +4 -3
- data/lib/killbill/gen/api/tag.rb +4 -3
- data/lib/killbill/gen/api/tag_api_exception.rb +4 -3
- data/lib/killbill/gen/api/tag_definition.rb +4 -3
- data/lib/killbill/gen/api/tag_definition_api_exception.rb +4 -3
- data/lib/killbill/gen/api/tag_user_api.rb +4 -3
- data/lib/killbill/gen/api/tenant.rb +4 -3
- data/lib/killbill/gen/api/tenant_api_exception.rb +4 -3
- data/lib/killbill/gen/api/tenant_context.rb +4 -3
- data/lib/killbill/gen/api/tenant_data.rb +4 -3
- data/lib/killbill/gen/api/tenant_kv.rb +4 -3
- data/lib/killbill/gen/api/tenant_user_api.rb +4 -3
- data/lib/killbill/gen/api/tier.rb +4 -3
- data/lib/killbill/gen/api/tiered_block.rb +4 -3
- data/lib/killbill/gen/api/unit.rb +4 -3
- data/lib/killbill/gen/api/usage.rb +4 -3
- data/lib/killbill/gen/api/usage_user_api.rb +4 -3
- data/lib/killbill/gen/plugin-api/currency_plugin_api.rb +4 -3
- data/lib/killbill/gen/plugin-api/ext_bus_event.rb +4 -3
- data/lib/killbill/gen/plugin-api/gateway_notification.rb +4 -3
- data/lib/killbill/gen/plugin-api/hosted_payment_page_form_descriptor.rb +4 -3
- data/lib/killbill/gen/plugin-api/notification_plugin_api.rb +4 -3
- data/lib/killbill/gen/plugin-api/payment_method_info_plugin.rb +4 -3
- data/lib/killbill/gen/plugin-api/payment_plugin_api.rb +75 -81
- data/lib/killbill/gen/plugin-api/payment_plugin_api_exception.rb +4 -3
- data/lib/killbill/gen/plugin-api/{payment_info_plugin.rb → payment_transaction_info_plugin.rb} +21 -6
- data/lib/killbill/gen/plugin-api/require_gen.rb +5 -5
- data/lib/killbill/helpers/active_merchant/active_record/models/payment_method.rb +20 -36
- data/lib/killbill/helpers/active_merchant/active_record/models/response.rb +72 -81
- data/lib/killbill/helpers/active_merchant/active_record/models/transaction.rb +62 -43
- data/lib/killbill/helpers/active_merchant/killbill_spec_helper.rb +0 -13
- data/lib/killbill/helpers/active_merchant/payment_plugin.rb +127 -125
- data/lib/killbill/http_servlet.rb +16 -1
- data/lib/killbill/killbill_api.rb +0 -3
- data/lib/killbill/payment.rb +22 -6
- data/lib/killbill/rake_task.rb +93 -31
- data/spec/killbill/helpers/payment_method_spec.rb +153 -0
- data/spec/killbill/helpers/response_spec.rb +58 -15
- data/spec/killbill/helpers/test_schema.rb +12 -8
- data/spec/killbill/helpers/transaction_spec.rb +134 -0
- data/spec/killbill/payment_plugin_api_spec.rb +18 -18
- data/spec/killbill/payment_plugin_spec.rb +26 -15
- data/spec/killbill/payment_test.rb +6 -7
- data/spec/spec_helper.rb +3 -0
- metadata +6 -5
- data/lib/killbill/gen/api/payment.rb +0 -187
- data/lib/killbill/gen/plugin-api/refund_info_plugin.rb +0 -152
@@ -28,14 +28,16 @@ ActiveRecord::Schema.define(:version => 20140410153635) do
|
|
28
28
|
|
29
29
|
create_table "test_transactions", :force => true do |t|
|
30
30
|
t.integer "response_id", :null => false
|
31
|
-
t.string "api_call",
|
32
|
-
t.string "kb_payment_id",
|
33
|
-
t.
|
34
|
-
t.string "
|
35
|
-
t.
|
36
|
-
t.
|
37
|
-
t.
|
38
|
-
t.
|
31
|
+
t.string "api_call", :null => false
|
32
|
+
t.string "kb_payment_id", :null => false
|
33
|
+
t.string "kb_payment_transaction_id", :null => false
|
34
|
+
t.string "transaction_type", :null => false
|
35
|
+
t.integer "amount_in_cents", :null => false
|
36
|
+
t.string "currency", :null => false
|
37
|
+
t.datetime "created_at", :null => false
|
38
|
+
t.datetime "updated_at", :null => false
|
39
|
+
t.string "kb_account_id", :null => false
|
40
|
+
t.string "kb_tenant_id", :null => false
|
39
41
|
end
|
40
42
|
|
41
43
|
add_index(:test_transactions, :kb_payment_id)
|
@@ -43,6 +45,8 @@ ActiveRecord::Schema.define(:version => 20140410153635) do
|
|
43
45
|
create_table "test_responses", :force => true do |t|
|
44
46
|
t.string "api_call", :null => false
|
45
47
|
t.string "kb_payment_id"
|
48
|
+
t.string "kb_payment_transaction_id"
|
49
|
+
t.string "transaction_type"
|
46
50
|
t.string "message"
|
47
51
|
t.string "authorization"
|
48
52
|
t.boolean "fraud_review"
|
@@ -0,0 +1,134 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Killbill #:nodoc:
|
4
|
+
module Test #:nodoc:
|
5
|
+
class TestTransaction < ::Killbill::Plugin::ActiveMerchant::ActiveRecord::Transaction
|
6
|
+
|
7
|
+
self.table_name = 'test_transactions'
|
8
|
+
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe Killbill::Plugin::ActiveMerchant::ActiveRecord::Transaction do
|
14
|
+
|
15
|
+
before :all do
|
16
|
+
::Killbill::Test::TestTransaction.delete_all
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should store and retrieve transactions correctly' do
|
20
|
+
api_call = 'for debugging only'
|
21
|
+
amount_in_cents = 1242
|
22
|
+
currency = :USD
|
23
|
+
kb_account_id = SecureRandom.uuid
|
24
|
+
kb_tenant_id = SecureRandom.uuid
|
25
|
+
|
26
|
+
kb_payment_id1 = SecureRandom.uuid
|
27
|
+
kb_payment_id2 = SecureRandom.uuid
|
28
|
+
kb_payment_transaction_id1 = SecureRandom.uuid
|
29
|
+
kb_payment_transaction_id2 = SecureRandom.uuid
|
30
|
+
kb_payment_transaction_id3 = SecureRandom.uuid
|
31
|
+
kb_payment_transaction_id4 = SecureRandom.uuid
|
32
|
+
kb_payment_transaction_id5 = SecureRandom.uuid
|
33
|
+
transaction_type1 = :AUTHORIZE
|
34
|
+
transaction_type2 = :CAPTURE
|
35
|
+
transaction_type3 = :CAPTURE
|
36
|
+
transaction_type4 = :PURCHASE
|
37
|
+
transaction_type5 = :REFUND
|
38
|
+
|
39
|
+
create_transaction(api_call, kb_payment_id1, kb_payment_transaction_id1, transaction_type1, amount_in_cents, currency, kb_account_id, kb_tenant_id)
|
40
|
+
create_transaction(api_call, kb_payment_id1, kb_payment_transaction_id2, transaction_type2, amount_in_cents, currency, kb_account_id, kb_tenant_id)
|
41
|
+
create_transaction(api_call, kb_payment_id1, kb_payment_transaction_id3, transaction_type3, amount_in_cents, currency, kb_account_id, kb_tenant_id)
|
42
|
+
create_transaction(api_call, kb_payment_id2, kb_payment_transaction_id4, transaction_type4, amount_in_cents, currency, kb_account_id, kb_tenant_id)
|
43
|
+
create_transaction(api_call, kb_payment_id2, kb_payment_transaction_id5, transaction_type5, amount_in_cents, currency, kb_account_id, kb_tenant_id)
|
44
|
+
|
45
|
+
::Killbill::Test::TestTransaction.transactions_from_kb_payment_id(kb_payment_id1, nil).size.should == 0
|
46
|
+
::Killbill::Test::TestTransaction.transactions_from_kb_payment_id(kb_payment_id1, SecureRandom.uuid).size.should == 0
|
47
|
+
::Killbill::Test::TestTransaction.transactions_from_kb_payment_id(SecureRandom.uuid, kb_tenant_id).size.should == 0
|
48
|
+
|
49
|
+
# Lookup transactions for kb_payment_id1
|
50
|
+
ts = ::Killbill::Test::TestTransaction.transactions_from_kb_payment_id(kb_payment_id1, kb_tenant_id)
|
51
|
+
ts.size.should == 3
|
52
|
+
ts[0].kb_payment_transaction_id.should == kb_payment_transaction_id1
|
53
|
+
ts[1].kb_payment_transaction_id.should == kb_payment_transaction_id2
|
54
|
+
ts[2].kb_payment_transaction_id.should == kb_payment_transaction_id3
|
55
|
+
|
56
|
+
# Lookup transactions for kb_payment_id2
|
57
|
+
ts = ::Killbill::Test::TestTransaction.transactions_from_kb_payment_id(kb_payment_id2, kb_tenant_id)
|
58
|
+
ts.size.should == 2
|
59
|
+
ts[0].kb_payment_transaction_id.should == kb_payment_transaction_id4
|
60
|
+
ts[1].kb_payment_transaction_id.should == kb_payment_transaction_id5
|
61
|
+
|
62
|
+
# Lookup AUTH for kb_payment_id1
|
63
|
+
ts = ::Killbill::Test::TestTransaction.authorizes_from_kb_payment_id(kb_payment_id1, kb_tenant_id)
|
64
|
+
ts.size.should == 1
|
65
|
+
ts[0].kb_payment_transaction_id.should == kb_payment_transaction_id1
|
66
|
+
ts = ::Killbill::Test::TestTransaction.authorizations_from_kb_payment_id(kb_payment_id1, kb_tenant_id)
|
67
|
+
ts.size.should == 1
|
68
|
+
ts[0].kb_payment_transaction_id.should == kb_payment_transaction_id1
|
69
|
+
|
70
|
+
# Lookup CAPTURE for kb_payment_id1
|
71
|
+
ts = ::Killbill::Test::TestTransaction.captures_from_kb_payment_id(kb_payment_id1, kb_tenant_id)
|
72
|
+
ts.size.should == 2
|
73
|
+
ts[0].kb_payment_transaction_id.should == kb_payment_transaction_id2
|
74
|
+
ts[1].kb_payment_transaction_id.should == kb_payment_transaction_id3
|
75
|
+
|
76
|
+
# Lookup PURCHASE for kb_payment_id1
|
77
|
+
::Killbill::Test::TestTransaction.purchases_from_kb_payment_id(kb_payment_id1, kb_tenant_id).size.should == 0
|
78
|
+
|
79
|
+
# Lookup CREDIT for kb_payment_id1
|
80
|
+
::Killbill::Test::TestTransaction.credits_from_kb_payment_id(kb_payment_id1, kb_tenant_id).size.should == 0
|
81
|
+
|
82
|
+
# Lookup REFUND for kb_payment_id1
|
83
|
+
::Killbill::Test::TestTransaction.refunds_from_kb_payment_id(kb_payment_id1, kb_tenant_id).size.should == 0
|
84
|
+
|
85
|
+
# Lookup VOID for kb_payment_id1
|
86
|
+
::Killbill::Test::TestTransaction.void_from_kb_payment_id(kb_payment_id1, kb_tenant_id).should be_nil
|
87
|
+
|
88
|
+
# Lookup AUTH for kb_payment_id2
|
89
|
+
::Killbill::Test::TestTransaction.authorizes_from_kb_payment_id(kb_payment_id2, kb_tenant_id).size.should == 0
|
90
|
+
::Killbill::Test::TestTransaction.authorizations_from_kb_payment_id(kb_payment_id2, kb_tenant_id).size.should == 0
|
91
|
+
|
92
|
+
# Lookup CAPTURE for kb_payment_id2
|
93
|
+
::Killbill::Test::TestTransaction.captures_from_kb_payment_id(kb_payment_id2, kb_tenant_id).size.should == 0
|
94
|
+
|
95
|
+
# Lookup PURCHASE for kb_payment_id2
|
96
|
+
ts = ::Killbill::Test::TestTransaction.purchases_from_kb_payment_id(kb_payment_id2, kb_tenant_id)
|
97
|
+
ts.size.should == 1
|
98
|
+
ts[0].kb_payment_transaction_id.should == kb_payment_transaction_id4
|
99
|
+
|
100
|
+
# Lookup CREDIT for kb_payment_id2
|
101
|
+
::Killbill::Test::TestTransaction.credits_from_kb_payment_id(kb_payment_id2, kb_tenant_id).size.should == 0
|
102
|
+
|
103
|
+
# Lookup REFUND for kb_payment_id2
|
104
|
+
ts = ::Killbill::Test::TestTransaction.refunds_from_kb_payment_id(kb_payment_id2, kb_tenant_id)
|
105
|
+
ts.size.should == 1
|
106
|
+
ts[0].kb_payment_transaction_id.should == kb_payment_transaction_id5
|
107
|
+
|
108
|
+
# Lookup VOID for kb_payment_id2
|
109
|
+
::Killbill::Test::TestTransaction.void_from_kb_payment_id(kb_payment_id2, kb_tenant_id).should be_nil
|
110
|
+
|
111
|
+
# Lookup individual transactions
|
112
|
+
::Killbill::Test::TestTransaction.from_kb_payment_transaction_id(kb_payment_transaction_id1, SecureRandom.uuid).should be_nil
|
113
|
+
::Killbill::Test::TestTransaction.from_kb_payment_transaction_id(SecureRandom.uuid, kb_tenant_id).should be_nil
|
114
|
+
::Killbill::Test::TestTransaction.from_kb_payment_transaction_id(kb_payment_transaction_id1, kb_tenant_id).transaction_type.should == 'AUTHORIZE'
|
115
|
+
::Killbill::Test::TestTransaction.from_kb_payment_transaction_id(kb_payment_transaction_id2, kb_tenant_id).transaction_type.should == 'CAPTURE'
|
116
|
+
::Killbill::Test::TestTransaction.from_kb_payment_transaction_id(kb_payment_transaction_id3, kb_tenant_id).transaction_type.should == 'CAPTURE'
|
117
|
+
::Killbill::Test::TestTransaction.from_kb_payment_transaction_id(kb_payment_transaction_id4, kb_tenant_id).transaction_type.should == 'PURCHASE'
|
118
|
+
::Killbill::Test::TestTransaction.from_kb_payment_transaction_id(kb_payment_transaction_id5, kb_tenant_id).transaction_type.should == 'REFUND'
|
119
|
+
end
|
120
|
+
|
121
|
+
private
|
122
|
+
|
123
|
+
def create_transaction(api_call, kb_payment_id, kb_payment_transaction_id, transaction_type, amount_in_cents, currency, kb_account_id, kb_tenant_id)
|
124
|
+
::Killbill::Test::TestTransaction.create(:api_call => api_call,
|
125
|
+
:kb_payment_id => kb_payment_id,
|
126
|
+
:kb_payment_transaction_id => kb_payment_transaction_id,
|
127
|
+
:transaction_type => transaction_type,
|
128
|
+
:amount_in_cents => amount_in_cents,
|
129
|
+
:currency => currency,
|
130
|
+
:kb_account_id => kb_account_id,
|
131
|
+
:kb_tenant_id => kb_tenant_id,
|
132
|
+
:response_id => 0)
|
133
|
+
end
|
134
|
+
end
|
@@ -4,18 +4,18 @@ require 'spec_helper'
|
|
4
4
|
describe Killbill::Plugin::Api::PaymentPluginApi do
|
5
5
|
|
6
6
|
before(:all) do
|
7
|
-
@call_context
|
8
|
-
logger
|
9
|
-
@paymentPluginApi
|
10
|
-
@kb_account_id
|
11
|
-
@kb_payment_id
|
12
|
-
@kb_payment_method_id
|
7
|
+
@call_context = Killbill::Plugin::Model::CallContext.new
|
8
|
+
logger = ::Logger.new(STDOUT)
|
9
|
+
@paymentPluginApi = Killbill::Plugin::Api::PaymentPluginApi.new("Killbill::Plugin::PaymentTest", {"logger" => logger})
|
10
|
+
@kb_account_id = java.util.UUID.fromString("aa5c926e-3d9d-4435-b44b-719d7b583256")
|
11
|
+
@kb_payment_id = java.util.UUID.fromString("bf5c926e-3d9c-470e-b34b-719d7b58323a")
|
12
|
+
@kb_payment_method_id = java.util.UUID.fromString("bf5c926e-3d9c-470e-b34b-719d7b58323a")
|
13
13
|
@payment_method_plugin = nil
|
14
|
-
@amount
|
15
|
-
@currency
|
16
|
-
propertyA
|
17
|
-
propertyB
|
18
|
-
@properties
|
14
|
+
@amount = java.math.BigDecimal.new("50")
|
15
|
+
@currency = Java::org.killbill.billing.catalog.api.Currency::USD
|
16
|
+
propertyA = Java::org.killbill.billing.payment.api.PluginProperty.new('keyA', 'valueA', false)
|
17
|
+
propertyB = Java::org.killbill.billing.payment.api.PluginProperty.new('keyB', 'valueB', true)
|
18
|
+
@properties = java.util.ArrayList.new
|
19
19
|
@properties.add(propertyA)
|
20
20
|
@properties.add(propertyB)
|
21
21
|
end
|
@@ -25,7 +25,7 @@ describe Killbill::Plugin::Api::PaymentPluginApi do
|
|
25
25
|
end
|
26
26
|
|
27
27
|
it "should_test_charge_ok" do
|
28
|
-
output = @paymentPluginApi.
|
28
|
+
output = @paymentPluginApi.purchase_payment(@kb_account_id, @kb_payment_id, @kb_payment_transaction_id, @kb_payment_method_id, @amount, @currency, @properties, nil)
|
29
29
|
output.amount.should be_an_instance_of java.math.BigDecimal
|
30
30
|
output.amount.compare_to(@amount).should == 0
|
31
31
|
output.status.java_kind_of?(Java::org.killbill.billing.payment.plugin.api.PaymentPluginStatus).should == true
|
@@ -34,35 +34,35 @@ describe Killbill::Plugin::Api::PaymentPluginApi do
|
|
34
34
|
|
35
35
|
it "should_test_charge_exception" do
|
36
36
|
@paymentPluginApi.delegate_plugin.send(:raise_exception_on_next_calls)
|
37
|
-
lambda { @paymentPluginApi.
|
37
|
+
lambda { @paymentPluginApi.purchase_payment(@kb_account_id, @kb_payment_id, @kb_payment_transaction_id, @kb_payment_method_id, @amount, @currency, @properties, nil) }.should raise_error Java::org.killbill.billing.payment.plugin.api.PaymentPluginApiException
|
38
38
|
end
|
39
39
|
|
40
40
|
it "should_test_get_payment_info_ok" do
|
41
41
|
output = @paymentPluginApi.get_payment_info(@kb_account_id, @kb_payment_method_id, @properties, nil)
|
42
|
+
output.size.should == 1
|
43
|
+
output = output.first
|
42
44
|
output.amount.should be_an_instance_of java.math.BigDecimal
|
43
45
|
output.amount.compare_to(java.math.BigDecimal.new(0)).should == 0
|
44
46
|
output.status.java_kind_of?(Java::org.killbill.billing.payment.plugin.api.PaymentPluginStatus).should == true
|
45
47
|
output.status.to_s.should == "PROCESSED"
|
46
48
|
end
|
47
49
|
|
48
|
-
|
49
50
|
it "should_test_get_payment_info_exception" do
|
50
51
|
@paymentPluginApi.delegate_plugin.send(:raise_exception_on_next_calls)
|
51
52
|
lambda { @paymentPluginApi.get_payment_info(@kb_account_id, @kb_payment_method_id, @properties, nil) }.should raise_error Java::org.killbill.billing.payment.plugin.api.PaymentPluginApiException
|
52
53
|
end
|
53
54
|
|
54
55
|
it "should_test_refund_ok" do
|
55
|
-
output = @paymentPluginApi.
|
56
|
+
output = @paymentPluginApi.refund_payment(@kb_account_id, @kb_payment_id, @kb_payment_transaction_id, @kb_payment_method_id, @amount, @currency, @properties, nil)
|
56
57
|
output.amount.should be_an_instance_of java.math.BigDecimal
|
57
58
|
output.amount.compare_to(@amount).should == 0
|
58
|
-
output.status.java_kind_of?(Java::org.killbill.billing.payment.plugin.api.
|
59
|
+
output.status.java_kind_of?(Java::org.killbill.billing.payment.plugin.api.PaymentPluginStatus).should == true
|
59
60
|
output.status.to_s.should == "PROCESSED"
|
60
61
|
end
|
61
62
|
|
62
|
-
|
63
63
|
it "should_test_refund_exception" do
|
64
64
|
@paymentPluginApi.delegate_plugin.send(:raise_exception_on_next_calls)
|
65
|
-
lambda { @paymentPluginApi.
|
65
|
+
lambda { @paymentPluginApi.refund_payment(@kb_account_id, @kb_payment_id, @kb_payment_transaction_id, @kb_payment_method_id, @amount, @currency, @properties, nil) }.should raise_error Java::org.killbill.billing.payment.plugin.api.PaymentPluginApiException
|
66
66
|
end
|
67
67
|
|
68
68
|
it "should_test_add_payment_method_ok" do
|
@@ -5,34 +5,45 @@ end
|
|
5
5
|
|
6
6
|
describe Killbill::Plugin::Payment do
|
7
7
|
before(:each) do
|
8
|
-
@kb_account_id
|
9
|
-
@kb_payment_id
|
10
|
-
@
|
11
|
-
@
|
12
|
-
@
|
8
|
+
@kb_account_id = SecureRandom.uuid
|
9
|
+
@kb_payment_id = SecureRandom.uuid
|
10
|
+
@kb_payment_transaction_id = SecureRandom.uuid
|
11
|
+
@amount_in_cents = rand(100000)
|
12
|
+
@currency = 'USD'
|
13
|
+
@call_context = Killbill::Plugin::Model::CallContext.new
|
13
14
|
|
14
|
-
@payment_method
|
15
|
+
@payment_method = Hash.new(:credit_card => SecureRandom.uuid)
|
15
16
|
@kb_payment_method_id = SecureRandom.uuid
|
16
17
|
|
17
|
-
@
|
18
|
+
@search_key = SecureRandom.uuid
|
19
|
+
@offset = 0
|
20
|
+
@limit = 100
|
21
|
+
|
22
|
+
@properties = [::Killbill::Plugin::Model::PluginProperty.new]
|
18
23
|
@payment_method_props = Hash.new
|
19
|
-
@payment_methods
|
20
|
-
@killbill_account
|
24
|
+
@payment_methods = Hash.new
|
25
|
+
@killbill_account = Hash.new(:name => SecureRandom.uuid)
|
21
26
|
|
22
27
|
@plugin = DummyPaymentPlugin.new
|
23
28
|
end
|
24
29
|
|
25
30
|
it "should raise exceptions for unsupported operations" do
|
26
|
-
lambda { @plugin.
|
27
|
-
lambda { @plugin.
|
31
|
+
lambda { @plugin.authorize_payment(@kb_account_id, @kb_payment_id, @kb_payment_transaction_id, @kb_payment_method_id, @amount_in_cents, @currency, @properties, @call_context) }.should raise_error Killbill::Plugin::Payment::OperationUnsupportedByGatewayError
|
32
|
+
lambda { @plugin.capture_payment(@kb_account_id, @kb_payment_id, @kb_payment_transaction_id, @kb_payment_method_id, @amount_in_cents, @currency, @properties, @call_context) }.should raise_error Killbill::Plugin::Payment::OperationUnsupportedByGatewayError
|
33
|
+
lambda { @plugin.purchase_payment(@kb_account_id, @kb_payment_id, @kb_payment_transaction_id, @kb_payment_method_id, @amount_in_cents, @currency, @properties, @call_context) }.should raise_error Killbill::Plugin::Payment::OperationUnsupportedByGatewayError
|
34
|
+
lambda { @plugin.void_payment(@kb_account_id, @kb_payment_id, @kb_payment_transaction_id, @kb_payment_method_id, @properties, @call_context) }.should raise_error Killbill::Plugin::Payment::OperationUnsupportedByGatewayError
|
35
|
+
lambda { @plugin.credit_payment(@kb_account_id, @kb_payment_id, @kb_payment_transaction_id, @kb_payment_method_id, @amount_in_cents, @currency, @properties, @call_context) }.should raise_error Killbill::Plugin::Payment::OperationUnsupportedByGatewayError
|
36
|
+
lambda { @plugin.refund_payment(@kb_account_id, @kb_payment_id, @kb_payment_transaction_id, @kb_payment_method_id, @amount_in_cents, @currency, @properties, @call_context) }.should raise_error Killbill::Plugin::Payment::OperationUnsupportedByGatewayError
|
28
37
|
lambda { @plugin.get_payment_info(@kb_account_id, @kb_payment_id, @properties, @call_context) }.should raise_error Killbill::Plugin::Payment::OperationUnsupportedByGatewayError
|
29
|
-
lambda { @plugin.
|
38
|
+
lambda { @plugin.search_payments(@search_key, @offset, @limit, @properties, @call_context) }.should raise_error Killbill::Plugin::Payment::OperationUnsupportedByGatewayError
|
30
39
|
lambda { @plugin.add_payment_method(@kb_account_id, @payment_method, @payment_method_props, true, @properties, @call_context) }.should raise_error Killbill::Plugin::Payment::OperationUnsupportedByGatewayError
|
31
40
|
lambda { @plugin.delete_payment_method(@kb_account_id, @kb_payment_method_id, @properties, @call_context) }.should raise_error Killbill::Plugin::Payment::OperationUnsupportedByGatewayError
|
32
|
-
lambda { @plugin.set_default_payment_method(@kb_account_id, @payment_method, @properties, @call_context) }.should raise_error Killbill::Plugin::Payment::OperationUnsupportedByGatewayError
|
33
|
-
|
34
41
|
lambda { @plugin.get_payment_method_detail(@kb_account_id, @payment_method, @properties, @call_context) }.should raise_error Killbill::Plugin::Payment::OperationUnsupportedByGatewayError
|
42
|
+
lambda { @plugin.set_default_payment_method(@kb_account_id, @payment_method, @properties, @call_context) }.should raise_error Killbill::Plugin::Payment::OperationUnsupportedByGatewayError
|
35
43
|
lambda { @plugin.get_payment_methods(@kb_account_id, true, @properties, @call_context) }.should raise_error Killbill::Plugin::Payment::OperationUnsupportedByGatewayError
|
36
|
-
lambda { @plugin.
|
44
|
+
lambda { @plugin.search_payment_methods(@search_key, @offset, @limit, @properties, @call_context) }.should raise_error Killbill::Plugin::Payment::OperationUnsupportedByGatewayError
|
45
|
+
lambda { @plugin.reset_payment_methods(@kb_account_id, @payment_methods, @properties, @call_context) }.should raise_error Killbill::Plugin::Payment::OperationUnsupportedByGatewayError
|
46
|
+
lambda { @plugin.build_form_descriptor(@kb_account_id, [], @properties, @call_context) }.should raise_error Killbill::Plugin::Payment::OperationUnsupportedByGatewayError
|
47
|
+
lambda { @plugin.process_notification("{ 'key' => 'value' }", @properties, @call_context) }.should raise_error Killbill::Plugin::Payment::OperationUnsupportedByGatewayError
|
37
48
|
end
|
38
49
|
end
|
@@ -8,11 +8,11 @@ module Killbill
|
|
8
8
|
@raise_exception = false
|
9
9
|
end
|
10
10
|
|
11
|
-
def
|
11
|
+
def purchase_payment(kb_account_id, kb_payment_id, kb_payment_transaction_id, kb_payment_method_id, amount_in_cents, currency, properties, context)
|
12
12
|
if @raise_exception
|
13
13
|
raise StandardError.new("Test exception")
|
14
14
|
else
|
15
|
-
res = Killbill::Plugin::Model::
|
15
|
+
res = Killbill::Plugin::Model::PaymentTransactionInfoPlugin.new
|
16
16
|
res.amount=amount_in_cents
|
17
17
|
res.status=:PROCESSED
|
18
18
|
res
|
@@ -23,18 +23,18 @@ module Killbill
|
|
23
23
|
if @raise_exception
|
24
24
|
raise StandardError.new("Test exception")
|
25
25
|
else
|
26
|
-
res = Killbill::Plugin::Model::
|
26
|
+
res = Killbill::Plugin::Model::PaymentTransactionInfoPlugin.new
|
27
27
|
res.amount=0
|
28
28
|
res.status=:PROCESSED
|
29
|
-
res
|
29
|
+
[res]
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
-
def
|
33
|
+
def refund_payment(kb_account_id, kb_payment_id, kb_payment_transaction_id, kb_payment_method_id, amount_in_cents, currency, properties, context)
|
34
34
|
if @raise_exception
|
35
35
|
raise StandardError.new("Test exception")
|
36
36
|
else
|
37
|
-
res = Killbill::Plugin::Model::
|
37
|
+
res = Killbill::Plugin::Model::PaymentTransactionInfoPlugin.new
|
38
38
|
res.amount=50
|
39
39
|
res.status=:PROCESSED
|
40
40
|
res
|
@@ -98,7 +98,6 @@ module Killbill
|
|
98
98
|
def clear_exception_on_next_calls
|
99
99
|
@raise_exception = false
|
100
100
|
end
|
101
|
-
|
102
101
|
end
|
103
102
|
end
|
104
103
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -34,6 +34,9 @@ ActiveRecord::Base.establish_connection(
|
|
34
34
|
:adapter => 'sqlite3',
|
35
35
|
:database => 'test.db'
|
36
36
|
)
|
37
|
+
# For debugging
|
38
|
+
#ActiveRecord::Base.logger = Logger.new(STDOUT)
|
39
|
+
# Create the schema
|
37
40
|
require File.expand_path(File.dirname(__FILE__) + '/killbill/helpers/test_schema.rb')
|
38
41
|
|
39
42
|
begin
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: killbill
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kill Bill core team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-07-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sinatra
|
@@ -257,7 +257,6 @@ files:
|
|
257
257
|
- lib/killbill/gen/api/osgi_killbill.rb
|
258
258
|
- lib/killbill/gen/api/osgi_plugin_properties.rb
|
259
259
|
- lib/killbill/gen/api/pagination.rb
|
260
|
-
- lib/killbill/gen/api/payment.rb
|
261
260
|
- lib/killbill/gen/api/payment_api.rb
|
262
261
|
- lib/killbill/gen/api/payment_api_exception.rb
|
263
262
|
- lib/killbill/gen/api/payment_attempt.rb
|
@@ -265,6 +264,7 @@ files:
|
|
265
264
|
- lib/killbill/gen/api/payment_method.rb
|
266
265
|
- lib/killbill/gen/api/payment_method_kv_info.rb
|
267
266
|
- lib/killbill/gen/api/payment_method_plugin.rb
|
267
|
+
- lib/killbill/gen/api/payment_options.rb
|
268
268
|
- lib/killbill/gen/api/plan.rb
|
269
269
|
- lib/killbill/gen/api/plan_change_result.rb
|
270
270
|
- lib/killbill/gen/api/plan_phase.rb
|
@@ -313,11 +313,10 @@ files:
|
|
313
313
|
- lib/killbill/gen/plugin-api/gateway_notification.rb
|
314
314
|
- lib/killbill/gen/plugin-api/hosted_payment_page_form_descriptor.rb
|
315
315
|
- lib/killbill/gen/plugin-api/notification_plugin_api.rb
|
316
|
-
- lib/killbill/gen/plugin-api/payment_info_plugin.rb
|
317
316
|
- lib/killbill/gen/plugin-api/payment_method_info_plugin.rb
|
318
317
|
- lib/killbill/gen/plugin-api/payment_plugin_api.rb
|
319
318
|
- lib/killbill/gen/plugin-api/payment_plugin_api_exception.rb
|
320
|
-
- lib/killbill/gen/plugin-api/
|
319
|
+
- lib/killbill/gen/plugin-api/payment_transaction_info_plugin.rb
|
321
320
|
- lib/killbill/gen/plugin-api/require_gen.rb
|
322
321
|
- lib/killbill/helpers/active_merchant.rb
|
323
322
|
- lib/killbill/helpers/active_merchant/active_record.rb
|
@@ -351,6 +350,7 @@ files:
|
|
351
350
|
- spec/killbill/helpers/payment_method_spec.rb
|
352
351
|
- spec/killbill/helpers/response_spec.rb
|
353
352
|
- spec/killbill/helpers/test_schema.rb
|
353
|
+
- spec/killbill/helpers/transaction_spec.rb
|
354
354
|
- spec/killbill/helpers/utils_spec.rb
|
355
355
|
- spec/killbill/killbill_integration_spec.rb
|
356
356
|
- spec/killbill/killbillapi_spec.rb
|
@@ -397,6 +397,7 @@ test_files:
|
|
397
397
|
- spec/killbill/helpers/payment_method_spec.rb
|
398
398
|
- spec/killbill/helpers/response_spec.rb
|
399
399
|
- spec/killbill/helpers/test_schema.rb
|
400
|
+
- spec/killbill/helpers/transaction_spec.rb
|
400
401
|
- spec/killbill/helpers/utils_spec.rb
|
401
402
|
- spec/killbill/killbill_integration_spec.rb
|
402
403
|
- spec/killbill/killbillapi_spec.rb
|
@@ -1,187 +0,0 @@
|
|
1
|
-
###################################################################################
|
2
|
-
# #
|
3
|
-
# Copyright 2010-2013 Ning, Inc. #
|
4
|
-
# #
|
5
|
-
# Ning licenses this file to you under the Apache License, version 2.0 #
|
6
|
-
# (the "License"); you may not use this file except in compliance with the #
|
7
|
-
# License. You may obtain a copy of the License at: #
|
8
|
-
# #
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0 #
|
10
|
-
# #
|
11
|
-
# Unless required by applicable law or agreed to in writing, software #
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT #
|
13
|
-
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the #
|
14
|
-
# License for the specific language governing permissions and limitations #
|
15
|
-
# under the License. #
|
16
|
-
# #
|
17
|
-
###################################################################################
|
18
|
-
|
19
|
-
|
20
|
-
#
|
21
|
-
# DO NOT EDIT!!!
|
22
|
-
# File automatically generated by killbill-java-parser (git@github.com:killbill/killbill-java-parser.git)
|
23
|
-
#
|
24
|
-
|
25
|
-
|
26
|
-
module Killbill
|
27
|
-
module Plugin
|
28
|
-
module Model
|
29
|
-
|
30
|
-
java_package 'org.killbill.billing.payment.api'
|
31
|
-
class Payment
|
32
|
-
|
33
|
-
include org.killbill.billing.payment.api.Payment
|
34
|
-
|
35
|
-
attr_accessor :id, :created_date, :updated_date, :account_id, :invoice_id, :payment_method_id, :payment_number, :amount, :paid_amount, :effective_date, :currency, :payment_status, :attempts, :payment_info_plugin
|
36
|
-
|
37
|
-
def initialize()
|
38
|
-
end
|
39
|
-
|
40
|
-
def to_java()
|
41
|
-
# conversion for id [type = java.util.UUID]
|
42
|
-
@id = java.util.UUID.fromString(@id.to_s) unless @id.nil?
|
43
|
-
|
44
|
-
# conversion for created_date [type = org.joda.time.DateTime]
|
45
|
-
if !@created_date.nil?
|
46
|
-
@created_date = (@created_date.kind_of? Time) ? DateTime.parse(@created_date.to_s) : @created_date
|
47
|
-
@created_date = Java::org.joda.time.DateTime.new(@created_date.to_s, Java::org.joda.time.DateTimeZone::UTC)
|
48
|
-
end
|
49
|
-
|
50
|
-
# conversion for updated_date [type = org.joda.time.DateTime]
|
51
|
-
if !@updated_date.nil?
|
52
|
-
@updated_date = (@updated_date.kind_of? Time) ? DateTime.parse(@updated_date.to_s) : @updated_date
|
53
|
-
@updated_date = Java::org.joda.time.DateTime.new(@updated_date.to_s, Java::org.joda.time.DateTimeZone::UTC)
|
54
|
-
end
|
55
|
-
|
56
|
-
# conversion for account_id [type = java.util.UUID]
|
57
|
-
@account_id = java.util.UUID.fromString(@account_id.to_s) unless @account_id.nil?
|
58
|
-
|
59
|
-
# conversion for invoice_id [type = java.util.UUID]
|
60
|
-
@invoice_id = java.util.UUID.fromString(@invoice_id.to_s) unless @invoice_id.nil?
|
61
|
-
|
62
|
-
# conversion for payment_method_id [type = java.util.UUID]
|
63
|
-
@payment_method_id = java.util.UUID.fromString(@payment_method_id.to_s) unless @payment_method_id.nil?
|
64
|
-
|
65
|
-
# conversion for payment_number [type = java.lang.Integer]
|
66
|
-
@payment_number = @payment_number
|
67
|
-
|
68
|
-
# conversion for amount [type = java.math.BigDecimal]
|
69
|
-
if @amount.nil?
|
70
|
-
@amount = java.math.BigDecimal::ZERO
|
71
|
-
else
|
72
|
-
@amount = java.math.BigDecimal.new(@amount.to_s)
|
73
|
-
end
|
74
|
-
|
75
|
-
# conversion for paid_amount [type = java.math.BigDecimal]
|
76
|
-
if @paid_amount.nil?
|
77
|
-
@paid_amount = java.math.BigDecimal::ZERO
|
78
|
-
else
|
79
|
-
@paid_amount = java.math.BigDecimal.new(@paid_amount.to_s)
|
80
|
-
end
|
81
|
-
|
82
|
-
# conversion for effective_date [type = org.joda.time.DateTime]
|
83
|
-
if !@effective_date.nil?
|
84
|
-
@effective_date = (@effective_date.kind_of? Time) ? DateTime.parse(@effective_date.to_s) : @effective_date
|
85
|
-
@effective_date = Java::org.joda.time.DateTime.new(@effective_date.to_s, Java::org.joda.time.DateTimeZone::UTC)
|
86
|
-
end
|
87
|
-
|
88
|
-
# conversion for currency [type = org.killbill.billing.catalog.api.Currency]
|
89
|
-
@currency = Java::org.killbill.billing.catalog.api.Currency.value_of("#{@currency.to_s}") unless @currency.nil?
|
90
|
-
|
91
|
-
# conversion for payment_status [type = org.killbill.billing.payment.api.PaymentStatus]
|
92
|
-
@payment_status = Java::org.killbill.billing.payment.api.PaymentStatus.value_of("#{@payment_status.to_s}") unless @payment_status.nil?
|
93
|
-
|
94
|
-
# conversion for attempts [type = java.util.List]
|
95
|
-
tmp = java.util.ArrayList.new
|
96
|
-
(@attempts || []).each do |m|
|
97
|
-
# conversion for m [type = org.killbill.billing.payment.api.PaymentAttempt]
|
98
|
-
m = m.to_java unless m.nil?
|
99
|
-
tmp.add(m)
|
100
|
-
end
|
101
|
-
@attempts = tmp
|
102
|
-
|
103
|
-
# conversion for payment_info_plugin [type = org.killbill.billing.payment.plugin.api.PaymentInfoPlugin]
|
104
|
-
@payment_info_plugin = @payment_info_plugin.to_java unless @payment_info_plugin.nil?
|
105
|
-
self
|
106
|
-
end
|
107
|
-
|
108
|
-
def to_ruby(j_obj)
|
109
|
-
# conversion for id [type = java.util.UUID]
|
110
|
-
@id = j_obj.id
|
111
|
-
@id = @id.nil? ? nil : @id.to_s
|
112
|
-
|
113
|
-
# conversion for created_date [type = org.joda.time.DateTime]
|
114
|
-
@created_date = j_obj.created_date
|
115
|
-
if !@created_date.nil?
|
116
|
-
fmt = Java::org.joda.time.format.ISODateTimeFormat.date_time_no_millis # See https://github.com/killbill/killbill-java-parser/issues/3
|
117
|
-
str = fmt.print(@created_date)
|
118
|
-
@created_date = DateTime.iso8601(str)
|
119
|
-
end
|
120
|
-
|
121
|
-
# conversion for updated_date [type = org.joda.time.DateTime]
|
122
|
-
@updated_date = j_obj.updated_date
|
123
|
-
if !@updated_date.nil?
|
124
|
-
fmt = Java::org.joda.time.format.ISODateTimeFormat.date_time_no_millis # See https://github.com/killbill/killbill-java-parser/issues/3
|
125
|
-
str = fmt.print(@updated_date)
|
126
|
-
@updated_date = DateTime.iso8601(str)
|
127
|
-
end
|
128
|
-
|
129
|
-
# conversion for account_id [type = java.util.UUID]
|
130
|
-
@account_id = j_obj.account_id
|
131
|
-
@account_id = @account_id.nil? ? nil : @account_id.to_s
|
132
|
-
|
133
|
-
# conversion for invoice_id [type = java.util.UUID]
|
134
|
-
@invoice_id = j_obj.invoice_id
|
135
|
-
@invoice_id = @invoice_id.nil? ? nil : @invoice_id.to_s
|
136
|
-
|
137
|
-
# conversion for payment_method_id [type = java.util.UUID]
|
138
|
-
@payment_method_id = j_obj.payment_method_id
|
139
|
-
@payment_method_id = @payment_method_id.nil? ? nil : @payment_method_id.to_s
|
140
|
-
|
141
|
-
# conversion for payment_number [type = java.lang.Integer]
|
142
|
-
@payment_number = j_obj.payment_number
|
143
|
-
|
144
|
-
# conversion for amount [type = java.math.BigDecimal]
|
145
|
-
@amount = j_obj.amount
|
146
|
-
@amount = @amount.nil? ? 0 : BigDecimal.new(@amount.to_s)
|
147
|
-
|
148
|
-
# conversion for paid_amount [type = java.math.BigDecimal]
|
149
|
-
@paid_amount = j_obj.paid_amount
|
150
|
-
@paid_amount = @paid_amount.nil? ? 0 : BigDecimal.new(@paid_amount.to_s)
|
151
|
-
|
152
|
-
# conversion for effective_date [type = org.joda.time.DateTime]
|
153
|
-
@effective_date = j_obj.effective_date
|
154
|
-
if !@effective_date.nil?
|
155
|
-
fmt = Java::org.joda.time.format.ISODateTimeFormat.date_time_no_millis # See https://github.com/killbill/killbill-java-parser/issues/3
|
156
|
-
str = fmt.print(@effective_date)
|
157
|
-
@effective_date = DateTime.iso8601(str)
|
158
|
-
end
|
159
|
-
|
160
|
-
# conversion for currency [type = org.killbill.billing.catalog.api.Currency]
|
161
|
-
@currency = j_obj.currency
|
162
|
-
@currency = @currency.to_s.to_sym unless @currency.nil?
|
163
|
-
|
164
|
-
# conversion for payment_status [type = org.killbill.billing.payment.api.PaymentStatus]
|
165
|
-
@payment_status = j_obj.payment_status
|
166
|
-
@payment_status = @payment_status.to_s.to_sym unless @payment_status.nil?
|
167
|
-
|
168
|
-
# conversion for attempts [type = java.util.List]
|
169
|
-
@attempts = j_obj.attempts
|
170
|
-
tmp = []
|
171
|
-
(@attempts || []).each do |m|
|
172
|
-
# conversion for m [type = org.killbill.billing.payment.api.PaymentAttempt]
|
173
|
-
m = Killbill::Plugin::Model::PaymentAttempt.new.to_ruby(m) unless m.nil?
|
174
|
-
tmp << m
|
175
|
-
end
|
176
|
-
@attempts = tmp
|
177
|
-
|
178
|
-
# conversion for payment_info_plugin [type = org.killbill.billing.payment.plugin.api.PaymentInfoPlugin]
|
179
|
-
@payment_info_plugin = j_obj.payment_info_plugin
|
180
|
-
@payment_info_plugin = Killbill::Plugin::Model::PaymentInfoPlugin.new.to_ruby(@payment_info_plugin) unless @payment_info_plugin.nil?
|
181
|
-
self
|
182
|
-
end
|
183
|
-
|
184
|
-
end
|
185
|
-
end
|
186
|
-
end
|
187
|
-
end
|