killbill 1.0.11 → 1.0.12

Sign up to get free protection for your applications and to get access to all the features.
data/Jarfile CHANGED
@@ -1,3 +1,3 @@
1
- jar 'com.ning.billing:killbill-api', '0.1.60'
2
- jar 'com.ning.billing:killbill-util:tests', '0.1.60'
1
+ jar 'com.ning.billing:killbill-api', '0.1.61'
2
+ jar 'com.ning.billing:killbill-util:tests', '0.1.61'
3
3
  jar 'javax.servlet:javax.servlet-api', '3.0.1'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.11
1
+ 1.0.12
@@ -33,11 +33,6 @@ module Killbill
33
33
  super(real_class_name, services)
34
34
  end
35
35
 
36
- # TODO STEPH decide what to do the getName()
37
- java_signature 'java.lang.String getName()'
38
- def get_name
39
- end
40
-
41
36
  java_signature 'com.ning.billing.payment.plugin.api.PaymentInfoPlugin processPayment(java.util.UUID, java.util.UUID, java.util.UUID, java.lang.BigDecimal, com.ning.billing.catalog.api.Currency, com.ning.billing.util.callcontext.CallContext)'
42
37
  def process_payment(*args)
43
38
  do_call_handle_exception(__method__, *args) do |res|
@@ -59,6 +54,17 @@ module Killbill
59
54
  end
60
55
  end
61
56
 
57
+ java_signature 'java.util.List getRefundInfo(java.util.UUID, java.util.UUID, Java::com.ning.billing.util.callcontext.TenantContext)'
58
+ def get_refund_info(*args)
59
+ do_call_handle_exception(__method__, *args) do |res|
60
+ array_res = java.util.ArrayList.new
61
+ res.each do |el|
62
+ array_res.add(JRefundResponse.new(el))
63
+ end
64
+ return array_res
65
+ end
66
+ end
67
+
62
68
  java_signature 'void addPaymentMethod(java.util.UUID, java.util.UUID, Java::com.ning.billing.payment.api.PaymentMethodPlugin, Java::boolean, Java::com.ning.billing.util.callcontext.CallContext)'
63
69
  def add_payment_method(*args)
64
70
  do_call_handle_exception(__method__, *args) do |res|
@@ -114,6 +120,8 @@ module Killbill
114
120
  yield(res)
115
121
  rescue Exception => e
116
122
  wrap_and_throw_exception(method_name, e)
123
+ ensure
124
+ @delegate_plugin.after_request
117
125
  end
118
126
  end
119
127
 
@@ -163,6 +171,9 @@ module Killbill
163
171
  nil
164
172
  end
165
173
  end
174
+ # Remove last argument if this is null (it means we passed a context)
175
+ args.delete_at(-1) if args[-1].nil?
176
+ args
166
177
  end
167
178
 
168
179
  end
@@ -17,7 +17,8 @@ module Killbill
17
17
  end
18
18
 
19
19
  def to_joda_date_time(time)
20
- time.nil? ? nil : org.joda.time.DateTime.new(time.to_s, org.joda.time.DateTimeZone::UTC)
20
+ date_time = (time.kind_of? Time) ? DateTime.parse(time.to_s) : time
21
+ date_time.nil? ? nil : org.joda.time.DateTime.new(date_time.to_s, org.joda.time.DateTimeZone::UTC)
21
22
  end
22
23
 
23
24
  def to_string(str)
@@ -83,7 +83,66 @@ module Killbill
83
83
  nil
84
84
  end
85
85
 
86
- end
86
+ java_signature 'java.lang.String getType()'
87
+ def get_type
88
+ get_value_string(PaymentMethodResponse::PROP_TYPE)
89
+ end
90
+
91
+ java_signature 'java.lang.String getCCName()'
92
+ def get_cc_name
93
+ get_value_string(PaymentMethodResponse::PROP_CC_NAME)
94
+ end
87
95
 
