Class: PrismPay::PrismPay

Inherits:
Object
  • Object
show all
Defined in:
lib/prismpay/prismpay.rb

Constant Summary collapse

WSDL =
File.expand_path("../TransactionService.xml", __FILE__)
ACH_CHECK_ACCT_TYPE =
{"checking" => 1, "savings" => 2}
ACH_SEC_CODES =
%w(POP, ARC, TEL, PPD, ICL, RCK, BOC, CCDN)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ PrismPay

Returns a new instance of PrismPay.



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/prismpay/prismpay.rb', line 16

def initialize(options = {})
  merchant_info = options
  merchant_info.merge!({:login => 'TEST0'}) unless merchant_info[:login]

  if merchant_info.respond_to?("has_key?")
    @acctid = merchant_info[:login] if merchant_info.has_key?(:login)
    @password = merchant_info[:password] if merchant_info.has_key?(:password)
  end

  @client = Savon::Client.new(WSDL) # initialize savon client

end

Instance Attribute Details

#acctidObject

Returns the value of attribute acctid.



13
14
15
# File 'lib/prismpay/prismpay.rb', line 13

def acctid
  @acctid
end

#clientObject (readonly)

Returns the value of attribute client.



14
15
16
# File 'lib/prismpay/prismpay.rb', line 14

def client
  @client
end

#passwordObject

Returns the value of attribute password.



13
14
15
# File 'lib/prismpay/prismpay.rb', line 13

def password
  @password
end

Instance Method Details

#ach_refund(amount, identification, pp_txn_id, options = {}) ⇒ Object



183
184
185
186
187
188
189
190
191
192
# File 'lib/prismpay/prismpay.rb', line 183

def ach_refund(amount, identification, pp_txn_id, options = {})
  # response = @client.request :process_ext_ach_credit do  
  response = @client.request 'processACHCreditRequest' do  
    http.auth.ssl.verify_mode = :none
    soap.body &build_ext_ach_refund_void(amount, identification,
                                         pp_txn_id, options)
  end

  PrismCreditResponse.new(response)
end

#ach_sale(amount, bank_account, options = {}) ⇒ Object

ACH Methods

These should be for normal ACH transactions ie: transactions coming from a client into a prismpay vendor.



132
133
134
135
136
137
138
139
140
# File 'lib/prismpay/prismpay.rb', line 132

def ach_sale(amount, , options = {})
  # response = @client.request :process_ext_ach_sale do 
  response = @client.request 'processACHSale' do 
    http.auth.ssl.verify_mode = :none
    soap.body &build_ext_ach_sale_disburse(amount, , options)
  end

  PrismCreditResponse.new(response)
end

#ach_void(identification, pp_txn_id, options = {}) ⇒ Object

ext_ach_void doesn’t work in generic testing accounts



172
173
174
175
176
177
178
179
180
181
# File 'lib/prismpay/prismpay.rb', line 172

def ach_void(identification, pp_txn_id, options = {})
  # response = @client.request :process_ext_ach_void do 
  response = @client.request 'processVoid' do 
    http.auth.ssl.verify_mode = :none
    soap.body &build_ext_ach_refund_void(nil, identification, 
                                         pp_txn_id, options)
  end

  PrismCreditResponse.new(response)
end

#cc_authorize(amount, creditcard, options = {}) ⇒ Object



75
76
77
78
79
80
81
82
83
84
# File 'lib/prismpay/prismpay.rb', line 75

def cc_authorize(amount, creditcard, options = {}) 
  # reserve funds for future captures
  # response = @client.request :process_cc_auth do 
  response = @client.request 'processCCAuth' do 
    http.auth.ssl.verify_mode = :none
    soap.body &build_cc_sale_auth(amount, creditcard, options)
  end

  PrismCreditResponse.new(response)
end

#cc_capture(amount, authorization, pp_txn_id, options = {}) ⇒ Object



87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/prismpay/prismpay.rb', line 87

def cc_capture(amount, authorization, pp_txn_id, options = {})
  # Captures reservered funds from previous auths
  # need to put some validation into these methods before 
  # making the call to the build methods

  # response = @client.request :process_cc_post do
  response = @client.request 'processCCPost' do
    http.auth.ssl.verify_mode = :none
    soap.body &build_cc_capture(amount, authorization, pp_txn_id, options)
  end

  PrismCreditResponse.new(response)
