prismpay 0.0.0 → 0.0.1

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.
@@ -1,119 +1,127 @@
1
- class PrismCreditResponse
2
- # this class will be responsible for handling the SOAP response
3
- def initialize(prism_savon_result_obj)
4
- # keys from successful response were :status, :result, :historyid,
5
- # :orderid, :refcode, :authcode, :total, :merchantordernumber,
6
- # :transdate, :paytype, :duplicate
7
- @result = prism_savon_result_obj
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
- def active_merchant_response
11
- params = options = { }
30
+ options[:authorization] = @result.body[:multi_ref][:historyid]
31
+ options[:external_identifier] = @result.body[:multi_ref][:orderid]
12
32
 
13
- # options[:avs_result]
14
- # options[:cvv_result]
15
- message = @result.body[:multi_ref][:status]
33
+ ActiveMerchant::Billing::Response.new(success, message,
34
+ params, options)
35
+ end
16
36
 
17
- if @result.body[:multi_ref][:status] =~ /Approved/
18
- success = true
19
- else
20
- success = false
21
- end
37
+ def parse_auth(authstr)
38
+ # parses the authorization specification string returned by prismpay
22
39
 
23
- options[:authorization] = @result.body[:multi_ref][:historyid]
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
- approval_fields = [:transaction_type, :auth_code, :ref_number,
37
- :batch_number, :transaction_id, :avs_code,
38
- :auth_net_message, :cvv_code, :partial_auth]
39
-
40
- decline_fields = [:result, :decline_code, :info]
41
-
42
- # first digit of the decline code has these meanings
43
- decline_code_map = {
44
- '0' => "Authorizing network declined the transaction",
45
- '1' => "Gateway declined the transaction",
46
- '2' => "Authorizing network returned an error, forcing a decline",
47
- '3' => "Gateway returned an error, forcing a decline"
48
- }
49
-
50
- # map cvv and avs response codes to meanings
51
- avs_map = { 'A'=> "Street addresses matches, but the ZIP code does " +
52
- "not. The first five numerical characters contained in the " +
53
- "address match. However, the ZIP code does not match.",
54
-
55
- 'E' => "Ineligible transaction. The card issuing institution is " +
56
- "not supporting AVS on the card in question. N Neither address " +
57
- "nor ZIP matches. The first five numerical characters contained " +
58
- "in the address do not match, and the ZIP code does not match. ",
59
-
60
- 'R'=> "Retry (system unavailable or timed out).",
61
-
62
- 'S' => "Card type not supported. The card type for this " +
63
- "transaction is not supported by AVS. AVS can verify " +
64
- "addresses for Visa cards, MasterCard, proprietary cards, and " +
65
- "private label transactions.",
66
-
67
- 'U' => "Address information unavailable. The address information "+
68
- "was not available at the issuer.",
69
-
70
- 'W' => "9 digit ZIP code match, address does not. The nine digit " +
71
- "ZIP code matches that stored at the issuer. However, the first " +
72
- "five numerical characters contained in the address do not match.",
73
-
74
- 'X' => "Exact match (9 digit zip and address) Both the nine digit " +
75
- "postal ZIP code as well as the first five numerical characters " +
76
- "contained in the address match.",
77
-
78
- 'Y' => "Address and 5 digits zip match. Both the five digit " +
79
- "postal ZIP code as well as the first five numerical characters " +
80
- "contained in the address match.",
81
-
82
- 'Z' => "5 digit ZIP matches, but the address does not. The five " +
83
- "digit postal ZIP code matches that stored at the VIC or card " +
84
- "issuer's center. However, the first five numerical characters " +
85
- "contained in the address do not match.",
86
-
87
- 'B' => "Street address matches for international transaction. " +
88
- "Postal Code not verified due to incompatible formats.",
89
-
90
- 'C' => "Street address and Postal Code not verified for " +
91
- "international transaction due to incompatible format.",
92
-
93
- 'D' => "Street address and Postal Code match for international " +
94
- "transaction.",
95
-
96
- 'P' => "Postal Code match for international transaction. Street " +
97
- "address not verified due to incompatible formats."
98
- } # end avs_map
99
-
100
- cvv_map = { " "=> "cvv not requested",
101
- 'M' => "cvv Match",
102
- 'N' => "cvv not matched",
103
- 'P' => "Not processed",
104
- 'S' => "cvv should be on card, but it indicated the value not present",
105
- 'U' => "Issuer doesn't support cvv2",
106
- 'X' => "Service provider did not respond"
107
- }
108
-
109
- hash = {}
110
- fields = authstr.split /:/
111
- if fields.size > 3 # approval
112
- approval_fields.each_index{|x| hash[approval_fields[x]] = fields[x]}
113
- else
114
- decline_fields.each_index{|x| hash[decline_fields[x]] = fields[x] }
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
- end # PrismCreditResponse
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
- # this class will manage the connection to the gateway and handle
9
- # transactions
9
+ class PrismPay
10
+ # this class will manage the connection to the gateway and handle
11
+ # transactions
10
12
 
