Class: Safecharge::Response
- Inherits:
-
Object
- Object
- Safecharge::Response
- Defined in:
- lib/safecharge/response.rb
Constant Summary collapse
- ALLOWED_FIELDS =
[ 'Status', 'totalAmount', 'TransactionID', 'ClientUniqueID', 'ErrCode', 'ExErrCode', 'AuthCode', 'Reason', 'Token', 'ReasonCode', 'advanceResponseChecksum', 'ECI', 'nameOnCard', 'currency', 'total_discount', 'total_handling', 'total_shipping', 'total_tax', 'customData', 'merchant_unique_id', 'merchant_site_id', 'requestVersion', 'message', 'Error', 'PPP_TransactionID', 'UserID', 'ProductID', 'ppp_status', 'merchantLocale', 'unknownParameters', 'webMasterId' ]
Instance Attribute Summary collapse
-
#params ⇒ Object
Returns the value of attribute params.
Class Method Summary collapse
Instance Method Summary collapse
- #decode(param_string) ⇒ Object
-
#initialize(incoming_encoded_params = nil) ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize(incoming_encoded_params = nil) ⇒ Response
Returns a new instance of Response.
22 23 24 |
# File 'lib/safecharge/response.rb', line 22 def initialize(incoming_encoded_params = nil) self.params = self.decode(incoming_encoded_params) end |
Instance Attribute Details
#params ⇒ Object
Returns the value of attribute params.
9 10 11 |
# File 'lib/safecharge/response.rb', line 9 def params @params end |
Class Method Details
.code(err, exerr) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/safecharge/response.rb', line 31 def self.code(err, exerr) return Safecharge::Constants::APPROVED if err == 0 && exerr == 0 return Safecharge::Constants::DECLINED if err == -1 && exerr == 0 # pending? see p 22 of the spec return Safecharge::Constants::ERROR if err == -1100 && exerr > 0 # could be more specific. see p 22 of the spec for exerr codes return Safecharge::Constants::BANK_ERROR if err < 0 && exerr != 0 return Safecharge::Constants::INVALID_LOGIN if err == -1001 return Safecharge::Constants::INVALID_IP if err == -1005 return Safecharge::Constants::TIMEOUT if err == -1203 return Safecharge::Constants::UNKNOWN_ERROR end |
Instance Method Details
#decode(param_string) ⇒ Object
26 27 28 29 |
# File 'lib/safecharge/response.rb', line 26 def decode(param_string) #todo write this. return {} end |