pxfusion 0.0.4

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,95 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://sec.paymentexpress.com/PxF/pxf.svc
6
+ body:
7
+ encoding: UTF-8
8
+ string: <?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
9
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://paymentexpress.com"
10
+ xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Body><tns:GetTransactionId><tns:username><USERNAME></tns:username><tns:password><PASSWORD></tns:password><tns:tranDetail><tns:amount>10.00</tns:amount><tns:currency>NZD</tns:currency><tns:returnUrl>https://test.host/</tns:returnUrl><tns:txnRef>1375927419</tns:txnRef><tns:txnType>Purchase</tns:txnType></tns:tranDetail></tns:GetTransactionId></env:Body></env:Envelope>
11
+ headers:
12
+ Soapaction:
13
+ - '"http://paymentexpress.com/IPxFusion/GetTransactionId"'
14
+ Content-Type:
15
+ - text/xml;charset=UTF-8
16
+ Content-Length:
17
+ - '676'
18
+ Accept-Encoding:
19
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
20
+ Accept:
21
+ - '*/*'
22
+ User-Agent:
23
+ - Ruby
24
+ response:
25
+ status:
26
+ code: 200
27
+ message: OK
28
+ headers:
29
+ Server:
30
+ - DPS_PX_SERVER
31
+ Cache-Control:
32
+ - private
33
+ Content-Type:
34
+ - text/xml; charset=utf-8
35
+ Vary:
36
+ - Accept-Encoding
37
+ Date:
38
+ - Thu, 08 Aug 2013 02:03:37 GMT
39
+ Content-Length:
40
+ - '360'
41
+ body:
42
+ encoding: UTF-8
43
+ string: <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><GetTransactionIdResponse
44
+ xmlns="http://paymentexpress.com"><GetTransactionIdResult xmlns:a="http://schemas.datacontract.org/2004/07/"
45
+ xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><a:sessionId>000001001676844154fa9ea9b4760801</a:sessionId><a:success>true</a:success><a:transactionId>000001001676844154fa9ea9b4760801</a:transactionId></GetTransactionIdResult></GetTransactionIdResponse></s:Body></s:Envelope>
46
+ http_version:
47
+ recorded_at: Thu, 08 Aug 2013 02:03:40 GMT
48
+ - request:
49
+ method: post
50
+ uri: https://sec.paymentexpress.com/PxF/pxf.svc
51
+ body:
52
+ encoding: UTF-8
53
+ string: <?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
54
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://paymentexpress.com"
55
+ xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Body><tns:GetTransaction><tns:username><USERNAME></tns:username><tns:password><PASSWORD></tns:password><tns:transactionId>000001001676844154fa9ea9b4760801</tns:transactionId></tns:GetTransaction></env:Body></env:Envelope>
56
+ headers:
57
+ Soapaction:
58
+ - '"http://paymentexpress.com/IPxFusion/GetTransaction"'
59
+ Content-Type:
60
+ - text/xml;charset=UTF-8
61
+ Content-Length:
62
+ - '529'
63
+ Accept-Encoding:
64
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
65
+ Accept:
66
+ - '*/*'
67
+ User-Agent:
68
+ - Ruby
69
+ response:
70
+ status:
71
+ code: 200
72
+ message: OK
73
+ headers:
74
+ Server:
75
+ - DPS_PX_SERVER
76
+ Cache-Control:
77
+ - private
78
+ Content-Type:
79
+ - text/xml; charset=utf-8
80
+ Vary:
81
+ - Accept-Encoding
82
+ Date:
83
+ - Thu, 08 Aug 2013 02:03:37 GMT
84
+ Content-Length:
85
+ - '591'
86
+ body:
87
+ encoding: UTF-8
88
+ string: <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><GetTransactionResponse
89
+ xmlns="http://paymentexpress.com"><GetTransactionResult xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><amount/><authCode/><billingId/><cardHolderName/><cardName/><cardNumber/><cardNumber2/><currencyId/><currencyName/><currencyRate
90
+ i:nil="true"/><cvc2ResultCode/><dateExpiry/><dateSettlement>0001-01-01T00:00:00</dateSettlement><dpsBillingId/><dpsTxnRef/><merchantReference/><responseCode/><responseText/><riskRuleMatches
91
+ xmlns:a="http://schemas.datacontract.org/2004/07/"/><sessionId>000001001676844154fa9ea9b4760801</sessionId><status>6</status><testMode>false</testMode><transactionId>000001001676844154fa9ea9b4760801</transactionId><transactionResultFields
92
+ xmlns:a="http://schemas.datacontract.org/2004/07/"/><txnData1/><txnData2/><txnData3/><txnMac/><txnRef/><txnType/></GetTransactionResult></GetTransactionResponse></s:Body></s:Envelope>
93
+ http_version:
94
+ recorded_at: Thu, 08 Aug 2013 02:03:40 GMT
95
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,48 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://sec.paymentexpress.com/PxF/pxf.svc
6
+ body:
7
+ encoding: UTF-8
8
+ string: <?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
9
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://paymentexpress.com"
10
+ xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Body><tns:GetTransactionId><tns:username><USERNAME></tns:username><tns:password><PASSWORD></tns:password><tns:tranDetail><tns:amount>10.00</tns:amount><tns:currency>NZD</tns:currency><tns:returnUrl>https://test.host/</tns:returnUrl><tns:txnRef>1375927420</tns:txnRef><tns:txnType>Purchase</tns:txnType></tns:tranDetail></tns:GetTransactionId></env:Body></env:Envelope>
11
+ headers:
12
+ Soapaction:
13
+ - '"http://paymentexpress.com/IPxFusion/GetTransactionId"'
14
+ Content-Type:
15
+ - text/xml;charset=UTF-8
16
+ Content-Length:
17
+ - '676'
18
+ Accept-Encoding:
19
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
20
+ Accept:
21
+ - '*/*'
22
+ User-Agent:
23
+ - Ruby
24
+ response:
25
+ status:
26
+ code: 200
27
+ message: OK
28
+ headers:
29
+ Server:
30
+ - DPS_PX_SERVER
31
+ Cache-Control:
32
+ - private
33
+ Content-Type:
34
+ - text/xml; charset=utf-8
35
+ Vary:
36
+ - Accept-Encoding
37
+ Date:
38
+ - Thu, 08 Aug 2013 02:03:38 GMT
39
+ Content-Length:
40
+ - '360'
41
+ body:
42
+ encoding: UTF-8
43
+ string: <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><GetTransactionIdResponse
44
+ xmlns="http://paymentexpress.com"><GetTransactionIdResult xmlns:a="http://schemas.datacontract.org/2004/07/"
45
+ xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><a:sessionId>00000100167684456d1970b4a6f5c501</a:sessionId><a:success>true</a:success><a:transactionId>00000100167684456d1970b4a6f5c501</a:transactionId></GetTransactionIdResult></GetTransactionIdResponse></s:Body></s:Envelope>
46
+ http_version:
47
+ recorded_at: Thu, 08 Aug 2013 02:03:41 GMT
48
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,10 @@
1
+ require "spec_helper"
2
+
3
+ describe PxFusion::Client do
4
+ it { described_class.superclass.should eq Savon::Client }
5
+
6
+ describe ".initialize" do
7
+ subject { described_class.new }
8
+ it { expect(subject.instance_variable_get("@wsdl").document).to eq "#{PxFusion.endpoint}?wsdl" }
9
+ end
10
+ end
@@ -0,0 +1,53 @@
1
+ require "spec_helper"
2
+
3
+ describe PxFusion::Transaction do
4
+ let(:timestamp) { Time.now.to_i }
5
+ let(:complete_transaction_id) { "0000010016327641e4c03879868bd001" }
6
+
7
+ subject(:transaction) { described_class.new(amount: "10.00", reference: timestamp) }
8
+
9
+ describe ".initialize" do
10
+ context "normal attributes passed in" do
11
+ it { transaction.amount.should eq "10.00" }
12
+ it { transaction.reference.should eq timestamp }
13
+ it { transaction.currency.should eq "NZD" }
14
+ end
15
+
16
+ context "missing attributes" do
17
+ it { expect { described_class.new(reference: "Test") }.to raise_error(ArgumentError) }
18
+ end
19
+
20
+ context "overriding globally-configured attributes", :vcr do
21
+ it { described_class.new(amount: "10.00", reference: "12345", currency: "USD").currency.should eq "USD" }
22
+ end
23
+
24
+ context "token billing" do
25
+ it { described_class.new(amount: "10.00", reference: "12345", token_billing: true).token_billing.should be_truthy }
26
+ end
27
+ end
28
+
29
+ describe ".generate_session_id!", :vcr do
30
+ subject { -> { transaction.reference = Time.now.to_i;transaction.generate_session_id! } }
31
+ it { expect { subject.call }.to change(transaction, :session_id) }
32
+ it { expect { subject.call }.to change(transaction, :id) }
33
+ end
34
+
35
+ describe ".fetch" do
36
+ context "transaction is complete", :vcr do
37
+ subject { PxFusion::Transaction.fetch(complete_transaction_id) }
38
+ it { subject.currency.should eq "NZD" }
39
+ it { subject.amount.should eq "1.00" }
40
+ it { subject.status.should eq PxFusion.statuses[:approved] }
41
+ it { subject.response.should_not be_empty }
42
+ end
43
+
44
+ context "transaction is incomplete", :vcr do
45
+ subject { transaction.reference = Time.now.to_i; transaction.generate_session_id! }
46
+ it { expect { PxFusion::Transaction.fetch(subject) }.to raise_error PxFusion::Transaction::NotFound }
47
+ end
48
+
49
+ context "transaction does not exist", :vcr do
50
+ it { expect { PxFusion::Transaction.fetch("1234") }.to raise_error(PxFusion::Transaction::NotFound) }
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,33 @@
1
+ require "spec_helper"
2
+
3
+ describe PxFusion do
4
+ describe "configuration" do
5
+ [:username, :password].each do |attr|
6
+ it { described_class.should respond_to :"#{attr}=" }
7
+ it { expect { described_class.send(:"#{attr}=", nil); described_class.send(attr) }.to raise_error }
8
+ it { expect { described_class.send(attr) }.to_not raise_error }
9
+ end
10
+
11
+ it { described_class.should respond_to :default_currency }
12
+ it { described_class.default_currency.should_not be_blank }
13
+ it { described_class.endpoint.should eq "https://sec.paymentexpress.com/pxf/pxf.svc" }
14
+ it { described_class.form_endpoint.should eq "https://sec.paymentexpress.com/pxmi3/pxfusionauth" }
15
+ it { described_class.should respond_to :default_return_url }
16
+ it { described_class.should respond_to :default_return_url= }
17
+ end
18
+
19
+ describe ".client" do
20
+ it { described_class.client.should be_a PxFusion::Client }
21
+ it { c = described_class.client; described_class.client.should eq c }
22
+ end
23
+
24
+ describe ".statuses" do
25
+ it { described_class.statuses[:approved].should eq 0 }
26
+ it { described_class.statuses[:declined].should eq 1 }
27
+ it { described_class.statuses[:retry].should eq 2 }
28
+ it { described_class.statuses[:invalid_post].should eq 3 }
29
+ it { described_class.statuses[:unknown].should eq 4 }
30
+ it { described_class.statuses[:cancelled].should eq 5 }
31
+ it { described_class.statuses[:not_found].should eq 6 }
32
+ end
33
+ end
@@ -0,0 +1,43 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # Require this file using `require "spec_helper"` to ensure that it is only
4
+ # loaded once.
5
+ #
6
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
7
+ require 'webmock/rspec'
8
+ require 'vcr'
9
+
10
+ VCR.configure do |c|
11
+ c.cassette_library_dir = 'spec/fixtures'
12
+ c.hook_into :webmock
13
+ c.allow_http_connections_when_no_cassette = true
14
+ c.configure_rspec_metadata!
15
+ c.filter_sensitive_data('<USERNAME>') { PxFusion.username }
16
+ c.filter_sensitive_data('<PASSWORD>') { PxFusion.password }
17
+ c.ignore_request do |request|
18
+ URI(request.uri).query == "wsdl"
19
+ end
20
+ end
21
+
22
+ require "pxfusion"
23
+
24
+ RSpec.configure do |config|
25
+ config.treat_symbols_as_metadata_keys_with_true_values = true
26
+ config.run_all_when_everything_filtered = true
27
+ config.filter_run :focus
28
+
29
+ config.before do
30
+ PxFusion.username = "sample"
31
+ PxFusion.password = "sample"
32
+ PxFusion.default_return_url = "http://pxfusion.local/test"
33
+ PxFusion.logging = false
34
+ PxFusion.client
35
+ end
36
+
37
+
38
+ # Run specs in random order to surface order dependencies. If you find an
39
+ # order dependency and want to debug it, you can fix the order by providing
40
+ # the seed, which is printed after each run.
41
+ # --seed 1234
42
+ config.order = 'random'
43
+ end
metadata ADDED
@@ -0,0 +1,171 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pxfusion
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.4
5
+ platform: ruby
6
+ authors:
7
+ - Josh McArthur
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-03-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
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: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: vcr
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: webmock
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: savon
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
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: activesupport
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: A Rubygem for talking to DPS's PxFusion payment product
112
+ email:
113
+ - joshua.mcarthur@gmail.com
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - ".gitignore"
119
+ - ".rspec"
120
+ - ".travis.yml"
121
+ - Gemfile
122
+ - LICENSE
123
+ - README.md
124
+ - Rakefile
125
+ - lib/pxfusion.rb
126
+ - lib/pxfusion/client.rb
127
+ - lib/pxfusion/transaction.rb
128
+ - lib/pxfusion/version.rb
129
+ - pxfusion.gemspec
130
+ - spec/fixtures/PxFusion_Transaction/_fetch/transaction_does_not_exist/.yml
131
+ - spec/fixtures/PxFusion_Transaction/_fetch/transaction_is_complete/.yml
132
+ - spec/fixtures/PxFusion_Transaction/_fetch/transaction_is_incomplete/.yml
133
+ - spec/fixtures/PxFusion_Transaction/_generate_session_id_/.yml
134
+ - spec/pxfusion/client_spec.rb
135
+ - spec/pxfusion/transaction_spec.rb
136
+ - spec/pxfusion_spec.rb
137
+ - spec/spec_helper.rb
138
+ homepage: https://github.com/3months/pxfusion
139
+ licenses:
140
+ - GPL
141
+ metadata: {}
142
+ post_install_message:
143
+ rdoc_options: []
144
+ require_paths:
145
+ - lib
146
+ required_ruby_version: !ruby/object:Gem::Requirement
147
+ requirements:
148
+ - - ">="
149
+ - !ruby/object:Gem::Version
150
+ version: '0'
151
+ required_rubygems_version: !ruby/object:Gem::Requirement
152
+ requirements:
153
+ - - ">="
154
+ - !ruby/object:Gem::Version
155
+ version: '0'
156
+ requirements: []
157
+ rubyforge_project:
158
+ rubygems_version: 2.2.2
159
+ signing_key:
160
+ specification_version: 4
161
+ summary: A Rubygem for talking to DPS's PxFusion payment product
162
+ test_files:
163
+ - spec/fixtures/PxFusion_Transaction/_fetch/transaction_does_not_exist/.yml
164
+ - spec/fixtures/PxFusion_Transaction/_fetch/transaction_is_complete/.yml
165
+ - spec/fixtures/PxFusion_Transaction/_fetch/transaction_is_incomplete/.yml
166
+ - spec/fixtures/PxFusion_Transaction/_generate_session_id_/.yml
167
+ - spec/pxfusion/client_spec.rb
168
+ - spec/pxfusion/transaction_spec.rb
169
+ - spec/pxfusion_spec.rb
170
+ - spec/spec_helper.rb
171
+ has_rdoc: