prismpay 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/prism_credit_response.rb +2 -2
- data/lib/prismpay.rb +42 -13
- data/lib/prismpay_am.rb +29 -9
- metadata +2 -2
@@ -19,7 +19,7 @@ module PrismPay
|
|
19
19
|
# options[:cvv_result]
|
20
20
|
message = @result.body[:multi_ref][:status]
|
21
21
|
|
22
|
-
if @result.body[:multi_ref][:status] =~ /
|
22
|
+
if @result.body[:multi_ref][:status] =~ /approved/i
|
23
23
|
success = true
|
24
24
|
else
|
25
25
|
decl = parse_auth(@result.body[:multi_ref][:authcode])
|
@@ -28,7 +28,7 @@ module PrismPay
|
|
28
28
|
end
|
29
29
|
|
30
30
|
options[:authorization] = @result.body[:multi_ref][:historyid]
|
31
|
-
|
31
|
+
params[:order_id] = @result.body[:multi_ref][:orderid]
|
32
32
|
|
33
33
|
ActiveMerchant::Billing::Response.new(success, message,
|
34
34
|
params, options)
|
data/lib/prismpay.rb
CHANGED
@@ -65,12 +65,12 @@ module PrismPay
|
|
65
65
|
return xml_block
|
66
66
|
end
|
67
67
|
|
68
|
-
def build_credit(amount, id, options)
|
68
|
+
def build_credit(amount, id, pp_txn_id, options)
|
69
69
|
xml_block = Proc.new { |xml|
|
70
70
|
xml.miscprocess("xsi:type" => "urn:VoidCreditPost"){
|
71
71
|
xml.acctid @acctid
|
72
72
|
xml.amount amount
|
73
|
-
xml.orderid
|
73
|
+
xml.orderid pp_txn_id
|
74
74
|
xml.historyid id
|
75
75
|
xml.ipaddress
|
76
76
|
}
|
@@ -79,13 +79,13 @@ module PrismPay
|
|
79
79
|
return xml_block
|
80
80
|
end
|
81
81
|
|
82
|
-
def build_cc_void(auth, options)
|
82
|
+
def build_cc_void(amount, auth, pp_txn_id, options)
|
83
83
|
# needs to have orderid and amount in options
|
84
84
|
xml_block = Proc.new {|xml|
|
85
85
|
xml.miscprocess("xsi:type" => "urn:VoidCreditPost"){
|
86
86
|
xml.acctid @acctid
|
87
|
-
xml.amount
|
88
|
-
xml.orderid
|
87
|
+
xml.amount amount
|
88
|
+
xml.orderid pp_txn_id
|
89
89
|
# xml.customizedfields{
|
90
90
|
# xml.custom1
|
91
91
|
# xml.custom2
|
@@ -102,13 +102,13 @@ module PrismPay
|
|
102
102
|
return xml_block
|
103
103
|
end
|
104
104
|
|
105
|
-
def build_cc_capture(amount, auth, options)
|
105
|
+
def build_cc_capture(amount, auth, pp_txn_id, options)
|
106
106
|
# as of now auth is historyid and we need :orderid set in options
|
107
107
|
xml_block = Proc.new {|xml|
|
108
108
|
xml.miscprocess("xsi:type" => "urn:VoidCreditPost"){
|
109
109
|
xml.acctid @acctid
|
110
110
|
xml.amount amount
|
111
|
-
xml.orderid
|
111
|
+
xml.orderid pp_txn_id
|
112
112
|
xml.historyid auth
|
113
113
|
xml.merchantordernumber auth
|
114
114
|
xml.merchantpin auth
|
@@ -238,6 +238,30 @@ module PrismPay
|
|
238
238
|
return xml_block
|
239
239
|
end
|
240
240
|
|
241
|
+
def build_profile_sale(amount, profile_id, last_four, options)
|
242
|
+
# as of now auth is historyid and we need :orderid set in options
|
243
|
+
|
244
|
+
xml_block = Proc.new {|xml|
|
245
|
+
xml.miscprocess("xsi:type" => "urn:MPTransProcess"){
|
246
|
+
xml.acctid @acctid
|
247
|
+
xml.last4digits last_four
|
248
|
+
xml.userprofileid profile_id
|
249
|
+
xml.amount amount
|
250
|
+
xml.ipaddress
|
251
|
+
}
|
252
|
+
}
|
253
|
+
return xml_block
|
254
|
+
end
|
255
|
+
|
256
|
+
|
257
|
+
def profile_sale(amount, profile_id, last_four, options = {})
|
258
|
+
response = @client.request :process_profile_sale do
|
259
|
+
soap.body &build_profile_sale(amount, profile_id, last_four, options)
|
260
|
+
end
|
261
|
+
PrismCreditResponse.new(response)
|
262
|
+
end
|
263
|
+
|
264
|
+
|
241
265
|
def profile_retrieve(options = {})
|
242
266
|
# process a profile retrieve request
|
243
267
|
response = @client.request :process_profile_retrieve do
|
@@ -245,6 +269,7 @@ module PrismPay
|
|
245
269
|
end
|
246
270
|
end
|
247
271
|
|
272
|
+
|
248
273
|
def cc_purchase(amount, creditcard, options ={})
|
249
274
|
# process a credit card sale and right now return the savon response
|
250
275
|
# The savon response needs to be mapped back into the proper response
|
@@ -260,6 +285,7 @@ module PrismPay
|
|
260
285
|
|
261
286
|
end
|
262
287
|
|
288
|
+
|
263
289
|
def cc_authorize(amount, creditcard, options = {})
|
264
290
|
# reserve funds for future captures
|
265
291
|
response = @client.request :process_cc_auth do
|
@@ -269,19 +295,21 @@ module PrismPay
|
|
269
295
|
PrismCreditResponse.new(response)
|
270
296
|
end
|
271
297
|
|
272
|
-
|
298
|
+
|
299
|
+
def cc_capture(amount, authorization, pp_txn_id, options = {})
|
273
300
|
# Captures reservered funds from previous auths
|
274
301
|
# need to put some validation into these methods before
|
275
302
|
# making the call to the build methods
|
276
303
|
|
277
304
|
response = @client.request :process_cc_post do
|
278
|
-
soap.body &build_cc_capture(amount, authorization, options)
|
305
|
+
soap.body &build_cc_capture(amount, authorization, pp_txn_id, options)
|
279
306
|
end
|
280
307
|
|
281
308
|
PrismCreditResponse.new(response)
|
282
309
|
end
|
283
310
|
|
284
|
-
|
311
|
+
|
312
|
+
def cc_void(amount, identification, pp_txn_id, options = {})
|
285
313
|
# voids previous transactions
|
286
314
|
response = @client.request :process_cc_void do
|
287
315
|
soap.body &build_cc_void(identification, options)
|
@@ -290,16 +318,17 @@ module PrismPay
|
|
290
318
|
PrismCreditResponse.new(response)
|
291
319
|
end
|
292
320
|
|
293
|
-
|
321
|
+
|
322
|
+
def credit(amount, identification, pp_txn_id, options = {})
|
294
323
|
# applies credit back against previous transaction
|
295
324
|
response = @client.request :process_credit do
|
296
|
-
soap.body &build_credit(amount, identification, options)
|
325
|
+
soap.body &build_credit(amount, identification, pp_txn_id, options)
|
297
326
|
end
|
298
327
|
|
299
328
|
PrismCreditResponse.new(response)
|
300
329
|
end
|
301
330
|
|
302
|
-
end # PrismPay
|
331
|
+
end # class PrismPay
|
303
332
|
|
304
333
|
|
305
334
|
class CreditCard
|
data/lib/prismpay_am.rb
CHANGED
@@ -23,26 +23,46 @@ module ActiveMerchant
|
|
23
23
|
|
24
24
|
|
25
25
|
# Transactions
|
26
|
-
def
|
27
|
-
|
26
|
+
def check_purchase
|
27
|
+
end
|
28
|
+
|
29
|
+
def check_refund
|
30
|
+
end
|
31
|
+
|
32
|
+
def profile_sale(amount, profile_id, last_four, options = {})
|
33
|
+
Rails.logger.info "########################################"
|
34
|
+
Rails.logger.info "# I am getting called"
|
35
|
+
Rails.logger.info "# amount #{amount}"
|
36
|
+
Rails.logger.info "# pofile Id #{profile_id}"
|
37
|
+
Rails.logger.info "# last four #{last_four}"
|
38
|
+
Rails.logger.info "########################################"
|
39
|
+
result = @gateway.profile_sale(amount, profile_id, last_four, options)
|
40
|
+
result.active_merchant_response
|
41
|
+
end
|
42
|
+
|
43
|
+
def purchase(amount, creditcard, options = { })
|
44
|
+
result = @gateway.cc_purchase(amount, creditcard, options)
|
28
45
|
result.active_merchant_response
|
29
46
|
end
|
30
47
|
|
31
|
-
def authorize(
|
32
|
-
result = @gateway.cc_authorize(
|
48
|
+
def authorize(amount, creditcard, options ={ })
|
49
|
+
result = @gateway.cc_authorize(amount, creditcard, options)
|
33
50
|
result.active_merchant_response
|
34
51
|
end
|
35
52
|
|
36
|
-
def capture(
|
37
|
-
result = @gateway.cc_capture(
|
53
|
+
def capture(amount, identification, pp_id, options = {})
|
54
|
+
result = @gateway.cc_capture(amount, identification, pp_id, options)
|
55
|
+
result.active_merchant_response
|
38
56
|
end
|
39
57
|
|
40
|
-
def void(identification, options = {})
|
58
|
+
def void(amount, identification, pp_txn_id, options = {})
|
41
59
|
result = @gateway.cc_void(identification, options)
|
60
|
+
result.active_merchant_response
|
42
61
|
end
|
43
62
|
|
44
|
-
def refund(
|
45
|
-
result = @gateway.credit(
|
63
|
+
def refund(amount, identification, pp_txn_id, options ={ })
|
64
|
+
result = @gateway.credit(amount, identification, options)
|
65
|
+
result.active_merchant_response
|
46
66
|
end
|
47
67
|
end
|
48
68
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prismpay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -82,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
82
82
|
version: '0'
|
83
83
|
requirements: []
|
84
84
|
rubyforge_project:
|
85
|
-
rubygems_version: 1.8.
|
85
|
+
rubygems_version: 1.8.19
|
86
86
|
signing_key:
|
87
87
|
specification_version: 3
|
88
88
|
summary: Provide an interface to the Prismpay Gateway
|