killbill-payment-test 1.8.1 → 1.8.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2b147831c6e1c2cc0656ef221245203ad0b90538
4
- data.tar.gz: 83b58ceaaa2fb32a220876bdcc8efa656a058e9e
3
+ metadata.gz: 625cf68f3d3b8c505f9ebaf9bb6822b777c74069
4
+ data.tar.gz: b9a98c6ff4551f0574bda9a53e07c05000fac780
5
5
  SHA512:
6
- metadata.gz: 667452a2cfb1a0168c6ccd6642814f0537344029520254a91ba5dd420a8fec74e928fc543c6a4b9a69e4fe13b65ce30ca2440c53461d2de458e55ed252598159
7
- data.tar.gz: 7229fc663bbe511d7cf9c5dd40d2cf1bc9c774122570ed67685c00b12c48fc4b7bceec8018878b1305d9a1b37636ef0a40cfd6707dfde91ec7795adc98f97fec
6
+ metadata.gz: a318e54f07d3e72638ce93c994645ddca8831687ecd9edba5f328db6e1f253d1a7ee3c47d762447526958e232358fe2abd3b2cbcfb65e66b61f04ef549bd8a7c
7
+ data.tar.gz: 12ecfb91f2ae42c986e5456680aa6319e15a0ee5b7e81f2fe96954a2f234ecc7919b9c6f7de11f675975ccb1dfba43c1d24265b6a0a738f6b47ade362e41739f
data/Jarfile CHANGED
@@ -1,6 +1,8 @@
1
- jar 'org.kill-bill.billing:killbill-api', '0.9.5'
2
- jar 'org.kill-bill.billing.plugin:killbill-plugin-api-notification', '0.7.2'
3
- jar 'org.kill-bill.billing.plugin:killbill-plugin-api-payment', '0.7.2'
4
- jar 'org.kill-bill.billing.plugin:killbill-plugin-api-currency', '0.7.2'
5
- jar 'org.kill-bill.billing:killbill-util:tests', '0.11.2'
1
+ jar 'org.kill-bill.billing:killbill-api', '0.9.6'
2
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-notification', '0.7.4'
3
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-payment', '0.7.4'
4
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-currency', '0.7.4'
5
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-retry', '0.7.4'
6
+ jar 'org.kill-bill.billing.plugin:killbill-plugin-api-invoice', '0.7.4'
7
+ jar 'org.kill-bill.billing:killbill-util:tests', '0.11.3'
6
8
  jar 'javax.servlet:javax.servlet-api', '3.0.1'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.8.1
1
+ 1.8.2
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
23
23
  s.rdoc_options << '--exclude' << '.'
24
24
 
25
25
 
26
- s.add_dependency 'killbill', '~> 3.1.1'
26
+ s.add_dependency 'killbill', '~> 3.1.4'
27
27
 
28
28
  s.add_development_dependency 'jbundler', '~> 0.4.1'
29
29
  s.add_development_dependency 'rake', '>= 10.0.0'
data/lib/payment_test.rb CHANGED
@@ -1 +1,2 @@
1
+ require 'killbill'
1
2
  require 'payment_test/api'
@@ -1,99 +1,40 @@
1
- require 'date'
2
-
3
- require 'killbill/payment'
4
-
5
1
  module PaymentTest
6
2
  class PaymentPlugin < Killbill::Plugin::Payment
7
3
 
8
-
9
- def start_plugin
10
- super
11
- end
12
-
13
- def initialize()
14
- @raise_exception = false
15
- super()
16
- end
17
-
18
- def get_name
19
- end
20
-
21
- def process_payment(kb_account_id, kb_payment_id, kb_payment_method_id, amount, currency, properties, context)
22
- # Make an API call from the payment call
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
4
+ def purchase_payment(kb_account_id, kb_payment_id, kb_payment_transaction_id, kb_payment_method_id, amount, currency, properties, context)
5
+ build_transaction_info :PURCHASE, kb_payment_id, kb_payment_transaction_id, amount, currency
32
6
  end
33
7
 
34
8
  def get_payment_info(kb_account_id, kb_payment_id, properties, context)
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
9
+ [build_transaction_info(:PURCHASE, kb_payment_id)]
43
10
  end
44
11
 
45
- def process_refund(kb_account_id, kb_payment_id, refund_amount, currency, properties, context)
46
- res = Killbill::Plugin::Model::RefundInfoPlugin.new
47
- res.amount= refund_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
12
+ def refund_payment(kb_account_id, kb_payment_id, kb_payment_transaction_id, kb_payment_method_id, amount, currency, properties, context)
13
+ build_transaction_info :REFUND, kb_payment_id, kb_payment_transaction_id, amount, currency
54
14
  end