96
+ java_signature 'java.lang.String getCCType()'
97
+ def get_cc_type
98
+ get_value_string(PaymentMethodResponse::PROP_CC_TYPE)
99
+ end
100
+
101
+ java_signature 'java.lang.String getCCExprirationMonth()'
102
+ def get_cc_expiration_month
103
+ get_value_string(PaymentMethodResponse::PROP_CC_EXP_MONTH)
104
+ end
105
+
106
+ java_signature 'java.lang.String getCCExprirationYear()'
107
+ def get_cc_expiration_year
108
+ get_value_string(PaymentMethodResponse::PROP_CC_EXP_YEAR)
109
+ end
110
+
111
+ java_signature 'java.lang.String getCCLast4()'
112
+ def get_cc_last_4
113
+ get_value_string(PaymentMethodResponse::PROP_CC_LAST_4)
114
+ end
115
+
116
+ java_signature 'java.lang.String getAddress1()'
117
+ def get_address1
118
+ get_value_string(PaymentMethodResponse::PROP_ADDRESS1)
119
+ end
120
+
121
+ java_signature 'java.lang.String getAddress2()'
122
+ def get_address2
123
+ get_value_string(PaymentMethodResponse::PROP_ADDRESS2)
124
+ end
125
+
126
+ java_signature 'java.lang.String getCity()'
127
+ def get_city
128
+ get_value_string(PaymentMethodResponse::PROP_CITY)
129
+ end
130
+
131
+ java_signature 'java.lang.String getState()'
132
+ def get_state
133
+ get_value_string(PaymentMethodResponse::PROP_STATE)
134
+ end
135
+
136
+ java_signature 'java.lang.String getZip()'
137
+ def get_zip
138
+ get_value_string(PaymentMethodResponse::PROP_ZIP)
139
+ end
140
+
141
+ java_signature 'java.lang.String getCountry()'
142
+ def get_country
143
+ get_value_string(PaymentMethodResponse::PROP_COUNTRY)
144
+ end
145
+
146
+ end
88
147
  end
89
148
  end
@@ -14,7 +14,9 @@ module Killbill
14
14
  :effective_date,
15
15
  :status,
16
16
  :gateway_error,
17
- :gateway_error_code
17
+ :gateway_error_code,
18
+ :first_payment_reference_id,
19
+ :second_payment_reference_id
18
20
 
19
21
  def initialize(payment_response)
20
22
  @amount = JConverter.to_big_decimal(payment_response.amount_in_cents)
@@ -23,6 +25,8 @@ module Killbill
23
25
  @status = JConverter.to_payment_plugin_status(payment_response.status)
24
26
  @gateway_error = JConverter.to_string(payment_response.gateway_error)
25
27
  @gateway_error_code = JConverter.to_string(payment_response.gateway_error_code)
28
+ @first_payment_reference_id = JConverter.to_string(payment_response.first_payment_reference_id)
29
+ @second_payment_reference_id = JConverter.to_string(payment_response.second_payment_reference_id)
26
30
  end
27
31
 
28
32
  java_signature 'java.math.BigDecimal getAmount()'
@@ -54,6 +58,17 @@ module Killbill
54
58
  def get_gateway_error_code
55
59
  @gateway_error_code
56
60
  end
61
+
62
+ java_signature 'java.lang.String getFirstPaymentReferenceId()'
63
+ def get_first_payment_reference_id
64
+ @first_payment_reference_id
65
+ end
66
+
67
+ java_signature 'java.lang.String getSecondPaymentReferenceId()'
68
+ def get_second_payment_reference_id
69
+ @second_payment_reference_id
70
+ end
71
+
57
72
  end
58
73
  end
59
74
  end
@@ -14,7 +14,8 @@ module Killbill
14
14
  :effective_date,
15
15
  :status,
16
16
  :gateway_error,
17
- :gateway_error_code
17
+ :gateway_error_code,
18
+ :reference_id
18
19
 
19
20
  def initialize(refund_response)
20
21
  @amount = JConverter.to_big_decimal(refund_response.amount_in_cents)
@@ -23,6 +24,7 @@ module Killbill
23
24
  @status = JConverter.to_refund_plugin_status(refund_response.status)
24
25
  @gateway_error = JConverter.to_string(refund_response.gateway_error)
25
26
  @gateway_error_code = JConverter.to_string(refund_response.gateway_error_code)
27
+ @reference_id = JConverter.to_string(refund_response.reference_id)
26
28
  end
27
29
 
28
30
 