11
- # WSDL = "https://trans.myprismpay.com/MPWeb/services/TransactionService?wsdl"
12
- WSDL = File.expand_path("../TransactionService.xml", __FILE__)
13
+ # WSDL = "https://trans.myprismpay.com/MPWeb/services/TransactionService?wsdl"
14
+ WSDL = File.expand_path("../TransactionService.xml", __FILE__)
13
15
 
14
- attr_accessor :acctid, :password
15
- attr_reader :client
16
+ attr_accessor :acctid, :password
17
+ attr_reader :client
16
18
 
17
- def initialize(options = {})
18
- merchant_info = options
19
- merchant_info = {:login => 'TEST0'} unless merchant_info[:login]
19
+ def initialize(options = {})
20
+ merchant_info = options
21
+ merchant_info = {:login => 'TEST0'} unless merchant_info[:login]
20
22
 
21
- if merchant_info.respond_to?("has_key?")
22
- @acctid = merchant_info[:login] if merchant_info.has_key?(:login)
23
- @password = merchant_info[:password] if merchant_info.has_key?(:password)
24
- end
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
- end
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
- retstr =
40
- "xml.#{type}address('xsi:type' => 'urn:address'){
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
- end
49
-
50
- def build_credit(amount, id, options)
51
- xml_block = Proc.new { |xml|
52
- xml.miscprocess("xsi:type" => "urn:VoidCreditPost"){
53
- xml.acctid @acctid
54
- xml.amount amount
55
- xml.orderid options[:orderid]
56
- xml.historyid id
57
- xml.ipaddress
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
- return xml_block
62
- end
63
-
64
- def build_cc_void(auth, options)
65
- # needs to have orderid and amount in options
66
- xml_block = Proc.new {|xml|
67
- xml.miscprocess("xsi:type" => "urn:VoidCreditPost"){
68
- xml.acctid @acctid
69
- xml.amount options[:amount]
70
- xml.orderid options[:orderid]
71
- # xml.customizedfields{
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
- return xml_block
85
- end
86
-
87
- def build_cc_capture(amount, auth, options)
88
- # as of now auth is historyid and we need :orderid set in options
89
- xml_block = Proc.new {|xml|
90
- xml.miscprocess("xsi:type" => "urn:VoidCreditPost"){
91
- xml.acctid @acctid
92
- xml.amount amount
93
- xml.orderid options[:orderid]
94
- xml.historyid auth
95
- xml.merchantordernumber auth
96
- xml.merchantpin auth
97
- xml.ipaddress
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
- return xml_block
101
- end
102
-
103
- def build_cc_sale_auth(amount, credit_card, options)
104
- # return a proc object to be used as a block for builder
105
- # passed to response.body {|xml| my xml block}
106
-
107
- missing_fields_for_options = {
108
- :acctid => '',
109
- :accountkey => '',
110
- :subid => ''
111
- }
112
-
113
- # to map the active_merchant option keys to prismpay
114
- active_merchant_credit_card = {
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
- xml_block = Proc.new{ |xml|
167
- xml.ccinfo("xsi:type" => "urn:CreditCardInfo") {
168
- xml.acctid @acctid
169
- xml.accountkey options[:password] if options.has_key?(:password)
170
- # xml.subid "xsi:nil" => "true"
171
- xml.ccname "#{credit_card.first_name} #{credit_card.last_name}"
172
- # xml.swipedata "xsi:nil" => "true"
173
- # xml.cardpresent "xsi;nil" => "true"
174
- # xml.cardreaderpresent "xsi:nil" => "true"
175
- # xml.voiceauth "xsi:nil" => "true"
176
- # xml.track1 "xsi:nil" => "true"
177
- # xml.track2 "xsi:nil" => "true"
178
- xml.ccnum credit_card.number
179
- xml.cctype credit_card.type
180
- xml.expmon credit_card.month
181
- xml.expyear credit_card.year
182
- xml.cvv2 credit_card.verification_value
183
- xml.amount amount
184
- xml.merchantordernumber options[:order_id] if options.has_key?(:order_id) # or invoice?
185
- # xml.companyname # says its our companyname
186
- eval(build_address(bill_address)) if bill_address
187
- eval(build_address(ship_address, "ship")) if ship_address
188
- xml.email options[:email] if options.has_key?(:email)
189
- # xml.dlnum
190
- # xml.ssnum
191
- xml.phone bill_address[:phone] if bill_address
192
- # xml.dobday
193
- # xml.dobmonth
194
- # xml.dobyear
195
- # xml.memo
196
- # xml.customizedemail("xsi:type" => "urn:customEmail"){ #method
197
- # xml.emailto "vpat@comcast.net"
198
- # xml.emailfrom "null@atsbank.com"
199
- # xml.emailsubject "Transaction Service Test"
200
- # xml.emailtext "This is just a test"
201
- # }
202
- # xml.recurring("xsi:type" => "urn:Recur") { #nees method
203
- # xml.create 0
204
- # xml.billingcycle 0
205
- # xml.billingmax 0
206
- # xml.start 0
207
- # xml.amount 0
208
- # }
209
- xml.ipaddress options[:ip] # req field ... nil if !(exists?)
210
- # xml.accttype ---> #have no clue
211
- # xml.merchantpin ----> #believe this is password
212
- # xml.currencycode
213
- # xml.industrycode ----> # no clue
214
- # xml.dynamicdescriptor ---> carries onto receipt for VITAL auths
215
- # xml.profileactiontype # no clue
216
- # xml.manualrecurring #number 1 if manual recurring
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
- return xml_block
221
- end
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
- def cc_purchase(amount, creditcard, options ={})
224
- # process a credit card sale and right now return the savon response
225
- # The savon response needs to be mapped back into the proper response
226
- # fields
227
-
228
- # need to merge the gateway instance options with the options
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
- PrismCreditResponse.new(response)
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
- end
269
+ PrismCreditResponse.new(response)
270
+ end
237
271
 
238
- def cc_authorize(amount, creditcard, options = {})
239
- # reserve funds for future captures
240
- response = @client.request :process_cc_auth do
241
- soap.body &build_cc_sale_auth(amount, creditcard, options)
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
- def cc_capture(amount, authorization, options = {})
246
- # Captures reservered funds from previous auths
247
- # need to put some validation into these methods before
248
- # making the call to the build methods
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
- response = @client.request :process_cc_post do
251
- soap.body &build_cc_capture(amount, authorization, options)
290
+ PrismCreditResponse.new(response)
252
291
  end
253
- end
254
292
 
255
- def cc_void(identification, options = {})
256
- # voids previous transactions
257
- response = @client.request :process_cc_void do
258
- soap.body &build_cc_void(identification, options)
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
- def credit(amount, identification, options = {})
263
- # applies credit back against previous transaction
264
- response = @client.request :process_credit do
265
- soap.body &build_credit(amount, identification, options)
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
- end
268
-
269
- end # PrismPay
270
-
271
-
272
-
273
- # class CreditCard
274
- # # credit card information... mimic ActiveMerchant
275
- # attr_accessor :number, :month, :year, :first_name,
276
- # :verification_value, :type, :last_name
277
-
278
- # def [](method)
279
- # eval ("self.#{method}")
280
- # end
281
-
282
- # def name
283
- # join(@first_name, @last_name)
284
- # end
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
  # #####################