spree-alpha-card 0.0.5 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6f1355e8a6e76936b991bd4b60ba4b17dfbdc559
4
- data.tar.gz: d98d401f5d29bfb8c91a5f284dfe3b17a061ba93
3
+ metadata.gz: 411790ac5a026306bc42c83c9f919c8864d8dee9
4
+ data.tar.gz: 08568d146651bb97410df07f3586456af5337f18
5
5
  SHA512:
6
- metadata.gz: ed17d46473adae3e03abd3169ae44d59078f04c143a64b1ec80bef246082da37cfeeda7deae60d5e4b84b0f1b04005c721d7c77d76a885e5958455ec447877f2
7
- data.tar.gz: 1fdd2f6343667ce10b9926540978a89c1d9aa2d8c6cb52bdefc1fd597b054122f6343fad3410ee6cdd7072159b6a00a9a1661323949a66aae96faacadc792d84
6
+ metadata.gz: 2e1a62d0a0ae8b336c76c2382c62636cdcdc4195d860849ced9329b815e963a5f06aae9acd9620b994fa0b76781d248242157e08855ee84f1fbe316e02a62b78
7
+ data.tar.gz: f49492a608cef7e427b8dc192d7a1c2b62d9d005f3c3d2a8bc9122099f429913285b7dc142c3c7a39b95c3cd2025684a57a3f97926d1b98d188952f41d045163
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- spree-alpha-card (0.0.5)
5
- alpha_card (~> 0.2.5)
4
+ spree-alpha-card (0.1.0)
5
+ alpha_card (= 0.2.5)
6
6
  spree_core (>= 3.0.0)
7
7
 
8
8
  GEM
@@ -48,14 +48,14 @@ GEM
48
48
  minitest (~> 5.1)
49
49
  thread_safe (~> 0.3, >= 0.3.4)
50
50
  tzinfo (~> 1.1)
51
- acts_as_list (0.7.2)
51
+ acts_as_list (0.7.4)
52
52
  activerecord (>= 3.0)
53
53
  addressable (2.3.8)
54
54
  alpha_card (0.2.5)
55
55
  rest-client (~> 1.8)
56
56
  virtus (~> 1.0)
57
57
  arel (6.0.3)
58
- awesome_nested_set (3.0.2)
58
+ awesome_nested_set (3.0.3)
59
59
  activerecord (>= 4.0.0, < 5)
60
60
  axiom-types (0.1.1)
61
61
  descendants_tracker (~> 0.0.4)
@@ -67,19 +67,19 @@ GEM
67
67
  cancancan (1.10.1)
68
68
  carmen (1.0.2)
69
69
  activesupport (>= 3.0.0)
70
- cldr-plurals-runtime-rb (1.0.0)
70
+ cldr-plurals-runtime-rb (1.0.1)
71
71
  climate_control (0.0.3)
72
72
  activesupport (>= 3.0)
73
- cocaine (0.5.7)
73
+ cocaine (0.5.8)
74
74
  climate_control (>= 0.0.3, < 1.0)
75
75
  coercible (1.0.0)
76
76
  descendants_tracker (~> 0.0.1)
77
77
  colorize (0.7.7)
78
78
  crack (0.4.2)
79
79
  safe_yaml (~> 1.0.0)
80
- css_parser (1.3.7)
80
+ css_parser (1.4.1)
81
81
  addressable
82
- deface (1.0.1)
82
+ deface (1.0.2)
83
83
  colorize (>= 0.5.8)
84
84
  nokogiri (~> 1.6.0)
85
85
  polyglot
@@ -87,15 +87,15 @@ GEM
87
87
  descendants_tracker (0.0.4)
88
88
  thread_safe (~> 0.3, >= 0.3.1)
89
89
  diff-lcs (1.2.5)
90
- domain_name (0.5.24)
90
+ domain_name (0.5.20160310)
91
91
  unf (>= 0.0.5, < 1.0.0)
92
92
  equalizer (0.0.11)
93
93
  erubis (2.7.0)
94
94
  factory_girl (4.5.0)
95
95
  activesupport (>= 3.0.0)
96
96
  ffaker (1.32.1)
