complete_payment_systems 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +12 -1
- data/complete_payment_systems.gemspec +1 -1
- data/example_request_form.html.erb +13 -0
- data/lib/complete_payment_systems.rb +9 -5
- data/lib/complete_payment_systems/request_processing.rb +0 -11
- data/lib/complete_payment_systems/response_processing.rb +1 -5
- data/lib/complete_payment_systems/version.rb +1 -1
- metadata +3 -3
- data/cps.xml +0 -43
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 174211885a2722217f72bac38695f2eafe0054a1
|
4
|
+
data.tar.gz: 8f75977416ea5e0bee8047a5b5f08558a3eaa8ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4423b6eef74ef1b377ff1c657cb298ca472591942fd16bd2db9c76d226df97f949b9b7b50a55dc4e30b084fb04305e4139d20e5167061efe9e4950d56a0476f0
|
7
|
+
data.tar.gz: fbd9f5a6504ddbfd93f941933c9b2b2c595836aac3b950ce812a3d3041f3c9c7545e1f33b245613b8e68cc052b926a58b24114ebe98c42ab307fe30eef9cfa14
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,17 @@
|
|
1
1
|
# CompletePaymentSystems
|
2
2
|
|
3
|
-
|
3
|
+
Ruby gem for a simple CPS (Complete Payment Systems) service API - creates request XML from a parameters hash, processes the response.
|
4
|
+
|
5
|
+
Only direct-3D payments supported for now.
|
6
|
+
|
7
|
+
###### Workflow Overview:
|
8
|
+
1. Install gem, congifure defaults
|
9
|
+
2. Build an appropriate parameter hash using user-entered card values
|
10
|
+
3. Instantiate CPS::Request object passing the hash as the single argument
|
11
|
+
4. Pass the request instance to the form view (see /example_request_form.html.erb)
|
12
|
+
5. Capture the CPS server response in a controller action that listens on _config.default_callback_url_
|
13
|
+
6. Based on the response (@response.ok?) change order status
|
14
|
+
7. Based on order status, process user return experience at _config.default_redirect_url_
|
4
15
|
|
5
16
|
## Installation
|
6
17
|
|
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.authors = ["Epigene"]
|
11
11
|
spec.email = ["augusts.bautra@gmail.com"]
|
12
12
|
spec.summary = %q{A client for CPS (Complete Payment Systems) card payment service}
|
13
|
-
spec.description = %q{
|
13
|
+
spec.description = %q{CPS (Complete Payment Systems) card payment service API in Ruby}
|
14
14
|
spec.homepage = ""
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
</head>
|
4
|
+
<body onload="document.cpsForm.submit();" style="display:none;">
|
5
|
+
<form method="POST" name="cpsForm" action="<%= CPS.config.cps_url %>">
|
6
|
+
<input name="type" value="<%= CPS.config.cps_method %>">
|
7
|
+
<textarea name="xml">
|
8
|
+
<%= @cps_request.xml %>
|
9
|
+
</textarea>
|
10
|
+
<input type="submit" value="Send">
|
11
|
+
</form>
|
12
|
+
</body>
|
13
|
+
</html>
|
@@ -52,10 +52,8 @@ module CompletePaymentSystems
|
|
52
52
|
|
53
53
|
CPS.configure {}
|
54
54
|
|
55
|
-
|
56
|
-
|
57
|
-
CPS = CompletePaymentSystems
|
58
|
-
hash = {
|
55
|
+
def self.return_test_instance
|
56
|
+
hash = {
|
59
57
|
order: (Time.now.to_i), # Pass the unique purchase ID here
|
60
58
|
value: "166", # Pass the purchase value in cents here (1$ purcase value = 100)
|
61
59
|
currency: "USD", # Pass the purchase currency 3-letter code here ($ = "USD")
|
@@ -67,4 +65,10 @@ hash = {
|
|
67
65
|
holder_ip: "123.124.125.226" # Get this from request.remote_ip
|
68
66
|
}
|
69
67
|
|
70
|
-
|
68
|
+
return CPS::Request.new(hash)
|
69
|
+
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
|
74
|
+
CPS = CompletePaymentSystems
|
@@ -30,15 +30,6 @@ module CompletePaymentSystems
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def build_request_xml
|
33
|
-
puts "before param init:"
|
34
|
-
puts params
|
35
|
-
puts "After param init:"
|
36
|
-
params = self.params
|
37
|
-
puts params
|
38
|
-
|
39
|
-
puts params["value"]
|
40
|
-
puts params[:value]
|
41
|
-
|
42
33
|
values = {
|
43
34
|
user: (params[:user] || CPS.config.default_user), # "test_pasta_sign" for direct, "pasta_test_3d" for direct with 3D
|
44
35
|
callback_url: (params[:callback_url] || CPS.config.default_callback_url),
|
@@ -61,8 +52,6 @@ module CompletePaymentSystems
|
|
61
52
|
product_url: (params[:product_url] || CPS.config.default_product_url)
|
62
53
|
}
|
63
54
|
|
64
|
-
puts values # TESTING
|
65
|
-
|
66
55
|
values[:signature] = sign(order_id: values[:order], value: values[:value], currency: values[:currency], card_number: values[:card_number]).gsub(/\n/, '')
|
67
56
|
|
68
57
|
values[:signature_line] = '<digiSignature>' + values[:signature] + '</digiSignature>'
|
@@ -4,7 +4,7 @@ module CompletePaymentSystems
|
|
4
4
|
attr_reader :xml, :response_hash, :code, :message
|
5
5
|
|
6
6
|
def initialize(xml)
|
7
|
-
@xml = xml
|
7
|
+
@xml = xml
|
8
8
|
@response_hash = parse_response(@xml)
|
9
9
|
@code = @response_hash["resultCode"]
|
10
10
|
@message = @response_hash["resultMessage"]
|
@@ -50,8 +50,4 @@ module CompletePaymentSystems
|
|
50
50
|
|
51
51
|
end
|
52
52
|
|
53
|
-
# def self.read_test_xml
|
54
|
-
# return File.read("#{CPS.root}/response.xml")
|
55
|
-
# end
|
56
|
-
|
57
53
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: complete_payment_systems
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Epigene
|
@@ -94,7 +94,7 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 3.1.0
|
97
|
-
description:
|
97
|
+
description: CPS (Complete Payment Systems) card payment service API in Ruby
|
98
98
|
email:
|
99
99
|
- augusts.bautra@gmail.com
|
100
100
|
executables: []
|
@@ -109,7 +109,7 @@ files:
|
|
109
109
|
- README.md
|
110
110
|
- Rakefile
|
111
111
|
- complete_payment_systems.gemspec
|
112
|
-
-
|
112
|
+
- example_request_form.html.erb
|
113
113
|
- lib/complete_payment_systems.rb
|
114
114
|
- lib/complete_payment_systems/certs/Pasta_test_3d.p12
|
115
115
|
- lib/complete_payment_systems/certs/Pasta_test_3d.pem
|
data/cps.xml
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8" ?>
|
2
|
-
<cpsxml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
3
|
-
xsi:schemaLocation="http://www.cps.lv/xml/ns/cpsxml https://3ds.cps.lv/GatorServo/Gator_SendForAuth.xsd"
|
4
|
-
xmlns="http://www.cps.lv/xml/ns/cpsxml">
|
5
|
-
<header xmlns="">
|
6
|
-
<responsetype>direct</responsetype>
|
7
|
-
<user>pasta_test_3d</user>
|
8
|
-
<type>sendForAuth</type>
|
9
|
-
<transType>DB</transType>
|
10
|
-
<digiSignature>NP+o4wK17G3tqcTF5K2vfBjXQ4RpCLEYPoK9I99/9GPQO95fD0Xp+DueUV4c
|
11
|
-
AtgNQmQg4C2BTw0vh1fme8PQanaGF50WJOTdgXdU5ygRxkjja4EyA9cDe1cq
|
12
|
-
Ex7iqtSazv2FZXu/6RfVgwcoy4SRuNuQrsDqo6/7isJ/BpgppTI=
|
13
|
-
</digiSignature>
|
14
|
-
<callbackUrl>www.google.lv</callbackUrl>
|
15
|
-
<redirectUrl>http://www.google.lv</redirectUrl>
|
16
|
-
</header>
|
17
|
-
<request xmlns="">
|
18
|
-
<orderNumber>1422028510</orderNumber>
|
19
|
-
<cardholder>
|
20
|
-
<firstName>Test</firstName>
|
21
|
-
<lastName>User</lastName>
|
22
|
-
<street>NOT USED</street>
|
23
|
-
<zip>NOT USED</zip>
|
24
|
-
<city>NOT USED</city>
|
25
|
-
<country>LV</country>
|
26
|
-
<email>hi@creo.mobi</email>
|
27
|
-
<ip>123.124.125.226</ip>
|
28
|
-
</cardholder>
|
29
|
-
<card>
|
30
|
-
<cardNumber>4314229999999913</cardNumber>
|
31
|
-
<expires>01/18</expires>
|
32
|
-
<cvv>123</cvv>
|
33
|
-
</card>
|
34
|
-
<amount>
|
35
|
-
<value>100</value>
|
36
|
-
<currency>USD</currency>
|
37
|
-
</amount>
|
38
|
-
<product>
|
39
|
-
<productName>Product</productName>
|
40
|
-
<productUrl>www.test.com</productUrl>
|
41
|
-
</product>
|
42
|
-
</request>
|
43
|
-
</cpsxml>
|