55
15
 
56
16
  def get_refund_info(kb_account_id, kb_payment_id, properties, context)
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
17
+ build_transaction_info :REFUND, kb_payment_id
65
18
  end
66
19
 
67
20
  def add_payment_method(kb_account_id, kb_payment_method_id, payment_method_props, set_default, properties, context)
68
- nil
69
21
  end
70
22
 
71
23
  def delete_payment_method(kb_account_id, kb_payment_method_id, properties, context)
72
24
  end
73
25
 
74
26
  def get_payment_method_detail(kb_account_id, kb_payment_method_id, properties, context)
75
- res = Killbill::Plugin::Model::PaymentMethodPlugin.new
76
- res.kb_payment_method_id="9e3ff858-809d-4d12-a1fa-da789e0841d"
77
- res.external_payment_method_id="external_payment_method_id"
78
- res.is_default_payment_method=true
79
- res.type="Test"
80
- res.cc_name="cc_name"
81
- res.cc_expiration_month="cc_expiration_month"
82
- res.cc_expiration_year="cc_expiration_year"
83
- res.cc_last4="cc_last4"
84
- res.address1="address1"
85
- res.address2="address2"
86
- res.city="city"
87
- res.state="state"
88
- res.zip="zip"
89
- res.country="country"
90
- properties = []
91
- prop1 = Killbill::Plugin::Model::PluginProperty.new
92
- prop1.key = "key1"
93
- prop1.value = "value1"
27
+ res = Killbill::Plugin::Model::PaymentMethodPlugin.new
28
+ res.kb_payment_method_id = "9e3ff858-809d-4d12-a1fa-da789e0841d"
29
+ res.external_payment_method_id = "external_payment_method_id"
30
+ res.is_default_payment_method = true
31
+ properties = []
32
+ prop1 = Killbill::Plugin::Model::PluginProperty.new
33
+ prop1.key = "key1"
34
+ prop1.value = "value1"
94
35
  properties << prop1
95
- prop2 = Killbill::Plugin::Model::PluginProperty.new
96
- prop2.key = "key2"
36
+ prop2 = Killbill::Plugin::Model::PluginProperty.new
37
+ prop2.key = "key2"
97
38
  prop2.value = "value2"
98
39
  properties << prop2
99
40
  res.properties=properties
@@ -104,28 +45,35 @@ module PaymentTest
104
45
  end
105
46
 
106
47
  def get_payment_methods(kb_account_id, refresh_from_gateway, properties, context)
107
- res = Killbill::Plugin::Model::PaymentMethodInfoPlugin.new
108
- res.account_id=kb_account_id
109
- res.payment_method_id=kb_account_id
110
- res.is_default=true
111
- res.external_payment_method_id="external_payment_method_id"
48
+ res = Killbill::Plugin::Model::PaymentMethodInfoPlugin.new
49
+ res.account_id = kb_account_id
50
+ res.payment_method_id = kb_account_id
51
+ res.is_default = true
52
+ res.external_payment_method_id = "external_payment_method_id"
112
53
  [res]
113
54
  end
114
55
 
115
- def search_payment_methods(search_key, offset, limit, properties, context)
116
- [get_payment_method_detail(nil, nil, nil, nil)]
117
- end
118
-
119
- def reset_payment_methods(kb_account_id, payment_methods, properties)
56
+ def search_payment_methods(search_key, offset = 0, limit = 100, properties, context)
57
+ [get_payment_method_detail(nil, nil, properties, context)]
120
58
  end
121
59
 
122
- def raise_exception_on_next_calls
123
- @raise_exception = true
124
- end
60
+ private
125
61
 
126
- def clear_exception_on_next_calls
127
- @raise_exception = false
62
+ def build_transaction_info(transaction_type, kb_payment_id, kb_payment_transaction_id=nil, amount=0, currency=:USD)
63
+ res = Killbill::Plugin::Model::PaymentTransactionInfoPlugin.new
64
+ res.kb_payment_id = kb_payment_id
65
+ res.kb_transaction_payment_id = kb_payment_transaction_id
66
+ res.transaction_type = transaction_type
67
+ res.amount = amount
68
+ res.currency = currency
69
+ res.created_date = DateTime.now
70
+ res.effective_date = DateTime.now
71
+ res.status = :PROCESSED
72
+ res.gateway_error = "gateway_error"
73
+ res.gateway_error_code = "gateway_error_code"
74
+ res.first_payment_reference_id = "first_payment_reference_id"
75
+ res.second_payment_reference_id = "second_payment_reference_id"
76
+ res
128
77
  end
