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
: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',
  :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



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

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.



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

def amount
  @amount
end

#authorization_numObject

Returns the value of attribute authorization_num.



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

def authorization_num
  @authorization_num
end

#cardholder_nameObject

Returns the value of attribute cardholder_name.



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

def cardholder_name
  @cardholder_name
end

#cavvObject

Returns the value of attribute cavv.



71
72
73
# File 'lib/ews/transaction/request.rb', line 71

def cavv
  @cavv
end

#cavv_algorithmObject

Returns the value of attribute cavv_algorithm.



71
72
73
# File 'lib/ews/transaction/request.rb', line 71

def cavv_algorithm
  @cavv_algorithm
end

#cc_expiryObject

Returns the value of attribute cc_expiry.



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

def cc_expiry
  @cc_expiry
end

#cc_numberObject

Returns the value of attribute cc_number.



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

def cc_number
  @cc_number
end

#cc_verification_str1Object

AVS - Address Verification,



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

def cc_verification_str1
  @cc_verification_str1
end

#cc_verification_str2Object

Returns the value of attribute cc_verification_str2.



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

def cc_verification_str2
  @cc_verification_str2
end

#client_emailObject

Returns the value of attribute client_email.



71
72
73
# File 'lib/ews/transaction/request.rb', line 71

def client_email
  @client_email
end

#client_ipObject

Returns the value of attribute client_ip.



71
72
73
# File 'lib/ews/transaction/request.rb', line 71

def client_ip
  @client_ip
end

#customer_refObject

Returns the value of attribute customer_ref.



71
72
73
# File 'lib/ews/transaction/request.rb', line 71

def customer_ref
  @customer_ref
end

#cvd_presence_indObject

Returns the value of attribute cvd_presence_ind.



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

def cvd_presence_ind
  @cvd_presence_ind
end

#ecommerce_flagObject

Returns the value of attribute ecommerce_flag.



71
72
73
# File 'lib/ews/transaction/request.rb', line 71

def ecommerce_flag
  @ecommerce_flag
end

#errorsObject

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



53
54
55
# File 'lib/ews/transaction/request.rb', line 53

def errors
  @errors
end

#gateway_idObject

Returns the value of attribute gateway_id.



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

def gateway_id
  @gateway_id
end

#languageObject

Returns the value of attribute language.



71
72
73
# File 'lib/ews/transaction/request.rb', line 71

def language
  @language
end

#panObject

Returns the value of attribute pan.



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

def pan
  @pan
end

#passwordObject

Returns the value of attribute password.



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

def password
  @password
end

#reference_3Object

Returns the value of attribute reference_3.



71
72
73
# File 'lib/ews/transaction/request.rb', line 71

def reference_3
  @reference_3
end

#reference_noObject

Returns the value of attribute reference_no.



71
72
73
# File 'lib/ews/transaction/request.rb', line 71

def reference_no
  @reference_no
end

#secure_auth_requiredObject

Returns the value of attribute secure_auth_required.



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

def secure_auth_required
  @secure_auth_required
end

#secure_auth_resultObject

Returns the value of attribute secure_auth_result.



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

def secure_auth_result
  @secure_auth_result
end

#surcharge_amountObject

Returns the value of attribute surcharge_amount.



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

def surcharge_amount
  @surcharge_amount
end

#tax1_amountObject

Returns the value of attribute tax1_amount.



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

def tax1_amount
  @tax1_amount
end

#tax1_numberObject

Returns the value of attribute tax1_number.



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

def tax1_number
  @tax1_number
end

#tax2_amountObject

Returns the value of attribute tax2_amount.



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

def tax2_amount
  @tax2_amount
end

#tax2_numberObject

Returns the value of attribute tax2_number.



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

def tax2_number
  @tax2_number
end

#track1Object

Returns the value of attribute track1.



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

def track1
  @track1
end

#track2Object

Returns the value of attribute track2.



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

def track2
  @track2
end

#transaction_tagObject

Returns the value of attribute transaction_tag.



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

def transaction_tag
  @transaction_tag
end

#transaction_typeObject

Returns the value of attribute transaction_type.



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

def transaction_type
  @transaction_type
end

#user_nameObject

Returns the value of attribute user_name.



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

def user_name
  @user_name
end

#xidObject

Returns the value of attribute xid.



71
72
73
# File 'lib/ews/transaction/request.rb', line 71

def xid
  @xid
end

#zip_codeObject

Returns the value of attribute zip_code.



71
72
73
# File 'lib/ews/transaction/request.rb', line 71

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)


94
95
96
# File 'lib/ews/transaction/request.rb', line 94

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