killbill-payment-test 1.0.9 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/Jarfile CHANGED
@@ -1,3 +1,5 @@
1
- jar 'com.ning.billing:killbill-api', '0.1.80'
2
- jar 'com.ning.billing:killbill-util:tests', '0.1.80'
1
+ jar 'com.ning.billing:killbill-api', '0.3.0'
2
+ jar 'com.ning.billing.plugin:killbill-plugin-api-notification', '0.2.4'
3
+ jar 'com.ning.billing.plugin:killbill-plugin-api-payment', '0.2.4'
4
+ jar 'com.ning.billing:killbill-util:tests', '0.2.6-SNAPSHOT'
3
5
  jar 'javax.servlet:javax.servlet-api', '3.0.1'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.9
1
+ 1.1.0
@@ -22,8 +22,7 @@ Gem::Specification.new do |s|
22
22
 
23
23
  s.rdoc_options << '--exclude' << '.'
24
24
 
25
- s.add_dependency 'killbill', '~> 1.0.19'
26
- s.add_dependency 'sinatra', '~> 1.3.4'
25
+ s.add_dependency 'killbill', '~> 1.1.2'
27
26
 
28
27
  s.add_development_dependency 'jbundler', '~> 0.4.1'
29
28
  s.add_development_dependency 'rake', '>= 10.0.0'
@@ -10,31 +10,58 @@ module PaymentTest
10
10
  super
11
11
  end
12
12
 
13
- def initialize(*args)
13
+ def initialize()
14
14
  @raise_exception = false
15
- super(*args)
15
+ super()
16
16
  end
17
17
 
18
18
  def get_name
19
19
  end
20
20
 
21
- def process_payment(kb_account_id, kb_payment_id, kb_payment_method_id, amount_in_cents, currency, call_context, options = {})
21
+ def process_payment(kb_account_id, kb_payment_id, kb_payment_method_id, amount, currency, call_context, options = {})
22
22
  # Make an API call from the payment call
23
- account = @kb_apis.get_account_by_id(kb_account_id)
24
- puts "process_payment got ACCOUNT #{account.inspect}"
25
- Killbill::Plugin::Model::PaymentInfoPlugin.new(amount_in_cents, DateTime.now, DateTime.now, Killbill::Plugin::Model::PaymentPluginStatus.new(:PROCESSED), "gateway_error", "gateway_error_code", nil, nil)
23
+ account = @kb_apis.account_user_api.get_account_by_id(kb_account_id, @kb_apis.create_context)
24
+ res = Killbill::Plugin::Model::PaymentInfoPlugin.new
25
+ res.amount= amount
26
+ res.created_date= DateTime.now
27
+ res.effective_date= DateTime.now
28
+ res.status=:PROCESSED
29
+ res.gateway_error="gateway_error"
30
+ res.gateway_error_code="gateway_error_code"
31
+ res
26
32
  end
27
33
 
28
34
  def get_payment_info(kb_account_id, kb_payment_id, tenant_context, options = {})
29
- Killbill::Plugin::Model::PaymentInfoPlugin.new(0, DateTime.now, DateTime.now, Killbill::Plugin::Model::PaymentPluginStatus.new(:PROCESSED), "gateway_error", "gateway_error_code", nil, nil)
35
+ res = Killbill::Plugin::Model::PaymentInfoPlugin.new
36
+ res.amount= 0
37
+ res.created_date= DateTime.now
38
+ res.effective_date= DateTime.now
39
+ res.status=:PROCESSED
40
+ res.gateway_error="gateway_error"
41
+ res.gateway_error_code="gateway_error_code"
42
+ res
30
43
  end
31
44
 
32
- def process_refund(kb_account_id, kb_payment_id, amount_in_cents, currency, call_context, options = {})
33
- Killbill::Plugin::Model::RefundInfoPlugin.new(amount_in_cents, DateTime.now, DateTime.now, Killbill::Plugin::Model::RefundPluginStatus.new(:PROCESSED), "gateway_error", "gateway_error_code", nil)
45
+ def process_refund(kb_account_id, kb_payment_id, amount, currency, call_context, options = {})
46
+ res = Killbill::Plugin::Model::RefundInfoPlugin.new
47
+ res.amount= amount
48
+ res.created_date= DateTime.now
49
+ res.effective_date=DateTime.now
50
+ res.status=:PROCESSED
51
+ res.gateway_error="gateway_error"
52
+ res.gateway_error_code="gateway_error_code"
53
+ res
34
54
  end
35
55
 
36
56
  def get_refund_info(kb_account_id, kb_payment_id, tenant_context, options = {})
37
- Killbill::Plugin::Model::RefundInfoPlugin.new(amount_in_cents, DateTime.now, DateTime.now, illbill::Plugin::Model::RefundPluginStatus.new(:PROCESSED), "gateway_error", "gateway_error_code", nil)
57
+ res = Killbill::Plugin::Model::RefundInfoPlugin.new
58
+ res.amount= 0
59
+ res.created_date= DateTime.now
60
+ res.effective_date=DateTime.now
61
+ res.status=:PROCESSED
62
+ res.gateway_error="gateway_error"
63
+ res.gateway_error_code="gateway_error_code"
64
+ res
38
65
  end
39
66
 
40
67
  def add_payment_method(kb_account_id, kb_payment_method_id, payment_method_props, set_default, call_context, options = {})
