wirecard_giropay 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 809c1924ee7e7b65a6203f9d508ae59d6b780ba9
4
+ data.tar.gz: d473555a20da047ef9ec7e487d6a07d8ac587534
5
+ SHA512:
6
+ metadata.gz: ec16618ab7ef97ce84086dd674d62d4e0d553d51dce141d7c1187aefb82d9cda92a76b6e45d2af9d6ef8b02e4fefee4f9a35a3be86319c1928376a1c38961c6d
7
+ data.tar.gz: 2b3cd50b343011cf29187e1fa3f1b221aec3cfe280618465a6835143218b3898e3e4f1751c994cb93adead9f067534d6699d441cc9e30a97a0b3375aa612440a
@@ -0,0 +1,15 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
15
+ .idea
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in wirecard_giropay.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Gregory Igelmund
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,31 @@
1
+ # Wirecard Giropay
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'wirecard_giropay'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install wirecard_giropay
20
+
21
+ ## Usage
22
+
23
+ TODO: Write usage instructions here
24
+
25
+ ## Contributing
26
+
27
+ 1. Fork it ( https://github.com/[my-github-username]/bancard/fork )
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
30
+ 4. Push to the branch (`git push origin my-new-feature`)
31
+ 5. Create a new Pull Request
@@ -0,0 +1,14 @@
1
+ require 'bundler/gem_tasks'
2
+
3
+ require 'rspec/core/rake_task'
4
+ RSpec::Core::RakeTask.new(:spec)
5
+ task default: :spec
6
+
7
+ desc 'Open an irb session preloaded with this library'
8
+ task :console do
9
+ require 'irb'
10
+ require 'irb/completion'
11
+ require 'wirecard_giropay'
12
+ ARGV.clear
13
+ IRB.start
14
+ end
@@ -0,0 +1,27 @@
1
+ require 'nokogiri'
2
+ require 'typhoeus'
3
+ require 'wirecard_giropay/version'
4
+ require 'wirecard_giropay/request'
5
+ require 'wirecard_giropay/response'
6
+ require 'wirecard_giropay/gateway'
7
+
8
+ module WirecardGiropay
9
+ SANDBOX_URL = 'https://c3-test.wirecard.com/secure/ssl-gateway'
10
+ LIVE_URL = 'https://c3.wirecard.com/secure/ssl-gateway'
11
+
12
+ def self.sandbox!
13
+ @sandboxed = true
14
+ end
15
+
16
+ def self.sandboxed?
17
+ !!@sandboxed
18
+ end
19
+
20
+ def self.gateway_url
21
+ sandboxed? ? SANDBOX_URL : LIVE_URL
22
+ end
23
+
24
+ def self.sandbox_credentials
25
+ '00000031556BEEC6:TestXAPTER'
26
+ end
27
+ end
@@ -0,0 +1,23 @@
1
+ module WirecardGiropay
2
+ class Gateway
3
+ attr_reader :business_case_signature, :username, :password
4
+
5
+ def initialize(opts = {})
6
+ @business_case_signature = opts.fetch(:business_case_signature)
7
+ @username = opts.fetch(:username)
8
+ @password = opts.fetch(:password)
9
+ end
10
+
11
+ def online_wire(params)
12
+ request = Request.new params.merge(business_case_signature: business_case_signature)
13
+ response = Typhoeus.post(WirecardGiropay.gateway_url, body: request.to_xml, userpwd: http_auth_credentials)
14
+ Response.from_xml response.body
15
+ end
16
+
17
+ private
18
+
19
+ def http_auth_credentials
20
+ WirecardGiropay.sandboxed? ? WirecardGiropay.sandbox_credentials : [username, password].join(':')
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,51 @@
1
+ module WirecardGiropay
2
+ class Request
3
+ TEMPLATE_PATH = File.expand_path('../../../templates/request.xml', __FILE__)
4
+
5
+ class InvalidParamsError < StandardError; end
6
+
7
+ PARAMS = %i(business_case_signature transaction_id first_name last_name account_number bank_code
8
+ country amount_in_cents currency usage success_redirect_url failure_redirect_url redirect_window_name
9
+ notification_url alternate_notification_url order_data
10
+ )
11
+
12
+ def initialize(given_params = {})
13
+ @given_params = given_params
14
+ missing_params = PARAMS.select { |k,v| !given_params.has_key? k }
15
+ raise InvalidParamsError.new("Missing parameters: #{missing_params}") if missing_params.count > 0
16
+
17
+ order_data = given_params[:order_data]
18
+ raise InvalidParamsError.new("Parameter 'order_data' must be a Hash.") if order_data and !order_data.is_a?(Hash)
19
+ end
20
+
21
+ def to_xml
22
+ xml_template = File.read TEMPLATE_PATH
23
+ xml_template.gsub /%\{\w+\}/, replace_params
24
+ end
25
+
26
+ def run
27
+ Response.from_xml Typhoeus.post(WirecardGiropay.gateway_url, body: to_xml).body
28
+ end
29
+
30
+ private
31
+
32
+ def replace_params
33
+ rep_params = {}
34
+ @given_params.each { |key, value| rep_params["%{#{key}}"] = value }
35
+ rep_params['%{order_data}'] = order_data_xml
36
+ rep_params['%{transaction_mode}'] = transaction_mode
37
+ rep_params
38
+ end
39
+
40
+ def order_data_xml
41
+ return '' unless @given_params[:order_data]
42
+ orders = '<ORDER_DATA>'
43
+ @given_params[:order_data].each { |key, parameter| orders << "<Parameter name=\"#{key}\">#{parameter}</Parameter>" }
44
+ orders << '</ORDER_DATA>'
45
+ end
46
+
47
+ def transaction_mode
48
+ WirecardGiropay.sandboxed? ? 'demo' : 'live'
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,73 @@
1
+ module WirecardGiropay
2
+ class Response
3
+
4
+ def initialize(xml)
5
+ @xml = xml
6
+ end
7
+
8
+ def self.from_xml(xml)
9
+ new xml
10
+ end
11
+
12
+ # Implements the ActiveMerchant interface
13
+ def params
14
+ {
15
+ success: success?,
16
+ redirect_html: redirect_html,
17
+ status_code: status_code,
18
+ reason_code: reason_code,
19
+ guwid: guwid,
20
+ original_xml_response: @xml
21
+ }
22
+ end
23
+
24
+ # Implements the ActiveMerchant interface
25
+ def message
26
+ end
27
+
28
+ # Implements the ActiveMerchant interface
29
+ def success?
30
+ status_code == 'O20'
31
+ end
32
+
33
+ def redirect_html
34
+ return '' unless success?
35
+ template_html = File.read File.expand_path('../../../templates/redirect.html', __FILE__)
36
+ template_html.gsub /%\{\w+\}/, replace_params
37
+ end
38
+
39
+ def status_code
40
+ xml_doc.xpath('//PROCESSING_STATUS/StatusCode').text
41
+ end
42
+
43
+ def reason_code
44
+ xml_doc.xpath('//PROCESSING_STATUS/ReasonCode').text
45
+ end
46
+
47
+ def guwid
48
+ xml_doc.xpath('//PROCESSING_STATUS/GuWID').text
49
+ end
50
+
51
+ def redirect_url
52
+ xml_doc.xpath('//REDIRECT_BANK_DATA/Url').text
53
+ end
54
+
55
+ def redirect_params
56
+ xml_doc.xpath('//REDIRECT_BANK_DATA/Parameters').text
57
+ end
58
+
59
+ private
60
+
61
+ def replace_params
62
+ {
63
+ '%{redirect_url}' => redirect_url,
64
+ '%{redirect_params}' => redirect_params
65
+ }
66
+ end
67
+
68
+ def xml_doc
69
+ @xml_doc ||= Nokogiri::XML @xml
70
+ end
71
+
72
+ end
73
+ end
@@ -0,0 +1,3 @@
1
+ module WirecardGiropay
2
+ VERSION = '0.0.1'
3
+ end
@@ -0,0 +1,58 @@
1
+ require 'spec_helper'
2
+
3
+ module WirecardGiropay
4
+ describe Gateway do
5
+ def read_sample_file(file)
6
+ File.read File.expand_path('../../../support/' + file, __FILE__)
7
+ end
8
+
9
+ let(:success_xml) { read_sample_file 'sample_response_success.xml' }
10
+ let(:failure_xml) { read_sample_file 'sample_response_failure.xml' }
11
+
12
+ let(:online_wire_params) do
13
+ {
14
+ transaction_id: 'TNR45122001',
15
+ first_name: 'John F',
16
+ last_name: 'Doe',
17
+ account_number: '12345678',
18
+ bank_code: '30020900',
19
+ country: 'DE',
20
+ amount_in_cents: '500',
21
+ currency: 'EUR',
22
+ usage: 'OrderNo-FT345S71 Thank you',
23
+ success_redirect_url: 'https://www.merchant.com/payment?result=success',
24
+ failure_redirect_url: 'https://www.merchant.com/payment?result=failure',
25
+ redirect_window_name: 'Payment Result',
26
+ notification_url: 'https://www.merchant.com/notification',
27
+ alternate_notification_url: 'mailto:notification@merchant.com',
28
+ order_data: {
29
+ 'key-1' => 'Project X',
30
+ 'key-2' => 'Organisation Y',
31
+ },
32
+ }
33
+ end
34
+
35
+ let(:gateway_opts) do
36
+ {
37
+ business_case_signature: '9490000000ABC',
38
+ username: 'foo',
39
+ password: 'bar'
40
+ }
41
+ end
42
+
43
+ let(:gateway) { Gateway.new(gateway_opts) }
44
+
45
+ describe '#online_wire' do
46
+ before do
47
+ response = Typhoeus::Response.new(code: 200, body: success_xml)
48
+ Typhoeus.stub(WirecardGiropay.gateway_url).and_return(response)
49
+ end
50
+
51
+ it 'returns a successful response' do
52
+ response = gateway.online_wire(online_wire_params)
53
+ expect(response).to be_a Response
54
+ end
55
+
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,41 @@
1
+ require 'spec_helper'
2
+
3
+ module WirecardGiropay
4
+ describe Request do
5
+ describe '#initialize' do
6
+ it 'throws an Error on missing params' do
7
+ expect{ Request.new(first_name: 'John') }.to raise_error(Request::InvalidParamsError)
8
+ end
9
+ end
10
+
11
+ describe '#to_xml' do
12
+ it 'gives the right xml' do
13
+ params = {
14
+ business_case_signature: '0000003162752CAC',
15
+ transaction_id: 'TNR45122001',
16
+ first_name: 'John F',
17
+ last_name: 'Doe',
18
+ account_number: '12345678',
19
+ bank_code: '30020900',
20
+ country: 'DE',
21
+ amount_in_cents: '500',
22
+ currency: 'EUR',
23
+ usage: 'OrderNo-FT345S71 Thank you',
24
+ success_redirect_url: 'https://www.merchant.com/payment?result=success',
25
+ failure_redirect_url: 'https://www.merchant.com/payment?result=failure',
26
+ redirect_window_name: 'Payment Result',
27
+ notification_url: 'https://www.merchant.com/notification',
28
+ alternate_notification_url: 'mailto:notification@merchant.com',
29
+ order_data: {
30
+ 'key-1' => 'Project X',
31
+ 'key-2' => 'Organisation Y',
32
+ },
33
+ }
34
+
35
+ req = Request.new params
36
+ expected_xml = File.read File.expand_path('../../../support/sample_request.xml', __FILE__)
37
+ expect(req.to_xml).to eq expected_xml
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,39 @@
1
+ require 'spec_helper'
2
+
3
+ module WirecardGiropay
4
+ describe Response do
5
+
6
+ def read_sample_file(file)
7
+ File.read File.expand_path('../../../support/' + file, __FILE__)
8
+ end
9
+
10
+ let(:success_xml) { read_sample_file 'sample_response_success.xml' }
11
+ let(:failure_xml) { read_sample_file 'sample_response_failure.xml' }
12
+ let(:redirect_html) { read_sample_file 'sample_redirect.html' }
13
+ let(:success_response) { Response.from_xml success_xml }
14
+ let(:failure_response) { Response.from_xml failure_xml }
15
+
16
+ describe '#params' do
17
+ context 'for a success response' do
18
+ let(:params) { success_response.params }
19
+
20
+ it('params[:success] returns true') { expect(params[:success]).to eq true }
21
+ it('params[:redirect_html] returns the right html') { expect(params[:redirect_html]).to eq redirect_html }
22
+ it('params[:status_code] returns O20') { expect(params[:status_code]).to eq 'O20' }
23
+ it('params[:reason_code] returns O2010') { expect(params[:reason_code]).to eq 'O2010' }
24
+ it('params[:guwid] returns the correct guwid') { expect(params[:guwid]).to eq 'F815887120947517965048' }
25
+ end
26
+
27
+ context 'for a failure response' do
28
+ let(:params) { failure_response.params }
29
+
30
+ it('params[:success] returns false') { expect(params[:success]).to eq false }
31
+ it('params[:redirect_html] returns ""') { expect(params[:redirect_html]).to eq '' }
32
+ it('params[:status_code] returns O30') { expect(params[:status_code]).to eq 'O30' }
33
+ it('params[:reason_code] returns O3050') { expect(params[:reason_code]).to eq 'O3050' }
34
+ it('params[:guwid] returns the correct guwid') { expect(params[:guwid]).to eq 'F815207120947498218406' }
35
+ end
36
+ end
37
+
38
+ end
39
+ end
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'WirecardGiropay' do
4
+ describe '.gateway_url' do
5
+ it 'returns the live system url' do
6
+ expect(WirecardGiropay.gateway_url).to eq 'https://c3.wirecard.com/secure/ssl-gateway'
7
+ end
8
+ end
9
+
10
+ context 'when running in sandbox mode' do
11
+ before { WirecardGiropay.sandbox! }
12
+
13
+ it 'returns the live system url' do
14
+ expect(WirecardGiropay.gateway_url).to eq 'https://c3-test.wirecard.com/secure/ssl-gateway'
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,23 @@
1
+ require 'simplecov'
2
+ require 'byebug'
3
+
4
+ SimpleCov.adapters.define 'gem' do
5
+ add_filter '/spec/'
6
+ add_filter '/autotest/'
7
+ add_group 'Libraries', '/lib/'
8
+ end
9
+ SimpleCov.start 'gem'
10
+
11
+ require 'wirecard_giropay'
12
+
13
+ RSpec.configure do |config|
14
+ # config.before do
15
+ # Bancard.test = true
16
+ # end
17
+ #
18
+ # config.before(:all) do
19
+ # body = { status: :success, process_id: 'lx6niQel0QzWK1g' }
20
+ # response = Typhoeus::Response.new(code: 200, body: body.to_json, headers: { 'Location' => 'payment-url' })
21
+ # Typhoeus.stub(/vpos/).and_return(response)
22
+ # end
23
+ end
@@ -0,0 +1,7 @@
1
+ <html>
2
+ <body onload="document.forms[0].submit();">
3
+ <form name="downloadForm" action="https://giropaytest1.fiducia.de/ShopSystem/bank/BankEntry" method="post">
4
+ <input type="hidden" name="redirectData" value="operatorId=002&merchantId=8993370&txId=F000004CHL&merchantTxId=1234567893&customerBankBLZ=44448888&shopEndSuccessURL=https%3A%2F%2Fgiropaytest1.fiducia.de%2FShopSystem%2Fstatic%2Fdone.html&shopEndFailureURL=https%3A%2F%2Fgiropaytest1.fiducia.de%2FShopSystem%2Fstatic%2Ffailure.html&beneficiaryName1=wirecard-Testshop&beneficiaryName2=&beneficiaryAcctNo=1234567890&beneficiaryBankBLZ=44448888&amount=100&currency=EUR&paymentPurposeLine1=wirecard&paymentPurposeLine2=GIROPAY0028993370F000004CHL&txInfos=label1%3Dtext1%26label2%3Dtext2&operatorSignature=PSVPKNxI7qEy6%2BX%2B5qG2sx6sbbbJAzpvYBXRuSyXlvUPe3HjW6FjHO8qbQZu2wzFryt%2B5KKUtDVuiAKMyOfpr2zXz4aYVTzAXITPiplw9wafR2eoCAJkwHpLw6zxn%2FY64BEg%2BSegZQ1Cfjp%2FMZ5Kn4soD4Sr6ukINl%2BrJrRhtxU%3D"/>
5
+ </form>
6
+ </body>
7
+ </html>
@@ -0,0 +1,70 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Notification>
3
+ <BusinessCaseSignature>9490000000ABC</BusinessCaseSignature>
4
+ <ReferenceJobID >JN7d31b875-1e9d-4383-a4c6-f4645d7b32b8</ReferenceJobID>
5
+ <ReferenceFunctionID >FN7d31b875-1e9d-4383-a4c6-f4645d7b32b8</ReferenceFunctionID>
6
+ <ReferenceTransactionID>7d31b875-1e9d-4383-a4c6-f4645d7b32b8</ReferenceTransactionID>
7
+ <ReferenceNotificationUrl>https://www.merchant.com/notification</ReferenceNotificationUrl>
8
+ <ReferenceAlternateNotificationUrl>mailto:notification@merchant.com</ReferenceAlternateNotificationUrl>
9
+ <ReferenceDescriptor>JLUH0BFSBS FT345S71</ReferenceDescriptor>
10
+ <Amount>1500</Amount>
11
+ <Currency>EUR</Currency>
12
+ <ConfirmationTimeStamp>2009-04-23T18:04:14.187+02:00</ConfirmationTimeStamp>
13
+ <ReferenceStatusCode>O10</ReferenceStatusCode>
14
+ <ReferenceStatusMessage>SUCCESS</ReferenceStatusMessage>
15
+ <ReferenceReasonCode>O1010</ReferenceReasonCode>
16
+ <ReferenceReasonMessage>Transaction completed successfully.</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><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#envelope-signature" /></Transforms>
23
+ <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
24
+ <DigestValue>Ad9M2sOBmZVFq7hG5LByiergA2E=</DigestValue>
25
+ </Reference>
26
+ </SignedInfo>
27
+ <SignatureValue>
28
+ TrP+dM0KmDaduQjcfsHnnfnBWkPC1fEqWGVQB/67zogormdhpMfyedTRkW76bEtJpa06
29
+ jlQp/aE96MxTlWkDnaX02Ffly34mRBE30GOeJFnoWQH/u+XWDgO44AlK+R6jwjIv+CzF
30
+ 8fLYNhuAtUSr6oIePB7KlinxNGJlho83h4klauln4keIApWnXIJ/pzvYttFqkDBrfMsq
31
+ KM2b5kblW77VVKUT1e/qkGe/8NUT96DcJnPgAXwCxDEQZhEe3+HkFmAq8Q/hfRYnjLV2
32
+ /6VYcGv4I0KQgf/EW5Ebcrz2lI33CHJGB4Ysae/mS3TCsyBkeBIojAqA/Qp6pfSjNcir
33
+ EQ==
34
+ </SignatureValue>
35
+ <KeyInfo>
36
+ <X509Data>
37
+ <X509SubjectName>CN=sign-test.wirecard.com, OU=IT, O=Wirecard AG, L=Grasbrunn, ST=Bavaria, C=DE</X509SubjectName>
38
+ <X509Certificate>
39
+ MIIEtzCCBCCgAwIBAgIQEd3bxwQDSylc+wWNRyWRfzANBgkqhkiG9w0BAQUFAD
40
+ CBujEfMB0GA1UEChMWVmVyaVNpZ24gVHJ1c3QgTmV0d29yazEXMBUGA1UECxMO
41
+ VmVyaVNpZ24sIEluYy4xMzAxBgNVBAsTKlZlcmlTaWduIEludGVybmF0aW9uYW
42
+ wgU2VydmVyIENBIC0gQ2xhc3MgMzFJMEcGA1UECxNAd3d3LnZlcmlzaWduLmNv
43
+ bS9DUFMgSW5jb3JwLmJ5IFJlZi4gTElBQklMSVRZIExURC4oYyk5NyBWZXJpU2
44
+ lnbjAeFw0wOTAzMzEwMDAwMDBaFw0xMTAzMzEyMzU5NTlaMHcxCzAJBgNVBAYT
45
+ AkRFMRAwDgYDVQQIEwdCYXZhcmlhMRIwEAYDVQQHFAlHcmFzYnJ1bm4xFDASBg
46
+ NVBAoUC1dpcmVjYXJkIEFHMQswCQYDVQQLFAJJVDEfMB0GA1UEAxQWc2lnbi10
47
+ ZXN0LndpcmVjYXJkLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCgg
48
+ EBAKivwjliJv9ZJdUyI0M4SNcM+4dQa6szGGonml8fJP9oEHYAFw2sU7JDpoHw
49
+ rdiPxzgWXGBkZ8Pq/Nsdr6hesWTm+ORNG2Tq0Na/6y3vIQaXqFWSMHKSpNu+cv
50
+ XJh9N0Qg8QvKVcNJDLrqK83RE0CHrJJy6+7wlKujuHnGtjxz4UjcBxk4IYYUm6
51
+ L+hOsVP9rAzLz3MBv74B4NBa+iJ9EdYzpu0qA28kyikUnvU4gEZZDYCE0YTwkO
52
+ gtwCOols6PAISb2VleE80VJd6Fr5ZY5DN7oMXsdCz/tuhPhS9h7M3tqqiBazvj
53
+ NLoJm0gNvXzZjk+SA3XNrpa7Bt/KymDX/58CAwEAAaOCAXowggF2MAkGA1UdEw
54
+ QCMAAwCwYDVR0PBAQDAgWgMEYGA1UdHwQ/MD0wO6A5oDeGNWh0dHA6Ly9jcmwu
55
+ dmVyaXNpZ24uY29tL0NsYXNzM0ludGVybmF0aW9uYWxTZXJ2ZXIuY3JsMEQGA1
56
+ UdIAQ9MDswOQYLYIZIAYb4RQEHFwMwKjAoBggrBgEFBQcCARYcaHR0cHM6Ly93
57
+ d3cudmVyaXNpZ24uY29tL3JwYTAoBgNVHSUEITAfBglghkgBhvhCBAEGCCsGAQ
58
+ UFBwMBBggrBgEFBQcDAjA0BggrBgEFBQcBAQQoMCYwJAYIKwYBBQUHMAGGGGh0
59
+ dHA6Ly9vY3NwLnZlcmlzaWduLmNvbTBuBggrBgEFBQcBDARiMGChXqBcMFowWD
60
+ BWFglpbWFnZS9naWYwITAfMAcGBSsOAwIaBBRLa7kolgYMu9BSOJsprEsHiyEF
61
+ GDAmFiRodHRwOi8vbG9nby52ZXJpc2lnbi5jb20vdnNsb2dvMS5naWYwDQYJKo
62
+ ZIhvcNAQEFBQADgYEAaKgUBvSJ3tSJkbLt25yd/kRvp3okcr5fzrbm7b0rYC34
63
+ 3KAs91QVaKD4MbqrLgxXfbnouEUULmgLt4CLTFRs9rWr/99ZekEjMxHeVIWeAs
64
+ 8Vd6hTOuIUsZzPO+/D5QM2dLumNoFDkrxb/zqW8Nt+ibPWJAb+1IHD27EiiFpb
65
+ E50=
66
+ </X509Certificate>
67
+ </X509Data>
68
+ </KeyInfo>
69
+ </Signature>
70
+ </Notification>
@@ -0,0 +1,7 @@
1
+ <html>
2
+ <body onload="document.forms[0].submit();">
3
+ <form name="downloadForm" action="https://www.bank.com/onlinebanking" method="post">
4
+ <input type="hidden" name="redirectData" value="operatorId=001&merchantId=1232323&txId=32132323&merchantTxId=434343143"/>
5
+ </form>
6
+ </body>
7
+ </html>
@@ -0,0 +1,35 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <WIRECARD_BXML xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">
3
+ <W_REQUEST>
4
+ <W_JOB>
5
+ <BusinessCaseSignature>0000003162752CAC</BusinessCaseSignature>
6
+ <JobID></JobID>
7
+ <FNC_FT_ONLINEWIRE>
8
+ <FunctionID></FunctionID>
9
+ <FT_TRANSACTION mode="live">
10
+ <TransactionID>TNR45122001</TransactionID>
11
+ <EXTERNAL_ACCOUNT>
12
+ <FirstName>John F</FirstName>
13
+ <LastName>Doe</LastName>
14
+ <AccountNumber>12345678</AccountNumber>
15
+ <BankCode>30020900</BankCode>
16
+ <Country>DE</Country>
17
+ </EXTERNAL_ACCOUNT>
18
+
19
+ <Amount minorunits="2">500</Amount>
20
+ <Currency>EUR</Currency>
21
+ <Usage>OrderNo-FT345S71 Thank you</Usage>
22
+
23
+ <MERCHANT_DATA>
24
+ <SuccessRedirectUrl>https://www.merchant.com/payment?result=success</SuccessRedirectUrl>
25
+ <FailureRedirectUrl>https://www.merchant.com/payment?result=failure</FailureRedirectUrl>
26
+ <RedirectWindowName>Payment Result</RedirectWindowName>
27
+ <NotificationUrl>https://www.merchant.com/notification</NotificationUrl>
28
+ <AlternateNotificationUrl>mailto:notification@merchant.com</AlternateNotificationUrl>
29
+ </MERCHANT_DATA>
30
+ <ORDER_DATA><Parameter name="key-1">Project X</Parameter><Parameter name="key-2">Organisation Y</Parameter></ORDER_DATA>
31
+ </FT_TRANSACTION>
32
+ </FNC_FT_ONLINEWIRE>
33
+ </W_JOB>
34
+ </W_REQUEST>
35
+ </WIRECARD_BXML>
@@ -0,0 +1,26 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <WIRECARD_BXML xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">
3
+ <W_RESPONSE>
4
+ <W_JOB>
5
+ <JobID>JN001</JobID>
6
+ <FNC_FT_ONLINEWIRE>
7
+ <FunctionID>FN001</FunctionID>
8
+ <FT_TRANSACTION mode="live">
9
+ <TransactionID>TNR45122001</TransactionID>
10
+ <PROCESSING_STATUS>
11
+ <FunctionResult>NOK</FunctionResult>
12
+ <GuWID>F815207120947498218406</GuWID>
13
+ <TimeStamp>2008-04-29 13:16:22</TimeStamp>
14
+ <StatusCode>O30</StatusCode>
15
+ <ReasonCode>O3050</ReasonCode>
16
+ <DETAIL>
17
+ <ReturnCode>30353</ReturnCode>
18
+ <Message>Account validation failed.</Message>
19
+ <Advice>Please verify the account.</Advice>
20
+ </DETAIL>
21
+ </PROCESSING_STATUS>
22
+ </FT_TRANSACTION>
23
+ </FNC_FT_ONLINEWIRE>
24
+ </W_JOB>
25
+ </W_RESPONSE>
26
+ </WIRECARD_BXML>
@@ -0,0 +1,26 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <WIRECARD_BXML xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">
3
+ <W_RESPONSE>
4
+ <W_JOB>
5
+ <JobID>JN001</JobID>
6
+ <FNC_FT_ONLINEWIRE>
7
+ <FunctionID>FN001</FunctionID>
8
+ <FT_TRANSACTION mode="live">
9
+ <TransactionID>TNR45122001</TransactionID>
10
+ <PROCESSING_STATUS>
11
+ <FunctionResult>PENDING</FunctionResult>
12
+ <GuWID>F815887120947517965048</GuWID>
13
+ <ReferenceID>0800119720441</ReferenceID>
14
+ <TimeStamp>2008-04-29 13:19:39</TimeStamp>
15
+ <StatusCode>O20</StatusCode>
16
+ <ReasonCode>O2010</ReasonCode>
17
+ </PROCESSING_STATUS>
18
+ <REDIRECT_BANK_DATA>
19
+ <Url>https://www.bank.com/onlinebanking</Url>
20
+ <Parameters>operatorId=001&amp;merchantId=1232323&amp;txId=32132323&amp;merchantTxId=434343143</Parameters>
21
+ </REDIRECT_BANK_DATA>
22
+ </FT_TRANSACTION>
23
+ </FNC_FT_ONLINEWIRE>
24
+ </W_JOB>
25
+ </W_RESPONSE>
26
+ </WIRECARD_BXML>
@@ -0,0 +1,7 @@
1
+ <html>
2
+ <body onload="document.forms[0].submit();">
3
+ <form name="downloadForm" action="%{redirect_url}" method="post">
4
+ <input type="hidden" name="redirectData" value="%{redirect_params}"/>
5
+ </form>
6
+ </body>
7
+ </html>
@@ -0,0 +1,35 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <WIRECARD_BXML xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">
3
+ <W_REQUEST>
4
+ <W_JOB>
5
+ <BusinessCaseSignature>%{business_case_signature}</BusinessCaseSignature>
6
+ <JobID></JobID>
7
+ <FNC_FT_ONLINEWIRE>
8
+ <FunctionID></FunctionID>
9
+ <FT_TRANSACTION mode="%{transaction_mode}">
10
+ <TransactionID>%{transaction_id}</TransactionID>
11
+ <EXTERNAL_ACCOUNT>
12
+ <FirstName>%{first_name}</FirstName>
13
+ <LastName>%{last_name}</LastName>
14
+ <AccountNumber>%{account_number}</AccountNumber>
15
+ <BankCode>%{bank_code}</BankCode>
16
+ <Country>%{country}</Country>
17
+ </EXTERNAL_ACCOUNT>
18
+
19
+ <Amount minorunits="2">%{amount_in_cents}</Amount>
20
+ <Currency>%{currency}</Currency>
21
+ <Usage>%{usage}</Usage>
22
+
23
+ <MERCHANT_DATA>
24
+ <SuccessRedirectUrl>%{success_redirect_url}</SuccessRedirectUrl>
25
+ <FailureRedirectUrl>%{failure_redirect_url}</FailureRedirectUrl>
26
+ <RedirectWindowName>%{redirect_window_name}</RedirectWindowName>
27
+ <NotificationUrl>%{notification_url}</NotificationUrl>
28
+ <AlternateNotificationUrl>%{alternate_notification_url}</AlternateNotificationUrl>
29
+ </MERCHANT_DATA>
30
+ %{order_data}
31
+ </FT_TRANSACTION>
32
+ </FNC_FT_ONLINEWIRE>
33
+ </W_JOB>
34
+ </W_REQUEST>
35
+ </WIRECARD_BXML>
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'wirecard_giropay/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "wirecard_giropay"
8
+ spec.version = WirecardGiropay::VERSION
9
+ spec.authors = ["betterplace developers"]
10
+ spec.email = ["developers@betterplace.org"]
11
+ spec.summary = %q{Wirecard Giropay implementation}
12
+ spec.description = %q{Wirecard Giropay implementation}
13
+ spec.homepage = ""
14
+ spec.license = "APACHE 2.0"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "typhoeus"
22
+ spec.add_dependency "nokogiri"
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.7"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ spec.add_development_dependency "rspec"
27
+ spec.add_development_dependency "byebug"
28
+ spec.add_development_dependency "simplecov"
29
+ end
metadata ADDED
@@ -0,0 +1,178 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: wirecard_giropay
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - betterplace developers
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-11-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: typhoeus
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: nokogiri
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.7'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.7'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: byebug
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: simplecov
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: Wirecard Giropay implementation
112
+ email:
113
+ - developers@betterplace.org
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - ".gitignore"
119
+ - ".rspec"
120
+ - Gemfile
121
+ - LICENSE.txt
122
+ - README.md
123
+ - Rakefile
124
+ - lib/wirecard_giropay.rb
125
+ - lib/wirecard_giropay/gateway.rb
126
+ - lib/wirecard_giropay/request.rb
127
+ - lib/wirecard_giropay/response.rb
128
+ - lib/wirecard_giropay/version.rb
129
+ - spec/lib/wirecard_giropay/gateway_spec.rb
130
+ - spec/lib/wirecard_giropay/request_spec.rb
131
+ - spec/lib/wirecard_giropay/response_spec.rb
132
+ - spec/lib/wirecard_giropay_spec.rb
133
+ - spec/spec_helper.rb
134
+ - spec/support/redirect.html
135
+ - spec/support/sample_notification_success.xml
136
+ - spec/support/sample_redirect.html
137
+ - spec/support/sample_request.xml
138
+ - spec/support/sample_response_failure.xml
139
+ - spec/support/sample_response_success.xml
140
+ - templates/redirect.html
141
+ - templates/request.xml
142
+ - wirecard_giropay.gemspec
143
+ homepage: ''
144
+ licenses:
145
+ - APACHE 2.0
146
+ metadata: {}
147
+ post_install_message:
148
+ rdoc_options: []
149
+ require_paths:
150
+ - lib
151
+ required_ruby_version: !ruby/object:Gem::Requirement
152
+ requirements:
153
+ - - ">="
154
+ - !ruby/object:Gem::Version
155
+ version: '0'
156
+ required_rubygems_version: !ruby/object:Gem::Requirement
157
+ requirements:
158
+ - - ">="
159
+ - !ruby/object:Gem::Version
160
+ version: '0'
161
+ requirements: []
162
+ rubyforge_project:
163
+ rubygems_version: 2.4.4
164
+ signing_key:
165
+ specification_version: 4
166
+ summary: Wirecard Giropay implementation
167
+ test_files:
168
+ - spec/lib/wirecard_giropay/gateway_spec.rb
169
+ - spec/lib/wirecard_giropay/request_spec.rb
170
+ - spec/lib/wirecard_giropay/response_spec.rb
171
+ - spec/lib/wirecard_giropay_spec.rb
172
+ - spec/spec_helper.rb
173
+ - spec/support/redirect.html
174
+ - spec/support/sample_notification_success.xml
175
+ - spec/support/sample_redirect.html
176
+ - spec/support/sample_request.xml
177
+ - spec/support/sample_response_failure.xml
178
+ - spec/support/sample_response_success.xml