gestpay 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/Gemfile +0 -13
- data/README.md +1 -0
- data/gestpay.gemspec +6 -4
- data/lib/gestpay.rb +2 -0
- data/lib/gestpay/custom_info.rb +14 -0
- data/lib/gestpay/digest.rb +5 -0
- data/lib/gestpay/gateway.rb +3 -1
- data/lib/gestpay/iframe.rb +15 -0
- data/lib/gestpay/version.rb +1 -1
- data/spec/lib/gestpay/custom_info_spec.rb +28 -0
- metadata +32 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11e9be4abe3c16b6795457f871cd352232afb7b0
|
4
|
+
data.tar.gz: 6d239b561ba96e715531993029e6ddefbf44d1f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 113d8ed0e5975f3934aca1aebd2944721943220ebed5c2b9e9dc985b15b2e586392692b9c4780a4716d0a30abf851def1ff1aaa38872a43f070a725d82bf182c
|
7
|
+
data.tar.gz: 35fc6abde9d00079de65a3da09932f99c1949be82a3eb98c4c4f1839e1f90cd14092abf9e4d4f8e9c9df3cd495ca0be7a0705e55c35b701492f04d8351b64a47
|
data/Gemfile
CHANGED
@@ -1,17 +1,4 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
gem 'savon', '~> 2.2.0'
|
4
|
-
gem 'activesupport', '~> 3.2.13'
|
5
|
-
|
6
|
-
group :test do
|
7
|
-
# gem 'factory_girl', '~> 4.2.0'
|
8
|
-
gem 'webmock', "~> 1.9.0"
|
9
|
-
gem 'vcr', "~> 2.4.0"
|
10
|
-
# gem 'turn'
|
11
|
-
gem 'rake'
|
12
|
-
gem 'rspec', "~> 2.13.0"
|
13
|
-
gem 'pry'
|
14
|
-
end
|
15
|
-
|
16
3
|
# Specify your gem's dependencies in gestpay.gemspec
|
17
4
|
gemspec
|
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# Gestpay
|
2
2
|
|
3
3
|
[![Build Status](https://travis-ci.org/momitians/gestpay.png?branch=master)](https://travis-ci.org/momitians/gestpay)
|
4
|
+
[![Dependency Status](https://gemnasium.com/momitians/gestpay.png)](https://gemnasium.com/momitians/gestpay)
|
4
5
|
[![Code Climate](https://codeclimate.com/github/momitians/gestpay.png)](https://codeclimate.com/github/momitians/gestpay)
|
5
6
|
|
6
7
|
Service wrapper for BancaSella Gestpay interface.
|
data/gestpay.gemspec
CHANGED
@@ -19,11 +19,13 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
21
|
spec.add_dependency "savon", "~> 2.2.0"
|
22
|
-
spec.add_dependency "activesupport", "
|
22
|
+
#spec.add_dependency "activesupport", ">= 3.2.13"
|
23
|
+
spec.add_dependency "activesupport", ">= 2"
|
23
24
|
|
24
25
|
spec.add_development_dependency "bundler", "~> 1.3"
|
25
|
-
spec.add_development_dependency "rake"
|
26
|
+
spec.add_development_dependency "rake", "~> 10.0.4"
|
26
27
|
spec.add_development_dependency "rspec", "~> 2.13.0"
|
27
|
-
spec.add_development_dependency "vcr", "~> 2.
|
28
|
-
spec.add_development_dependency "webmock", "~> 1.
|
28
|
+
spec.add_development_dependency "vcr", "~> 2.5.0"
|
29
|
+
spec.add_development_dependency "webmock", "~> 1.11.0"
|
30
|
+
spec.add_development_dependency "pry", "~> 0.9.12"
|
29
31
|
end
|
data/lib/gestpay.rb
CHANGED
@@ -2,10 +2,12 @@ require 'savon'
|
|
2
2
|
require 'active_support/core_ext'
|
3
3
|
|
4
4
|
require "gestpay/version"
|
5
|
+
require "gestpay/custom_info"
|
5
6
|
require "gestpay/digest"
|
6
7
|
require "gestpay/gateway"
|
7
8
|
require "gestpay/configuration"
|
8
9
|
require "gestpay/result"
|
10
|
+
require "gestpay/iframe"
|
9
11
|
|
10
12
|
require "gestpay/error"
|
11
13
|
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Gestpay
|
2
|
+
module CustomInfo
|
3
|
+
|
4
|
+
def gestpay_encode(custom_info)
|
5
|
+
custom_info.collect{|k,v| "#{k}=#{v.to_s.unpack('H*')[0]}"}.sort.join('*P1*')
|
6
|
+
end
|
7
|
+
|
8
|
+
def gestpay_decode(string)
|
9
|
+
string.split('*P1*').inject({}) { |mem, var| k,v=var.split('='); mem[k]=[v].pack('H*') ; mem }
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
data/lib/gestpay/digest.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
module Gestpay
|
2
2
|
class Digest
|
3
3
|
|
4
|
+
include Gestpay::CustomInfo
|
5
|
+
|
4
6
|
URL = {
|
5
7
|
:test => 'https://testecomm.sella.it/gestpay/gestpayws/WSCryptDecrypt.asmx?WSDL',
|
6
8
|
:production => 'https://ecomms2s.sella.it/gestpay/gestpayws/WSCryptDecrypt.asmx?WSDL'
|
@@ -26,6 +28,8 @@ module Gestpay
|
|
26
28
|
end
|
27
29
|
|
28
30
|
def encrypt(data)
|
31
|
+
data[:custom_info] = gestpay_encode(data[:custom_info]) if data[:custom_info]
|
32
|
+
|
29
33
|
response = @client.call(:encrypt, soap_options(data))
|
30
34
|
response_content = response.body[:encrypt_response][:encrypt_result][:gest_pay_crypt_decrypt]
|
31
35
|
Result::Encrypt.new(response_content)
|
@@ -34,6 +38,7 @@ module Gestpay
|
|
34
38
|
def decrypt(string)
|
35
39
|
response = @client.call(:decrypt, soap_options({'CryptedString' => string}))
|
36
40
|
response_content = response.body[:decrypt_response][:decrypt_result][:gest_pay_crypt_decrypt]
|
41
|
+
response_content[:custom_info] = gestpay_decode(response_content[:custom_info]) if response_content[:custom_info]
|
37
42
|
Result::Decrypt.new(response_content)
|
38
43
|
end
|
39
44
|
|
data/lib/gestpay/gateway.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
module Gestpay
|
2
2
|
class Gateway
|
3
3
|
|
4
|
+
include Gestpay::CustomInfo
|
5
|
+
|
4
6
|
URL = {
|
5
7
|
:test => 'https://testecomm.sella.it/gestpay/gestpayws/WSs2s.asmx?WSDL',
|
6
8
|
:production => 'https://ecomms2s.sella.it/gestpay/gestpayws/WSs2s.asmx?WSDL'
|
@@ -29,7 +31,7 @@ module Gestpay
|
|
29
31
|
|
30
32
|
def payment(data)
|
31
33
|
# Custom info must be enabled on Gestpay backoffice interface, by adding new parameters
|
32
|
-
data[:custom_info] = data[:custom_info]
|
34
|
+
data[:custom_info] = gestpay_encode(data[:custom_info]) if data[:custom_info]
|
33
35
|
response = @client.call(:call_pagam_s2_s, soap_options(data))
|
34
36
|
response_content = response.body[:call_pagam_s2_s_response][:call_pagam_s2_s_result][:gest_pay_s2_s]
|
35
37
|
Result::Payment.new(response_content)
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Gestpay
|
2
|
+
class Iframe
|
3
|
+
|
4
|
+
FALLBACK_URL = {
|
5
|
+
:test => 'https://testecomm.sella.it/pagam/pagam.aspx',
|
6
|
+
:production => 'https://ecomm.sella.it/pagam/pagam.aspx'
|
7
|
+
}
|
8
|
+
|
9
|
+
def self.fallback_url
|
10
|
+
FALLBACK_URL[Gestpay.config.environment]
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
data/lib/gestpay/version.rb
CHANGED
@@ -0,0 +1,28 @@
|
|
1
|
+
require (File.expand_path('../../../spec_helper', __FILE__))
|
2
|
+
# For Ruby > 1.9.3, use this instead of require
|
3
|
+
# require_relative '../../spec_helper'
|
4
|
+
|
5
|
+
describe Gestpay::CustomInfo do
|
6
|
+
|
7
|
+
before do
|
8
|
+
@object = Object.new
|
9
|
+
@object.extend Gestpay::CustomInfo
|
10
|
+
end
|
11
|
+
|
12
|
+
describe "#gestpay_encode" do
|
13
|
+
custom_hash= {'par1'=>'http://path.to/stuff', 'par2'=> 123}
|
14
|
+
encoded_string= "par1=687474703a2f2f706174682e746f2f7374756666*P1*par2=313233"
|
15
|
+
it "encodes custom info values in base(16) notation" do
|
16
|
+
@object.gestpay_encode(custom_hash).should eq encoded_string
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe "#gestpay_decode" do
|
21
|
+
custom_hash= {'par1'=>'http://path.to/stuff', 'par2'=> 123.to_s} #numbers will be returned as strings anyway
|
22
|
+
encoded_string= "par1=687474703a2f2f706174682e746f2f7374756666*P1*par2=313233"
|
23
|
+
it "decodes custom info values in base(16) notation" do
|
24
|
+
@object.gestpay_decode(encoded_string).should eq custom_hash
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gestpay
|
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
|
- Alessandro Mencarini
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-08-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: savon
|
@@ -29,16 +29,16 @@ dependencies:
|
|
29
29
|
name: activesupport
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- -
|
32
|
+
- - '>='
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version:
|
34
|
+
version: '2'
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- -
|
39
|
+
- - '>='
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version:
|
41
|
+
version: '2'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: bundler
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -57,16 +57,16 @@ dependencies:
|
|
57
57
|
name: rake
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
|
-
- -
|
60
|
+
- - ~>
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version:
|
62
|
+
version: 10.0.4
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- -
|
67
|
+
- - ~>
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
69
|
+
version: 10.0.4
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: rspec
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
@@ -87,28 +87,42 @@ dependencies:
|
|
87
87
|
requirements:
|
88
88
|
- - ~>
|
89
89
|
- !ruby/object:Gem::Version
|
90
|
-
version: 2.
|
90
|
+
version: 2.5.0
|
91
91
|
type: :development
|
92
92
|
prerelease: false
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
95
|
- - ~>
|
96
96
|
- !ruby/object:Gem::Version
|
97
|
-
version: 2.
|
97
|
+
version: 2.5.0
|
98
98
|
- !ruby/object:Gem::Dependency
|
99
99
|
name: webmock
|
100
100
|
requirement: !ruby/object:Gem::Requirement
|
101
101
|
requirements:
|
102
102
|
- - ~>
|
103
103
|
- !ruby/object:Gem::Version
|
104
|
-
version: 1.
|
104
|
+
version: 1.11.0
|
105
|
+
type: :development
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ~>
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: 1.11.0
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: pry
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ~>
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: 0.9.12
|
105
119
|
type: :development
|
106
120
|
prerelease: false
|
107
121
|
version_requirements: !ruby/object:Gem::Requirement
|
108
122
|
requirements:
|
109
123
|
- - ~>
|
110
124
|
- !ruby/object:Gem::Version
|
111
|
-
version:
|
125
|
+
version: 0.9.12
|
112
126
|
description: GestPay services wrapper
|
113
127
|
email:
|
114
128
|
- a.mencarini@freegoweb.it
|
@@ -127,11 +141,13 @@ files:
|
|
127
141
|
- gestpay.gemspec
|
128
142
|
- lib/gestpay.rb
|
129
143
|
- lib/gestpay/configuration.rb
|
144
|
+
- lib/gestpay/custom_info.rb
|
130
145
|
- lib/gestpay/digest.rb
|
131
146
|
- lib/gestpay/error.rb
|
132
147
|
- lib/gestpay/error/failed_digest.rb
|
133
148
|
- lib/gestpay/error/verify_visa.rb
|
134
149
|
- lib/gestpay/gateway.rb
|
150
|
+
- lib/gestpay/iframe.rb
|
135
151
|
- lib/gestpay/result.rb
|
136
152
|
- lib/gestpay/result/base.rb
|
137
153
|
- lib/gestpay/result/decrypt.rb
|
@@ -149,6 +165,7 @@ files:
|
|
149
165
|
- spec/fixtures/gestpay_cassettes/payment_visa.yml
|
150
166
|
- spec/fixtures/gestpay_cassettes/request_token_ko.yml
|
151
167
|
- spec/fixtures/gestpay_cassettes/request_token_ok.yml
|
168
|
+
- spec/lib/gestpay/custom_info_spec.rb
|
152
169
|
- spec/lib/gestpay/digest_spec.rb
|
153
170
|
- spec/lib/gestpay/gateway_spec.rb
|
154
171
|
- spec/spec_helper.rb
|
@@ -187,6 +204,7 @@ test_files:
|
|
187
204
|
- spec/fixtures/gestpay_cassettes/payment_visa.yml
|
188
205
|
- spec/fixtures/gestpay_cassettes/request_token_ko.yml
|
189
206
|
- spec/fixtures/gestpay_cassettes/request_token_ok.yml
|
207
|
+
- spec/lib/gestpay/custom_info_spec.rb
|
190
208
|
- spec/lib/gestpay/digest_spec.rb
|
191
209
|
- spec/lib/gestpay/gateway_spec.rb
|
192
210
|
- spec/spec_helper.rb
|