prismpay 0.0.0 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/prism_credit_response.rb +119 -111
- data/lib/prismpay.rb +298 -264
- data/lib/prismpay_am.rb +1 -1
- data/lib/webpay.rb +211 -0
- data/spec/prism_credit_response_spec.rb +1 -1
- data/spec/prismpay_spec.rb +32 -32
- data/spec/webpay_spec.rb +17 -0
- data/spec/webpay_spec.rb~ +10 -0
- metadata +28 -13
@@ -1,119 +1,127 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
1
|
+
module PrismPay
|
2
|
+
class PrismCreditResponse
|
3
|
+
# this class will be responsible for handling the SOAP response
|
4
|
+
def initialize(prism_savon_result_obj)
|
5
|
+
# keys from successful response were :status, :result, :historyid,
|
6
|
+
# :orderid, :refcode, :authcode, :total, :merchantordernumber,
|
7
|
+
# :transdate, :paytype, :duplicate
|
8
|
+
@result = prism_savon_result_obj
|
9
|
+
end
|
10
|
+
|
11
|
+
def soap_response
|
12
|
+
@result
|
13
|
+
end
|
14
|
+
|
15
|
+
def active_merchant_response
|
16
|
+
params = options = { }
|
17
|
+
|
18
|
+
# options[:avs_result]
|
19
|
+
# options[:cvv_result]
|
20
|
+
message = @result.body[:multi_ref][:status]
|
21
|
+
|
22
|
+
if @result.body[:multi_ref][:status] =~ /Approved/
|
23
|
+
success = true
|
24
|
+
else
|
25
|
+
decl = parse_auth(@result.body[:multi_ref][:authcode])
|
26
|
+
message = "#{decl[:result]}: #{decl[:info]}"
|
27
|
+
success = false
|
8
28
|
end
|
9
29
|
|
10
|
-
|
11
|
-
|
30
|
+
options[:authorization] = @result.body[:multi_ref][:historyid]
|
31
|
+
options[:external_identifier] = @result.body[:multi_ref][:orderid]
|
12
32
|
|
13
|
-
|
14
|
-
|
15
|
-
|
33
|
+
ActiveMerchant::Billing::Response.new(success, message,
|
34
|
+
params, options)
|
35
|
+
end
|
16
36
|
|
17
|
-
|
18
|
-
|
19
|
-
else
|
20
|
-
success = false
|
21
|
-
end
|
37
|
+
def parse_auth(authstr)
|
38
|
+
# parses the authorization specification string returned by prismpay
|
22
39
|
|
23
|
-
|
24
|
-
options[:external_identifier] = @result.body[:multi_ref][:orderid]
|
25
|
-
|
26
|
-
ActiveMerchant::Billing::Response.new(success, message,
|
27
|
-
params, options)
|
28
|
-
end
|
29
|
-
|
30
|
-
def parse_auth(authstr)
|
31
|
-
# parses the authorization specification string returned by prismpay
|
32
|
-
|
33
|
-
trasaction_types = %w(SALE, AVSALE, AUTH, AVSAUTH, POST, AVSPOST,
|
40
|
+
trasaction_types = %w(SALE, AVSALE, AUTH, AVSAUTH, POST, AVSPOST,
|
34
41
|
VOICEPOST, VOID, CREDIT)
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
end
|
116
|
-
hash
|
42
|
+
|
43
|
+
approval_fields = [:transaction_type, :auth_code, :ref_number,
|
44
|
+
:batch_number, :transaction_id, :avs_code,
|
45
|
+
:auth_net_message, :cvv_code, :partial_auth]
|
46
|
+
|
47
|
+
decline_fields = [:result, :decline_code, :info]
|
48
|
+
|
49
|
+
# first digit of the decline code has these meanings
|
50
|
+
decline_code_map = {
|
51
|
+
'0' => "Authorizing network declined the transaction",
|
52
|
+
'1' => "Gateway declined the transaction",
|
53
|
+
'2' => "Authorizing network returned an error, forcing a decline",
|
54
|
+
'3' => "Gateway returned an error, forcing a decline"
|
55
|
+
}
|
56
|
+
|
57
|
+
# map cvv and avs response codes to meanings
|
58
|
+
avs_map = { 'A'=> "Street addresses matches, but the ZIP code does " +
|
59
|
+
"not. The first five numerical characters contained in the " +
|
60
|
+
"address match. However, the ZIP code does not match.",
|
61
|
+
|
62
|
+
'E' => "Ineligible transaction. The card issuing institution is " +
|
63
|
+
"not supporting AVS on the card in question. N Neither address " +
|
64
|
+
"nor ZIP matches. The first five numerical characters contained " +
|
65
|
+
"in the address do not match, and the ZIP code does not match. ",
|
66
|
+
|
67
|
+
'R'=> "Retry (system unavailable or timed out).",
|
68
|
+
|
69
|
+
'S' => "Card type not supported. The card type for this " +
|
70
|
+
"transaction is not supported by AVS. AVS can verify " +
|
71
|
+
"addresses for Visa cards, MasterCard, proprietary cards, and " +
|
72
|
+
"private label transactions.",
|
73
|
+
|
74
|
+
'U' => "Address information unavailable. The address information "+
|
75
|
+
"was not available at the issuer.",
|
76
|
+
|
77
|
+
'W' => "9 digit ZIP code match, address does not. The nine digit " +
|
78
|
+
"ZIP code matches that stored at the issuer. However, the first " +
|
79
|
+
"five numerical characters contained in the address do not match.",
|
80
|
+
|
81
|
+
'X' => "Exact match (9 digit zip and address) Both the nine digit " +
|
82
|
+
"postal ZIP code as well as the first five numerical characters " +
|
83
|
+
"contained in the address match.",
|
84
|
+
|
85
|
+
'Y' => "Address and 5 digits zip match. Both the five digit " +
|
86
|
+
"postal ZIP code as well as the first five numerical characters " +
|
87
|
+
"contained in the address match.",
|
88
|
+
|
89
|
+
'Z' => "5 digit ZIP matches, but the address does not. The five " +
|
90
|
+
"digit postal ZIP code matches that stored at the VIC or card " +
|
91
|
+
"issuer's center. However, the first five numerical characters " +
|
92
|
+
"contained in the address do not match.",
|
93
|
+
|
94
|
+
'B' => "Street address matches for international transaction. " +
|
95
|
+
"Postal Code not verified due to incompatible formats.",
|
96
|
+
|
97
|
+
'C' => "Street address and Postal Code not verified for " +
|
98
|
+
"international transaction due to incompatible format.",
|
99
|
+
|
100
|
+
'D' => "Street address and Postal Code match for international " +
|
101
|
+
"transaction.",
|
102
|
+
|
103
|
+
'P' => "Postal Code match for international transaction. Street " +
|
104
|
+
"address not verified due to incompatible formats."
|
105
|
+
} # end avs_map
|
106
|
+
|
107
|
+
cvv_map = { " "=> "cvv not requested",
|
108
|
+
'M' => "cvv Match",
|
109
|
+
'N' => "cvv not matched",
|
110
|
+
'P' => "Not processed",
|
111
|
+
'S' => "cvv should be on card, but it indicated the value not present",
|
112
|
+
'U' => "Issuer doesn't support cvv2",
|
113
|
+
'X' => "Service provider did not respond"
|
114
|
+
}
|
115
|
+
|
116
|
+
hash = {}
|
117
|
+
fields = authstr.split /:/
|
118
|
+
if fields.size > 3 # approval
|
119
|
+
approval_fields.each_index{|x| hash[approval_fields[x]] = fields[x]}
|
120
|
+
else
|
121
|
+
decline_fields.each_index{|x| hash[decline_fields[x]] = fields[x] }
|
117
122
|
end
|
123
|
+
hash
|
124
|
+
end
|
118
125
|
|
119
|
-
|
126
|
+
end # PrismCreditResponse
|
127
|
+
end #module PrismPay
|
data/lib/prismpay.rb
CHANGED
@@ -1,43 +1,45 @@
|
|
1
1
|
require 'savon'
|
2
2
|
require 'activemerchant'
|
3
3
|
require 'prism_credit_response'
|
4
|
+
require 'webpay'
|
4
5
|
require 'builder'
|
5
6
|
|
7
|
+
module PrismPay
|
6
8
|
|
7
|
-
class PrismPay
|
8
|
-
|
9
|
-
|
9
|
+
class PrismPay
|
10
|
+
# this class will manage the connection to the gateway and handle
|
11
|
+
# transactions
|
10
12
|
|
11
|
-
|
12
|
-
|
13
|
+
# WSDL = "https://trans.myprismpay.com/MPWeb/services/TransactionService?wsdl"
|
14
|
+
WSDL = File.expand_path("../TransactionService.xml", __FILE__)
|
13
15
|
|
14
|
-
|
15
|
-
|
16
|
+
attr_accessor :acctid, :password
|
17
|
+
attr_reader :client
|
16
18
|
|
17
|
-
|
18
|
-
|
19
|
-
|
19
|
+
def initialize(options = {})
|
20
|
+
merchant_info = options
|
21
|
+
merchant_info = {:login => 'TEST0'} unless merchant_info[:login]
|
20
22
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
@client = Savon::Client.new(WSDL) # initialize savon client
|
23
|
+
if merchant_info.respond_to?("has_key?")
|
24
|
+
@acctid = merchant_info[:login] if merchant_info.has_key?(:login)
|
25
|
+
@password = merchant_info[:password] if merchant_info.has_key?(:password)
|
26
|
+
end
|
27
27
|
|
28
|
-
|
28
|
+
@client = Savon::Client.new(WSDL) # initialize savon client
|
29
29
|
|
30
|
-
def build_address(addr, type= "bill")
|
31
|
-
# receives a hash that contains the keys for active_merchant
|
32
|
-
# address and type which should be 'bill' or 'ship'
|
33
|
-
# returns a str to be eval and included in xml builder block
|
34
|
-
|
35
|
-
if type != "bill" && type != "ship"
|
36
|
-
type = "bill"
|
37
30
|
end
|
38
|
-
|
39
|
-
|
40
|
-
|
31
|
+
|
32
|
+
def build_address(addr, type= "bill")
|
33
|
+
# receives a hash that contains the keys for active_merchant
|
34
|
+
# address and type which should be 'bill' or 'ship'
|
35
|
+
# returns a str to be eval and included in xml builder block
|
36
|
+
|
37
|
+
if type != "bill" && type != "ship"
|
38
|
+
type = "bill"
|
39
|
+
end
|
40
|
+
|
41
|
+
retstr =
|
42
|
+
"xml.#{type}address('xsi:type' => 'urn:address'){
|
41
43
|
xml.addr1 '#{addr[:address1]}'
|
42
44
|
xml.addr2 '#{addr[:address2]}'
|
43
45
|
xml.city '#{addr[:city]}'
|
@@ -45,265 +47,297 @@ class PrismPay
|
|
45
47
|
xml.zip '#{addr[:zip]}'
|
46
48
|
xml.country '#{addr[:country]}'
|
47
49
|
}"
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
50
|
+
end
|
51
|
+
|
52
|
+
def build_profile_retrieve(options = {})
|
53
|
+
xml_block = Proc.new { |xml|
|
54
|
+
xml.miscprocess("xsi:type" => "urn:ProfileRetrieve"){
|
55
|
+
xml.acctid @acctid
|
56
|
+
xml.subid options[:subid] if options[:subid]
|
57
|
+
xml.accountkey @password if @password
|
58
|
+
xml.last4digits options[:last_four]
|
59
|
+
xml.userprofileid options[:profileid]
|
60
|
+
xml.merchantpin options[:merchantpin] if options[:merchantpin]
|
61
|
+
xml.ipaddress
|
62
|
+
}
|
58
63
|
}
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
# xml.custom1
|
73
|
-
# xml.custom2
|
74
|
-
# xml.custom3
|
75
|
-
# xml.custom4
|
76
|
-
# xml.custom5
|
77
|
-
# xml.custom6
|
78
|
-
# }
|
79
|
-
xml.historyid auth
|
80
|
-
xml.ipaddress
|
64
|
+
|
65
|
+
return xml_block
|
66
|
+
end
|
67
|
+
|
68
|
+
def build_credit(amount, id, options)
|
69
|
+
xml_block = Proc.new { |xml|
|
70
|
+
xml.miscprocess("xsi:type" => "urn:VoidCreditPost"){
|
71
|
+
xml.acctid @acctid
|
72
|
+
xml.amount amount
|
73
|
+
xml.orderid options[:orderid]
|
74
|
+
xml.historyid id
|
75
|
+
xml.ipaddress
|
76
|
+
}
|
81
77
|
}
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
78
|
+
|
79
|
+
return xml_block
|
80
|
+
end
|
81
|
+
|
82
|
+
def build_cc_void(auth, options)
|
83
|
+
# needs to have orderid and amount in options
|
84
|
+
xml_block = Proc.new {|xml|
|
85
|
+
xml.miscprocess("xsi:type" => "urn:VoidCreditPost"){
|
86
|
+
xml.acctid @acctid
|
87
|
+
xml.amount options[:amount]
|
88
|
+
xml.orderid options[:orderid]
|
89
|
+
# xml.customizedfields{
|
90
|
+
# xml.custom1
|
91
|
+
# xml.custom2
|
92
|
+
# xml.custom3
|
93
|
+
# xml.custom4
|
94
|
+
# xml.custom5
|
95
|
+
# xml.custom6
|
96
|
+
# }
|
97
|
+
xml.historyid auth
|
98
|
+
xml.ipaddress
|
99
|
+
}
|
98
100
|
}
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
:first_name => '',
|
116
|
-
:last_name => '',
|
117
|
-
:month => '',
|
118
|
-
:number => '',
|
119
|
-
:type => '',
|
120
|
-
:verification_value => '',
|
121
|
-
:year => ''
|
122
|
-
}
|
123
|
-
|
124
|
-
active_merchant_option_map = {
|
125
|
-
:order_id => :merchantordernumber,
|
126
|
-
:ip => :ipaddress,
|
127
|
-
:customer => '', # customer info
|
128
|
-
:invoice => '', # invoice
|
129
|
-
:merchant => '', # name of merchant offering the product
|
130
|
-
:description => '', # A description of the transaction
|
131
|
-
:email => :email, # The email address of the customer
|
132
|
-
:currency => :currencycode,
|
133
|
-
:address => '', # if this is set it is both billing and shipping
|
134
|
-
:billing_address => {
|
135
|
-
:name => '',
|
136
|
-
:company => '',
|
137
|
-
:address1 => '',
|
138
|
-
:address2 => '',
|
139
|
-
:city => '',
|
140
|
-
:state => '',
|
141
|
-
:country => '',
|
142
|
-
:zip => '',
|
143
|
-
:phone => ''
|
144
|
-
},
|
145
|
-
:shipping_address => {
|
146
|
-
:name => '',
|
147
|
-
:company => '',
|
148
|
-
:address1 => '',
|
149
|
-
:address2 => '',
|
150
|
-
:city => '',
|
151
|
-
:state => '',
|
152
|
-
:country => '',
|
153
|
-
:zip => '',
|
154
|
-
:phone => ''
|
101
|
+
|
102
|
+
return xml_block
|
103
|
+
end
|
104
|
+
|
105
|
+
def build_cc_capture(amount, auth, options)
|
106
|
+
# as of now auth is historyid and we need :orderid set in options
|
107
|
+
xml_block = Proc.new {|xml|
|
108
|
+
xml.miscprocess("xsi:type" => "urn:VoidCreditPost"){
|
109
|
+
xml.acctid @acctid
|
110
|
+
xml.amount amount
|
111
|
+
xml.orderid options[:orderid]
|
112
|
+
xml.historyid auth
|
113
|
+
xml.merchantordernumber auth
|
114
|
+
xml.merchantpin auth
|
115
|
+
xml.ipaddress
|
116
|
+
}
|
155
117
|
}
|
156
|
-
|
157
|
-
|
158
|
-
if options.has_key?(:address)
|
159
|
-
bill_address = ship_address = options[:address]
|
160
|
-
else
|
161
|
-
# assigns nil to variables if keys aren't present
|
162
|
-
bill_address = options[:billing_address]
|
163
|
-
ship_address = options[:shipping_address]
|
118
|
+
return xml_block
|
164
119
|
end
|
165
120
|
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
#
|
191
|
-
|
192
|
-
#
|
193
|
-
#
|
194
|
-
#
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
121
|
+
def build_cc_sale_auth(amount, credit_card, options)
|
122
|
+
# return a proc object to be used as a block for builder
|
123
|
+
# passed to response.body {|xml| my xml block}
|
124
|
+
|
125
|
+
missing_fields_for_options = {
|
126
|
+
:acctid => '',
|
127
|
+
:accountkey => '',
|
128
|
+
:subid => ''
|
129
|
+
}
|
130
|
+
|
131
|
+
# to map the active_merchant option keys to prismpay
|
132
|
+
active_merchant_credit_card = {
|
133
|
+
:first_name => '',
|
134
|
+
:last_name => '',
|
135
|
+
:month => '',
|
136
|
+
:number => '',
|
137
|
+
:type => '',
|
138
|
+
:verification_value => '',
|
139
|
+
:year => ''
|
140
|
+
}
|
141
|
+
|
142
|
+
active_merchant_option_map = {
|
143
|
+
:order_id => :merchantordernumber,
|
144
|
+
:ip => :ipaddress,
|
145
|
+
:customer => '', # customer info
|
146
|
+
:invoice => '', # invoice
|
147
|
+
:merchant => '', # name of merchant offering the product
|
148
|
+
:description => '', # A description of the transaction
|
149
|
+
:email => :email, # The email address of the customer
|
150
|
+
:currency => :currencycode,
|
151
|
+
:address => '', # if this is set it is both billing and shipping
|
152
|
+
:billing_address => {
|
153
|
+
:name => '',
|
154
|
+
:company => '',
|
155
|
+
:address1 => '',
|
156
|
+
:address2 => '',
|
157
|
+
:city => '',
|
158
|
+
:state => '',
|
159
|
+
:country => '',
|
160
|
+
:zip => '',
|
161
|
+
:phone => ''
|
162
|
+
},
|
163
|
+
:shipping_address => {
|
164
|
+
:name => '',
|
165
|
+
:company => '',
|
166
|
+
:address1 => '',
|
167
|
+
:address2 => '',
|
168
|
+
:city => '',
|
169
|
+
:state => '',
|
170
|
+
:country => '',
|
171
|
+
:zip => '',
|
172
|
+
:phone => ''
|
173
|
+
}
|
174
|
+
}
|
175
|
+
|
176
|
+
if options.has_key?(:address)
|
177
|
+
bill_address = ship_address = options[:address]
|
178
|
+
else
|
179
|
+
# assigns nil to variables if keys aren't present
|
180
|
+
bill_address = options[:billing_address]
|
181
|
+
ship_address = options[:shipping_address]
|
182
|
+
end
|
183
|
+
|
184
|
+
xml_block = Proc.new{ |xml|
|
185
|
+
xml.ccinfo("xsi:type" => "urn:CreditCardInfo") {
|
186
|
+
xml.acctid @acctid
|
187
|
+
xml.accountkey options[:password] if options.has_key?(:password)
|
188
|
+
# xml.subid "xsi:nil" => "true"
|
189
|
+
xml.ccname "#{credit_card.first_name} #{credit_card.last_name}"
|
190
|
+
# xml.swipedata "xsi:nil" => "true"
|
191
|
+
# xml.cardpresent "xsi;nil" => "true"
|
192
|
+
# xml.cardreaderpresent "xsi:nil" => "true"
|
193
|
+
# xml.voiceauth "xsi:nil" => "true"
|
194
|
+
# xml.track1 "xsi:nil" => "true"
|
195
|
+
# xml.track2 "xsi:nil" => "true"
|
196
|
+
xml.ccnum credit_card.number
|
197
|
+
xml.cctype credit_card.type
|
198
|
+
xml.expmon credit_card.month
|
199
|
+
xml.expyear credit_card.year
|
200
|
+
xml.cvv2 credit_card.verification_value
|
201
|
+
xml.amount amount
|
202
|
+
xml.merchantordernumber options[:order_id] if options.has_key?(:order_id) # or invoice?
|
203
|
+
# xml.companyname # says its our companyname
|
204
|
+
eval(build_address(bill_address)) if bill_address
|
205
|
+
eval(build_address(ship_address, "ship")) if ship_address
|
206
|
+
xml.email options[:email] if options.has_key?(:email)
|
207
|
+
# xml.dlnum
|
208
|
+
# xml.ssnum
|
209
|
+
xml.phone bill_address[:phone] if bill_address
|
210
|
+
# xml.dobday
|
211
|
+
# xml.dobmonth
|
212
|
+
# xml.dobyear
|
213
|
+
# xml.memo
|
214
|
+
# xml.customizedemail("xsi:type" => "urn:customEmail"){ #method
|
215
|
+
# xml.emailto "vpat@comcast.net"
|
216
|
+
# xml.emailfrom "null@atsbank.com"
|
217
|
+
# xml.emailsubject "Transaction Service Test"
|
218
|
+
# xml.emailtext "This is just a test"
|
219
|
+
# }
|
220
|
+
# xml.recurring("xsi:type" => "urn:Recur") { #nees method
|
221
|
+
# xml.create 0
|
222
|
+
# xml.billingcycle 0
|
223
|
+
# xml.billingmax 0
|
224
|
+
# xml.start 0
|
225
|
+
# xml.amount 0
|
226
|
+
# }
|
227
|
+
xml.ipaddress options[:ip] # req field ... nil if !(exists?)
|
228
|
+
# xml.accttype ---> #have no clue
|
229
|
+
# xml.merchantpin ----> #believe this is password
|
230
|
+
# xml.currencycode
|
231
|
+
# xml.industrycode ----> # no clue
|
232
|
+
# xml.dynamicdescriptor ---> carries onto receipt for VITAL auths
|
233
|
+
# xml.profileactiontype # no clue
|
234
|
+
# xml.manualrecurring #number 1 if manual recurring
|
235
|
+
}
|
217
236
|
}
|
218
|
-
}
|
219
237
|
|
220
|
-
|
221
|
-
|
238
|
+
return xml_block
|
239
|
+
end
|
240
|
+
|
241
|
+
def profile_retrieve(options = {})
|
242
|
+
# process a profile retrieve request
|
243
|
+
response = @client.request :process_profile_retrieve do
|
244
|
+
soap.body &build_profile_retrieve(options)
|
245
|
+
end
|
246
|
+
end
|
222
247
|
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
248
|
+
def cc_purchase(amount, creditcard, options ={})
|
249
|
+
# process a credit card sale and right now return the savon response
|
250
|
+
# The savon response needs to be mapped back into the proper response
|
251
|
+
# fields
|
252
|
+
|
253
|
+
# need to merge the gateway instance options with the options
|
254
|
+
|
255
|
+
response = @client.request :process_cc_sale do
|
256
|
+
soap.body &build_cc_sale_auth(amount, creditcard, options)
|
257
|
+
end
|
258
|
+
|
259
|
+
PrismCreditResponse.new(response)
|
229
260
|
|
230
|
-
response = @client.request :process_cc_sale do
|
231
|
-
soap.body &build_cc_sale_auth(amount, creditcard, options)
|
232
261
|
end
|
233
262
|
|
234
|
-
|
263
|
+
def cc_authorize(amount, creditcard, options = {})
|
264
|
+
# reserve funds for future captures
|
265
|
+
response = @client.request :process_cc_auth do
|
266
|
+
soap.body &build_cc_sale_auth(amount, creditcard, options)
|
267
|
+
end
|
235
268
|
|
236
|
-
|
269
|
+
PrismCreditResponse.new(response)
|
270
|
+
end
|
237
271
|
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
272
|
+
def cc_capture(amount, authorization, options = {})
|
273
|
+
# Captures reservered funds from previous auths
|
274
|
+
# need to put some validation into these methods before
|
275
|
+
# making the call to the build methods
|
276
|
+
|
277
|
+
response = @client.request :process_cc_post do
|
278
|
+
soap.body &build_cc_capture(amount, authorization, options)
|
279
|
+
end
|
280
|
+
|
281
|
+
PrismCreditResponse.new(response)
|
242
282
|
end
|
243
|
-
end
|
244
283
|
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
284
|
+
def cc_void(identification, options = {})
|
285
|
+
# voids previous transactions
|
286
|
+
response = @client.request :process_cc_void do
|
287
|
+
soap.body &build_cc_void(identification, options)
|
288
|
+
end
|
249
289
|
|
250
|
-
|
251
|
-
soap.body &build_cc_capture(amount, authorization, options)
|
290
|
+
PrismCreditResponse.new(response)
|
252
291
|
end
|
253
|
-
end
|
254
292
|
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
293
|
+
def credit(amount, identification, options = {})
|
294
|
+
# applies credit back against previous transaction
|
295
|
+
response = @client.request :process_credit do
|
296
|
+
soap.body &build_credit(amount, identification, options)
|
297
|
+
end
|
298
|
+
|
299
|
+
PrismCreditResponse.new(response)
|
259
300
|
end
|
260
|
-
end
|
261
301
|
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
302
|
+
end # PrismPay
|
303
|
+
|
304
|
+
|
305
|
+
class CreditCard
|
306
|
+
# credit card information... mimic ActiveMerchant
|
307
|
+
attr_accessor :number, :month, :year, :first_name,
|
308
|
+
:verification_value, :type, :last_name
|
309
|
+
|
310
|
+
def [](method)
|
311
|
+
eval ("self.#{method}")
|
312
|
+
end
|
313
|
+
|
314
|
+
def name
|
315
|
+
join(@first_name, @last_name)
|
316
|
+
end
|
317
|
+
|
318
|
+
def name=(n)
|
319
|
+
names = n.split(' ')
|
320
|
+
@first_name = names[0]
|
321
|
+
@last_name = names[1]
|
266
322
|
end
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
#
|
283
|
-
|
284
|
-
#
|
285
|
-
|
286
|
-
# def name=(n)
|
287
|
-
# names = n.split(' ')
|
288
|
-
# @first_name = names[0]
|
289
|
-
# @last_name = names[1]
|
290
|
-
# end
|
291
|
-
|
292
|
-
# def []=(method, rval)
|
293
|
-
# eval ("self.#{method} = rval")
|
294
|
-
# end
|
295
|
-
|
296
|
-
# def initialize(ccinfo)
|
297
|
-
# if ccinfo.respond_to?("has_key?")
|
298
|
-
# @number = ccinfo[:number] if ccinfo.has_key?(:number)
|
299
|
-
# @month = ccinfo[:month] if ccinfo.has_key?(:month)
|
300
|
-
# @year = ccinfo[:year] if ccinfo.has_key?(:year)
|
301
|
-
# @name = ccinfo[:name] if ccinfo.has_key?(:name)
|
302
|
-
# @verification_value = ccinfo[:verification_value] if ccinfo.has_key?(:verification_value)
|
303
|
-
# @type = ccinfo[:type] if ccinfo.has_key?(:type)
|
304
|
-
# end
|
305
|
-
# end
|
306
|
-
# end # CreditCard
|
323
|
+
|
324
|
+
def []=(method, rval)
|
325
|
+
eval ("self.#{method} = rval")
|
326
|
+
end
|
327
|
+
|
328
|
+
def initialize(ccinfo)
|
329
|
+
if ccinfo.respond_to?("has_key?")
|
330
|
+
@number = ccinfo[:number] if ccinfo.has_key?(:number)
|
331
|
+
@month = ccinfo[:month] if ccinfo.has_key?(:month)
|
332
|
+
@year = ccinfo[:year] if ccinfo.has_key?(:year)
|
333
|
+
@name = ccinfo[:name] if ccinfo.has_key?(:name)
|
334
|
+
@verification_value = ccinfo[:verification_value] if ccinfo.has_key?(:verification_value)
|
335
|
+
@type = ccinfo[:type] if ccinfo.has_key?(:type)
|
336
|
+
end
|
337
|
+
end
|
338
|
+
end # CreditCard
|
339
|
+
|
340
|
+
end #module PrismPay
|
307
341
|
|
308
342
|
|
309
343
|
# #####################
|