Class: SallieMaeGateway::Response
- Inherits:
-
Object
- Object
- SallieMaeGateway::Response
- Defined in:
- app/models/sallie_mae_gateway/response.rb
Constant Summary collapse
- SUCCESS_INDICATOR =
{ 'A' => 'Credit Card Accepted', 'S' => 'ACH Scheduled', 'D' => 'Declined', 'P' => 'Pending', 'C' => 'Canceled' }.freeze
- PAYMENT_INDICATOR =
{ 'AX' => 'American Express', 'DI' => 'Discover Card', 'DN' => 'Diners Club', 'CB' => 'Carte Blanche', 'JC' => 'JCB', 'MC' => 'Master Card', 'VI' => 'Visa', 'CK' => 'Checking Account', 'SV' => 'Savings Account' }.freeze
Instance Attribute Summary collapse
-
#raw_response ⇒ Object
Returns the value of attribute raw_response.
Instance Method Summary collapse
- #canceled? ⇒ Boolean
-
#initialize(args = nil) ⇒ Response
constructor
A new instance of Response.
- #payment_method ⇒ Object
- #success? ⇒ Boolean
- #success_message ⇒ Object
Constructor Details
#initialize(args = nil) ⇒ Response
Returns a new instance of Response.
28 29 30 31 32 33 |
# File 'app/models/sallie_mae_gateway/response.rb', line 28 def initialize(args=nil) if args.is_a? Hash @raw_response = args process_response end end |
Instance Attribute Details
#raw_response ⇒ Object
Returns the value of attribute raw_response.
26 27 28 |
# File 'app/models/sallie_mae_gateway/response.rb', line 26 def raw_response @raw_response end |
Instance Method Details
#canceled? ⇒ Boolean
40 41 42 43 |
# File 'app/models/sallie_mae_gateway/response.rb', line 40 def canceled? raise 'Unable to determine status. Has a response been provided?' unless self.respond_to? :success_indicator self.success_indicator.eql? CANCELED end |
#payment_method ⇒ Object
55 56 57 58 |
# File 'app/models/sallie_mae_gateway/response.rb', line 55 def payment_method raise 'Unable to determine payment method. Has a response been provided?' unless self.respond_to? :pmt_indicator PAYMENT_INDICATOR[self.pmt_indicator] end |
#success? ⇒ Boolean
45 46 47 48 |
# File 'app/models/sallie_mae_gateway/response.rb', line 45 def success? raise 'Unable to determine status. Has a response been provided?' unless self.respond_to? :success_indicator self.success_indicator.eql? SUCCESS end |
#success_message ⇒ Object
50 51 52 53 |
# File 'app/models/sallie_mae_gateway/response.rb', line 50 def raise 'Unable to determine status. Has a response been provided?' unless self.respond_to? :success_indicator SUCCESS_INDICATOR[self.success_indicator] end |