wirecardmapper 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE DELETED
@@ -1,20 +0,0 @@
1
- Copyright (c) 2010 Alexander Klaiber
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,8 +0,0 @@
1
- class Net::HTTP
2
- alias_method :old_initialize, :initialize
3
- def initialize(*args)
4
- old_initialize(*args)
5
- @ssl_context = OpenSSL::SSL::SSLContext.new
6
- @ssl_context.verify_mode = OpenSSL::SSL::VERIFY_NONE
7
- end
8
- end
@@ -1,43 +0,0 @@
1
- module WirecardMapper
2
- module Xml
3
-
4
- def main_xml
5
- xml = open_xml('main.xml')
6
- if xml
7
- xml.at_css("issuer-request")['mode'] = Config.mode
8
- xml.at_css("request-id").content = request_id
9
- xml.at_css("entity-id").content = Config.entity_id
10
- end
11
- return xml
12
- end
13
-
14
- def sub_xml(name, params)
15
- xml = open_xml(name)
16
- xml.at_css("product-id").content = Config.product_id if xml.at_css("product-id")
17
- params.each do |param, value|
18
- if xml.at_css(param.to_s.gsub(/_/,'-'))
19
- if value.kind_of?(Time)
20
- xml.at_css(param.to_s.gsub(/_/,'-')).content = value.iso8601
21
- else
22
- xml.at_css(param.to_s.gsub(/_/,'-')).content = value
23
- end
24
- end
25
- end
26
- yield xml
27
- end
28
-
29
- private
30
-
31
- def request_id
32
- UUID.generate
33
- end
34
-
35
- def open_xml(file_name)
36
- xml_file = File.open(File.join(Config.templates_path, file_name))
37
- if xml_file
38
- return Nokogiri::XML(xml_file)
39
- end
40
- end
41
-
42
- end
43
- end
@@ -1,58 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'Request' do
4
-
5
- it "should get cardinfo" do
6
- response = WirecardMapper.card_info(:card_id => '47ae07020a010018157db66065da6e5c')
7
- response.ok?.should be_true
8
- response.card_id.should eql('47ae07020a010018157db66065da6e5c')
9
- response.card_number.should eql(5274569796581777)
10
- response.balance.should eql(200)
11
- end
12
-
13
- it "should create card" do
14
- response = WirecardMapper.create_card
15
- response.ok?.should be_true
16
- response.card_id.should_not be_empty
17
- response.card_number.should_not be_nil
18
- response.status_message.should eql('Active card')
19
- response.status_code.should eql('activated')
20
- end
21
-
22
- it "should update card info" do
23
- response = WirecardMapper.update_card_info(:card_id => '47ae07020a010018157db66065da6e5c')
24
- response.ok?.should be_true
25
- response.return_code.to_i.should eql(0)
26
- response.return_message.should eql('Successful system entry.')
27
- end
28
-
29
- it "should submit payment load" do
30
- response = WirecardMapper.submit_payment(:card_id => '47ae07020a010018157db66065da6e5c', :amount => 10, :payment_comment => "Test Comment")
31
- response.ok?.should be_true
32
- response.return_code.to_i.should eql(0)
33
- response.return_message.should eql('Successful system entry.')
34
- end
35
-
36
- it "should submit payment unload" do
37
- response = WirecardMapper.submit_payment(:card_id => '47ae07020a010018157db66065da6e5c', :amount => -10, :payment_comment => "Test Comment")
38
- response.ok?.should be_true
39
- response.return_code.to_i.should eql(0)
40
- response.return_message.should eql('Successful system entry.')
41
- end
42
-
43
- it "should get payment info" do
44
- response = WirecardMapper.payment_info(:card_id => '47ae07020a010018157db66065da6e5c', :from => Time.now - (24 * 3600), :to => Time.now)
45
- response.ok?.should be_true
46
- response.return_code.to_i.should eql(0)
47
- response.return_message.should eql('Successful system entry.')
48
- end
49
-
50
- it "should change card status" do
51
- response = WirecardMapper.change_card_status(:card_id => '47ae07020a010018157db66065da6e5c', :status_code => 'cancelled')
52
- response.ok?.should be_true
53
- response.return_code.to_i.should eql(0)
54
- response.return_message.should eql('Successful system entry.')
55
- end
56
-
57
- end
58
-
@@ -1,7 +0,0 @@
1
- <change-card-status>
2
- <status-code></status-code>
3
- <card-data>
4
- <card-id></card-id>
5
- </card-data>
6
- </change-card-status>
7
-
@@ -1,8 +0,0 @@
1
- <create-card>
2
- <product-data>
3
- <product-id></product-id>
4
- </product-data>
5
- <card-data>
6
- <card-comment>This is a test card</card-comment>
7
- </card-data>
8
- </create-card>
@@ -1,6 +0,0 @@
1
- <get-card-info>
2
- <card-data>
3
- <card-id></card-id>
4
- </card-data>
5
- <card-activity>no</card-activity>
6
- </get-card-info>
@@ -1,11 +0,0 @@
1
- <get-payment-info>
2
- <time-range>
3
- <from></from>
4
- <to></to>
5
- </time-range>
6
- <detail-type>MINIMUM</detail-type>
7
- <card-data>
8
- <card-id></card-id>
9
- </card-data>
10
- </get-payment-info>
11
-
data/templates/main.xml DELETED
@@ -1,7 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <issuer-request mode="live" version="1.0">
3
- <application>
4
- <request-id></request-id>
5
- <entity-id></entity-id>
6
- </application>
7
- </issuer-request>
@@ -1,10 +0,0 @@
1
- <submit-payment>
2
- <payment-data>
3
- <amount currency="EUR"></amount>
4
- <payment-comment>Load for john.doe@abc.com</payment-comment>
5
- </payment-data>
6
- <card-data>
7
- <card-id></card-id>
8
- </card-data>
9
- </submit-payment>
10
-
@@ -1,6 +0,0 @@
1
- <update-card-info>
2
- <card-data>
3
- <card-id></card-id>
4
- </card-data>
5
- </update-card-info>
6
-