end

#cc_purchase(amount, creditcard, options = {}) ⇒ Object



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/prismpay/prismpay.rb', line 57

def cc_purchase(amount, creditcard, options ={})                
  # process a credit card sale and right now return the savon response
  # The savon response needs to be mapped back into the proper response 
  # fields 
  
  # need to merge the gateway instance options with the options

  # response = @client.request :process_cc_sale do 
  response = @client.request 'processCCSale' do 
    http.auth.ssl.verify_mode = :none
    soap.body &build_cc_sale_auth(amount, creditcard, options)
  end

  PrismCreditResponse.new(response)

end

#cc_void(amount, identification, pp_txn_id, options = {}) ⇒ Object



102
103
104
105
106
107
108
109
110
111
# File 'lib/prismpay/prismpay.rb', line 102

def cc_void(amount, identification, pp_txn_id, options = {})
  # voids previous transactions
  # response = @client.request :process_cc_void do 
  response = @client.request 'processCCVoid' do 
    http.auth.ssl.verify_mode = :none
    soap.body &build_cc_void(amount, identification, pp_txn_id, options)
  end

  PrismCreditResponse.new(response)
end

#credit(amount, identification, pp_txn_id, options = {}) ⇒ Object



114
115
116
117
118
119
120
121
122
123
# File 'lib/prismpay/prismpay.rb', line 114

def credit(amount, identification, pp_txn_id, options = {})
  # applies credit back against previous transaction
  # response = @client.request :process_credit do 
  response = @client.request 'processCredit' do 
    http.auth.ssl.verify_mode = :none
    soap.body &build_credit(amount, identification, pp_txn_id, options)
  end

  PrismCreditResponse.new(response)
end

#ext_ach_consumer_disbursement(amount, bank_account, options = {}) ⇒ Object



194
195
196
197
198
199
200
201
202
# File 'lib/prismpay/prismpay.rb', line 194

def ext_ach_consumer_disbursement(amount, , options = {})
  # response = @client.request :process_ext_ach_consumer_disbursement do 
  response = @client.request 'processExtACHConsumerDisbursement' do 
    http.auth.ssl.verify_mode = :none
    soap.body &build_ext_ach_sale_disburse(amount, , options)
  end

  PrismCreditResponse.new(response)
end

#ext_ach_sale(amount, bank_account, options = {}) ⇒ Object

ACH Ext Check Sale

These will be used for checks coming in which will have disbursments to a third party as well



159
160
161
162
163
164
165
166
167
# File 'lib/prismpay/prismpay.rb', line 159

def ext_ach_sale(amount, , options = {})
  # response = @client.request :process_ext_ach_sale do 
  response = @client.request 'processExtACHSale' do 
    http.auth.ssl.verify_mode = :none
    soap.body &build_ext_ach_sale_disburse(amount, , options)
  end

  PrismCreditResponse.new(response)
end

#profile_retrieve(options = {}) ⇒ Object



47
48
49
50
51
52
53
54
# File 'lib/prismpay/prismpay.rb', line 47

def profile_retrieve(options = {})
  # process a profile retrieve request
  # response = @client.request :process_profile_retrieve do 
  response = @client.request 'processProfileRetrieve' do 
    http.auth.ssl.verify_mode = :none
    soap.body &build_profile_retrieve(options)
  end
end

#profile_sale(amount, profile_id, last_four, options = {}) ⇒ Object

CreditCard SOAP methods: ########################################################### TODO: the profile methods should be refactored to be either for credit cards or for ACH transactions



37
38
39
40
41
42
43
44
# File 'lib/prismpay/prismpay.rb', line 37

def profile_sale(amount, profile_id, last_four, options = {})
  # response = @client.request :process_profile_sale do
  response = @client.request 'processProfileSale' do
    http.auth.ssl.verify_mode = :none
    soap.body &build_profile_sale(amount, profile_id, last_four, options)
  end
  PrismCreditResponse.new(response)
end