killbill-paypal-express 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/Jarfile CHANGED
@@ -1,5 +1,5 @@
1
- jar 'com.ning.billing:killbill-api', '0.3.0'
1
+ jar 'com.ning.billing:killbill-api', '0.3.2'
2
2
  jar 'com.ning.billing.plugin:killbill-plugin-api-notification', '0.2.4'
3
3
  jar 'com.ning.billing.plugin:killbill-plugin-api-payment', '0.2.4'
4
- jar 'com.ning.billing:killbill-util:tests', '0.3.0'
4
+ jar 'com.ning.billing:killbill-util:tests', '0.3.4'
5
5
  jar 'javax.servlet:javax.servlet-api', '3.0.1'
data/NEWS CHANGED
@@ -1,3 +1,6 @@
1
+ 1.3.0
2
+ Update to latest killbill (1.3.0 version)
3
+
1
4
  1.2.0
2
5
  Update to killbill 1.2.0
3
6
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.0
1
+ 1.3.0
@@ -22,7 +22,7 @@ Gem::Specification.new do |s|
22
22
 
23
23
  s.rdoc_options << '--exclude' << '.'
24
24
 
25
- s.add_dependency 'killbill', '~> 1.2.0'
25
+ s.add_dependency 'killbill', '~> 1.3.0'
26
26
  s.add_dependency 'activemerchant', '~> 2.0.0'
27
27
  s.add_dependency 'activerecord', '~> 3.2.1'
28
28
  s.add_dependency 'sinatra', '~> 1.3.4'
@@ -169,6 +169,10 @@ module Killbill::PaypalExpress
169
169
  end
170
170
  end
171
171
 
172
+ def search(search_key, call_context = nil, options = {})
173
+ PaypalExpressPaymentMethod.search(search_key).map(&:to_payment_method_response)
174
+ end
175
+
172
176
  private
173
177
 
174
178
  def save_response_and_transaction(paypal_express_response, api_call, kb_payment_id=nil, amount_in_cents=0)
@@ -33,6 +33,16 @@ module Killbill::PaypalExpress
33
33
  payment_method.save!
34
34
  end
35
35
 
36
+ def self.search(search_key)
37
+ search_columns = [
38
+ :paypal_express_payer_id,
39
+ :paypal_express_baid,
40
+ :paypal_express_token
41
+ ]
42
+ query = search_columns.map(&:to_s).join(' like ? or ') + ' like ?'
43
+ where(query, *search_columns.map { |e| "%#{search_key}%" })
44
+ end
45
+
36
46
  def to_payment_method_response
37
47
  properties = []
38
48
  properties << create_pm_kv_info('payerId', paypal_express_payer_id)
data/pom.xml CHANGED
@@ -25,7 +25,7 @@
25
25
  <groupId>com.ning.killbill.ruby</groupId>
26
26
  <artifactId>paypal-express-plugin</artifactId>
27
27
  <packaging>pom</packaging>
28
- <version>1.2.0</version>
28
+ <version>1.3.0</version>
29
29
  <name>paypal-express-plugin</name>
30
30
  <url>http://github.com/killbill/killbill-paypal-express-plugin</url>
31
31
  <description>Plugin for accessing paypal as a payment gateway</description>
@@ -0,0 +1,32 @@
1
+ require 'spec_helper'
2
+
3
+ describe Killbill::PaypalExpress::PaypalExpressPaymentMethod do
4
+ it 'should search all fields' do
5
+ Killbill::PaypalExpress::PaypalExpressPaymentMethod.search('foo').size.should == 0
6
+
7
+ pm = Killbill::PaypalExpress::PaypalExpressPaymentMethod.create :kb_account_id => '11-22-33-44',
8
+ :kb_payment_method_id => '55-66-77-88',
9
+ :paypal_express_payer_id => 38102343,
10
+ :paypal_express_baid => 'baid',
11
+ :paypal_express_token => 'token'
12
+
13
+ Killbill::PaypalExpress::PaypalExpressPaymentMethod.search('foo').size.should == 0
14
+ Killbill::PaypalExpress::PaypalExpressPaymentMethod.search(pm.paypal_express_payer_id).size.should == 1
15
+ Killbill::PaypalExpress::PaypalExpressPaymentMethod.search('baid').size.should == 1
16
+ Killbill::PaypalExpress::PaypalExpressPaymentMethod.search('token').size.should == 1
17
+ Killbill::PaypalExpress::PaypalExpressPaymentMethod.search(2343).size.should == 1
18
+
19
+ pm2 = Killbill::PaypalExpress::PaypalExpressPaymentMethod.create :kb_account_id => '22-33-44-55',
20
+ :kb_payment_method_id => '66-77-88-99',
21
+ :paypal_express_payer_id => 49384029302,
22
+ :paypal_express_baid => 'baid',
23
+ :paypal_express_token => 'token'
24
+
25
+ Killbill::PaypalExpress::PaypalExpressPaymentMethod.search('foo').size.should == 0
26
+ Killbill::PaypalExpress::PaypalExpressPaymentMethod.search(pm.paypal_express_payer_id).size.should == 1
27
+ Killbill::PaypalExpress::PaypalExpressPaymentMethod.search(pm2.paypal_express_payer_id).size.should == 1
28
+ Killbill::PaypalExpress::PaypalExpressPaymentMethod.search('baid').size.should == 2
29
+ Killbill::PaypalExpress::PaypalExpressPaymentMethod.search('token').size.should == 2
30
+ Killbill::PaypalExpress::PaypalExpressPaymentMethod.search(2343).size.should == 1
31
+ end
32
+ end
@@ -80,6 +80,10 @@ describe Killbill::PaypalExpress::PaymentPlugin do
80
80
  pm_details = @plugin.get_payment_method_detail(@pm.kb_account_id, @pm.kb_payment_method_id)
81
81
  pm_details.external_payment_method_id.should == @pm.paypal_express_baid
82
82
 
83
+ pms_found = @plugin.search @pm.paypal_express_baid
84
+ pms_found.size.should == 1
85
+ pms_found.first.external_payment_method_id.should == pm_details.external_payment_method_id
86
+
83
87
  @plugin.delete_payment_method @pm.kb_account_id, @pm.kb_payment_method_id
84
88
 
85
89
  @plugin.get_payment_methods(@pm.kb_account_id, false).size.should == 0
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: killbill-paypal-express
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.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-22 00:00:00.000000000 Z
12
+ date: 2013-07-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: killbill
@@ -17,13 +17,13 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: 1.2.0
20
+ version: 1.3.0
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.2.0
26
+ version: 1.3.0
27
27
  none: false
28
28
  prerelease: false
29
29
  type: :runtime
@@ -188,6 +188,7 @@ files:
188
188
  - pom.xml
189
189
  - release.sh
190
190
  - spec/paypal_express/base_plugin_spec.rb
191
+ - spec/paypal_express/paypal_express_payment_method_spec.rb
191
192
  - spec/paypal_express/remote/integration_spec.rb
192
193
  - spec/spec_helper.rb
193
194
  homepage: http://kill-bill.org
@@ -223,5 +224,6 @@ specification_version: 3
223
224
  summary: Plugin to use Express Checkout as a gateway.
224
225
  test_files:
225
226
  - spec/paypal_express/base_plugin_spec.rb
227
+ - spec/paypal_express/paypal_express_payment_method_spec.rb
226
228
  - spec/paypal_express/remote/integration_spec.rb
227
229
  - spec/spec_helper.rb