netaxept 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -12,6 +12,10 @@ module Netaxept
12
12
  end
13
13
  end
14
14
 
15
+ def terminal_url
16
+ "#{Netaxept::Service.base_uri}/terminal/default.aspx?MerchantID=#{Netaxept::Service.merchant_id}&TransactionID=#{self.transaction_id}"
17
+ end
18
+
15
19
  end # RegisterResponse
16
20
 
17
21
  end # Responses
@@ -8,10 +8,13 @@ module Netaxept
8
8
 
9
9
  module Configuration
10
10
 
11
+ attr_accessor :merchant_id
12
+
11
13
  ##
12
14
  # Stores the merchant id and the token for later requests
13
15
 
14
16
  def authenticate(merchant_id, token)
17
+ self.merchant_id = merchant_id
15
18
  default_params({
16
19
  :MerchantId => merchant_id,
17
20
  :token => token
@@ -1,3 +1,3 @@
1
1
  module Netaxept
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -49,10 +49,68 @@
49
49
  x-powered-by:
50
50
  - ASP.NET
51
51
  date:
52
- - Wed, 03 Aug 2011 12:59:50 GMT
52
+ - Wed, 03 Aug 2011 15:44:01 GMT
53
53
  content-length:
54
54
  - '271'
55
55
  body: ! "<?xml version=\"1.0\"?>\r\n<Exception xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
56
56
  xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\r\n <Error xsi:type=\"ValidationException\">\r\n
57
57
  \ <Message>Transaction amount must be greater than zero.</Message>\r\n </Error>\r\n</Exception>"
58
58
  http_version: '1.1'
59
+ - !ruby/struct:VCR::HTTPInteraction
60
+ request: !ruby/struct:VCR::Request
61
+ method: :get
62
+ uri: https://epayment.bbs.no:443/Netaxept/Register.aspx?CurrencyCode=NOK&MerchantId=123123&token=123test&amount=20100&orderNumber=12&redirectUrl=http%3A%2F%2Flocalhost%3A3000%2Forder%2F1%2Freturn
63
+ body: !!null
64
+ headers: !!null
65
+ response: !ruby/struct:VCR::Response
66
+ status: !ruby/struct:VCR::ResponseStatus
67
+ code: 200
68
+ message: OK
69
+ headers:
70
+ cache-control:
71
+ - private
72
+ content-type:
73
+ - text/xml
74
+ server:
75
+ - Microsoft-IIS/7.5
76
+ x-aspnet-version:
77
+ - 2.0.50727
78
+ x-powered-by:
79
+ - ASP.NET
80
+ date:
81
+ - Wed, 03 Aug 2011 16:22:10 GMT
82
+ content-length:
83
+ - '258'
84
+ body: ! "<?xml version=\"1.0\"?>\r\n<Exception xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
85
+ xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\r\n <Error xsi:type=\"AuthenticationException\">\r\n
86
+ \ <Message>Authentication failed (PROD)</Message>\r\n </Error>\r\n</Exception>"
87
+ http_version: '1.1'
88
+ - !ruby/struct:VCR::HTTPInteraction
89
+ request: !ruby/struct:VCR::Request
90
+ method: :get
91
+ uri: https://epayment.bbs.no:443/Netaxept/Register.aspx?CurrencyCode=NOK&MerchantId=123123&token=123test&amount=0&orderNumber=12&redirectUrl=http%3A%2F%2Flocalhost%3A3000%2Forder%2F1%2Freturn
92
+ body: !!null
93
+ headers: !!null
94
+ response: !ruby/struct:VCR::Response
95
+ status: !ruby/struct:VCR::ResponseStatus
96
+ code: 200
97
+ message: OK
98
+ headers:
99
+ cache-control:
100
+ - private
101
+ content-type:
102
+ - text/xml
103
+ server:
104
+ - Microsoft-IIS/7.5
105
+ x-aspnet-version:
106
+ - 2.0.50727
107
+ x-powered-by:
108
+ - ASP.NET
109
+ date:
110
+ - Wed, 03 Aug 2011 16:22:10 GMT
111
+ content-length:
112
+ - '258'
113
+ body: ! "<?xml version=\"1.0\"?>\r\n<Exception xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
114
+ xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\r\n <Error xsi:type=\"AuthenticationException\">\r\n
115
+ \ <Message>Authentication failed (PROD)</Message>\r\n </Error>\r\n</Exception>"
116
+ http_version: '1.1'
@@ -58,3 +58,177 @@
58
58
  \ <TransactionId>899995942e1e4d43b0c8e0957b4716db</TransactionId>\r\n <ExecutionTime>2011-08-03T15:26:53.5194685+02:00</ExecutionTime>\r\n
59
59
  \ <MerchantId>123123</MerchantId>\r\n</ProcessResponse>"
60
60
  http_version: '1.1'
61
+ - !ruby/struct:VCR::HTTPInteraction
62
+ request: !ruby/struct:VCR::Request
63
+ method: :get
64
+ uri: https://epayment-test.bbs.no:443/Netaxept/Register.aspx?CurrencyCode=NOK&MerchantId=123123&token=test123&amount=20100&orderNumber=12&redirectUrl=http%3A%2F%2Flocalhost%3A3000%2Forder%2F1%2Freturn
65
+ body: !!null
66
+ headers: !!null
67
+ response: !ruby/struct:VCR::Response
68
+ status: !ruby/struct:VCR::ResponseStatus
69
+ code: 200
70
+ message: OK
71
+ headers:
72
+ cache-control:
73
+ - private
74
+ content-type:
75
+ - text/xml
76
+ server:
77
+ - Microsoft-IIS/7.5
78
+ x-aspnet-version:
79
+ - 2.0.50727
80
+ x-powered-by:
81
+ - ASP.NET
82
+ date:
83
+ - Wed, 03 Aug 2011 15:41:34 GMT
84
+ content-length:
85
+ - '258'
86
+ body: ! "<?xml version=\"1.0\"?>\r\n<Exception xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
87
+ xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\r\n <Error xsi:type=\"AuthenticationException\">\r\n
88
+ \ <Message>Authentication failed (Test)</Message>\r\n </Error>\r\n</Exception>"
89
+ http_version: '1.1'
90
+ - !ruby/struct:VCR::HTTPInteraction
91
+ request: !ruby/struct:VCR::Request
92
+ method: :get
93
+ uri: https://epayment-test.bbs.no:443/Netaxept/Process.aspx?CurrencyCode=NOK&MerchantId=123123&token=test123&amount=20100&transactionId=&operation=SALE
94
+ body: !!null
95
+ headers: !!null
96
+ response: !ruby/struct:VCR::Response
97
+ status: !ruby/struct:VCR::ResponseStatus
98
+ code: 200
99
+ message: OK
100
+ headers:
101
+ cache-control:
102
+ - private
103
+ content-type:
104
+ - text/xml
105
+ server:
106
+ - Microsoft-IIS/7.5
107
+ x-aspnet-version:
108
+ - 2.0.50727
109
+ x-powered-by:
110
+ - ASP.NET
111
+ date:
112
+ - Wed, 03 Aug 2011 15:41:34 GMT
113
+ content-length:
114
+ - '258'
115
+ body: ! "<?xml version=\"1.0\"?>\r\n<Exception xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
116
+ xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\r\n <Error xsi:type=\"AuthenticationException\">\r\n
117
+ \ <Message>Authentication failed (Test)</Message>\r\n </Error>\r\n</Exception>"
118
+ http_version: '1.1'
119
+ - !ruby/struct:VCR::HTTPInteraction
120
+ request: !ruby/struct:VCR::Request
121
+ method: :get
122
+ uri: https://epayment-test.bbs.no:443/Netaxept/Register.aspx?CurrencyCode=NOK&MerchantId=411889&token=sC*6Z9p%2B&amount=20100&orderNumber=12&redirectUrl=http%3A%2F%2Flocalhost%3A3000%2Forder%2F1%2Freturn
123
+ body: !!null
124
+ headers: !!null
125
+ response: !ruby/struct:VCR::Response
126
+ status: !ruby/struct:VCR::ResponseStatus
127
+ code: 200
128
+ message: OK
129
+ headers:
130
+ cache-control:
131
+ - private
132
+ content-type:
133
+ - text/xml
134
+ server:
135
+ - Microsoft-IIS/7.5
136
+ x-aspnet-version:
137
+ - 2.0.50727
138
+ x-powered-by:
139
+ - ASP.NET
140
+ date:
141
+ - Wed, 03 Aug 2011 15:44:01 GMT
142
+ content-length:
143
+ - '228'
144
+ body: ! "<?xml version=\"1.0\"?>\r\n<RegisterResponse xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
145
+ xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\r\n <TransactionId>be2173196d1744cf9bf36c92913235c0</TransactionId>\r\n</RegisterResponse>"
146
+ http_version: '1.1'
147
+ - !ruby/struct:VCR::HTTPInteraction
148
+ request: !ruby/struct:VCR::Request
149
+ method: :get
150
+ uri: https://epayment-test.bbs.no:443/Netaxept/Process.aspx?CurrencyCode=NOK&MerchantId=411889&token=sC*6Z9p%2B&amount=20100&transactionId=be2173196d1744cf9bf36c92913235c0&operation=SALE
151
+ body: !!null
152
+ headers: !!null
153
+ response: !ruby/struct:VCR::Response
154
+ status: !ruby/struct:VCR::ResponseStatus
155
+ code: 200
156
+ message: OK
157
+ headers:
158
+ cache-control:
159
+ - private
160
+ content-type:
161
+ - text/xml
162
+ server:
163
+ - Microsoft-IIS/7.5
164
+ x-aspnet-version:
165
+ - 2.0.50727
166
+ x-powered-by:
167
+ - ASP.NET
168
+ date:
169
+ - Wed, 03 Aug 2011 15:44:01 GMT
170
+ content-length:
171
+ - '269'
172
+ body: ! "<?xml version=\"1.0\"?>\r\n<Exception xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
173
+ xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\r\n <Error xsi:type=\"GenericError\">\r\n
174
+ \ <Message>Process setup has not been run on this transaction</Message>\r\n
175
+ \ </Error>\r\n</Exception>"
176
+ http_version: '1.1'
177
+ - !ruby/struct:VCR::HTTPInteraction
178
+ request: !ruby/struct:VCR::Request
179
+ method: :get
180
+ uri: https://epayment.bbs.no:443/Netaxept/Register.aspx?CurrencyCode=NOK&MerchantId=123123&token=123test&amount=20100&orderNumber=12&redirectUrl=http%3A%2F%2Flocalhost%3A3000%2Forder%2F1%2Freturn
181
+ body: !!null
182
+ headers: !!null
183
+ response: !ruby/struct:VCR::Response
184
+ status: !ruby/struct:VCR::ResponseStatus
185
+ code: 200
186
+ message: OK
187
+ headers:
188
+ cache-control:
189
+ - private
190
+ content-type:
191
+ - text/xml
192
+ server:
193
+ - Microsoft-IIS/7.5
194
+ x-aspnet-version:
195
+ - 2.0.50727
196
+ x-powered-by:
197
+ - ASP.NET
198
+ date:
199
+ - Wed, 03 Aug 2011 16:22:12 GMT
200
+ content-length:
201
+ - '258'
202
+ body: ! "<?xml version=\"1.0\"?>\r\n<Exception xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
203
+ xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\r\n <Error xsi:type=\"AuthenticationException\">\r\n
204
+ \ <Message>Authentication failed (PROD)</Message>\r\n </Error>\r\n</Exception>"
205
+ http_version: '1.1'
206
+ - !ruby/struct:VCR::HTTPInteraction
207
+ request: !ruby/struct:VCR::Request
208
+ method: :get
209
+ uri: https://epayment.bbs.no:443/Netaxept/Process.aspx?CurrencyCode=NOK&MerchantId=123123&token=123test&amount=20100&transactionId=&operation=SALE
210
+ body: !!null
211
+ headers: !!null
212
+ response: !ruby/struct:VCR::Response
213
+ status: !ruby/struct:VCR::ResponseStatus
214
+ code: 200
215
+ message: OK
216
+ headers:
217
+ cache-control:
218
+ - private
219
+ content-type:
220
+ - text/xml
221
+ server:
222
+ - Microsoft-IIS/7.5
223
+ x-aspnet-version:
224
+ - 2.0.50727
225
+ x-powered-by:
226
+ - ASP.NET
227
+ date:
228
+ - Wed, 03 Aug 2011 16:22:13 GMT
229
+ content-length:
230
+ - '258'
231
+ body: ! "<?xml version=\"1.0\"?>\r\n<Exception xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
232
+ xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\r\n <Error xsi:type=\"AuthenticationException\">\r\n
233
+ \ <Message>Authentication failed (PROD)</Message>\r\n </Error>\r\n</Exception>"
234
+ http_version: '1.1'
@@ -44,6 +44,15 @@ describe Netaxept::Service do
44
44
  response.transaction_id.should_not be_nil
45
45
  end
46
46
 
47
+ it "has a terminal url" do
48
+ response.terminal_url.should match /^https:\/\/epayment-test\.bbs\.no\/terminal\/default\.aspx\?MerchantID=(.*)&TransactionID=(.*)$/
49
+ end
50
+
51
+ it "has a production terminal url if the environment is production" do
52
+ Netaxept::Service.environment = :production
53
+ response.terminal_url.should match /^https:\/\/epayment\.bbs\.no\/terminal\/default\.aspx\?MerchantID=(.*)&TransactionID=(.*)$/
54
+ Netaxept::Service.environment = :test
55
+ end
47
56
  end
48
57
 
49
58
  describe "a request without error (no money)" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: netaxept
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -14,7 +14,7 @@ default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: httparty
17
- requirement: &2158181140 !ruby/object:Gem::Requirement
17
+ requirement: &2158408740 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ~>
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '0.7'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *2158181140
25
+ version_requirements: *2158408740
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: rspec
28
- requirement: &2158180720 !ruby/object:Gem::Requirement
28
+ requirement: &2158408320 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
- version_requirements: *2158180720
36
+ version_requirements: *2158408320
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: rdoc
39
- requirement: &2158180260 !ruby/object:Gem::Requirement
39
+ requirement: &2158407860 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: '0'
45
45
  type: :development
46
46
  prerelease: false
47
- version_requirements: *2158180260
47
+ version_requirements: *2158407860
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: vcr
50
- requirement: &2158179840 !ruby/object:Gem::Requirement
50
+ requirement: &2158407440 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ! '>='
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: '0'
56
56
  type: :development
57
57
  prerelease: false
58
- version_requirements: *2158179840
58
+ version_requirements: *2158407440
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: fakeweb
61
- requirement: &2158179420 !ruby/object:Gem::Requirement
61
+ requirement: &2158407020 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ! '>='
@@ -66,7 +66,7 @@ dependencies:
66
66
  version: '0'
67
67
  type: :development
68
68
  prerelease: false
69
- version_requirements: *2158179420
69
+ version_requirements: *2158407020
70
70
  description: This gem simplifies the comunication with the netaxept service significantly.
71
71
  Right now it only supports register and sale, more is to come.
72
72
  email: