pci_proxy 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -1
- data/Gemfile.lock +1 -1
- data/README.md +2 -2
- data/lib/pci_proxy.rb +1 -0
- data/lib/pci_proxy/model/tokenised_card.rb +43 -0
- data/lib/pci_proxy/token.rb +2 -1
- data/lib/pci_proxy/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e3809fc9d53de874082c4b1c7ffb7ad715adcfeb2fea22fef66266d4072d41bd
|
4
|
+
data.tar.gz: 176d0778aa1f90c0e6f95fc141da290fd951ace11c3a5232a617bc9db21ba474
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 154eb6fd451665825ba0eb146fa12c51448c815cfc13dd1dbea93a65f49c35053c2ae1ae9691622ba198770cfc8ddbed7e01030e13504445cdf255d8010ac9b0
|
7
|
+
data.tar.gz: 44975973ccded51daa015e25000291f7a992ec1ecd642119491a5c589bf16bf6e10f9a145c2164e344242425edf40de0b7f26fc6a64016bac3c67b94d104af97
|
data/CHANGELOG.md
CHANGED
@@ -2,4 +2,8 @@
|
|
2
2
|
|
3
3
|
A simple client library for [PCI Proxy](https://pci-proxy.com)'s API
|
4
4
|
|
5
|
-
v1.
|
5
|
+
v1.1.0 - 17th January 2020 - Return an instance of PciProxy::Model::TokenisedCard instead of plain Hash
|
6
|
+
|
7
|
+
v1.0.1 - 14th January 2020 - Relax dependency version requirements
|
8
|
+
|
9
|
+
v1.0.0 - 14th January 2020 - Initial release - covering the [Token API](https://docs.pci-proxy.com/collect-and-store-cards/capture-iframes/token-api)
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -35,10 +35,10 @@ And execute a token exchange like so:
|
|
35
35
|
client.execute(transaction_id: '1234567890')
|
36
36
|
```
|
37
37
|
|
38
|
-
In the event of a 200 OK response,
|
38
|
+
In the event of a 200 OK response, an instance of PciProxy::Model::TokenisedCard is returned:
|
39
39
|
|
40
40
|
```ruby
|
41
|
-
{"aliasCC"=>"411111GGCMUJ1111", "aliasCVV"=>"
|
41
|
+
#<PciProxy::Model::TokenisedCard:0x00007fda073453f8 @response={"aliasCC"=>"411111GGCMUJ1111", "aliasCVV"=>"b8XeAbhQQES6OVWTpOCaAscj", "paymentMethod"=>"VIS"}, @pan_token="411111GGCMUJ1111", @cvv_token="b8XeAbhQQES6OVWTpOCaAscj", @type_slug=:visa>
|
42
42
|
```
|
43
43
|
|
44
44
|
In the event of an error, a subclass of ```PciProxyAPIError``` will be raised.
|
data/lib/pci_proxy.rb
CHANGED
@@ -0,0 +1,43 @@
|
|
1
|
+
module PciProxy
|
2
|
+
module Model
|
3
|
+
class TokenisedCard
|
4
|
+
|
5
|
+
attr_reader :pan_token, :cvv_token, :type_slug, :response
|
6
|
+
|
7
|
+
def initialize(response)
|
8
|
+
@response = response
|
9
|
+
@pan_token = response["aliasCC"]
|
10
|
+
@cvv_token = response["aliasCVV"]
|
11
|
+
@type_slug = slug_for(response["paymentMethod"])
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def slug_for(payment_method)
|
17
|
+
return nil if payment_method.nil?
|
18
|
+
|
19
|
+
case payment_method
|
20
|
+
when 'VIS'
|
21
|
+
:visa
|
22
|
+
when 'ECA'
|
23
|
+
:mastercard
|
24
|
+
when 'AMX'
|
25
|
+
:amex
|
26
|
+
when 'DIN'
|
27
|
+
:diners
|
28
|
+
when 'DIS'
|
29
|
+
:discovery
|
30
|
+
when 'JCB'
|
31
|
+
:jcb
|
32
|
+
when 'ELO'
|
33
|
+
:elo
|
34
|
+
when 'CUP'
|
35
|
+
:cup
|
36
|
+
else
|
37
|
+
:unknown
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
data/lib/pci_proxy/token.rb
CHANGED
@@ -18,7 +18,8 @@ module PciProxy
|
|
18
18
|
# @raise [PciProxyAPIError] in cases where the API responds with a non-200 response code
|
19
19
|
# @return [Hash] result from PCI Proxy, decoded from JSON
|
20
20
|
def execute(transaction_id:, return_payment_method: true, cvv_mandatory: false)
|
21
|
-
request(params: { transactionId: transaction_id, returnPaymentMethod: return_payment_method, mandatoryAliasCVV: cvv_mandatory })
|
21
|
+
response = request(params: { transactionId: transaction_id, returnPaymentMethod: return_payment_method, mandatoryAliasCVV: cvv_mandatory })
|
22
|
+
PciProxy::Model::TokenisedCard.new(response)
|
22
23
|
end
|
23
24
|
|
24
25
|
end
|
data/lib/pci_proxy/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pci_proxy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rory Sinclair
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-01-
|
11
|
+
date: 2020-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -100,6 +100,7 @@ files:
|
|
100
100
|
- bin/setup
|
101
101
|
- lib/pci_proxy.rb
|
102
102
|
- lib/pci_proxy/base.rb
|
103
|
+
- lib/pci_proxy/model/tokenised_card.rb
|
103
104
|
- lib/pci_proxy/token.rb
|
104
105
|
- lib/pci_proxy/version.rb
|
105
106
|
- pci_proxy.gemspec
|