Class: EWS::Transaction::Request

Inherits:
Object
  • Object
show all
Includes:
Validator
Defined in:
lib/ews/transaction/request.rb

Overview

The Request class allows you to build transaction requests for submission to the E-xact Web Service.

All requests will result in a financial transaction occurring, with the exception of the :transaction_details request, which looks up the details of a pre-existing transaction.

The following fields are mandatory on all requests:

:gateway_id         the gateway to which this request should be sent
:password           your password for that gateway
:transaction_type   the type of transaction you want to perform

Different transaction types will have their own additional requirements when it comes to mandatory and optional fields, and it is recommended that the E-xact Web Service Programming Reference Guide, v8.5 be consulted. This document is contained in the Webservice Plugin ZIP file: www.e-xact.com/wp-content/uploads/2007/06/E-xact_Payment_Webservice_Plug-In.zip

Please note that, if your chosen transaction requires it, credit card expiry dates must be entered in MMYY format.

Allowable transaction types

:purchase
:pre_auth
:pre_auth_completion
:forced_post
:refund
:pre_auth_only
:purchase_correction
:refund_correction
:void
:tagged_purchase
:tagged_pre_auth
:tagged_pre_auth_completion
:tagged_void
:tagged_refund
:tagged_online_debit_refund
:tagged_update
:referenced_void
:recurring_seed_pre_auth
:recurring_seed_purchase
:idebit_purchase
:idebit_refund
:secure_storage
:secure_storage_eft
:batch_query
:batch_close
:transaction_details

Constant Summary collapse

