wirecard_giropay 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/wirecard_giropay.rb +1 -0
- data/lib/wirecard_giropay/notification_response.rb +32 -0
- data/lib/wirecard_giropay/version.rb +1 -1
- data/spec/lib/wirecard_giropay/notification_response_spec.rb +41 -0
- data/spec/support/sample_notification_rejection.xml +62 -0
- data/spec/support/sample_notification_success.xml +3 -3
- metadata +8 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 225732a648e032ef8f62b9c295eeff6fa9ee2930
|
4
|
+
data.tar.gz: 9a214f120130a257dc492e7d06cc149dff9fe264
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ed0fc184113b1132cae1934635c08f798833148e8c8175618e8d92ac6f67a84a1a84a70773efdfb0a2962b0f9c0d8e7aec5b01bc28f8750af481179ee1a0388
|
7
|
+
data.tar.gz: 05462c3ec17f7697746a91aa6db37580774852559f6f12991d86143df506d14544d079788988409dbd7c098e14a38c40bc8266f9ae88d0974633d872e47db670
|
data/lib/wirecard_giropay.rb
CHANGED
@@ -0,0 +1,32 @@
|
|
1
|
+
module WirecardGiropay
|
2
|
+
class NotificationResponse
|
3
|
+
|
4
|
+
def initialize(xml)
|
5
|
+
@xml = xml
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.from_xml(xml)
|
9
|
+
new xml
|
10
|
+
end
|
11
|
+
|
12
|
+
def success?
|
13
|
+
status_code == 'O10'
|
14
|
+
end
|
15
|
+
|
16
|
+
def failed?
|
17
|
+
status_code == 'O30'
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def status_code
|
23
|
+
@status_code ||= xml_doc.xpath('//Notification/ReferenceStatusCode').text
|
24
|
+
end
|
25
|
+
|
26
|
+
def xml_doc
|
27
|
+
@xml_doc ||= Nokogiri::XML @xml
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module WirecardGiropay
|
4
|
+
describe NotificationResponse do
|
5
|
+
|
6
|
+
def read_sample_file(file)
|
7
|
+
File.read File.expand_path('../../../support/' + file, __FILE__)
|
8
|
+
end
|
9
|
+
|
10
|
+
let(:notification_success_xml) { read_sample_file 'sample_notification_success.xml' }
|
11
|
+
let(:notification_reject_xml) { read_sample_file 'sample_notification_rejection.xml' }
|
12
|
+
|
13
|
+
describe '#success?' do
|
14
|
+
context 'for a successful payment' do
|
15
|
+
let(:response) { NotificationResponse.from_xml notification_success_xml }
|
16
|
+
|
17
|
+
it('returns true') { expect(response.success?).to eq true }
|
18
|
+
end
|
19
|
+
|
20
|
+
context 'for a rejected payment' do
|
21
|
+
let(:response) { NotificationResponse.from_xml notification_reject_xml }
|
22
|
+
|
23
|
+
it('returns false') { expect(response.success?).to eq false }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe '#failed?' do
|
28
|
+
context 'for a rejected payment' do
|
29
|
+
let(:response) { NotificationResponse.from_xml notification_reject_xml }
|
30
|
+
|
31
|
+
it('returns true') { expect(response.failed?).to eq true }
|
32
|
+
end
|
33
|
+
|
34
|
+
context 'for a successful payment' do
|
35
|
+
let(:response) { NotificationResponse.from_xml notification_success_xml }
|
36
|
+
|
37
|
+
it('returns false') { expect(response.failed?).to eq false }
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<Notification>
|
3
|
+
<BusinessCaseSignature>000000316D073C58</BusinessCaseSignature>
|
4
|
+
<ReferenceJobID />
|
5
|
+
<ReferenceFunctionID />
|
6
|
+
<ReferenceTransactionID>720109</ReferenceTransactionID>
|
7
|
+
<ReferenceNotificationUrl>https://www.betterplace.org/de/wirecard_giropay/720109/notification</ReferenceNotificationUrl>
|
8
|
+
<ReferenceAlternateNotificationUrl>mailto:developers@betterplace.org</ReferenceAlternateNotificationUrl>
|
9
|
+
<ReferenceDescriptor>2A0HC00PXU Spende via betterplace.org Skateistan Afghanistan</ReferenceDescriptor>
|
10
|
+
<Amount>2300</Amount>
|
11
|
+
<Currency>EUR</Currency>
|
12
|
+
<ConfirmationTimeStamp>2015-04-27T11:52:12.154+02:00</ConfirmationTimeStamp>
|
13
|
+
<ReferenceStatusCode>O30</ReferenceStatusCode>
|
14
|
+
<ReferenceStatusMessage>REJECTED</ReferenceStatusMessage>
|
15
|
+
<ReferenceReasonCode>O3080</ReferenceReasonCode>
|
16
|
+
<ReferenceReasonMessage>Cancelled by account holder.</ReferenceReasonMessage>
|
17
|
+
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
|
18
|
+
<SignedInfo>
|
19
|
+
<CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" />
|
20
|
+
<SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
|
21
|
+
<Reference URI="">
|
22
|
+
<Transforms>
|
23
|
+
<Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
|
24
|
+
</Transforms>
|
25
|
+
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
|
26
|
+
<DigestValue>uFfGXZIRCpijPOwfmf+aDwKcjfY=</DigestValue>
|
27
|
+
</Reference>
|
28
|
+
</SignedInfo>
|
29
|
+
<SignatureValue>PI6QDZO66sfihQ0QCWaWRymUh2c7XCQ9cnuHsFYfolhEpdEow9GoJ/Q/iDBxJG0LfaH5gY0rlWRJ
|
30
|
+
v7n/UTyN6fpNdOVGLlHdluYEC7JJGd8XcJSjNY29E2DR7IgJ2EtwzMv0shloESUPYqskXrCHmIn7
|
31
|
+
tqn6PrkQqIUKd1JqIX72Mm2zw4+t5H1Twosp0IAi2aQ5hz0GjJkSq72KLDdSnum4LH3+d4J55A9g
|
32
|
+
XieDHI4ut/Gv6zftqJpRCOe/rAGeTNMTDGslpn74XofhDkRK8VCd6OXnxXpDmCjQr5IUOmmIDbVz
|
33
|
+
ifafAcy2lK+xrvBfo48d1qMVDSrm2ATil9vI+A==</SignatureValue>
|
34
|
+
<KeyInfo>
|
35
|
+
<X509Data>
|
36
|
+
<X509SubjectName>CN=sign.wirecard.com, OU=IT, O=Wirecard AG, L=Grasbrunn, ST=Bavaria, C=DE</X509SubjectName>
|
37
|
+
<X509Certificate>MIIEsjCCBBugAwIBAgIQWvgqwPeheleU/MmlO31IPTANBgkqhkiG9w0BAQUFADCBujEfMB0GA1UE
|
38
|
+
ChMWVmVyaVNpZ24gVHJ1c3QgTmV0d29yazEXMBUGA1UECxMOVmVyaVNpZ24sIEluYy4xMzAxBgNV
|
39
|
+
BAsTKlZlcmlTaWduIEludGVybmF0aW9uYWwgU2VydmVyIENBIC0gQ2xhc3MgMzFJMEcGA1UECxNA
|
40
|
+
d3d3LnZlcmlzaWduLmNvbS9DUFMgSW5jb3JwLmJ5IFJlZi4gTElBQklMSVRZIExURC4oYyk5NyBW
|
41
|
+
ZXJpU2lnbjAeFw0wOTAzMzEwMDAwMDBaFw0xMTAzMzEyMzU5NTlaMHIxCzAJBgNVBAYTAkRFMRAw
|
42
|
+
DgYDVQQIEwdCYXZhcmlhMRIwEAYDVQQHFAlHcmFzYnJ1bm4xFDASBgNVBAoUC1dpcmVjYXJkIEFH
|
43
|
+
MQswCQYDVQQLFAJJVDEaMBgGA1UEAxQRc2lnbi53aXJlY2FyZC5jb20wggEiMA0GCSqGSIb3DQEB
|
44
|
+
AQUAA4IBDwAwggEKAoIBAQDBFZJr2limXRIWmK515WXCSBnFnb4mkwGag5i3xXfoI5L7hbCFwk6o
|
45
|
+
Hdzb8r3+LnYXcpcCgs7A0PFyJiEM7DSu57KPSN64HjBgSisxZAL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1deXt</X509Certificate>
|
59
|
+
</X509Data>
|
60
|
+
</KeyInfo>
|
61
|
+
</Signature>
|
62
|
+
</Notification>
|
@@ -1,8 +1,8 @@
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
2
|
<Notification>
|
3
3
|
<BusinessCaseSignature>9490000000ABC</BusinessCaseSignature>
|
4
|
-
<ReferenceJobID
|
5
|
-
<ReferenceFunctionID
|
4
|
+
<ReferenceJobID>JN7d31b875-1e9d-4383-a4c6-f4645d7b32b8</ReferenceJobID>
|
5
|
+
<ReferenceFunctionID>FN7d31b875-1e9d-4383-a4c6-f4645d7b32b8</ReferenceFunctionID>
|
6
6
|
<ReferenceTransactionID>7d31b875-1e9d-4383-a4c6-f4645d7b32b8</ReferenceTransactionID>
|
7
7
|
<ReferenceNotificationUrl>https://www.merchant.com/notification</ReferenceNotificationUrl>
|
8
8
|
<ReferenceAlternateNotificationUrl>mailto:notification@merchant.com</ReferenceAlternateNotificationUrl>
|
@@ -67,4 +67,4 @@
|
|
67
67
|
</X509Data>
|
68
68
|
</KeyInfo>
|
69
69
|
</Signature>
|
70
|
-
</Notification>
|
70
|
+
</Notification>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wirecard_giropay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- betterplace developers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|
@@ -123,16 +123,19 @@ files:
|
|
123
123
|
- Rakefile
|
124
124
|
- lib/wirecard_giropay.rb
|
125
125
|
- lib/wirecard_giropay/gateway.rb
|
126
|
+
- lib/wirecard_giropay/notification_response.rb
|
126
127
|
- lib/wirecard_giropay/request.rb
|
127
128
|
- lib/wirecard_giropay/response.rb
|
128
129
|
- lib/wirecard_giropay/testing.rb
|
129
130
|
- lib/wirecard_giropay/version.rb
|
130
131
|
- spec/lib/wirecard_giropay/gateway_spec.rb
|
132
|
+
- spec/lib/wirecard_giropay/notification_response_spec.rb
|
131
133
|
- spec/lib/wirecard_giropay/request_spec.rb
|
132
134
|
- spec/lib/wirecard_giropay/response_spec.rb
|
133
135
|
- spec/lib/wirecard_giropay_spec.rb
|
134
136
|
- spec/spec_helper.rb
|
135
137
|
- spec/support/redirect.html
|
138
|
+
- spec/support/sample_notification_rejection.xml
|
136
139
|
- spec/support/sample_notification_success.xml
|
137
140
|
- spec/support/sample_redirect.html
|
138
141
|
- spec/support/sample_request.xml
|
@@ -161,17 +164,19 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
161
164
|
version: '0'
|
162
165
|
requirements: []
|
163
166
|
rubyforge_project:
|
164
|
-
rubygems_version: 2.
|
167
|
+
rubygems_version: 2.4.5
|
165
168
|
signing_key:
|
166
169
|
specification_version: 4
|
167
170
|
summary: Wirecard Giropay implementation
|
168
171
|
test_files:
|
169
172
|
- spec/lib/wirecard_giropay/gateway_spec.rb
|
173
|
+
- spec/lib/wirecard_giropay/notification_response_spec.rb
|
170
174
|
- spec/lib/wirecard_giropay/request_spec.rb
|
171
175
|
- spec/lib/wirecard_giropay/response_spec.rb
|
172
176
|
- spec/lib/wirecard_giropay_spec.rb
|
173
177
|
- spec/spec_helper.rb
|
174
178
|
- spec/support/redirect.html
|
179
|
+
- spec/support/sample_notification_rejection.xml
|
175
180
|
- spec/support/sample_notification_success.xml
|
176
181
|
- spec/support/sample_redirect.html
|
177
182
|
- spec/support/sample_request.xml
|