97
- font-awesome-rails (4.4.0.0)
98
- railties (>= 3.2, < 5.0)
97
+ font-awesome-rails (4.6.3.0)
98
+ railties (>= 3.2, < 5.1)
99
99
  friendly_id (5.1.0)
100
100
  activerecord (>= 4.0.0)
101
101
  globalid (0.3.6)
@@ -109,25 +109,26 @@ GEM
109
109
  json (~> 1.8)
110
110
  multi_xml (>= 0.5.2)
111
111
  i18n (0.7.0)
112
- ice_nine (0.11.1)
112
+ ice_nine (0.11.2)
113
113
  json (1.8.3)
114
- kaminari (0.16.3)
114
+ kaminari (0.17.0)
115
115
  actionpack (>= 3.0.0)
116
116
  activesupport (>= 3.0.0)
117
117
  loofah (2.0.3)
118
118
  nokogiri (>= 1.5.9)
119
- mail (2.6.3)
120
- mime-types (>= 1.16, < 3)
121
- mime-types (2.6.2)
119
+ mail (2.6.4)
120
+ mime-types (>= 1.16, < 4)
121
+ mime-types (2.99.2)
122
122
  mini_portile (0.6.2)
123
123
  minitest (5.8.1)
124
- monetize (1.3.1)
125
- money (~> 6.6)
126
- money (6.6.1)
124
+ monetize (1.4.0)
125
+ money (~> 6.7)
126
+ money (6.7.1)
127
127
  i18n (>= 0.6.4, <= 0.7.0)
128
+ sixarm_ruby_unaccent (>= 1.1.1, < 2)
128
129
  multi_json (1.11.2)
129
130
  multi_xml (0.5.5)
130
- netrc (0.10.3)
131
+ netrc (0.11.0)
131
132
  nokogiri (1.6.6.2)
132
133
  mini_portile (~> 0.6.0)
133
134
  paperclip (4.2.4)
@@ -135,17 +136,17 @@ GEM
135
136
  activesupport (>= 3.2.0)
136
137
  cocaine (~> 0.5.5)
137
138
  mime-types
138
- paranoia (2.1.3)
139
+ paranoia (2.1.5)
139
140
  activerecord (~> 4.0)
140
141
  pg (0.18.3)
141
- polyamorous (1.2.0)
142
+ polyamorous (1.3.0)
142
143
  activerecord (>= 3.0)
143
144
  polyglot (0.3.5)
144
145
  premailer (1.8.6)
145
146
  css_parser (>= 1.3.6)
146
147
  htmlentities (>= 4.0.0)
147
- premailer-rails (1.8.2)
148
- actionmailer (>= 3, < 5)
148
+ premailer-rails (1.9.3)
149
+ actionmailer (>= 3, < 6)
149
150
  premailer (~> 1.7, >= 1.7.9)
150
151
  rack (1.6.4)
151
152
  rack-test (0.6.3)
@@ -181,8 +182,8 @@ GEM
181
182
  activesupport (>= 3.0)
182
183
  i18n
183
184
  polyamorous (~> 1.1)
184
- responders (2.1.0)
185
- railties (>= 4.2.0, < 5)
185
+ responders (2.2.0)
186
+ railties (>= 4.2.0, < 5.1)
186
187
  rest-client (1.8.0)
187
188
  http-cookie (>= 1.0.2, < 2.0)
188
189
  mime-types (>= 1.16, < 3.0)
@@ -211,6 +212,7 @@ GEM
211
212
  sass (~> 3.2.2)
212
213
  sprockets (~> 2.8, < 3.0)
213
214
  sprockets-rails (~> 2.0)
215
+ sixarm_ruby_unaccent (1.1.1)
214
216
  spree_core (3.0.4)
215
217
  activemerchant (~> 1.47.0)
216
218
  acts_as_list (~> 0.6)
@@ -247,18 +249,18 @@ GEM
247
249
  sprockets (>= 2.8, < 4.0)
248
250
  sqlite3 (1.3.10)
249
251
  state_machines (0.4.0)
250
- state_machines-activemodel (0.3.0)
251
- activemodel (~> 4.1)
252
+ state_machines-activemodel (0.4.0)
253
+ activemodel (>= 4.1, < 5.1)
252
254
  state_machines (>= 0.4.0)