@@ -45,14 +72,43 @@ module PaymentTest
45
72
  end
46
73
 
47
74
  def get_payment_method_detail(kb_account_id, kb_payment_method_id, tenant_context, options = {})
48
- Killbill::Plugin::Model::PaymentMethodPlugin.new("external_payment_method_id", false, [], nil, "Test", "cc_name", "cc_type", "cc_expiration_month", "cc_expiration_year", "cc_last4", "address1", "address2", "city", "state", "zip", "country")
75
+ res = Killbill::Plugin::Model::PaymentMethodPlugin.new
76
+ res.external_payment_method_id="external_payment_method_id"
77
+ res.is_default_payment_method=true
78
+ res.type="Test"
79
+ res.cc_name="cc_name"
80
+ res.cc_expiration_month="cc_expiration_month"
81
+ res.cc_expiration_year="cc_expiration_year"
82
+ res.cc_last4="cc_last4"
83
+ res.address1="address1"
84
+ res.address2="address2"
85
+ res.city="city"
86
+ res.state="state"
87
+ res.zip="zip"
88
+ res.country="country"
89
+ properties = []
90
+ prop1 = Killbill::Plugin::Model::PaymentMethodKVInfo.new
91
+ prop1.key = "key1"
92
+ prop1.value = "value1"
93
+ properties << prop1
94
+ prop2 = Killbill::Plugin::Model::PaymentMethodKVInfo.new
95
+ prop2.key = "key2"
96
+ prop2.value = "value2"
97
+ properties << prop2
98
+ res.properties=properties
99
+ res
49
100
  end
50
101
 
51
102
  def set_default_payment_method(kb_account_id, kb_payment_method_id, call_context, options = {})
52
103
  end
53
104
 
54
105
  def get_payment_methods(kb_account_id, refresh_from_gateway, call_context, options = {})
55
- [Killbill::Plugin::Model::PaymentMethodInfoPlugin.new(kb_account_id, kb_account_id, false, "external_payment_method_id")]
106
+ res = Killbill::Plugin::Model::PaymentMethodInfoPlugin.new
107
+ res.account_id=kb_account_id
108
+ res.payment_method_id=kb_account_id
109
+ res.is_default=true
110
+ res.external_payment_method_id="external_payment_method_id"
111
+ [res]
56
112
  end
57
113
 
58
114
  def reset_payment_methods(kb_account_id, payment_methods)
@@ -6,22 +6,23 @@ require 'killbill'
6
6
 
7
7
  require 'payment_test'
8
8
 
9
- class KillbillApiWithFakeGetAccountById < Killbill::Plugin::KillbillApi
10
- def initialize(japi_proxy)
11
- super(japi_proxy)
12
- end
9
+ class FakeJavaUserAccountApi
13
10
 
14
11
  # Returns an account where we specify the currency for the report group
15
- def get_account_by_id(id)
16
- Killbill::Plugin::Model::Account.new(id, nil, nil, nil, nil, nil, 1, nil, 1, 'USD', nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, false, true)
12
+ def get_account_by_id(id, context)
13
+ account = Killbill::Plugin::Model::Account.new
14
+ account.id=id
15
+ account
17
16
  end
18
17
  end
19
18
 
20
19
  describe PaymentTest::PaymentPlugin do
21
20
  before(:each) do
21
+ svcs = {:account_user_api => FakeJavaUserAccountApi.new}
22
+ kb_apis = Killbill::Plugin::KillbillApi.new("foo", svcs)
22
23
  @plugin = PaymentTest::PaymentPlugin.new
23
24
  @plugin.logger = Logger.new(STDOUT)
24
- @plugin.kb_apis = KillbillApiWithFakeGetAccountById.new(nil)
25
+ @plugin.kb_apis = kb_apis
25
26
 
26
27
  @kb_account_id = "a86ed6d4-c0bd-4a44-b49a-5ec29c3b314a"
27
28
  @kb_payment_id = "9f73c8e9-188a-4603-a3ba-2ce684411fb9"
@@ -41,7 +42,7 @@ describe PaymentTest::PaymentPlugin do
41
42
 
42
43
  output.should be_an_instance_of Killbill::Plugin::Model::PaymentInfoPlugin
43
44
  output.amount.should == @amount_in_cents
44
- output.status.should == Killbill::Plugin::Model::PaymentPluginStatus.new(:PROCESSED)
45
+ output.status.to_s.should == "PROCESSED"
45
46
  end
46
47
 
47
48
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: killbill-payment-test
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.9
4
+ version: 1.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-03 00:00:00.000000000 Z
12
+ date: 2013-06-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: killbill
@@ -17,29 +17,13 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: 1.0.19
20
+ version: 1.1.2
21
21
  none: false
22
22
  requirement: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.0.19
27
- none: false
28
- prerelease: false
29
- type: :runtime
30
- - !ruby/object:Gem::Dependency
31
- name: sinatra
32
- version_requirements: !ruby/object:Gem::Requirement
33
- requirements:
34
- - - "~>"
35
- - !ruby/object:Gem::Version
36
- version: 1.3.4
37
- none: false
38
- requirement: !ruby/object:Gem::Requirement
39
- requirements:
40
- - - "~>"
41
- - !ruby/object:Gem::Version
42
- version: 1.3.4
26
+ version: 1.1.2
43
27
  none: false
44
28
  prerelease: false
45
29
  type: :runtime