129
-
130
78
  end
131
79
  end
data/pom.xml CHANGED
@@ -1,6 +1,8 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <!--
3
3
  ~ Copyright 2010-2013 Ning, Inc.
4
+ ~ Copyright 2014 Groupon, Inc
5
+ ~ Copyright 2014 The Billing Project, LLC
4
6
  ~
5
7
  ~ Ning licenses this file to you under the Apache License, version 2.0
6
8
  ~ (the "License"); you may not use this file except in compliance with the
@@ -25,7 +27,7 @@
25
27
  <groupId>org.kill-bill.billing.plugin.ruby</groupId>
26
28
  <artifactId>payment-test-plugin</artifactId>
27
29
  <packaging>pom</packaging>
28
- <version>1.8.1</version>
30
+ <version>1.8.2</version>
29
31
  <name>payment-test-plugin</name>
30
32
  <description></description>
31
33
  <scm>
@@ -1,31 +1,18 @@
1
1
  require 'spec_helper'
2
2
  require 'logger'
3
- require 'tempfile'
4
-
5
- require 'killbill'
6
3
 
7
4
  require 'payment_test'
8
5
 
9
- class FakeJavaUserAccountApi
10
-
11
- # Returns an account where we specify the currency for the report group
12
- def get_account_by_id(id, context)
13
- account = Killbill::Plugin::Model::Account.new
14
- account.id=id
15
- account
16
- end
17
- end
18
-
19
6
  describe PaymentTest::PaymentPlugin do
20
7
  before(:each) do
21
- svcs = {:account_user_api => FakeJavaUserAccountApi.new}
22
- kb_apis = Killbill::Plugin::KillbillApi.new("foo", svcs)
8
+ kb_apis = Killbill::Plugin::KillbillApi.new("killbill-payment-test", {})
23
9
  @plugin = PaymentTest::PaymentPlugin.new
24
10
  @plugin.logger = Logger.new(STDOUT)
25
11
  @plugin.kb_apis = kb_apis
26
12
 
27
13
  @kb_account_id = "a86ed6d4-c0bd-4a44-b49a-5ec29c3b314a"
28
14
  @kb_payment_id = "9f73c8e9-188a-4603-a3ba-2ce684411fb9"
15
+ @kb_payment_transaction_id = "46bb26b0-fae2-11e3-a3ac-0800200c9a66"
29
16
  @kb_payment_method_id = "b1396a76-b210-4690-a61e-e94c911a2a09"
30
17
  @amount_in_cents = 100
31
18
  @currency = 'USD'
@@ -38,9 +25,9 @@ describe PaymentTest::PaymentPlugin do
38
25
  end
39
26
 
40
27
  it "should test charge" do
41
- output = @plugin.process_payment(@kb_account_id, @kb_payment_id, @kb_payment_method_id, @amount_in_cents, @currency, nil, @call_context)
28
+ output = @plugin.purchase_payment(@kb_account_id, @kb_payment_id, @kb_payment_transaction_id, @kb_payment_method_id, @amount_in_cents, @currency, [], @call_context)
42
29
 
43
- output.should be_an_instance_of Killbill::Plugin::Model::PaymentInfoPlugin
30
+ output.should be_an_instance_of Killbill::Plugin::Model::PaymentTransactionInfoPlugin
44
31
  output.amount.should == @amount_in_cents
45
32
  output.status.to_s.should == "PROCESSED"
46
33
  end
data/spec/spec_helper.rb CHANGED
@@ -7,9 +7,3 @@ RSpec.configure do |config|
7
7
  config.tty = true
8
8
  config.formatter = 'documentation'
9
9
  end
10
-
11
- class Object
12
- def blank?
13
- respond_to?(:empty?) ? empty? : !self
14
- end
15
- end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: killbill-payment-test
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.1
4
+ version: 1.8.2
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-04-28 00:00:00.000000000 Z
11
+ date: 2014-07-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: killbill
@@ -16,12 +16,12 @@ dependencies:
16
16
  requirements:
17
17
  - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: 3.1.1
19
+ version: 3.1.4
20
20
  requirement: !ruby/object:Gem::Requirement
21
21
  requirements:
22
22
  - - ~>
23
23
  - !ruby/object:Gem::Version
24
- version: 3.1.1
24
+ version: 3.1.4
25
25
  prerelease: false
26
26
  type: :runtime
27
27
  - !ruby/object:Gem::Dependency