253
- state_machines-activerecord (0.3.0)
254
- activerecord (~> 4.1)
255
+ state_machines-activerecord (0.4.0)
256
+ activerecord (>= 4.1, < 5.1)
255
257
  state_machines-activemodel (>= 0.3.0)
256
- stringex (2.5.2)
258
+ stringex (2.6.0)
257
259
  thor (0.19.1)
258
260
  thread_safe (0.3.5)
259
261
  tilt (1.4.1)
260
262
  truncate_html (0.9.2)
261
- twitter_cldr (3.2.1)
263
+ twitter_cldr (3.3.0)
262
264
  camertron-eprun
263
265
  cldr-plurals-runtime-rb (~> 1.0.0)
264
266
  json
@@ -267,7 +269,7 @@ GEM
267
269
  thread_safe (~> 0.1)
268
270
  unf (0.1.4)
269
271
  unf_ext
270
- unf_ext (0.0.7.1)
272
+ unf_ext (0.0.7.2)
271
273
  vcr (2.9.3)
272
274
  virtus (1.0.5)
273
275
  axiom-types (~> 0.1)
@@ -296,4 +298,4 @@ DEPENDENCIES
296
298
  webmock
297
299
 
298
300
  BUNDLED WITH
299
- 1.10.6
301
+ 1.11.2
@@ -37,12 +37,14 @@ module Spree
37
37
  %w(purchase credit)
38
38
  end
39
39
 
40
- def void(*args)
41
- ActiveMerchant::Billing::Response.new false, "AlphaCardGateway#void not implemented, please use refund", {}, {}
40
+ def void transaction_id, options = {}
41
+ opts = {
42
+ type: 'void',
43
+ transactionid: transaction_id
44
+ }
45
+ request opts, 'void'
42
46
  end
43
47
 
44
-
45
-
46
48
  def purchase money, credit_card, options = {}
