pci_proxy 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -0
- data/Gemfile.lock +2 -2
- data/README.md +43 -2
- data/lib/pci_proxy/model/check_result.rb +1 -1
- data/lib/pci_proxy/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 47c687f9c8597bf60929b77d33f0849ed847381885eb7a17a82e1658e98a35bc
|
|
4
|
+
data.tar.gz: 361afd9f1839a8661cf9116ba4739e7844e290a974cc0a745721683ac09df7b3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2c93bb9d784fdd2e513cdb37b7a3168997563307068f552f2071cc6a5d9f1d0d503fd4c860866e8dc640bd5921b1f2b30c153525a0283d8a12242468e4e55787
|
|
7
|
+
data.tar.gz: 74047acd5ee6bc8f197fb25d4bcb90e9ff84cd9bd73809281d0bc624ebbbf927fefebcbb792918e09b98d8dcbf557192b3875e7f3c8124c90ad7e42657094bcf
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
A simple client library for [PCI Proxy](https://pci-proxy.com)'s API
|
|
4
4
|
|
|
5
|
+
v1.2.1 - 30th January 2020 - Minor tweaks; cleanups; update documentation
|
|
6
|
+
|
|
5
7
|
v1.2.0 - 30th January 2020 - Add support for the [Check API](https://docs.pci-proxy.com/use-stored-cards/check)
|
|
6
8
|
|
|
7
9
|
v1.1.0 - 17th January 2020 - Return an instance of PciProxy::Model::TokenisedCard instead of plain Hash
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -20,7 +20,7 @@ Or install it yourself as:
|
|
|
20
20
|
|
|
21
21
|
## Usage
|
|
22
22
|
|
|
23
|
-
Initially, this gem only covers the [Token API](https://docs.pci-proxy.com/collect-and-store-cards/capture-iframes/token-api), which converts a transactionId from the [secure fields](https://docs.pci-proxy.com/collect-and-store-cards/capture-iframes) mechanism into tokenised card PAN and CVV.
|
|
23
|
+
Initially, this gem only covers the [Token API](https://docs.pci-proxy.com/collect-and-store-cards/capture-iframes/token-api), which converts a transactionId from the [secure fields](https://docs.pci-proxy.com/collect-and-store-cards/capture-iframes) mechanism into tokenised card PAN and CVV, and the [Check API](https://docs.pci-proxy.com/use-stored-cards/check) which allows verification of a card token.
|
|
24
24
|
|
|
25
25
|
Pull requests are most welcome for coverage of other PCI Proxy APIs :)
|
|
26
26
|
### Token API - Usage
|
|
@@ -38,8 +38,17 @@ client.execute(transaction_id: '1234567890')
|
|
|
38
38
|
In the event of a 200 OK response, an instance of PciProxy::Model::TokenisedCard is returned:
|
|
39
39
|
|
|
40
40
|
```ruby
|
|
41
|
-
#<PciProxy::Model::TokenisedCard:0x00007fda073453f8 @
|
|
41
|
+
#<PciProxy::Model::TokenisedCard:0x00007fda073453f8 @pan_token="411111GGCMUJ1111", @cvv_token="b8XeAbhQQES6OVWTpOCaAscj", @type_slug=:visa>
|
|
42
42
|
```
|
|
43
|
+
(```response``` attr_reader value omitted for clarity)
|
|
44
|
+
|
|
45
|
+
This object has attr_readers for ```pan_token```, ```cvv_token``` and ```type_slug``` which will return one of the following symbols:
|
|
46
|
+
|
|
47
|
+
```ruby
|
|
48
|
+
[:visa, :mastercard, :amex, :diners, :discovery, :jcb, :elo, :cup, :unknown]
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
It also has an attr_reader for ```response``` which is the raw parsed JSON response, as a hash.
|
|
43
52
|
|
|
44
53
|
In the event of an error, a subclass of ```PciProxyAPIError``` will be raised.
|
|
45
54
|
|
|
@@ -49,6 +58,38 @@ The most likely error is that the transactionId temporary token has expired, res
|
|
|
49
58
|
PciProxy::BadRequestError (HTTP status: 400, Response: Tokenization not found)
|
|
50
59
|
```
|
|
51
60
|
|
|
61
|
+
### Check API - Usage
|
|
62
|
+
|
|
63
|
+
Create an instance of ```PciProxy::Check``` and call ```execute``` as follows:
|
|
64
|
+
|
|
65
|
+
```ruby
|
|
66
|
+
client = PciProxy::Check.new(api_username: 'username', api_password: 'password')
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
And execute a card verification like so:
|
|
70
|
+
|
|
71
|
+
```ruby
|
|
72
|
+
client.execute(reference: 'foo', card_token: '411111GGCMUJ1111', card_type: :visa, expiry_month: 1, expiry_year: 2022)
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
In all cases (success, denoted by 200 OK from the API, or error, denoted by non-200 response), an instance of ```PciProxy::Model::CheckResult``` is returned.
|
|
76
|
+
|
|
77
|
+
This object has attr_readers for ```auth_code```, ```transaction_id```, ```status``` and ```error```
|
|
78
|
+
|
|
79
|
+
It also has an attr_reader for ```response``` which is the raw parsed JSON response, as a hash.
|
|
80
|
+
|
|
81
|
+
With a successful response, the object's ```status``` attribute will have the value ```:success```, and the ```auth_code``` and ```transaction_id``` values will be available:
|
|
82
|
+
```ruby
|
|
83
|
+
#<PciProxy::Model::CheckResult:0x00007fbda2186fe8 @auth_code="124101", @transaction_id="190828124101219812", @error=nil, @status=:success>
|
|
84
|
+
```
|
|
85
|
+
(```response``` attr_reader value omitted for clarity)
|
|
86
|
+
|
|
87
|
+
With an unsuccessful response, the object's ```status``` attribute will have the value ```:error```:
|
|
88
|
+
```ruby
|
|
89
|
+
#<PciProxy::Model::CheckResult:0x00007fbda2186fe8 @auth_code=nil, @transaction_id=nil, @error={"code"=>"UNAUTHORIZED", "message"=>"The account is not configured to use this API."}, @status=:error>
|
|
90
|
+
```
|
|
91
|
+
(```response``` attr_reader value omitted for clarity)
|
|
92
|
+
|
|
52
93
|
## Changes
|
|
53
94
|
See [Changelog](CHANGELOG.md)
|
|
54
95
|
|
|
@@ -10,7 +10,7 @@ module PciProxy
|
|
|
10
10
|
@transaction_id = response["transactionId"]
|
|
11
11
|
@error = response["error"]
|
|
12
12
|
|
|
13
|
-
@status = @auth_code && @transaction_id && !@error ?
|
|
13
|
+
@status = @auth_code && @transaction_id && !@error ? :success : :error
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
end
|
data/lib/pci_proxy/version.rb
CHANGED