@@ -55,6 +57,12 @@ module Killbill
55
57
  def get_gateway_error_code
56
58
  @gateway_error_code
57
59
  end
60
+
61
+ java_signature 'java.lang.String getReferenceId()'
62
+ def get_reference_id
63
+ @reference_id
64
+ end
65
+
58
66
  end
59
67
  end
60
68
  end
@@ -12,10 +12,6 @@ module Killbill
12
12
  class OperationUnsupportedByGatewayError < NotImplementedError
13
13
  end
14
14
 
15
- def get_name
16
- raise OperationUnsupportedByGatewayError
17
- end
18
-
19
15
  def process_payment(kb_account_id, kb_payment_id, kb_payment_method_id, amount_in_cents, currency, options = {})
20
16
  raise OperationUnsupportedByGatewayError
21
17
  end
@@ -68,6 +68,10 @@ module Killbill
68
68
  @logger ||= Logger.new(STDOUT)
69
69
  end
70
70
 
71
+ # Will be called by each thread before returning to Killbill
72
+ def after_request
73
+ end
74
+
71
75
  class APINotAvailableError < NotImplementedError
72
76
  end
73
77
 
@@ -16,6 +16,19 @@ module Killbill
16
16
 
17
17
  class PaymentMethodResponse
18
18
 
19
+ PROP_TYPE = "type";
20
+ PROP_CC_NAME = "cc_name";
21
+ PROP_CC_TYPE = "cc_type";
22
+ PROP_CC_EXP_MONTH = "cc_exp_month";
23
+ PROP_CC_EXP_YEAR = "cc_exp_year";
24
+ PROP_CC_LAST_4 = "cc_last_4";
25
+ PROP_ADDRESS1 = "address1";
26
+ PROP_ADDRESS2 = "address2";
27
+ PROP_CITY = "city";
28
+ PROP_STATE = "state";
29
+ PROP_ZIP = "zip";
30
+ PROP_COUNTRY = "country";
31
+
19
32
  attr_reader :external_payment_method_id,
20
33
  :is_default,
21
34
  :properties
@@ -7,15 +7,19 @@ module Killbill
7
7
  :effective_date,
8
8
  :status,
9
9
  :gateway_error,
10
- :gateway_error_code
10
+ :gateway_error_code,
11
+ :first_payment_reference_id,
12
+ :second_payment_reference_id
11
13
 
12
- def initialize(amount_in_cents, created_date, effective_date, status, gateway_error=nil, gateway_error_code=nil)
14
+ def initialize(amount_in_cents, created_date, effective_date, status, gateway_error=nil, gateway_error_code=nil, first_payment_reference_id=nil, second_payment_reference_id=nil)
13
15
  @amount_in_cents = amount_in_cents
14
16
  @created_date = created_date
15
17
  @effective_date = effective_date
16
18
  @status = status
17
19
  @gateway_error = gateway_error
18
20
  @gateway_error_code = gateway_error_code
21
+ @first_payment_reference_id = first_payment_reference_id
22
+ @second_payment_reference_id = second_payment_reference_id
19
23
  end
20
24
  end
21
25
  end
@@ -8,15 +8,17 @@ module Killbill
8
8
  :effective_date,
9
9
  :status,
10
10
  :gateway_error,
11
- :gateway_error_code
11
+ :gateway_error_code,
12
+ :reference_id
12
13
 
13
- def initialize(amount_in_cents, created_date, effective_date, status, gateway_error, gateway_error_code)
14
+ def initialize(amount_in_cents, created_date, effective_date, status, gateway_error=nil, gateway_error_code=nil, reference_id=nil)
14
15
  @amount_in_cents = amount_in_cents
15
16
  @created_date = created_date
16
17
  @effective_date = effective_date
17
18
  @status = status
18
19
  @gateway_error = gateway_error
19
20
  @gateway_error_code = gateway_error_code
21
+ @reference_id = reference_id
20
22
  end
21
23
  end
22
24
  end
@@ -8,9 +8,6 @@ module Killbill
8
8
  @raise_exception = false
9
9
  end
10
10
 
11
- def get_name
12
- end
13
-
14
11
  def process_payment(kb_account_id, kb_payment_id, kb_payment_method_id, amount_in_cents, currency, options = {})
