killbill 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Jarfile +3 -2
- data/README.md +21 -0
- data/VERSION +1 -1
- data/killbill.gemspec +4 -2
- data/lib/killbill.rb +3 -4
- data/lib/killbill/http_servlet.rb +99 -0
- data/lib/killbill/jpayment.rb +152 -0
- data/lib/killbill/jresponse/jconverter.rb +100 -0
- data/lib/killbill/jresponse/jpayment_method_response.rb +89 -0
- data/lib/killbill/jresponse/jpayment_method_response_internal.rb +54 -0
- data/lib/killbill/jresponse/jpayment_response.rb +59 -0
- data/lib/killbill/jresponse/jrefund_response.rb +60 -0
- data/lib/killbill/logger.rb +44 -0
- data/lib/killbill/payment.rb +16 -8
- data/lib/killbill/plugin.rb +59 -26
- data/lib/killbill/rake_task.rb +27 -8
- data/lib/killbill/response/payment_method_response.rb +31 -0
- data/lib/killbill/response/payment_method_response_internal.rb +20 -0
- data/lib/killbill/response/payment_response.rb +22 -0
- data/lib/killbill/response/payment_status.rb +10 -0
- data/lib/killbill/response/refund_response.rb +23 -0
- data/spec/killbill/base_plugin_spec.rb +7 -0
- data/spec/killbill/config_test.ru +7 -0
- data/spec/killbill/jpayment_spec.rb +121 -0
- data/spec/killbill/jresponse/jconverter_spec.rb +208 -0
- data/spec/killbill/jresponse/jpayment_method_response_internal_spec.rb +34 -0
- data/spec/killbill/jresponse/jpayment_method_response_spec.rb +53 -0
- data/spec/killbill/jresponse/jpayment_response_spec.rb +41 -0
- data/spec/killbill/jresponse/jrefund_response_spec.rb +41 -0
- data/spec/killbill/killbill_integration_spec.rb +4 -5
- data/spec/killbill/payment_plugin_spec.rb +7 -3
- data/spec/killbill/payment_test.rb +88 -0
- data/spec/killbill/rack_handler_spec.rb +16 -0
- data/spec/spec_helper.rb +5 -0
- metadata +79 -16
@@ -0,0 +1,31 @@
|
|
1
|
+
module Killbill
|
2
|
+
module Plugin
|
3
|
+
|
4
|
+
class PaymentMethodProperty
|
5
|
+
|
6
|
+
attr_reader :key,
|
7
|
+
:value,
|
8
|
+
:is_updatable
|
9
|
+
|
10
|
+
def initialize(key, value, is_updatable)
|
11
|
+
@key = key
|
12
|
+
@value = value
|
13
|
+
@is_updatable = is_updatable
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
class PaymentMethodResponse
|
18
|
+
|
19
|
+
attr_reader :external_payment_method_id,
|
20
|
+
:is_default,
|
21
|
+
:properties
|
22
|
+
|
23
|
+
def initialize(external_payment_method_id, is_default, properties)
|
24
|
+
@external_payment_method_id = external_payment_method_id
|
25
|
+
@is_default = is_default
|
26
|
+
@properties = properties
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Killbill
|
2
|
+
module Plugin
|
3
|
+
|
4
|
+
class PaymentMethodResponseInternal
|
5
|
+
|
6
|
+
attr_reader :kb_account_id,
|
7
|
+
:kb_payment_method_id,
|
8
|
+
:is_default,
|
9
|
+
:external_payment_method_id
|
10
|
+
|
11
|
+
def initialize(kb_account_id, kb_payment_method_id, is_default, external_payment_method_id)
|
12
|
+
@kb_account_id = kb_account_id
|
13
|
+
@kb_payment_method_id = kb_payment_method_id
|
14
|
+
@is_default = is_default
|
15
|
+
@external_payment_method_id = external_payment_method_id
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Killbill
|
2
|
+
module Plugin
|
3
|
+
class PaymentResponse
|
4
|
+
|
5
|
+
attr_reader :amount_in_cents,
|
6
|
+
:created_date,
|
7
|
+
:effective_date,
|
8
|
+
:status,
|
9
|
+
:gateway_error,
|
10
|
+
:gateway_error_code
|
11
|
+
|
12
|
+
def initialize(amount_in_cents, created_date, effective_date, status, gateway_error=nil, gateway_error_code=nil)
|
13
|
+
@amount_in_cents = amount_in_cents
|
14
|
+
@created_date = created_date
|
15
|
+
@effective_date = effective_date
|
16
|
+
@status = status
|
17
|
+
@gateway_error = gateway_error
|
18
|
+
@gateway_error_code = gateway_error_code
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Killbill
|
2
|
+
module Plugin
|
3
|
+
|
4
|
+
class RefundResponse
|
5
|
+
|
6
|
+
attr_reader :amount_in_cents,
|
7
|
+
:created_date,
|
8
|
+
:effective_date,
|
9
|
+
:status,
|
10
|
+
:gateway_error,
|
11
|
+
:gateway_error_code
|
12
|
+
|
13
|
+
def initialize(amount_in_cents, created_date, effective_date, status, gateway_error, gateway_error_code)
|
14
|
+
@amount_in_cents = amount_in_cents
|
15
|
+
@created_date = created_date
|
16
|
+
@effective_date = effective_date
|
17
|
+
@status = status
|
18
|
+
@gateway_error = gateway_error
|
19
|
+
@gateway_error_code = gateway_error_code
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -19,7 +19,14 @@ describe Killbill::Plugin::PluginBase do
|
|
19
19
|
plugin = Killbill::Plugin::PluginBase.new(:account_user_api => MockAccountUserApi.new)
|
20
20
|
|
21
21
|
plugin.account_user_api.get_accounts(nil).size.should == 0
|
22
|
+
# Existing API, present
|
23
|
+
lambda { plugin.account_user_api.do_foo('with my bar') }.should_not raise_error Killbill::Plugin::PluginBase::APINotAvailableError
|
24
|
+
# Existing API, absent
|
25
|
+
lambda { plugin.payment_api.do_foo('with my bar') }.should raise_error Killbill::Plugin::PluginBase::APINotAvailableError
|
26
|
+
# Non-existing API
|
22
27
|
lambda { plugin.foobar_user_api.do_foo('with my bar') }.should raise_error Killbill::Plugin::PluginBase::APINotAvailableError
|
28
|
+
# Default method missing behavior
|
29
|
+
lambda { plugin.blablabla }.should raise_error NoMethodError
|
23
30
|
end
|
24
31
|
|
25
32
|
it 'should be able to add custom code in the startup/shutdown sequence' do
|
@@ -0,0 +1,121 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
require 'killbill/jpayment'
|
4
|
+
|
5
|
+
describe Killbill::Plugin::JPayment do
|
6
|
+
|
7
|
+
before(:all) do
|
8
|
+
@jpayment = Killbill::Plugin::JPayment.new("Killbill::Plugin::PaymentTest")
|
9
|
+
@kb_account_id = java.util.UUID.fromString("aa5c926e-3d9d-4435-b44b-719d7b583256")
|
10
|
+
@kb_payment_id = java.util.UUID.fromString("bf5c926e-3d9c-470e-b34b-719d7b58323a")
|
11
|
+
@kb_payment_method_id = java.util.UUID.fromString("bf5c926e-3d9c-470e-b34b-719d7b58323a")
|
12
|
+
@payment_method_plugin = nil
|
13
|
+
@amount = java.math.BigDecimal.new("50")
|
14
|
+
end
|
15
|
+
|
16
|
+
before(:each) do
|
17
|
+
@jpayment.real_payment.send(:clear_exception_on_next_calls)
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should_test_charge_ok" do
|
21
|
+
output = @jpayment.charge(@kb_payment_id, @kb_payment_method_id, @amount)
|
22
|
+
output.get_amount.should be_an_instance_of java.math.BigDecimal
|
23
|
+
output.get_amount.to_s.should == "50.00";
|
24
|
+
output.get_status.should be_an_instance_of Java::com.ning.billing.payment.plugin.api.PaymentInfoPlugin::PaymentPluginStatus
|
25
|
+
output.get_status.to_s.should == "PROCESSED"
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should_test_charge_exception" do
|
29
|
+
@jpayment.real_payment.send(:raise_exception_on_next_calls)
|
30
|
+
lambda { @jpayment.charge(@kb_payment_id, @kb_payment_method_id, @amount) }.should raise_error Java::com.ning.billing.payment.plugin.api.PaymentPluginApiException
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should_test_get_payment_info_ok" do
|
34
|
+
output = @jpayment.get_payment_info(@kb_payment_method_id)
|
35
|
+
output.get_amount.should be_an_instance_of java.math.BigDecimal
|
36
|
+
output.get_amount.to_s.should == "0.00";
|
37
|
+
output.get_status.should be_an_instance_of Java::com.ning.billing.payment.plugin.api.PaymentInfoPlugin::PaymentPluginStatus
|
38
|
+
output.get_status.to_s.should == "PROCESSED"
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should_test_get_payment_info_exception" do
|
42
|
+
@jpayment.real_payment.send(:raise_exception_on_next_calls)
|
43
|
+
lambda { @jpayment.get_payment_info(@kb_payment_method_id) }.should raise_error Java::com.ning.billing.payment.plugin.api.PaymentPluginApiException
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should_test_refund_ok" do
|
47
|
+
output = @jpayment.refund(@kb_payment_method_id, @amount)
|
48
|
+
output.get_amount.should be_an_instance_of java.math.BigDecimal
|
49
|
+
output.get_amount.to_s.should == "50.00";
|
50
|
+
output.get_status.should be_an_instance_of Java::com.ning.billing.payment.plugin.api.PaymentInfoPlugin::PaymentPluginStatus
|
51
|
+
output.get_status.to_s.should == "PROCESSED"
|
52
|
+
end
|
53
|
+
|
54
|
+
it "should_test_refund_exception" do
|
55
|
+
@jpayment.real_payment.send(:raise_exception_on_next_calls)
|
56
|
+
lambda { @jpayment.refund(@kb_payment_method_id, @amount) }.should raise_error Java::com.ning.billing.payment.plugin.api.PaymentPluginApiException
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should_test_add_payment_method_ok" do
|
60
|
+
@jpayment.add_payment_method(@kb_account_id, @kb_payment_method_id, @payment_method_plugin, java.lang.Boolean.new("true"))
|
61
|
+
end
|
62
|
+
|
63
|
+
it "should_test_add_payment_method_exception" do
|
64
|
+
@jpayment.real_payment.send(:raise_exception_on_next_calls)
|
65
|
+
lambda { @jpayment.add_payment_method(@kb_account_id, @kb_payment_method_id, @payment_method_plugin, true) }.should raise_error Java::com.ning.billing.payment.plugin.api.PaymentPluginApiException
|
66
|
+
end
|
67
|
+
|
68
|
+
|
69
|
+
it "should_test_delete_payment_method_ok" do
|
70
|
+
@jpayment.delete_payment_method(@kb_payment_method_id)
|
71
|
+
end
|
72
|
+
|
73
|
+
it "should_test_delete_payment_method_exception" do
|
74
|
+
@jpayment.real_payment.send(:raise_exception_on_next_calls)
|
75
|
+
lambda { @jpayment.delete_payment_method(@kb_payment_method_id) }.should raise_error Java::com.ning.billing.payment.plugin.api.PaymentPluginApiException
|
76
|
+
end
|
77
|
+
|
78
|
+
it "should_test_get_payment_method_detail_ok" do
|
79
|
+
output = @jpayment.get_payment_method_detail(@kb_account_id, @kb_payment_method_id)
|
80
|
+
output.get_external_payment_method_id.should be_an_instance_of java.lang.String
|
81
|
+
output.get_external_payment_method_id.should == "foo"
|
82
|
+
end
|
83
|
+
|
84
|
+
it "should_test_get_payment_method_detail_exception" do
|
85
|
+
@jpayment.real_payment.send(:raise_exception_on_next_calls)
|
86
|
+
lambda { @jpayment.get_payment_method_detail(@kb_account_id, @kb_payment_method_id) }.should raise_error Java::com.ning.billing.payment.plugin.api.PaymentPluginApiException
|
87
|
+
end
|
88
|
+
|
89
|
+
it "should_test_set_default_payment_method_ok" do
|
90
|
+
@jpayment.set_default_payment_method(@kb_payment_method_id)
|
91
|
+
end
|
92
|
+
|
93
|
+
it "should_test_set_default_payment_method_exception" do
|
94
|
+
@jpayment.real_payment.send(:raise_exception_on_next_calls)
|
95
|
+
lambda { @jpayment.set_default_payment_method(@kb_payment_method_id) }.should raise_error Java::com.ning.billing.payment.plugin.api.PaymentPluginApiException
|
96
|
+
end
|
97
|
+
|
98
|
+
it "should_get_payment_methods_ok" do
|
99
|
+
output = @jpayment.get_payment_methods(@kb_account_id, java.lang.Boolean.new("true"))
|
100
|
+
|
101
|
+
output.should be_an_instance_of java.util.ArrayList
|
102
|
+
output.size.should == 1
|
103
|
+
|
104
|
+
current_payment_method = output.get(0)
|
105
|
+
current_payment_method.get_account_id.to_s.should == @kb_account_id.to_s
|
106
|
+
end
|
107
|
+
|
108
|
+
it "should_get_payment_methods_exception" do
|
109
|
+
@jpayment.real_payment.send(:raise_exception_on_next_calls)
|
110
|
+
lambda { @jpayment.get_payment_methods(@kb_account_id, true) }.should raise_error Java::com.ning.billing.payment.plugin.api.PaymentPluginApiException
|
111
|
+
end
|
112
|
+
|
113
|
+
it "should_test_reset_payment_methods_ok" do
|
114
|
+
@jpayment.reset_payment_methods(java.util.ArrayList.new)
|
115
|
+
end
|
116
|
+
|
117
|
+
it "should_test_reset_payment_methods_exception" do
|
118
|
+
@jpayment.real_payment.send(:raise_exception_on_next_calls)
|
119
|
+
lambda { @jpayment.reset_payment_methods(java.util.ArrayList.new) }.should raise_error Java::com.ning.billing.payment.plugin.api.PaymentPluginApiException
|
120
|
+
end
|
121
|
+
end
|
@@ -0,0 +1,208 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'date'
|
3
|
+
|
4
|
+
require 'killbill/response/payment_method_response'
|
5
|
+
require 'killbill/response/payment_method_response_internal'
|
6
|
+
require 'killbill/response/payment_status'
|
7
|
+
require 'killbill/response/payment_response'
|
8
|
+
require 'killbill/response/refund_response'
|
9
|
+
|
10
|
+
require 'killbill/jresponse/jconverter'
|
11
|
+
require 'killbill/jresponse/jpayment_method_response'
|
12
|
+
require 'killbill/jresponse/jpayment_method_response_internal'
|
13
|
+
|
14
|
+
describe Killbill::Plugin::JConverter do
|
15
|
+
|
16
|
+
it "should_test_uuid_converter" do
|
17
|
+
input = "bf5c926e-3d9c-470e-b34b-0719d7b58323"
|
18
|
+
output = Killbill::Plugin::JConverter.to_uuid(input)
|
19
|
+
output.should be_an_instance_of java.util.UUID
|
20
|
+
output.to_s.should == input
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should_test_joda_date_time_converter" do
|
24
|
+
input_str = '2013-03-11T16:05:11-07:00'
|
25
|
+
expected_output_str = '2013-03-11T16:05:11.000-07:00'
|
26
|
+
input = org.joda.time.DateTime.parse(input_str)
|
27
|
+
output = Killbill::Plugin::JConverter.to_joda_date_time(input)
|
28
|
+
output.should be_an_instance_of org.joda.time.DateTime
|
29
|
+
output.to_s.should == expected_output_str
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should_test_to_string_converter" do
|
33
|
+
input = "great it works"
|
34
|
+
output = Killbill::Plugin::JConverter.to_string(input)
|
35
|
+
output.should be_an_instance_of java.lang.String
|
36
|
+
output.should == input
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should_test_payment_plugin_status_success_converter" do
|
40
|
+
input = Killbill::Plugin::PaymentStatus::SUCCESS
|
41
|
+
output = Killbill::Plugin::JConverter.to_payment_plugin_status(input)
|
42
|
+
output.should be_an_instance_of Java::com.ning.billing.payment.plugin.api.PaymentInfoPlugin::PaymentPluginStatus
|
43
|
+
output.should == Java::com.ning.billing.payment.plugin.api.PaymentInfoPlugin::PaymentPluginStatus::PROCESSED
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should_test_payment_plugin_status_failed_converter" do
|
47
|
+
input = Killbill::Plugin::PaymentStatus::ERROR
|
48
|
+
output = Killbill::Plugin::JConverter.to_payment_plugin_status(input)
|
49
|
+
output.should be_an_instance_of Java::com.ning.billing.payment.plugin.api.PaymentInfoPlugin::PaymentPluginStatus
|
50
|
+
output.should == Java::com.ning.billing.payment.plugin.api.PaymentInfoPlugin::PaymentPluginStatus::ERROR
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should_test_payment_plugin_status_undefined_converter" do
|
54
|
+
input = Killbill::Plugin::PaymentStatus::UNDEFINED
|
55
|
+
output = Killbill::Plugin::JConverter.to_payment_plugin_status(input)
|
56
|
+
output.should be_an_instance_of Java::com.ning.billing.payment.plugin.api.PaymentInfoPlugin::PaymentPluginStatus
|
57
|
+
output.should == Java::com.ning.billing.payment.plugin.api.PaymentInfoPlugin::PaymentPluginStatus::UNDEFINED
|
58
|
+
end
|
59
|
+
|
60
|
+
it "should_test_big_decimal_converter" do
|
61
|
+
{
|
62
|
+
nil => '0',
|
63
|
+
1 => '0.01',
|
64
|
+
0 => '0',
|
65
|
+
-1 => '-0.01',
|
66
|
+
12376 => '12.376',
|
67
|
+
-532 => '-5.32'
|
68
|
+
}.each do |input,output|
|
69
|
+
output = Killbill::Plugin::JConverter.to_big_decimal(input)
|
70
|
+
output.should be_an_instance_of java.math.BigDecimal
|
71
|
+
output.to_s.should == output.to_s
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
it "should_test_boolean_true_converter" do
|
76
|
+
input = true
|
77
|
+
output = Killbill::Plugin::JConverter.to_boolean(input)
|
78
|
+
output.should be_an_instance_of java.lang.Boolean
|
79
|
+
output.to_s == input.to_s
|
80
|
+
end
|
81
|
+
|
82
|
+
it "should_test_boolean_false_converter" do
|
83
|
+
input = nil
|
84
|
+
output = Killbill::Plugin::JConverter.to_boolean(input)
|
85
|
+
output.should be_an_instance_of java.lang.Boolean
|
86
|
+
output.to_s == "false"
|
87
|
+
end
|
88
|
+
|
89
|
+
it "should_test_uuid_from_converter" do
|
90
|
+
input = java.util.UUID.random_uuid
|
91
|
+
output = Killbill::Plugin::JConverter.from_uuid(input)
|
92
|
+
output.should be_an_instance_of String
|
93
|
+
output.to_s.should == input.to_s
|
94
|
+
end
|
95
|
+
|
96
|
+
|
97
|
+
it "should_test_boolean_from_nil_converter" do
|
98
|
+
input = nil
|
99
|
+
output = Killbill::Plugin::JConverter.from_boolean(input)
|
100
|
+
output.should be_an_instance_of FalseClass
|
101
|
+
output.to_s == "false"
|
102
|
+
end
|
103
|
+
|
104
|
+
it "should_test_boolean_from_false_converter" do
|
105
|
+
input = java.lang.Boolean.new("false")
|
106
|
+
output = Killbill::Plugin::JConverter.from_boolean(input)
|
107
|
+
output.should be_an_instance_of FalseClass
|
108
|
+
output.to_s == "false"
|
109
|
+
end
|
110
|
+
|
111
|
+
it "should_test_boolean_from_false2_converter" do
|
112
|
+
input = java.lang.Boolean.new("false").boolean_value
|
113
|
+
output = Killbill::Plugin::JConverter.from_boolean(input)
|
114
|
+
output.should be_an_instance_of FalseClass
|
115
|
+
output.to_s == "false"
|
116
|
+
end
|
117
|
+
|
118
|
+
|
119
|
+
it "should_test_boolean_from_true_converter" do
|
120
|
+
input = java.lang.Boolean.new("true")
|
121
|
+
output = Killbill::Plugin::JConverter.from_boolean(input)
|
122
|
+
output.should be_an_instance_of TrueClass
|
123
|
+
output.to_s == "true"
|
124
|
+
end
|
125
|
+
|
126
|
+
it "should_test_boolean_from_true2_converter" do
|
127
|
+
input = java.lang.Boolean.new("true").boolean_value
|
128
|
+
output = Killbill::Plugin::JConverter.from_boolean(input)
|
129
|
+
output.should be_an_instance_of TrueClass
|
130
|
+
output.to_s == "true"
|
131
|
+
end
|
132
|
+
|
133
|
+
|
134
|
+
it "should_test_joda_time_from_converter" do
|
135
|
+
input = org.joda.time.DateTime.new
|
136
|
+
input = input.minus_millis(input.millis_of_second)
|
137
|
+
output = Killbill::Plugin::JConverter.from_joda_date_time(input)
|
138
|
+
output.should be_an_instance_of DateTime
|
139
|
+
|
140
|
+
input_match = Killbill::Plugin::JConverter.to_joda_date_time(output)
|
141
|
+
input_match.to_s.should == input.to_s
|
142
|
+
end
|
143
|
+
|
144
|
+
it "should_test_payment_status_from_converter" do
|
145
|
+
input = Java::com.ning.billing.payment.plugin.api.PaymentInfoPlugin::PaymentPluginStatus::PROCESSED
|
146
|
+
output = Killbill::Plugin::JConverter.from_payment_plugin_status(input)
|
147
|
+
output.should == Killbill::Plugin::PaymentStatus::SUCCESS
|
148
|
+
end
|
149
|
+
|
150
|
+
it "should_test_big_decimal_from_converter" do
|
151
|
+
input = java.math.BigDecimal::TEN
|
152
|
+
output = Killbill::Plugin::JConverter.from_big_decimal(input)
|
153
|
+
output.should be_an_instance_of Fixnum
|
154
|
+
output.to_s.should == "1000"
|
155
|
+
end
|
156
|
+
|
157
|
+
it "should_test_payment_method_plugin_from_converter" do
|
158
|
+
prop = Killbill::Plugin::PaymentMethodProperty.new("key", "value", true)
|
159
|
+
payment_method_response = Killbill::Plugin::PaymentMethodResponse.new("external_payment_method_id", true, [prop])
|
160
|
+
input = Killbill::Plugin::JPaymentMethodResponse.new(payment_method_response)
|
161
|
+
output = Killbill::Plugin::JConverter.from_payment_method_plugin(input)
|
162
|
+
|
163
|
+
output.should be_an_instance_of Killbill::Plugin::PaymentMethodResponse
|
164
|
+
|
165
|
+
output.external_payment_method_id.should be_an_instance_of String
|
166
|
+
output.external_payment_method_id.should == payment_method_response.external_payment_method_id
|
167
|
+
|
168
|
+
output.is_default.should be_an_instance_of TrueClass
|
169
|
+
output.is_default.should == payment_method_response.is_default
|
170
|
+
|
171
|
+
output.properties.should be_an_instance_of Array
|
172
|
+
output.properties.size.should == 1
|
173
|
+
|
174
|
+
output_prop = output.properties[0]
|
175
|
+
output_prop.should be_an_instance_of Killbill::Plugin::PaymentMethodProperty
|
176
|
+
|
177
|
+
output_prop.key.should be_an_instance_of String
|
178
|
+
output_prop.key.should == prop.key
|
179
|
+
|
180
|
+
output_prop.value.should be_an_instance_of String
|
181
|
+
output_prop.value.should == prop.value
|
182
|
+
|
183
|
+
output_prop.is_updatable.should be_an_instance_of TrueClass
|
184
|
+
output_prop.is_updatable.should == prop.is_updatable
|
185
|
+
end
|
186
|
+
|
187
|
+
it "should_test_payment_method_info_plugin__from_converter" do
|
188
|
+
|
189
|
+
payment_method_info = Killbill::Plugin::PaymentMethodResponseInternal.new("bf5c926e-3d9c-470e-b34b-0719d7b58323", "ca5c926e-3d9c-470e-b34b-0719d7b58312", false, "external_payment_method_id")
|
190
|
+
input = Killbill::Plugin::JPaymentMethodResponseInternal.new(payment_method_info)
|
191
|
+
output = Killbill::Plugin::JConverter.from_payment_method_info_plugin(input)
|
192
|
+
|
193
|
+
output.should be_an_instance_of Killbill::Plugin::PaymentMethodResponseInternal
|
194
|
+
|
195
|
+
output.kb_account_id.should be_an_instance_of String
|
196
|
+
output.kb_account_id.should == payment_method_info.kb_account_id
|
197
|
+
|
198
|
+
output.kb_payment_method_id.should be_an_instance_of String
|
199
|
+
output.kb_payment_method_id.should == payment_method_info.kb_payment_method_id
|
200
|
+
|
201
|
+
output.is_default.should be_an_instance_of FalseClass
|
202
|
+
output.is_default.should == payment_method_info.is_default
|
203
|
+
|
204
|
+
output.external_payment_method_id.should be_an_instance_of String
|
205
|
+
output.external_payment_method_id.should == payment_method_info.external_payment_method_id
|
206
|
+
|
207
|
+
end
|
208
|
+
end
|