gestpay 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +24 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +7 -0
  5. data/Gemfile +17 -0
  6. data/LICENSE.txt +22 -0
  7. data/README.md +52 -0
  8. data/Rakefile +4 -0
  9. data/gestpay.gemspec +29 -0
  10. data/lib/gestpay.rb +22 -0
  11. data/lib/gestpay/configuration.rb +34 -0
  12. data/lib/gestpay/digest.rb +41 -0
  13. data/lib/gestpay/error.rb +7 -0
  14. data/lib/gestpay/error/failed_digest.rb +19 -0
  15. data/lib/gestpay/error/verify_visa.rb +15 -0
  16. data/lib/gestpay/gateway.rb +49 -0
  17. data/lib/gestpay/result.rb +10 -0
  18. data/lib/gestpay/result/base.rb +25 -0
  19. data/lib/gestpay/result/decrypt.rb +6 -0
  20. data/lib/gestpay/result/encrypt.rb +9 -0
  21. data/lib/gestpay/result/payment.rb +13 -0
  22. data/lib/gestpay/result/token_request.rb +9 -0
  23. data/lib/gestpay/version.rb +3 -0
  24. data/spec/fixtures/gestpay_cassettes/decrypt_ko.yml +224 -0
  25. data/spec/fixtures/gestpay_cassettes/decrypt_ok.yml +171 -0
  26. data/spec/fixtures/gestpay_cassettes/encrypt_ko.yml +169 -0
  27. data/spec/fixtures/gestpay_cassettes/encrypt_ok.yml +170 -0
  28. data/spec/fixtures/gestpay_cassettes/payment_ko.yml +397 -0
  29. data/spec/fixtures/gestpay_cassettes/payment_ok.yml +395 -0
  30. data/spec/fixtures/gestpay_cassettes/payment_token.yml +397 -0
  31. data/spec/fixtures/gestpay_cassettes/payment_visa.yml +395 -0
  32. data/spec/fixtures/gestpay_cassettes/request_token_ko.yml +400 -0
  33. data/spec/fixtures/gestpay_cassettes/request_token_ok.yml +399 -0
  34. data/spec/lib/gestpay/digest_spec.rb +72 -0
  35. data/spec/lib/gestpay/gateway_spec.rb +110 -0
  36. data/spec/spec_helper.rb +30 -0
  37. metadata +192 -0