@@transaction_codes =
{
  :purchase => '00',
  :pre_auth => '01',
  :pre_auth_completion => '02',
  :forced_post => '03',
  :refund => '04',
  :pre_auth_only => '05',
  :purchase_correction => '11',
  :refund_correction => '12',
  :void => '13',
  :tagged_purchase => '30',
  :tagged_pre_auth => '31',
  :tagged_pre_auth_completion => '32',
  :tagged_void => '33',
  :tagged_refund => '34',
  :tagged_online_debit_refund => '35',
  :referenced_void => '36',
  :tagged_update => '37',
  :recurring_seed_pre_auth => '40',
  :recurring_seed_purchase => '41',
  :idebit_purchase => '50',
  :idebit_refund => '54',
  :secure_storage => '60',
  :secure_storage_eft => '61',
  :batch_query => '80',
  :batch_close => '81',
  :transaction_details => 'CR'
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Validator

#valid?

Constructor Details

#initialize(hash = {}) ⇒ Request

Initialize a Request with a hash of values



76
77
78
79
# File 'lib/ews/transaction/request.rb', line 76

def initialize(hash = {})
  hash.each {|k,v| self.send "#{k.to_s}=", v}
  @errors = {}
end

Instance Attribute Details

#amountObject

Returns the value of attribute amount.



56
57
58
# File 'lib/ews/transaction/request.rb', line 56

def amount
  @amount
end

#authorization_numObject

Returns the value of attribute authorization_num.



56
57
58
# File 'lib/ews/transaction/request.rb', line 56

def authorization_num
  @authorization_num
end

#cardholder_nameObject

Returns the value of attribute cardholder_name.



56
57
58
# File 'lib/ews/transaction/request.rb', line 56

def cardholder_name
  @cardholder_name
end

#cavvObject

Returns the value of attribute cavv.



73
74
75
# File 'lib/ews/transaction/request.rb', line 73

def cavv
  @cavv
end

#cavv_algorithmObject

Returns the value of attribute cavv_algorithm.



73
74
75
# File 'lib/ews/transaction/request.rb', line 73

def cavv_algorithm
  @cavv_algorithm
end

#cc_expiryObject

Returns the value of attribute cc_expiry.



56
57
58
# File 'lib/ews/transaction/request.rb', line 56

def cc_expiry
  @cc_expiry
end

#cc_numberObject

Returns the value of attribute cc_number.



56
57
58
# File 'lib/ews/transaction/request.rb', line 56

def cc_number
  @cc_number
end

#cc_verification_str1Object

AVS - Address Verification,



60
61
62
# File 'lib/ews/transaction/request.rb', line 60

def cc_verification_str1
  @cc_verification_str1
end

#cc_verification_str2Object

Returns the value of attribute cc_verification_str2.



57
58
59
# File 'lib/ews/transaction/request.rb', line 57

def cc_verification_str2
  @cc_verification_str2
end

#client_emailObject

Returns the value of attribute client_email.



73
74
75
# File 'lib/ews/transaction/request.rb', line 73

def client_email
  @client_email
end

#client_ipObject

Returns the value of attribute client_ip.



73
74
75
# File 'lib/ews/transaction/request.rb', line 73

def client_ip
  @client_ip
end

#customer_refObject

Returns the value of attribute customer_ref.



73
74
75
# File 'lib/ews/transaction/request.rb', line 73

def customer_ref
  @customer_ref
end

#cvd_presence_indObject

Returns the value of attribute cvd_presence_ind.



57
58
59
# File 'lib/ews/transaction/request.rb', line 57

def cvd_presence_ind
  @cvd_presence_ind
end

#ecommerce_flagObject

Returns the value of attribute ecommerce_flag.



73
74
75
# File 'lib/ews/transaction/request.rb', line 73

def ecommerce_flag
  @ecommerce_flag
end

#errorsObject

yeah, it’s ugly, but otherwise RDoc won’t pick them up



55
56
57
# File 'lib/ews/transaction/request.rb', line 55

def errors
  @errors
end

#gateway_idObject

Returns the value of attribute gateway_id.



56
57
58
# File 'lib/ews/transaction/request.rb', line 56

def gateway_id
  @gateway_id
end

#languageObject

Returns the value of attribute language.



73
74
75
# File 'lib/ews/transaction/request.rb', line 73

def language
  @language
end

#panObject

Returns the value of attribute pan.



56
57
58
# File 'lib/ews/transaction/request.rb', line 56

def pan
  @pan
end

#passwordObject

Returns the value of attribute password.



56
57
58
# File 'lib/ews/transaction/request.rb', line 56

def password
  @password
end

#reference_3Object

Returns the value of attribute reference_3.



73
74
75
# File 'lib/ews/transaction/request.rb', line 73

def reference_3
  @reference_3
end

#reference_noObject

Returns the value of attribute reference_no.



73
74
75
# File 'lib/ews/transaction/request.rb', line 73

def reference_no
  @reference_no
end

#secure_auth_requiredObject

Returns the value of attribute secure_auth_required.



57
58
59
# File 'lib/ews/transaction/request.rb', line 57

def secure_auth_required
  @secure_auth_required
end

#secure_auth_resultObject

Returns the value of attribute secure_auth_result.



57
58
59
# File 'lib/ews/transaction/request.rb', line 57

def secure_auth_result
  @secure_auth_result
end

#surcharge_amountObject

Returns the value of attribute surcharge_amount.



56
57
58
# File 'lib/ews/transaction/request.rb', line 56

def surcharge_amount
  @surcharge_amount
end

#tax1_amountObject

Returns the value of attribute tax1_amount.



57
58
59
# File 'lib/ews/transaction/request.rb', line 57

def tax1_amount
  @tax1_amount
end

#tax1_numberObject

Returns the value of attribute tax1_number.



57
58
59
# File 'lib/ews/transaction/request.rb', line 57

def tax1_number
  @tax1_number
end

#tax2_amountObject

Returns the value of attribute tax2_amount.



57
58
59
# File 'lib/ews/transaction/request.rb', line 57

def tax2_amount
  @tax2_amount
end

#tax2_numberObject

Returns the value of attribute tax2_number.



57
58
59
# File 'lib/ews/transaction/request.rb', line 57

def tax2_number
  @tax2_number
end

#track1Object

Returns the value of attribute track1.



56
57
58
# File 'lib/ews/transaction/request.rb', line 56

def track1
  @track1
end

#track2Object

Returns the value of attribute track2.



56
57
58
# File 'lib/ews/transaction/request.rb', line 56

def track2
  @track2
end

#transaction_tagObject

Returns the value of attribute transaction_tag.



56
57
58
# File 'lib/ews/transaction/request.rb', line 56

def transaction_tag
  @transaction_tag
end

#transaction_typeObject

Returns the value of attribute transaction_type.



56
57
58
# File 'lib/ews/transaction/request.rb', line 56

def transaction_type
  @transaction_type
end

#user_nameObject

Returns the value of attribute user_name.



57
58
59
# File 'lib/ews/transaction/request.rb', line 57

def user_name
  @user_name
end

#xidObject

Returns the value of attribute xid.



73
74
75
# File 'lib/ews/transaction/request.rb', line 73

def xid
  @xid
end

#zip_codeObject

Returns the value of attribute zip_code.



73
74
75
# File 'lib/ews/transaction/request.rb', line 73

def zip_code
  @zip_code
end

Instance Method Details

#is_find_transaction?Boolean

Indicates whether or not this transaction is a :transaction_details transaction

Returns:

  • (Boolean)


96
97
98
# File 'lib/ews/transaction/request.rb', line 96

def is_find_transaction?
  self.transaction_type == "CR"
end