47
49
  opts = {
48
50
  type: 'sale',
@@ -57,17 +59,23 @@ module Spree
57
59
  request opts, 'purchase'
58
60
  end
59
61
 
62
+ def refund money, reference, options = {}
63
+ opts = {
64
+ type: 'refund',
65
+ transactionid: reference
66
+ }
67
+ add_money! opts, money, options
60
68
 
69
+ request opts, 'refund'
70
+ end
61
71
 
62
72
  def credit money, reference, options = {}
63
- opts = {type: 'credit'}
64
- add_money! opts, money, currency: options[:originator].payment.currency
65
- opts[:transactionid] = reference
66
-
67
- request opts, 'credit'
73
+ refund money, reference, options
68
74
  end
69
75
 
70
-
76
+ def cancel reference
77
+ void reference
78
+ end
71
79
 
72
80
  protected
73
81
 
@@ -131,7 +139,7 @@ module Spree
131
139
  def response_params data
132
140
  options = {
133
141
  test: test?,
134
- authorization: data['authcode'].presence,
142
+ authorization: data['transactionid'].presence,
135
143
  cvv_result: data['cvvresponse'].presence,
136
144
  }
137
145
 
@@ -1,6 +1,6 @@
1
1
  module Spree
2
2
  module AlphaCard
3
- VERSION = '0.0.5'
3
+ VERSION = '0.1.0'
4
4
  end
5
5
  end
6
6
 
@@ -0,0 +1,38 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://secure.alphacardgateway.com/api/transact.php
6
+ body:
7
+ encoding: US-ASCII
8
+ string: type=sale&email=kari%40schmitt.name&orderid=R005225159-P0YC41ZG&ipaddress=&amount=5.00&currency=USD&tax=0.00&shipping=0.00&ccnumber=4111111111111111&ccexp=1217&firstname=John&lastname=Doe&address1=10%20Lovely%20Street&address2=Northwest&city=Herndon&state=AL&zip=35005&country=US&phone=555-555-0199&username=demo&password=password
9
+ headers:
10
+ Accept:
11
+ - "*/*; q=0.5, application/xml"
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ Content-Length:
15
+ - '330'
16
+ Content-Type:
17
+ - application/x-www-form-urlencoded
18
+ User-Agent:
19
+ - Ruby
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Date:
26
+ - Thu, 16 Jun 2016 05:44:38 GMT
27
+ Server:
28
+ - Apache
29
+ Content-Length:
30
+ - '155'
31
+ Content-Type:
32
+ - text/html; charset=UTF-8
33
+ body:
34
+ encoding: UTF-8
35
+ string: response=1&responsetext=SUCCESS&authcode=123456&transactionid=3155194171&avsresponse=N&cvvresponse=&orderid=R005225159-P0YC41ZG&type=sale&response_code=100
36
+ http_version:
37
+ recorded_at: Thu, 16 Jun 2016 05:44:40 GMT
38
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,73 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://secure.alphacardgateway.com/api/transact.php
6
+ body:
7
+ encoding: US-ASCII
8
+ string: type=sale&email=dean%40feil.ca&orderid=R112326018-PR1R19VW&ipaddress=&amount=5.00&currency=USD&tax=0.00&shipping=0.00&ccnumber=4111111111111111&ccexp=1217&firstname=John&lastname=Doe&address1=10%20Lovely%20Street&address2=Northwest&city=Herndon&state=AL&zip=35005&country=US&phone=555-555-0199&username=demo&password=password
9
+ headers:
10
+ Accept:
11
+ - "*/*; q=0.5, application/xml"
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ Content-Length:
15
+ - '325'
16
+ Content-Type:
17
+ - application/x-www-form-urlencoded
18
+ User-Agent:
19
+ - Ruby
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Date:
26
+ - Thu, 16 Jun 2016 05:54:44 GMT
27
+ Server:
28
+ - Apache
29
+ Content-Length:
30
+ - '155'
31
+ Content-Type:
32
+ - text/html; charset=UTF-8
33
+ body:
34
+ encoding: UTF-8
35
+ string: response=1&responsetext=SUCCESS&authcode=123456&transactionid=3155208099&avsresponse=N&cvvresponse=&orderid=R112326018-PR1R19VW&type=sale&response_code=100
36
+ http_version:
37
+ recorded_at: Thu, 16 Jun 2016 05:54:46 GMT
38
+ - request:
39
+ method: post
40
+ uri: https://secure.alphacardgateway.com/api/transact.php
41
+ body:
42
+ encoding: US-ASCII
43
+ string: type=void&transactionid=3155208099&username=demo&password=password
44
+ headers:
45
+ Accept:
46
+ - "*/*; q=0.5, application/xml"
47
+ Accept-Encoding:
48
+ - gzip, deflate
49
+ Content-Length:
50
+ - '66'
51
+ Content-Type:
52
+ - application/x-www-form-urlencoded
53
+ User-Agent:
54
+ - Ruby
55
+ response:
56
+ status:
57
+ code: 200
58
+ message: OK
59
+ headers:
60
+ Date:
61
+ - Thu, 16 Jun 2016 05:54:46 GMT
62
+ Server:
63
+ - Apache
64
+ Content-Length:
65
+ - '174'
66
+ Content-Type:
67
+ - text/html; charset=UTF-8
68
+ body:
69
+ encoding: UTF-8
70
+ string: response=1&responsetext=Transaction Void Successful&authcode=123456&transactionid=3155208099&avsresponse=&cvvresponse=&orderid=R112326018-PR1R19VW&type=void&response_code=100
71
+ http_version:
72
+ recorded_at: Thu, 16 Jun 2016 05:54:48 GMT
73
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,73 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://secure.alphacardgateway.com/api/transact.php
6
+ body:
7
+ encoding: US-ASCII
8
+ string: type=sale&email=monserrat.howell%40binsdaniel.biz&orderid=R469909421-P800VDWM&ipaddress=&amount=5.00&currency=USD&tax=0.00&shipping=0.00&ccnumber=4111111111111111&ccexp=1217&firstname=John&lastname=Doe&address1=10%20Lovely%20Street&address2=Northwest&city=Herndon&state=AL&zip=35005&country=US&phone=555-555-0199&username=demo&password=password
9
+ headers:
10
+ Accept:
11
+ - "*/*; q=0.5, application/xml"
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ Content-Length:
15
+ - '344'
16
+ Content-Type:
17
+ - application/x-www-form-urlencoded
18
+ User-Agent:
19
+ - Ruby
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Date:
26
+ - Thu, 16 Jun 2016 07:13:47 GMT
27
+ Server:
28
+ - Apache
29
+ Content-Length:
30
+ - '155'
31
+ Content-Type:
32
+ - text/html; charset=UTF-8
33
+ body:
34
+ encoding: UTF-8
35
+ string: response=1&responsetext=SUCCESS&authcode=123456&transactionid=3155305412&avsresponse=N&cvvresponse=&orderid=R469909421-P800VDWM&type=sale&response_code=100
36
+ http_version:
37
+ recorded_at: Thu, 16 Jun 2016 07:13:50 GMT
38
+ - request:
39
+ method: post
40
+ uri: https://secure.alphacardgateway.com/api/transact.php
41
+ body:
42
+ encoding: US-ASCII
43
+ string: type=refund&transactionid=3155305412&amount=5.00&currency=&username=demo&password=password
44
+ headers:
45
+ Accept:
46
+ - "*/*; q=0.5, application/xml"
47
+ Accept-Encoding:
48
+ - gzip, deflate
49
+ Content-Length:
50
+ - '90'
51
+ Content-Type:
52
+ - application/x-www-form-urlencoded
53
+ User-Agent:
54
+ - Ruby
55
+ response:
56
+ status:
57
+ code: 200
58
+ message: OK
59
+ headers:
60
+ Date:
61
+ - Thu, 16 Jun 2016 07:13:51 GMT
62
+ Server:
63
+ - Apache
64
+ Content-Length:
65
+ - '150'
66
+ Content-Type:
67
+ - text/html; charset=UTF-8
68
+ body:
69
+ encoding: UTF-8
70
+ string: response=1&responsetext=SUCCESS&authcode=&transactionid=3155305466&avsresponse=&cvvresponse=&orderid=R469909421-P800VDWM&type=refund&response_code=100
71
+ http_version:
72
+ recorded_at: Thu, 16 Jun 2016 07:13:52 GMT
73
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,73 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://secure.alphacardgateway.com/api/transact.php
6
+ body:
7
+ encoding: US-ASCII
8
+ string: type=sale&email=l%40larskluge.com&orderid=12345678&ipaddress=&amount=256.67&currency=USD&ccnumber=4111111111111111&ccexp=0715&username=demo&password=password
9
+ headers:
10
+ Accept:
11
+ - "*/*; q=0.5, application/xml"
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ Content-Length:
15
+ - '157'
16
+ Content-Type:
17
+ - application/x-www-form-urlencoded
18
+ User-Agent:
19
+ - Ruby
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Date:
26
+ - Mon, 13 Jun 2016 06:15:51 GMT
27
+ Server:
28
+ - Apache
29
+ Content-Length:
30
+ - '143'
31
+ Content-Type:
32
+ - text/html; charset=UTF-8
33
+ body:
34
+ encoding: UTF-8
35
+ string: response=1&responsetext=SUCCESS&authcode=123456&transactionid=3151165813&avsresponse=&cvvresponse=&orderid=12345678&type=sale&response_code=100
36
+ http_version:
37
+ recorded_at: Mon, 13 Jun 2016 06:15:52 GMT
38
+ - request:
39
+ method: post
40
+ uri: https://secure.alphacardgateway.com/api/transact.php
41
+ body:
42
+ encoding: US-ASCII
43
+ string: type=refund&transactionid=3151165813&amount=256.67&currency=USD&username=demo&password=password
44
+ headers:
45
+ Accept:
46
+ - "*/*; q=0.5, application/xml"
47
+ Accept-Encoding:
48
+ - gzip, deflate
49
+ Content-Length:
50
+ - '95'
51
+ Content-Type:
52
+ - application/x-www-form-urlencoded
53
+ User-Agent:
54
+ - Ruby
55
+ response:
56
+ status:
57
+ code: 200
58
+ message: OK
59
+ headers:
60
+ Date:
61
+ - Mon, 13 Jun 2016 06:15:53 GMT
62
+ Server:
63
+ - Apache
64
+ Content-Length:
65
+ - '139'
66
+ Content-Type:
67
+ - text/html; charset=UTF-8
68
+ body:
69
+ encoding: UTF-8
70
+ string: response=1&responsetext=SUCCESS&authcode=&transactionid=3151165836&avsresponse=&cvvresponse=&orderid=12345678&type=refund&response_code=100
71
+ http_version:
72
+ recorded_at: Mon, 13 Jun 2016 06:15:55 GMT
73
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,73 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://secure.alphacardgateway.com/api/transact.php
6
+ body:
7
+ encoding: US-ASCII
8
+ string: type=sale&email=l%40larskluge.com&orderid=12345678&ipaddress=&amount=256.67&currency=USD&ccnumber=4111111111111111&ccexp=0715&username=demo&password=password
9
+ headers:
10
+ Accept:
11
+ - "*/*; q=0.5, application/xml"
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ Content-Length:
15
+ - '157'
16
+ Content-Type:
17
+ - application/x-www-form-urlencoded
18
+ User-Agent:
19
+ - Ruby
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Date:
26
+ - Mon, 13 Jun 2016 06:15:46 GMT
27
+ Server:
28
+ - Apache
29
+ Content-Length:
30
+ - '143'
31
+ Content-Type:
32
+ - text/html; charset=UTF-8
33
+ body:
34
+ encoding: UTF-8
35
+ string: response=1&responsetext=SUCCESS&authcode=123456&transactionid=3151165769&avsresponse=&cvvresponse=&orderid=12345678&type=sale&response_code=100
36
+ http_version:
37
+ recorded_at: Mon, 13 Jun 2016 06:15:48 GMT
38
+ - request:
39
+ method: post
40
+ uri: https://secure.alphacardgateway.com/api/transact.php
41
+ body:
42
+ encoding: US-ASCII
43
+ string: type=void&transactionid=3151165769&username=demo&password=password
44
+ headers:
45
+ Accept:
46
+ - "*/*; q=0.5, application/xml"
47
+ Accept-Encoding:
48
+ - gzip, deflate
49
+ Content-Length:
50
+ - '66'
51
+ Content-Type:
52
+ - application/x-www-form-urlencoded
53
+ User-Agent:
54
+ - Ruby
55
+ response:
56
+ status:
57
+ code: 200
58
+ message: OK
59
+ headers:
60
+ Date:
61
+ - Mon, 13 Jun 2016 06:15:48 GMT
62
+ Server:
63
+ - Apache
64
+ Content-Length:
65
+ - '163'
66
+ Content-Type:
67
+ - text/html; charset=UTF-8
68
+ body:
69
+ encoding: UTF-8
70
+ string: response=1&responsetext=Transaction Void Successful&authcode=123456&transactionid=3151165769&avsresponse=&cvvresponse=&orderid=12345678&type=void&response_code=100
71
+ http_version:
72
+ recorded_at: Mon, 13 Jun 2016 06:15:50 GMT
73
+ recorded_with: VCR 2.9.3
@@ -88,7 +88,6 @@ RSpec.describe Spree::Gateway::AlphaCardGateway do
88
88
  expect(response).to be_an_instance_of(::ActiveMerchant::Billing::Response)
89
89
  expect(response).to be_success
90
90
  expect(response.params).to include("type" => "sale")
91
- expect(response.authorization).to eq("123456")
92
91
  expect(response.error_code).to be_nil
93
92
  end
94
93
 
@@ -99,7 +98,6 @@ RSpec.describe Spree::Gateway::AlphaCardGateway do
99
98
 
100
99
  expect(response).to be_an_instance_of(::ActiveMerchant::Billing::Response)
101
100
  expect(response).to_not be_success
102
- expect(response.authorization).to be_nil
103
101
  expect(response.message).to match(/declined/i)
104
102
  expect(response.error_code).to eq("200")
105
103
  end
@@ -141,12 +139,57 @@ RSpec.describe Spree::Gateway::AlphaCardGateway do
141
139
  end
142
140
 
143
141
  context '#void' do
142
+ let(:opts) do
143
+ {
144
+ email: "l@larskluge.com",
145
+ order_id: "12345678",
146
+ ipaddress: "::1",
147
+ currency: "USD",
148
+ }
149
+ end
150
+
151
+ before(:each) do
152
+ allow(Spree::Order).to receive(:find_by!).and_return nil
153
+ end
154
+
155
+ it 'voids the transaction successfully' do
156
+ response = VCR.use_cassette("simple void") do
157
+ transactionid = provider.purchase(256_67, cc, opts).params["transactionid"]
158
+ provider.void transactionid
159
+ end
144
160
 
145
- it 'fails to void since implementation is missing' do
146
- response = provider.void
147
161
  expect(response).to be_an_instance_of(::ActiveMerchant::Billing::Response)
148
- expect(response).to_not be_success
149
- expect(response.message).to match(/not implemented/i)
162
+ expect(response).to be_success
163
+ expect(response.params).to include("type" => "void")
164
+ expect(response.error_code).to be_nil
165
+ end
166
+
167
+ end
168
+
169
+ context '#refund' do
170
+ let(:opts) do
171
+ {
172
+ email: "l@larskluge.com",
173
+ order_id: "12345678",
174
+ ipaddress: "::1",
175
+ currency: "USD",
176
+ }
177
+ end
178
+
179
+ before(:each) do
180
+ allow(Spree::Order).to receive(:find_by!).and_return nil
181
+ end
182
+
183
+ it 'refunds the transaction successfully' do
184
+ response = VCR.use_cassette("simple refund") do
185
+ transactionid = provider.purchase(256_67, cc, opts).params["transactionid"]
186
+ provider.refund 256_67, transactionid, opts
187
+ end
188
+
189
+ expect(response).to be_an_instance_of(::ActiveMerchant::Billing::Response)
190
+ expect(response).to be_success
191
+ expect(response.params).to include("type" => "refund")
192
+ expect(response.error_code).to be_nil
150
193
  end
151
194
 
152
195
  end
@@ -0,0 +1,25 @@
1
+ require 'spec_helper'
2
+
3
+ describe Spree::Order, type: :model do
4
+ let(:card) { create :credit_card }
5
+ let(:order) { create(:completed_order_with_totals) }
6
+ let(:gateway) { Spree::Gateway::AlphaCardGateway.new }
7
+ let!(:payment) do
8
+ payment = Spree::Payment.new
9
+ payment.source = card
10
+ payment.order = order
11
+ payment.payment_method = gateway
12
+ payment.amount = order.total
13
+ payment.state = "completed"
14
+ payment
15
+ end
16
+
17
+ describe '#cancel' do
18
+ it 'cancels the order successfully' do
19
+ VCR.use_cassette("order/cancel") do
20
+ order.cancel
21
+ end
22
+ expect(order.state).to eq "canceled"
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,37 @@
1
+ require 'spec_helper'
2
+
3
+ describe Spree::Payment, type: :model do
4
+ let(:order) { create :order }
5
+ let(:gateway) { Spree::Gateway::AlphaCardGateway.new }
6
+ let(:card) { create :credit_card }
7
+
8
+ let(:payment) do
9
+ payment = Spree::Payment.new
10
+ payment.source = card
11
+ payment.order = order
12
+ payment.payment_method = gateway
13
+ payment.amount = 5
14
+ payment
15
+ end
16
+
17
+ describe "#purchase!" do
18
+ it 'purchases successfully' do
19
+ VCR.use_cassette("payment/purchase") do
20
+ payment.purchase!
21
+ end
22
+
23
+ expect(payment.state).to eq "completed"
24
+ end
25
+ end
26
+
27
+ describe "#void_transaction!" do
28
+ it 'voids successfully' do
29
+ response = VCR.use_cassette("payment/void") do
30
+ payment.purchase!
31
+ payment.void_transaction!
32
+ end
33
+
34
+ expect(payment.state).to eq "void"
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,28 @@
1
+ require 'spec_helper'
2
+
3
+ describe Spree::Refund, type: :model do
4
+ let(:order) { create :order }
5
+ let(:gateway) { Spree::Gateway::AlphaCardGateway.new }
6
+ let(:card) { create :credit_card }
7
+ let(:amount) { 5 }
8
+
9
+ let(:payment) do
10
+ payment = Spree::Payment.new
11
+ payment.source = card
12
+ payment.order = order
13
+ payment.payment_method = gateway
14
+ payment.amount = amount
15
+ payment
16
+ end
17
+
18
+ let(:refund_reason) { create(:refund_reason) }
19
+
20
+ let(:refund) { create(:refund, payment: payment, amount: amount, reason: refund_reason, transaction_id: nil) }
21
+
22
+ it 'performs successfully' do
23
+ VCR.use_cassette("refund/perform") do
24
+ payment.purchase!
25
+ refund
26
+ end
27
+ end
28
+ end
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
31
31
  spec.add_development_dependency 'vcr'
32
32
  spec.add_development_dependency 'webmock'
33
33
 
34
- spec.add_runtime_dependency 'alpha_card', '~> 0.2.5'
34
+ spec.add_runtime_dependency 'alpha_card', '= 0.2.5'
35
35
  spec.add_runtime_dependency 'spree_core', '>= 3.0.0'
36
36
  end
37
37
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree-alpha-card
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lars Kluge
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-02 00:00:00.000000000 Z
11
+ date: 2016-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -168,14 +168,14 @@ dependencies:
168
168
  name: alpha_card
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
- - - "~>"
171
+ - - '='
172
172
  - !ruby/object:Gem::Version
173
173
  version: 0.2.5
174
174
  type: :runtime
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
- - - "~>"
178
+ - - '='
179
179
  - !ruby/object:Gem::Version
180
180
  version: 0.2.5
181
181
  - !ruby/object:Gem::Dependency
@@ -210,10 +210,18 @@ files:
210
210
  - lib/spree/alpha_card/engine.rb
211
211
  - lib/spree/alpha_card/version.rb
212
212
  - spec/cassettes/credit_without_valid_transaction_id.yml
213
+ - spec/cassettes/payment/purchase.yml
214
+ - spec/cassettes/payment/void.yml
213
215
  - spec/cassettes/purchase_invalid_cc_number.yml
214
216
  - spec/cassettes/purchase_low_amount.yml
217
+ - spec/cassettes/refund/perform.yml
215
218
  - spec/cassettes/simple_purchase.yml
219
+ - spec/cassettes/simple_refund.yml
220
+ - spec/cassettes/simple_void.yml
216
221
  - spec/models/spree/gateway/alpha_card_gateway_spec.rb
222
+ - spec/models/spree/gateway/spree_order.rb
223
+ - spec/models/spree/gateway/spree_payment.rb
224
+ - spec/models/spree/gateway/spree_refund.rb
217
225
  - spec/spec_helper.rb
218
226
  - spree-alpha-card.gemspec
219
227
  homepage: ''
@@ -236,14 +244,22 @@ required_rubygems_version: !ruby/object:Gem::Requirement
236
244
  version: '0'
237
245
  requirements: []
238
246
  rubyforge_project:
239
- rubygems_version: 2.4.5.1
247
+ rubygems_version: 2.5.1
240
248
  signing_key:
241
249
  specification_version: 4
242
250
  summary: Alpha Card Payment Gateway for Spree
243
251
  test_files:
244
252
  - spec/cassettes/credit_without_valid_transaction_id.yml
253
+ - spec/cassettes/payment/purchase.yml
254
+ - spec/cassettes/payment/void.yml
245
255
  - spec/cassettes/purchase_invalid_cc_number.yml
246
256
  - spec/cassettes/purchase_low_amount.yml
257
+ - spec/cassettes/refund/perform.yml
247
258
  - spec/cassettes/simple_purchase.yml
259
+ - spec/cassettes/simple_refund.yml
260
+ - spec/cassettes/simple_void.yml
248
261
  - spec/models/spree/gateway/alpha_card_gateway_spec.rb
262
+ - spec/models/spree/gateway/spree_order.rb
263
+ - spec/models/spree/gateway/spree_payment.rb
264
+ - spec/models/spree/gateway/spree_refund.rb
249
265
  - spec/spec_helper.rb