15
12
  if @raise_exception
16
13
  raise StandardError.new("Test exception")
@@ -75,6 +72,9 @@ module Killbill
75
72
  end
76
73
  end
77
74
 
75
+ def after_request
76
+ end
77
+
78
78
  def raise_exception_on_next_calls
79
79
  @raise_exception = true
80
80
  end
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: killbill
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.11
5
4
  prerelease:
5
+ version: 1.0.12
6
6
  platform: ruby
7
7
  authors:
8
8
  - Killbill core team
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-26 00:00:00.000000000 Z
12
+ date: 2013-04-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jbundler
16
16
  version_requirements: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ~>
18
+ - - "~>"
19
19
  - !ruby/object:Gem::Version
20
20
  version: 0.4.1
21
21
  none: false
22
22
  requirement: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.4.1
27
27
  none: false
@@ -31,13 +31,13 @@ dependencies:
31
31
  name: rack
32
32
  version_requirements: !ruby/object:Gem::Requirement
33
33
  requirements:
34
- - - ! '>='
34
+ - - ">="
35
35
  - !ruby/object:Gem::Version
36
36
  version: 1.5.2
37
37
  none: false
38
38
  requirement: !ruby/object:Gem::Requirement
39
39
  requirements:
40
- - - ! '>='
40
+ - - ">="
41
41
  - !ruby/object:Gem::Version
42
42
  version: 1.5.2
43
43
  none: false
@@ -47,13 +47,13 @@ dependencies:
47
47
  name: rake
48
48
  version_requirements: !ruby/object:Gem::Requirement
49
49
  requirements:
50
- - - ! '>='
50
+ - - ">="
51
51
  - !ruby/object:Gem::Version
52
52
  version: 0.8.7
53
53
  none: false
54
54
  requirement: !ruby/object:Gem::Requirement
55
55
  requirements:
56
- - - ! '>='
56
+ - - ">="
57
57
  - !ruby/object:Gem::Version
58
58
  version: 0.8.7
59
59
  none: false
@@ -63,13 +63,13 @@ dependencies:
63
63
  name: rspec
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: 2.12.0
69
69
  none: false
70
70
  requirement: !ruby/object:Gem::Requirement
71
71
  requirements:
72
- - - ~>
72
+ - - "~>"
73
73
  - !ruby/object:Gem::Version
74
74
  version: 2.12.0
75
75
  none: false
@@ -79,13 +79,13 @@ dependencies:
79
79
  name: sinatra
80
80
  version_requirements: !ruby/object:Gem::Requirement
81
81
  requirements:
82
- - - ~>
82
+ - - "~>"
83
83
  - !ruby/object:Gem::Version
84
84
  version: 1.3.4
85
85
  none: false
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
- - - ~>
88
+ - - "~>"
89
89
  - !ruby/object:Gem::Version
90
90
  version: 1.3.4
91
91
  none: false
@@ -97,8 +97,8 @@ executables: []
97
97
  extensions: []
98
98
  extra_rdoc_files: []
99
99
  files:
100
- - .gitignore
101
- - .travis.yml
100
+ - ".gitignore"
101
+ - ".travis.yml"
102
102
  - Gemfile
103
103
  - Jarfile
104
104
  - README.md
@@ -144,25 +144,25 @@ licenses:
144
144
  - Apache License (2.0)
145
145
  post_install_message:
146
146
  rdoc_options:
147
- - --exclude
148
- - .
147
+ - "--exclude"
148
+ - "."
149
149
  require_paths:
150
150
  - lib
151
151
  required_ruby_version: !ruby/object:Gem::Requirement
152
152
  requirements:
153
- - - ! '>='
153
+ - - ">="
154
154
  - !ruby/object:Gem::Version
155
155
  version: 1.9.3
156
156
  none: false
157
157
  required_rubygems_version: !ruby/object:Gem::Requirement
158
158
  requirements:
159
- - - ! '>='
159
+ - - ">="
160
160
  - !ruby/object:Gem::Version
161
161
  segments:
162
162
  - 0
163
+ hash: 2
163
164
  version: !binary |-
164
165
  MA==
165
- hash: 2
166
166
  none: false
167
167
  requirements:
168
168
  - jar 'com.ning.billing:killbill-api'