killbill-payment-test 3.1.0 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/Jarfile.lock +2 -0
- data/README.md +64 -2
- data/VERSION +1 -1
- data/lib/payment_test/api_control.rb +2 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a664c1965053965e7f01b9d7976c1e7493b17d51
|
4
|
+
data.tar.gz: 93113c6b15ebf46346d4dd269dbbdb368cdff21e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7773e5935ac7985b3441ca8831e691879d53cc124ba7b98fcba76a02fd4499cd4119a34bb02eed627074fd5062f34e7b05428a41be08e43404702dfa4e58ebbc
|
7
|
+
data.tar.gz: 016b3d90189fd4ff93deb6d9f81fa61e4b86529024ac23055a5d725ddf2e7b7af7386a023145dab4fc80e28618e8762ebbf4a228568860aca590030f57ccc27e
|
data/Gemfile.lock
CHANGED
data/Jarfile.lock
CHANGED
@@ -36,11 +36,13 @@
|
|
36
36
|
- org.jdbi:jdbi:jar:2.62
|
37
37
|
- org.kill-bill.billing:killbill-platform-api:jar:0.15
|
38
38
|
- org.kill-bill.billing:killbill-platform-osgi:jar:0.15
|
39
|
+
- org.bouncycastle:bcprov-jdk15on:jar:1.50
|
39
40
|
- org.apache.felix:org.apache.felix.framework:jar:4.4.1
|
40
41
|
- org.joda:joda-money:jar:0.9
|
41
42
|
- org.kill-bill.commons:killbill-jdbi:jar:0.11
|
42
43
|
- org.kill-bill.commons:killbill-embeddeddb-common:jar:0.11
|
43
44
|
- org.apache.shiro:shiro-core:jar:1.2.3
|
45
|
+
- org.bouncycastle:bcpkix-jdk15on:jar:1.50
|
44
46
|
- org.kill-bill.billing:killbill-platform-osgi-api:jar:0.15
|
45
47
|
- org.kill-bill.billing.plugin:killbill-plugin-api-payment:jar:0.18
|
46
48
|
- com.fasterxml.jackson.core:jackson-databind:jar:2.4.3
|
data/README.md
CHANGED
@@ -1,6 +1,68 @@
|
|
1
|
-
killbill-payment-test-plugin
|
2
|
-
============================
|
1
|
+
# killbill-payment-test-plugin
|
3
2
|
|
4
3
|
Plugin to test the Kill Bill PaymentPlugin API.
|
5
4
|
|
6
5
|
Release builds are available on [Maven Central](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.kill-bill.billing.plugin.ruby%22%20AND%20a%3A%22payment-test-plugin%22) with coordinates `org.kill-bill.billing.plugin.ruby:payment-test-plugin`.
|
6
|
+
|
7
|
+
|
8
|
+
The plugin currently supports 3 different modes
|
9
|
+
|
10
|
+
* A mode mode where the plugin can be configured on a per request basis
|
11
|
+
* A mode where the plugin can be configured through a private endpoint for all subsequent requests
|
12
|
+
* A backward compatible mode for existing killbill unit test
|
13
|
+
|
14
|
+
## Per Request Level Configuration
|
15
|
+
|
16
|
+
When using payment api, one can provide payment plugin properties to enable failure modes:
|
17
|
+
|
18
|
+
In that mode, the property `TEST_MODE` must be set to something different than `BEATRIX` (any other string would work. In addition the following properties are allowed:
|
19
|
+
|
20
|
+
* `THROW_EXCEPTION`=true : This will make the plugin throw RuntimeException exception on each call
|
21
|
+
* `RETURN_NIL`=true : This will make the plugin return a nil value on each call
|
22
|
+
* `SLEEP_TIME_SEC`=sleep_time_sec : This will make the plugin sleep `sleep_time_sec` on each call
|
23
|
+
|
24
|
+
## Global State Configuration
|
25
|
+
|
26
|
+
There are cases where it is not possible to pass plugin properties because the payments are made by the system, and the user does not have the opportunity to set plugin properties. For example, when Kill Bill attempts to pay an invoice, it make a `purchase_payment` call without passing plugin properties.
|
27
|
+
|
28
|
+
In order to address this scenario it is convenient to configure the plugin to behave a certain way. The plugin can be configured using a private endpoint `/plugins/killbill-payment-test/configure` to either throw exceptions, return nil values or sleep (similar to previous mode). However we also allow to configure which operations should behave that way (the idea is that we may want to make a `purchase_payment` call fail but still allow the `get_payment_info` call to return.
|
29
|
+
|
30
|
+
The json body for the call supports the following:
|
31
|
+
|
32
|
+
* `CONFIGURE_ACTION`: {`ACTION_THROW_EXCEPTION`|`ACTION_RETURN_NIL`|`ACTION_SLEEP`|`ACTION_RESET`}
|
33
|
+
* `SLEEP_TIME_SEC`: (valid for `CONFIGURE_ACTION` = `ACTION_SLEEP`
|
34
|
+
* `METHODS`: The payment plugin api methods for which the configuration apply (or all methods if not specified)
|
35
|
+
|
36
|
+
Examples:
|
37
|
+
|
38
|
+
This will confgure the plugin th throw exception on each `purchase_payment` call:
|
39
|
+
|
40
|
+
```
|
41
|
+
curl -v \
|
42
|
+
-u'admin:password' \
|
43
|
+
-H "X-Killbill-ApiKey: bob" \
|
44
|
+
-H 'X-Killbill-ApiSecret: lazar' \
|
45
|
+
-H "Content-Type: application/json" \
|
46
|
+
-H 'X-Killbill-CreatedBy: stephane' \
|
47
|
+
-X POST \
|
48
|
+
--data-binary '{"CONFIGURE_ACTION":"ACTION_THROW_EXCEPTION", "METHODS":"purchase_payment"}' \
|
49
|
+
-v 'http://127.0.0.1:8080/plugins/killbill-payment-test/configure'
|
50
|
+
```
|
51
|
+
|
52
|
+
One can clear the state with the following:
|
53
|
+
|
54
|
+
```
|
55
|
+
curl -v \
|
56
|
+
-u'admin:password' \
|
57
|
+
-H "X-Killbill-ApiKey: bob" \
|
58
|
+
-H 'X-Killbill-ApiSecret: lazar' \
|
59
|
+
-H "Content-Type: application/json" \
|
60
|
+
-H 'X-Killbill-CreatedBy: stephane' \
|
61
|
+
-X POST \
|
62
|
+
--data-binary '{"CONFIGURE_ACTION":"ACTION_CLEAR"}' \
|
63
|
+
-v 'http://127.0.0.1:8080/plugins/killbill-payment-test/configure'
|
64
|
+
```
|
65
|
+
|
66
|
+
## Kill Bill Backward Compatible Configuration
|
67
|
+
|
68
|
+
This should be ignored as this will be depracated
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.2.0
|
@@ -66,9 +66,8 @@ module PaymentTest
|
|
66
66
|
end
|
67
67
|
|
68
68
|
def get_payment_method_detail(kb_account_id, kb_payment_method_id, properties, context)
|
69
|
-
payment_method = ::Killbill::Plugin::Model::
|
70
|
-
payment_method.
|
71
|
-
payment_method.payment_method_id = kb_payment_method_id
|
69
|
+
payment_method = ::Killbill::Plugin::Model::PaymentMethodPlugin.new
|
70
|
+
payment_method.kb_payment_method_id = kb_payment_method_id
|
72
71
|
payment_method
|
73
72
|
end
|
74
73
|
|
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: 3.
|
4
|
+
version: 3.2.0
|
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: 2015-12-
|
11
|
+
date: 2015-12-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: killbill
|