@@ -0,0 +1,399 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://testecomm.sella.it/gestpay/gestpayws/WSs2s.asmx?WSDL
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - '*/*'
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Date:
22
+ - Tue, 21 May 2013 11:53:21 GMT
23
+ Server:
24
+ - Microsoft-IIS/6.0
25
+ P3p:
26
+ - CP="ALL IND"
27
+ X-Powered-By:
28
+ - ASP.NET
29
+ X-Aspnet-Version:
30
+ - 4.0.30319
31
+ Cache-Control:
32
+ - private, max-age=0
33
+ Content-Type:
34
+ - text/xml; charset=utf-8
35
+ Content-Length:
36
+ - '23531'
37
+ body:
38
+ encoding: UTF-8
39
+ string: "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<wsdl:definitions xmlns:soap=\"http://schemas.xmlsoap.org/wsdl/soap/\"
40
+ xmlns:tm=\"http://microsoft.com/wsdl/mime/textMatching/\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"
41
+ xmlns:mime=\"http://schemas.xmlsoap.org/wsdl/mime/\" xmlns:tns=\"https://ecomms2s.sella.it/\"
42
+ xmlns:s=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap12=\"http://schemas.xmlsoap.org/wsdl/soap12/\"
43
+ xmlns:http=\"http://schemas.xmlsoap.org/wsdl/http/\" targetNamespace=\"https://ecomms2s.sella.it/\"
44
+ xmlns:wsdl=\"http://schemas.xmlsoap.org/wsdl/\">\r\n <wsdl:types>\r\n <s:schema
45
+ elementFormDefault=\"qualified\" targetNamespace=\"https://ecomms2s.sella.it/\">\r\n
46
+ \ <s:element name=\"callRefundS2S\">\r\n <s:complexType>\r\n <s:sequence>\r\n
47
+ \ <s:element minOccurs=\"0\" maxOccurs=\"1\" name=\"shopLogin\"
48
+ type=\"s:string\" />\r\n <s:element minOccurs=\"0\" maxOccurs=\"1\"
49
+ name=\"uicCode\" type=\"s:string\" />\r\n <s:element minOccurs=\"0\"
50
+ maxOccurs=\"1\" name=\"amount\" type=\"s:string\" />\r\n <s:element
51
+ minOccurs=\"0\" maxOccurs=\"1\" name=\"shopTransactionId\" type=\"s:string\"
52
+ />\r\n <s:element minOccurs=\"0\" maxOccurs=\"1\" name=\"bankTransactionId\"
53
+ type=\"s:string\" />\r\n </s:sequence>\r\n </s:complexType>\r\n
54
+ \ </s:element>\r\n <s:element name=\"callRefundS2SResponse\">\r\n
55
+ \ <s:complexType>\r\n <s:sequence>\r\n <s:element
56
+ minOccurs=\"0\" maxOccurs=\"1\" name=\"callRefundS2SResult\">\r\n <s:complexType
57
+ mixed=\"true\">\r\n <s:sequence>\r\n <s:any
58
+ />\r\n </s:sequence>\r\n </s:complexType>\r\n
59
+ \ </s:element>\r\n </s:sequence>\r\n </s:complexType>\r\n
60
+ \ </s:element>\r\n <s:element name=\"callReadTrxS2S\">\r\n <s:complexType>\r\n
61
+ \ <s:sequence>\r\n <s:element minOccurs=\"0\" maxOccurs=\"1\"
62
+ name=\"shopLogin\" type=\"s:string\" />\r\n <s:element minOccurs=\"0\"
63
+ maxOccurs=\"1\" name=\"shopTransactionId\" type=\"s:string\" />\r\n <s:element
64
+ minOccurs=\"0\" maxOccurs=\"1\" name=\"bankTransactionId\" type=\"s:string\"
65
+ />\r\n </s:sequence>\r\n </s:complexType>\r\n </s:element>\r\n
66
+ \ <s:element name=\"callReadTrxS2SResponse\">\r\n <s:complexType>\r\n
67
+ \ <s:sequence>\r\n <s:element minOccurs=\"0\" maxOccurs=\"1\"
68
+ name=\"callReadTrxS2SResult\">\r\n <s:complexType mixed=\"true\">\r\n
69
+ \ <s:sequence>\r\n <s:any />\r\n </s:sequence>\r\n
70
+ \ </s:complexType>\r\n </s:element>\r\n </s:sequence>\r\n
71
+ \ </s:complexType>\r\n </s:element>\r\n <s:element name=\"callPagamS2S\">\r\n
72
+ \ <s:complexType>\r\n <s:sequence>\r\n <s:element
73
+ minOccurs=\"0\" maxOccurs=\"1\" name=\"shopLogin\" type=\"s:string\" />\r\n
74
+ \ <s:element minOccurs=\"0\" maxOccurs=\"1\" name=\"uicCode\" type=\"s:string\"
75
+ />\r\n <s:element minOccurs=\"0\" maxOccurs=\"1\" name=\"amount\"
76
+ type=\"s:string\" />\r\n <s:element minOccurs=\"0\" maxOccurs=\"1\"
77
+ name=\"shopTransactionId\" type=\"s:string\" />\r\n <s:element
78
+ minOccurs=\"0\" maxOccurs=\"1\" name=\"cardNumber\" type=\"s:string\" />\r\n
79
+ \ <s:element minOccurs=\"0\" maxOccurs=\"1\" name=\"expiryMonth\"
80
+ type=\"s:string\" />\r\n <s:element minOccurs=\"0\" maxOccurs=\"1\"
81
+ name=\"expiryYear\" type=\"s:string\" />\r\n <s:element minOccurs=\"0\"
82
+ maxOccurs=\"1\" name=\"buyerName\" type=\"s:string\" />\r\n <s:element
83
+ minOccurs=\"0\" maxOccurs=\"1\" name=\"buyerEmail\" type=\"s:string\" />\r\n
84
+ \ <s:element minOccurs=\"0\" maxOccurs=\"1\" name=\"languageId\"
85
+ type=\"s:string\" />\r\n <s:element minOccurs=\"0\" maxOccurs=\"1\"
86
+ name=\"cvv\" type=\"s:string\" />\r\n <s:element minOccurs=\"0\"
87
+ maxOccurs=\"1\" name=\"min\" type=\"s:string\" />\r\n <s:element
88
+ minOccurs=\"0\" maxOccurs=\"1\" name=\"transKey\" type=\"s:string\" />\r\n
89
+ \ <s:element minOccurs=\"0\" maxOccurs=\"1\" name=\"PARes\" type=\"s:string\"
90
+ />\r\n <s:element minOccurs=\"0\" maxOccurs=\"1\" name=\"customInfo\"
91
+ type=\"s:string\" />\r\n <s:element minOccurs=\"0\" maxOccurs=\"1\"
92
+ name=\"IDEA\" type=\"s:string\" />\r\n <s:element minOccurs=\"0\"
93
+ maxOccurs=\"1\" name=\"requestToken\" type=\"s:string\" />\r\n <s:element
94
+ minOccurs=\"0\" maxOccurs=\"1\" name=\"tokenValue\" type=\"s:string\" />\r\n
95
+ \ </s:sequence>\r\n </s:complexType>\r\n </s:element>\r\n
96
+ \ <s:element name=\"callPagamS2SResponse\">\r\n <s:complexType>\r\n
97
+ \ <s:sequence>\r\n <s:element minOccurs=\"0\" maxOccurs=\"1\"
98
+ name=\"callPagamS2SResult\">\r\n <s:complexType mixed=\"true\">\r\n
99
+ \ <s:sequence>\r\n <s:any />\r\n </s:sequence>\r\n
100
+ \ </s:complexType>\r\n </s:element>\r\n </s:sequence>\r\n
101
+ \ </s:complexType>\r\n </s:element>\r\n <s:element name=\"callDeleteS2S\">\r\n
102
+ \ <s:complexType>\r\n <s:sequence>\r\n <s:element
103
+ minOccurs=\"0\" maxOccurs=\"1\" name=\"shopLogin\" type=\"s:string\" />\r\n
104
+ \ <s:element minOccurs=\"0\" maxOccurs=\"1\" name=\"shopTransactionId\"
105
+ type=\"s:string\" />\r\n <s:element minOccurs=\"0\" maxOccurs=\"1\"
106
+ name=\"bankTransactionId\" type=\"s:string\" />\r\n </s:sequence>\r\n
107
+ \ </s:complexType>\r\n </s:element>\r\n <s:element name=\"callDeleteS2SResponse\">\r\n
108
+ \ <s:complexType>\r\n <s:sequence>\r\n <s:element
109
+ minOccurs=\"0\" maxOccurs=\"1\" name=\"callDeleteS2SResult\">\r\n <s:complexType
110
+ mixed=\"true\">\r\n <s:sequence>\r\n <s:any
111
+ />\r\n </s:sequence>\r\n </s:complexType>\r\n
112
+ \ </s:element>\r\n </s:sequence>\r\n </s:complexType>\r\n
113
+ \ </s:element>\r\n <s:element name=\"callSettleS2S\">\r\n <s:complexType>\r\n
114
+ \ <s:sequence>\r\n <s:element minOccurs=\"0\" maxOccurs=\"1\"
115
+ name=\"shopLogin\" type=\"s:string\" />\r\n <s:element minOccurs=\"0\"
116
+ maxOccurs=\"1\" name=\"uicCode\" type=\"s:string\" />\r\n <s:element
117
+ minOccurs=\"0\" maxOccurs=\"1\" name=\"amount\" type=\"s:string\" />\r\n <s:element
118
+ minOccurs=\"0\" maxOccurs=\"1\" name=\"shopTransID\" type=\"s:string\" />\r\n
119
+ \ <s:element minOccurs=\"0\" maxOccurs=\"1\" name=\"bankTransID\"
120
+ type=\"s:string\" />\r\n </s:sequence>\r\n </s:complexType>\r\n
121
+ \ </s:element>\r\n <s:element name=\"callSettleS2SResponse\">\r\n
122
+ \ <s:complexType>\r\n <s:sequence>\r\n <s:element
123
+ minOccurs=\"0\" maxOccurs=\"1\" name=\"callSettleS2SResult\">\r\n <s:complexType
124
+ mixed=\"true\">\r\n <s:sequence>\r\n <s:any
125
+ />\r\n </s:sequence>\r\n </s:complexType>\r\n
126
+ \ </s:element>\r\n </s:sequence>\r\n </s:complexType>\r\n
127
+ \ </s:element>\r\n <s:element name=\"callVerifycardS2S\">\r\n <s:complexType>\r\n
128
+ \ <s:sequence>\r\n <s:element minOccurs=\"0\" maxOccurs=\"1\"
129
+ name=\"shopLogin\" type=\"s:string\" />\r\n <s:element minOccurs=\"0\"
130
+ maxOccurs=\"1\" name=\"shopTransactionId\" type=\"s:string\" />\r\n <s:element
131
+ minOccurs=\"0\" maxOccurs=\"1\" name=\"cardNumber\" type=\"s:string\" />\r\n
132
+ \ <s:element minOccurs=\"0\" maxOccurs=\"1\" name=\"expMonth\" type=\"s:string\"
133
+ />\r\n <s:element minOccurs=\"0\" maxOccurs=\"1\" name=\"expYear\"
134
+ type=\"s:string\" />\r\n <s:element minOccurs=\"0\" maxOccurs=\"1\"
135
+ name=\"CVV2\" type=\"s:string\" />\r\n </s:sequence>\r\n </s:complexType>\r\n
136
+ \ </s:element>\r\n <s:element name=\"callVerifycardS2SResponse\">\r\n
137
+ \ <s:complexType>\r\n <s:sequence>\r\n <s:element
138
+ minOccurs=\"0\" maxOccurs=\"1\" name=\"callVerifycardS2SResult\">\r\n <s:complexType
139
+ mixed=\"true\">\r\n <s:sequence>\r\n <s:any
140
+ />\r\n </s:sequence>\r\n </s:complexType>\r\n
141
+ \ </s:element>\r\n </s:sequence>\r\n </s:complexType>\r\n
142
+ \ </s:element>\r\n <s:element name=\"callCheckCartaS2S\">\r\n <s:complexType>\r\n
143
+ \ <s:sequence>\r\n <s:element minOccurs=\"0\" maxOccurs=\"1\"
144
+ name=\"shopLogin\" type=\"s:string\" />\r\n <s:element minOccurs=\"0\"
145
+ maxOccurs=\"1\" name=\"shopTransactionId\" type=\"s:string\" />\r\n <s:element
146
+ minOccurs=\"0\" maxOccurs=\"1\" name=\"cardNumber\" type=\"s:string\" />\r\n
147
+ \ <s:element minOccurs=\"0\" maxOccurs=\"1\" name=\"expMonth\" type=\"s:string\"
148
+ />\r\n <s:element minOccurs=\"0\" maxOccurs=\"1\" name=\"expYear\"
149
+ type=\"s:string\" />\r\n <s:element minOccurs=\"0\" maxOccurs=\"1\"
150
+ name=\"CVV2\" type=\"s:string\" />\r\n <s:element minOccurs=\"0\"
151
+ maxOccurs=\"1\" name=\"withAuth\" type=\"s:string\" />\r\n </s:sequence>\r\n
152
+ \ </s:complexType>\r\n </s:element>\r\n <s:element name=\"callCheckCartaS2SResponse\">\r\n
153
+ \ <s:complexType>\r\n <s:sequence>\r\n <s:element
154
+ minOccurs=\"0\" maxOccurs=\"1\" name=\"callCheckCartaS2SResult\">\r\n <s:complexType
155
+ mixed=\"true\">\r\n <s:sequence>\r\n <s:any
156
+ />\r\n </s:sequence>\r\n </s:complexType>\r\n
157
+ \ </s:element>\r\n </s:sequence>\r\n </s:complexType>\r\n
158
+ \ </s:element>\r\n <s:element name=\"callRenounce\">\r\n <s:complexType
159
+ />\r\n </s:element>\r\n <s:element name=\"callRenounceResponse\">\r\n
160
+ \ <s:complexType>\r\n <s:sequence>\r\n <s:element
161
+ minOccurs=\"0\" maxOccurs=\"1\" name=\"callRenounceResult\">\r\n <s:complexType
162
+ mixed=\"true\">\r\n <s:sequence>\r\n <s:any
163
+ />\r\n </s:sequence>\r\n </s:complexType>\r\n
164
+ \ </s:element>\r\n </s:sequence>\r\n </s:complexType>\r\n
165
+ \ </s:element>\r\n <s:element name=\"CallRequestTokenS2S\">\r\n <s:complexType>\r\n
166
+ \ <s:sequence>\r\n <s:element minOccurs=\"0\" maxOccurs=\"1\"
167
+ name=\"shopLogin\" type=\"s:string\" />\r\n <s:element minOccurs=\"0\"
168
+ maxOccurs=\"1\" name=\"requestToken\" type=\"s:string\" />\r\n <s:element
169
+ minOccurs=\"0\" maxOccurs=\"1\" name=\"cardNumber\" type=\"s:string\" />\r\n
170
+ \ <s:element minOccurs=\"0\" maxOccurs=\"1\" name=\"expiryMonth\"
171
+ type=\"s:string\" />\r\n <s:element minOccurs=\"0\" maxOccurs=\"1\"
172
+ name=\"expiryYear\" type=\"s:string\" />\r\n <s:element minOccurs=\"0\"
173
+ maxOccurs=\"1\" name=\"cvv\" type=\"s:string\" />\r\n <s:element
174
+ minOccurs=\"0\" maxOccurs=\"1\" name=\"withAuth\" type=\"s:string\" />\r\n
175
+ \ </s:sequence>\r\n </s:complexType>\r\n </s:element>\r\n
176
+ \ <s:element name=\"CallRequestTokenS2SResponse\">\r\n <s:complexType>\r\n
177
+ \ <s:sequence>\r\n <s:element minOccurs=\"0\" maxOccurs=\"1\"
178
+ name=\"CallRequestTokenS2SResult\">\r\n <s:complexType mixed=\"true\">\r\n
179
+ \ <s:sequence>\r\n <s:any />\r\n </s:sequence>\r\n
180
+ \ </s:complexType>\r\n </s:element>\r\n </s:sequence>\r\n
181
+ \ </s:complexType>\r\n </s:element>\r\n <s:element name=\"callDeleteTokenS2S\">\r\n
182
+ \ <s:complexType>\r\n <s:sequence>\r\n <s:element
183
+ minOccurs=\"0\" maxOccurs=\"1\" name=\"tokenValue\" type=\"s:string\" />\r\n
184
+ \ <s:element minOccurs=\"0\" maxOccurs=\"1\" name=\"shopLogin\"
185
+ type=\"s:string\" />\r\n </s:sequence>\r\n </s:complexType>\r\n
186
+ \ </s:element>\r\n <s:element name=\"callDeleteTokenS2SResponse\">\r\n
187
+ \ <s:complexType>\r\n <s:sequence>\r\n <s:element
188
+ minOccurs=\"0\" maxOccurs=\"1\" name=\"callDeleteTokenS2SResult\">\r\n <s:complexType
189
+ mixed=\"true\">\r\n <s:sequence>\r\n <s:any
190
+ />\r\n </s:sequence>\r\n </s:complexType>\r\n
191
+ \ </s:element>\r\n </s:sequence>\r\n </s:complexType>\r\n
192
+ \ </s:element>\r\n </s:schema>\r\n </wsdl:types>\r\n <wsdl:message
193
+ name=\"callRefundS2SSoapIn\">\r\n <wsdl:part name=\"parameters\" element=\"tns:callRefundS2S\"
194
+ />\r\n </wsdl:message>\r\n <wsdl:message name=\"callRefundS2SSoapOut\">\r\n
195
+ \ <wsdl:part name=\"parameters\" element=\"tns:callRefundS2SResponse\" />\r\n
196
+ \ </wsdl:message>\r\n <wsdl:message name=\"callReadTrxS2SSoapIn\">\r\n <wsdl:part
197
+ name=\"parameters\" element=\"tns:callReadTrxS2S\" />\r\n </wsdl:message>\r\n
198
+ \ <wsdl:message name=\"callReadTrxS2SSoapOut\">\r\n <wsdl:part name=\"parameters\"
199
+ element=\"tns:callReadTrxS2SResponse\" />\r\n </wsdl:message>\r\n <wsdl:message
200
+ name=\"callPagamS2SSoapIn\">\r\n <wsdl:part name=\"parameters\" element=\"tns:callPagamS2S\"
201
+ />\r\n </wsdl:message>\r\n <wsdl:message name=\"callPagamS2SSoapOut\">\r\n
202
+ \ <wsdl:part name=\"parameters\" element=\"tns:callPagamS2SResponse\" />\r\n
203
+ \ </wsdl:message>\r\n <wsdl:message name=\"callDeleteS2SSoapIn\">\r\n <wsdl:part
204
+ name=\"parameters\" element=\"tns:callDeleteS2S\" />\r\n </wsdl:message>\r\n
205
+ \ <wsdl:message name=\"callDeleteS2SSoapOut\">\r\n <wsdl:part name=\"parameters\"
206
+ element=\"tns:callDeleteS2SResponse\" />\r\n </wsdl:message>\r\n <wsdl:message
207
+ name=\"callSettleS2SSoapIn\">\r\n <wsdl:part name=\"parameters\" element=\"tns:callSettleS2S\"
208
+ />\r\n </wsdl:message>\r\n <wsdl:message name=\"callSettleS2SSoapOut\">\r\n
209
+ \ <wsdl:part name=\"parameters\" element=\"tns:callSettleS2SResponse\" />\r\n
210
+ \ </wsdl:message>\r\n <wsdl:message name=\"callVerifycardS2SSoapIn\">\r\n
211
+ \ <wsdl:part name=\"parameters\" element=\"tns:callVerifycardS2S\" />\r\n
212
+ \ </wsdl:message>\r\n <wsdl:message name=\"callVerifycardS2SSoapOut\">\r\n
213
+ \ <wsdl:part name=\"parameters\" element=\"tns:callVerifycardS2SResponse\"
214
+ />\r\n </wsdl:message>\r\n <wsdl:message name=\"callCheckCartaS2SSoapIn\">\r\n
215
+ \ <wsdl:part name=\"parameters\" element=\"tns:callCheckCartaS2S\" />\r\n
216
+ \ </wsdl:message>\r\n <wsdl:message name=\"callCheckCartaS2SSoapOut\">\r\n
217
+ \ <wsdl:part name=\"parameters\" element=\"tns:callCheckCartaS2SResponse\"
218
+ />\r\n </wsdl:message>\r\n <wsdl:message name=\"callRenounceSoapIn\">\r\n
219
+ \ <wsdl:part name=\"parameters\" element=\"tns:callRenounce\" />\r\n </wsdl:message>\r\n
220
+ \ <wsdl:message name=\"callRenounceSoapOut\">\r\n <wsdl:part name=\"parameters\"
221
+ element=\"tns:callRenounceResponse\" />\r\n </wsdl:message>\r\n <wsdl:message
222
+ name=\"CallRequestTokenS2SSoapIn\">\r\n <wsdl:part name=\"parameters\"
223
+ element=\"tns:CallRequestTokenS2S\" />\r\n </wsdl:message>\r\n <wsdl:message
224
+ name=\"CallRequestTokenS2SSoapOut\">\r\n <wsdl:part name=\"parameters\"
225
+ element=\"tns:CallRequestTokenS2SResponse\" />\r\n </wsdl:message>\r\n <wsdl:message
226
+ name=\"callDeleteTokenS2SSoapIn\">\r\n <wsdl:part name=\"parameters\" element=\"tns:callDeleteTokenS2S\"
227
+ />\r\n </wsdl:message>\r\n <wsdl:message name=\"callDeleteTokenS2SSoapOut\">\r\n
228
+ \ <wsdl:part name=\"parameters\" element=\"tns:callDeleteTokenS2SResponse\"
229
+ />\r\n </wsdl:message>\r\n <wsdl:portType name=\"WSs2sSoap\">\r\n <wsdl:operation
230
+ name=\"callRefundS2S\">\r\n <wsdl:input message=\"tns:callRefundS2SSoapIn\"
231
+ />\r\n <wsdl:output message=\"tns:callRefundS2SSoapOut\" />\r\n </wsdl:operation>\r\n
232
+ \ <wsdl:operation name=\"callReadTrxS2S\">\r\n <wsdl:input message=\"tns:callReadTrxS2SSoapIn\"
233
+ />\r\n <wsdl:output message=\"tns:callReadTrxS2SSoapOut\" />\r\n </wsdl:operation>\r\n
234
+ \ <wsdl:operation name=\"callPagamS2S\">\r\n <wsdl:input message=\"tns:callPagamS2SSoapIn\"
235
+ />\r\n <wsdl:output message=\"tns:callPagamS2SSoapOut\" />\r\n </wsdl:operation>\r\n
236
+ \ <wsdl:operation name=\"callDeleteS2S\">\r\n <wsdl:input message=\"tns:callDeleteS2SSoapIn\"
237
+ />\r\n <wsdl:output message=\"tns:callDeleteS2SSoapOut\" />\r\n </wsdl:operation>\r\n
238
+ \ <wsdl:operation name=\"callSettleS2S\">\r\n <wsdl:input message=\"tns:callSettleS2SSoapIn\"
239
+ />\r\n <wsdl:output message=\"tns:callSettleS2SSoapOut\" />\r\n </wsdl:operation>\r\n
240
+ \ <wsdl:operation name=\"callVerifycardS2S\">\r\n <wsdl:input message=\"tns:callVerifycardS2SSoapIn\"
241
+ />\r\n <wsdl:output message=\"tns:callVerifycardS2SSoapOut\" />\r\n </wsdl:operation>\r\n
242
+ \ <wsdl:operation name=\"callCheckCartaS2S\">\r\n <wsdl:input message=\"tns:callCheckCartaS2SSoapIn\"
243
+ />\r\n <wsdl:output message=\"tns:callCheckCartaS2SSoapOut\" />\r\n </wsdl:operation>\r\n
244
+ \ <wsdl:operation name=\"callRenounce\">\r\n <wsdl:input message=\"tns:callRenounceSoapIn\"
245
+ />\r\n <wsdl:output message=\"tns:callRenounceSoapOut\" />\r\n </wsdl:operation>\r\n
246
+ \ <wsdl:operation name=\"CallRequestTokenS2S\">\r\n <wsdl:input message=\"tns:CallRequestTokenS2SSoapIn\"
247
+ />\r\n <wsdl:output message=\"tns:CallRequestTokenS2SSoapOut\" />\r\n
248
+ \ </wsdl:operation>\r\n <wsdl:operation name=\"callDeleteTokenS2S\">\r\n
249
+ \ <wsdl:input message=\"tns:callDeleteTokenS2SSoapIn\" />\r\n <wsdl:output
250
+ message=\"tns:callDeleteTokenS2SSoapOut\" />\r\n </wsdl:operation>\r\n
251
+ \ </wsdl:portType>\r\n <wsdl:binding name=\"WSs2sSoap\" type=\"tns:WSs2sSoap\">\r\n
252
+ \ <soap:binding transport=\"http://schemas.xmlsoap.org/soap/http\" />\r\n
253
+ \ <wsdl:operation name=\"callRefundS2S\">\r\n <soap:operation soapAction=\"https://ecomms2s.sella.it/callRefundS2S\"
254
+ style=\"document\" />\r\n <wsdl:input>\r\n <soap:body use=\"literal\"
255
+ />\r\n </wsdl:input>\r\n <wsdl:output>\r\n <soap:body use=\"literal\"
256
+ />\r\n </wsdl:output>\r\n </wsdl:operation>\r\n <wsdl:operation
257
+ name=\"callReadTrxS2S\">\r\n <soap:operation soapAction=\"https://ecomms2s.sella.it/callReadTrxS2S\"
258
+ style=\"document\" />\r\n <wsdl:input>\r\n <soap:body use=\"literal\"
259
+ />\r\n </wsdl:input>\r\n <wsdl:output>\r\n <soap:body use=\"literal\"
260
+ />\r\n </wsdl:output>\r\n </wsdl:operation>\r\n <wsdl:operation
261
+ name=\"callPagamS2S\">\r\n <soap:operation soapAction=\"https://ecomms2s.sella.it/callPagamS2S\"
262
+ style=\"document\" />\r\n <wsdl:input>\r\n <soap:body use=\"literal\"
263
+ />\r\n </wsdl:input>\r\n <wsdl:output>\r\n <soap:body use=\"literal\"
264
+ />\r\n </wsdl:output>\r\n </wsdl:operation>\r\n <wsdl:operation
265
+ name=\"callDeleteS2S\">\r\n <soap:operation soapAction=\"https://ecomms2s.sella.it/callDeleteS2S\"
266
+ style=\"document\" />\r\n <wsdl:input>\r\n <soap:body use=\"literal\"
267
+ />\r\n </wsdl:input>\r\n <wsdl:output>\r\n <soap:body use=\"literal\"
268
+ />\r\n </wsdl:output>\r\n </wsdl:operation>\r\n <wsdl:operation
269
+ name=\"callSettleS2S\">\r\n <soap:operation soapAction=\"https://ecomms2s.sella.it/callSettleS2S\"
270
+ style=\"document\" />\r\n <wsdl:input>\r\n <soap:body use=\"literal\"
271
+ />\r\n </wsdl:input>\r\n <wsdl:output>\r\n <soap:body use=\"literal\"
272
+ />\r\n </wsdl:output>\r\n </wsdl:operation>\r\n <wsdl:operation
273
+ name=\"callVerifycardS2S\">\r\n <soap:operation soapAction=\"https://ecomms2s.sella.it/callVerifycardS2S\"
274
+ style=\"document\" />\r\n <wsdl:input>\r\n <soap:body use=\"literal\"
275
+ />\r\n </wsdl:input>\r\n <wsdl:output>\r\n <soap:body use=\"literal\"
276
+ />\r\n </wsdl:output>\r\n </wsdl:operation>\r\n <wsdl:operation
277
+ name=\"callCheckCartaS2S\">\r\n <soap:operation soapAction=\"https://ecomms2s.sella.it/callCheckCartaS2S\"
278
+ style=\"document\" />\r\n <wsdl:input>\r\n <soap:body use=\"literal\"
279
+ />\r\n </wsdl:input>\r\n <wsdl:output>\r\n <soap:body use=\"literal\"
280
+ />\r\n </wsdl:output>\r\n </wsdl:operation>\r\n <wsdl:operation
281
+ name=\"callRenounce\">\r\n <soap:operation soapAction=\"https://ecomms2s.sella.it/callRenounce\"
282
+ style=\"document\" />\r\n <wsdl:input>\r\n <soap:body use=\"literal\"
283
+ />\r\n </wsdl:input>\r\n <wsdl:output>\r\n <soap:body use=\"literal\"
284
+ />\r\n </wsdl:output>\r\n </wsdl:operation>\r\n <wsdl:operation
285
+ name=\"CallRequestTokenS2S\">\r\n <soap:operation soapAction=\"https://ecomms2s.sella.it/CallRequestTokenS2S\"
286
+ style=\"document\" />\r\n <wsdl:input>\r\n <soap:body use=\"literal\"
287
+ />\r\n </wsdl:input>\r\n <wsdl:output>\r\n <soap:body use=\"literal\"
288
+ />\r\n </wsdl:output>\r\n </wsdl:operation>\r\n <wsdl:operation
289
+ name=\"callDeleteTokenS2S\">\r\n <soap:operation soapAction=\"https://ecomms2s.sella.it/callDeleteTokenS2S\"
290
+ style=\"document\" />\r\n <wsdl:input>\r\n <soap:body use=\"literal\"
291
+ />\r\n </wsdl:input>\r\n <wsdl:output>\r\n <soap:body use=\"literal\"
292
+ />\r\n </wsdl:output>\r\n </wsdl:operation>\r\n </wsdl:binding>\r\n
293
+ \ <wsdl:binding name=\"WSs2sSoap12\" type=\"tns:WSs2sSoap\">\r\n <soap12:binding
294
+ transport=\"http://schemas.xmlsoap.org/soap/http\" />\r\n <wsdl:operation
295
+ name=\"callRefundS2S\">\r\n <soap12:operation soapAction=\"https://ecomms2s.sella.it/callRefundS2S\"
296
+ style=\"document\" />\r\n <wsdl:input>\r\n <soap12:body use=\"literal\"
297
+ />\r\n </wsdl:input>\r\n <wsdl:output>\r\n <soap12:body use=\"literal\"
298
+ />\r\n </wsdl:output>\r\n </wsdl:operation>\r\n <wsdl:operation
299
+ name=\"callReadTrxS2S\">\r\n <soap12:operation soapAction=\"https://ecomms2s.sella.it/callReadTrxS2S\"
300
+ style=\"document\" />\r\n <wsdl:input>\r\n <soap12:body use=\"literal\"
301
+ />\r\n </wsdl:input>\r\n <wsdl:output>\r\n <soap12:body use=\"literal\"
302
+ />\r\n </wsdl:output>\r\n </wsdl:operation>\r\n <wsdl:operation
303
+ name=\"callPagamS2S\">\r\n <soap12:operation soapAction=\"https://ecomms2s.sella.it/callPagamS2S\"
304
+ style=\"document\" />\r\n <wsdl:input>\r\n <soap12:body use=\"literal\"
305
+ />\r\n </wsdl:input>\r\n <wsdl:output>\r\n <soap12:body use=\"literal\"
306
+ />\r\n </wsdl:output>\r\n </wsdl:operation>\r\n <wsdl:operation
307
+ name=\"callDeleteS2S\">\r\n <soap12:operation soapAction=\"https://ecomms2s.sella.it/callDeleteS2S\"
308
+ style=\"document\" />\r\n <wsdl:input>\r\n <soap12:body use=\"literal\"
309
+ />\r\n </wsdl:input>\r\n <wsdl:output>\r\n <soap12:body use=\"literal\"
310
+ />\r\n </wsdl:output>\r\n </wsdl:operation>\r\n <wsdl:operation
311
+ name=\"callSettleS2S\">\r\n <soap12:operation soapAction=\"https://ecomms2s.sella.it/callSettleS2S\"
312
+ style=\"document\" />\r\n <wsdl:input>\r\n <soap12:body use=\"literal\"
313
+ />\r\n </wsdl:input>\r\n <wsdl:output>\r\n <soap12:body use=\"literal\"
314
+ />\r\n </wsdl:output>\r\n </wsdl:operation>\r\n <wsdl:operation
315
+ name=\"callVerifycardS2S\">\r\n <soap12:operation soapAction=\"https://ecomms2s.sella.it/callVerifycardS2S\"
316
+ style=\"document\" />\r\n <wsdl:input>\r\n <soap12:body use=\"literal\"
317
+ />\r\n </wsdl:input>\r\n <wsdl:output>\r\n <soap12:body use=\"literal\"
318
+ />\r\n </wsdl:output>\r\n </wsdl:operation>\r\n <wsdl:operation
319
+ name=\"callCheckCartaS2S\">\r\n <soap12:operation soapAction=\"https://ecomms2s.sella.it/callCheckCartaS2S\"
320
+ style=\"document\" />\r\n <wsdl:input>\r\n <soap12:body use=\"literal\"
321
+ />\r\n </wsdl:input>\r\n <wsdl:output>\r\n <soap12:body use=\"literal\"
322
+ />\r\n </wsdl:output>\r\n </wsdl:operation>\r\n <wsdl:operation
323
+ name=\"callRenounce\">\r\n <soap12:operation soapAction=\"https://ecomms2s.sella.it/callRenounce\"
324
+ style=\"document\" />\r\n <wsdl:input>\r\n <soap12:body use=\"literal\"
325
+ />\r\n </wsdl:input>\r\n <wsdl:output>\r\n <soap12:body use=\"literal\"
326
+ />\r\n </wsdl:output>\r\n </wsdl:operation>\r\n <wsdl:operation
327
+ name=\"CallRequestTokenS2S\">\r\n <soap12:operation soapAction=\"https://ecomms2s.sella.it/CallRequestTokenS2S\"
328
+ style=\"document\" />\r\n <wsdl:input>\r\n <soap12:body use=\"literal\"
329
+ />\r\n </wsdl:input>\r\n <wsdl:output>\r\n <soap12:body use=\"literal\"
330
+ />\r\n </wsdl:output>\r\n </wsdl:operation>\r\n <wsdl:operation
331
+ name=\"callDeleteTokenS2S\">\r\n <soap12:operation soapAction=\"https://ecomms2s.sella.it/callDeleteTokenS2S\"
332
+ style=\"document\" />\r\n <wsdl:input>\r\n <soap12:body use=\"literal\"
333
+ />\r\n </wsdl:input>\r\n <wsdl:output>\r\n <soap12:body use=\"literal\"
334
+ />\r\n </wsdl:output>\r\n </wsdl:operation>\r\n </wsdl:binding>\r\n
335
+ \ <wsdl:service name=\"WSs2s\">\r\n <wsdl:port name=\"WSs2sSoap\" binding=\"tns:WSs2sSoap\">\r\n
336
+ \ <soap:address location=\"https://testecomm.sella.it/gestpay/gestpayws/WSs2s.asmx\"
337
+ />\r\n </wsdl:port>\r\n <wsdl:port name=\"WSs2sSoap12\" binding=\"tns:WSs2sSoap12\">\r\n
338
+ \ <soap12:address location=\"https://testecomm.sella.it/gestpay/gestpayws/WSs2s.asmx\"
339
+ />\r\n </wsdl:port>\r\n </wsdl:service>\r\n</wsdl:definitions>"
340
+ http_version:
341
+ recorded_at: Tue, 21 May 2013 11:53:21 GMT
342
+ - request:
343
+ method: post
344
+ uri: https://testecomm.sella.it/gestpay/gestpayws/WSs2s.asmx
345
+ body:
346
+ encoding: UTF-8
347
+ string: <?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
348
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="https://ecomms2s.sella.it/"
349
+ xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Body><tns:CallRequestTokenS2S><tns:shopLogin>GESPAY12345</tns:shopLogin><tns:cardNumber>4556541926187165</tns:cardNumber><tns:expiryMonth>12</tns:expiryMonth><tns:expiryYear>20</tns:expiryYear><tns:cvv>123</tns:cvv><tns:requestToken>MASKEDPAN</tns:requestToken><tns:withAuth>0</tns:withAuth></tns:CallRequestTokenS2S></env:Body></env:Envelope>
350
+ headers:
351
+ Soapaction:
352
+ - '"https://ecomms2s.sella.it/CallRequestTokenS2S"'
353
+ Content-Type:
354
+ - text/xml;charset=UTF-8
355
+ Content-Length:
356
+ - '592'
357
+ Accept-Encoding:
358
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
359
+ Accept:
360
+ - '*/*'
361
+ User-Agent:
362
+ - Ruby
363
+ response:
364
+ status:
365
+ code: 200
366
+ message: OK
367
+ headers:
368
+ Date:
369
+ - Tue, 21 May 2013 11:53:24 GMT
370
+ Server:
371
+ - Microsoft-IIS/6.0
372
+ P3p:
373
+ - CP="ALL IND"
374
+ X-Powered-By:
375
+ - ASP.NET
376
+ X-Aspnet-Version:
377
+ - 4.0.30319
378
+ Set-Cookie:
379
+ - ASP.NET_SessionId=wlimyvwlud3ei21beenaueul; path=/; HttpOnly
380
+ Cache-Control:
381
+ - private, max-age=0
382
+ Content-Type:
383
+ - text/xml; charset=utf-8
384
+ Content-Length:
385
+ - '1646'
386
+ body:
387
+ encoding: UTF-8
388
+ string: <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
389
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><CallRequestTokenS2SResponse
390
+ xmlns="https://ecomms2s.sella.it/"><CallRequestTokenS2SResult><GestPayS2S
391
+ xmlns=""><TransactionType>REQUESTTOKEN</TransactionType><TransactionResult>OK</TransactionResult><TransactionErrorCode>0</TransactionErrorCode><TransactionErrorDescription>Transazione
392
+ correttamente effettuata</TransactionErrorDescription><AuthorizationErrorCode></AuthorizationErrorCode><AuthorizationResult></AuthorizationResult><AuthorizationCodeDescription></AuthorizationCodeDescription><CardCountry><![CDATA[SPAGNA]]></CardCountry><CardCountryCode>724</CardCountryCode><CheckCVV>OK</CheckCVV><CheckCVVDescription>CVV
393
+ VALID</CheckCVVDescription><IssuerCountry><![CDATA[SPAGNA]]></IssuerCountry><IssuerCountryCode>724</IssuerCountryCode><CompanyDescription><![CDATA[VISA]]></CompanyDescription><CompanyCode>1</CompanyCode><Commercial>N</Commercial><ProductDescription><![CDATA[Visa
394
+ Classic]]></ProductDescription><ProductType>Credit</ProductType><CheckDigit>OK</CheckDigit><CheckDigitDescription>CheckDigit
395
+ VALID</CheckDigitDescription><CheckDate>OK</CheckDate><CheckDateDescription>DATE
396
+ VALID</CheckDateDescription><EnrolledCode>Y</EnrolledCode><EnrolledDescription>ENROLLED</EnrolledDescription><Prepaid></Prepaid><Token>45OGBX64451Y7165</Token><TokenExpiryMonth>12</TokenExpiryMonth><TokenExpiryYear>20</TokenExpiryYear></GestPayS2S></CallRequestTokenS2SResult></CallRequestTokenS2SResponse></soap:Body></soap:Envelope>
397
+ http_version:
398
+ recorded_at: Tue, 21 May 2013 11:53:24 GMT
399
+ recorded_with: VCR 2.4.0
@@ -0,0 +1,72 @@
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::Digest do
6
+
7
+ let(:digest) { Gestpay::Digest.new }
8
+
9
+ after do
10
+ VCR.eject_cassette
11
+ end
12
+
13
+ describe '#encrypt' do
14
+ let(:result) { digest.encrypt(hash) }
15
+
16
+ context "with an ok data hash" do
17
+ before { VCR.insert_cassette 'encrypt_ok', :record => :new_episodes }
18
+ let(:hash) do
19
+ {
20
+ :uic_code => '242',
21
+ :amount => '0.01',
22
+ :shop_transaction_id => '123',
23
+ :language_id => '1',
24
+ :buyer_name => "Test Customer",
25
+ :buyer_email => "test@example.com"
26
+ }
27
+ end
28
+
29
+ it 'should return a Result object' do
30
+ result.should respond_to(:success?)
31
+ end
32
+
33
+ it "should return a Result with a token" do
34
+ result.should be_success
35
+ result.encrypted_string.should == 'i3eUhxjb5HNxldtVSXb4qxaYva_uWKNn6BSQgRXkBUWKjoQvU6IbNgocbJYSr2LZ3FdnsvnpXH8KQ1*lizVn5LmWYMmN7JA0wMpuURkqftlBYPdjzXMmOomRrUenCF1JzE0j1ugNdSIbY7rrrUVxYAtjdvkKmyKrtLOiDuTohJsWaWGuIH4y_KUUa5cWcY3Oqz8eSjVfiWr8RUeAYCVmeA'
36
+ end
37
+ end
38
+
39
+ context "with a wrong data hash" do
40
+ before { VCR.insert_cassette 'encrypt_ko', :record => :new_episodes }
41
+ let(:hash) { Hash.new }
42
+
43
+ it "should raise an error" do
44
+ result.should_not be_success
45
+ end
46
+ end
47
+ end
48
+
49
+ describe '#decrypt' do
50
+ context "with an ok transaction" do
51
+ before { VCR.insert_cassette 'decrypt_ok', :record => :new_episodes }
52
+ it "should return an ok envelope" do
53
+ result = digest.decrypt('rxd4jKk3CN8PbPX7gHh9u60ocD8_R85bI0NR_C*SOk1r1y2P8E9fDBgXKmmMnyyhyosyF8X6rvyTs_GCulPAy8TZKJc99tSb57cAWuo36MZ9_OWp2pwgKYLx7jS9XaLBgAqBufiFIoPq*Pwj5SdHY06vUf3ebnKryDvRnC0oldLw1YxpkIxlebYd7YxvNfSGLfSvce2NN8wWcwPfdR2jPKb*_oJpCEVZNO5TVMaH6h1UONEksNLIuDeZPqWfrHRcgbi0MLuoifb7ZBGrTw7HlEqfF6ojKt2oihKtNdn3Y3W5MkBHCsBrWq63TLYlDU8PRaV20jAdqQIJBHopVyumMGtyLoHlMFaH*nXUvgzwmYnTtwQZ*Q1nGCP0cl4YilBcivSTJCOkcrRwUhqYOl*4F1kmT15Nkp_sBB4oJRODYs8')
54
+ result.should be_success
55
+ result.data[:buyer].should == {:buyer_name=>"Test Customer", :buyer_email=>"test@example.com"}
56
+ result.data[:transaction_result].should == 'OK'
57
+ result.data[:shop_transaction_id].should == '123'
58
+ end
59
+ end
60
+
61
+ context "with a failed transaction" do
62
+ before { VCR.insert_cassette 'decrypt_ko', :record => :new_episodes }
63
+ it "should return a ko envelope" do
64
+ string = 'KFzOej9MGr*lXEe*LOB2wzLmHja3ghKAo3iMpR1pG35moFdejWKzAj1Zd*R_e0x8qyOSTQmZVGRXEzJMVzd9xRXS*7tkbQLPOuBZ7qAtoFsX2Fxks5HxY*3YsUeiOInUXNF7*ih1bzkwmYGchDqYnEi31rN8ZYwLHnjwMIEmWJNn7oJHE6RpfUHG*7qohDxZRto*VVTPFdM93CwECq7SdYLebAQ_9EefdcE90QCRcFdGxZp_yAr_t*YRgLcZ5B5j843krtjCvf_m8nS99CroJQ768XsvlXy29McM2G*369mTufGyGMRab5PIvJlpSd3ds6mGi1IoMJAyXVkCu_ygRDDXN5Fk4Hz58LrDIci4ZszyVRcqy56SeYV7eG*kG8LZV40WV2ey8Qeh8XDUZnCV3A'
65
+ result = digest.decrypt(string)
66
+ result.should_not be_success
67
+ result.error.should == "Error 74: Autorizzazione negata"
68
+ end
69
+ end
70
+ end
71
+
72
+ end