Class: SecureTrading::Requests::TDSQuery
- Inherits:
-
SecureTrading::Request
- Object
- SecureTrading::Request
- SecureTrading::Requests::TDSQuery
- Defined in:
- lib/secure_trading/requests/tds_query.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#currency ⇒ Object
Returns the value of attribute currency.
-
#merchant_name ⇒ Object
Returns the value of attribute merchant_name.
-
#order ⇒ Object
Returns the value of attribute order.
-
#payment_method ⇒ Object
Returns the value of attribute payment_method.
-
#term_url ⇒ Object
Returns the value of attribute term_url.
-
#user_agent ⇒ Object
Returns the value of attribute user_agent.
Attributes inherited from SecureTrading::Request
Instance Method Summary collapse
- #enrollment_status ⇒ Object
- #invalid_details? ⇒ Boolean
- #is_enrolled? ⇒ Boolean
-
#request_3d_auth? ⇒ Boolean
Should we perform a 3d auth for this card?.
- #request_type ⇒ Object
- #to_hash ⇒ Object
Methods inherited from SecureTrading::Request
#error_message, #initialize, #process, #sanitized_xml_request, #xml_request
Constructor Details
This class inherits a constructor from SecureTrading::Request
Instance Attribute Details
#amount ⇒ Object
Returns the value of attribute amount.
5 6 7 |
# File 'lib/secure_trading/requests/tds_query.rb', line 5 def amount @amount end |
#currency ⇒ Object
Returns the value of attribute currency.
5 6 7 |
# File 'lib/secure_trading/requests/tds_query.rb', line 5 def currency @currency end |
#merchant_name ⇒ Object
Returns the value of attribute merchant_name.
5 6 7 |
# File 'lib/secure_trading/requests/tds_query.rb', line 5 def merchant_name @merchant_name end |
#order ⇒ Object
Returns the value of attribute order.
5 6 7 |
# File 'lib/secure_trading/requests/tds_query.rb', line 5 def order @order end |
#payment_method ⇒ Object
Returns the value of attribute payment_method.
5 6 7 |
# File 'lib/secure_trading/requests/tds_query.rb', line 5 def payment_method @payment_method end |
#term_url ⇒ Object
Returns the value of attribute term_url.
5 6 7 |
# File 'lib/secure_trading/requests/tds_query.rb', line 5 def term_url @term_url end |
#user_agent ⇒ Object
Returns the value of attribute user_agent.
5 6 7 |
# File 'lib/secure_trading/requests/tds_query.rb', line 5 def user_agent @user_agent end |
Instance Method Details
#enrollment_status ⇒ Object
42 43 44 |
# File 'lib/secure_trading/requests/tds_query.rb', line 42 def enrollment_status self.response.operation_response['Enrolled'] end |
#invalid_details? ⇒ Boolean
26 27 28 29 30 |
# File 'lib/secure_trading/requests/tds_query.rb', line 26 def invalid_details? ## This can actually mean quite a few other things but for now we're assuming the card details are invalid ## as this is the most likely cause for result 0 self.response.result == 0 end |
#is_enrolled? ⇒ Boolean
38 39 40 |
# File 'lib/secure_trading/requests/tds_query.rb', line 38 def is_enrolled? self.response.operation_response['Enrolled'].upcase == 'Y' end |
#request_3d_auth? ⇒ Boolean
Should we perform a 3d auth for this card?
33 34 35 36 |
# File 'lib/secure_trading/requests/tds_query.rb', line 33 def request_3d_auth? return false if self.response.result == 2 self.response.result == 1 && ['Y', 'N', 'U'].include?(self.response.operation_response['Enrolled']) end |
#request_type ⇒ Object
7 8 9 |
# File 'lib/secure_trading/requests/tds_query.rb', line 7 def request_type 'ST3DCARDQUERY' end |
#to_hash ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/secure_trading/requests/tds_query.rb', line 11 def to_hash { 'Operation' => { 'SiteReference' => self.connection.site_reference, 'Amount' => self.amount, 'Currency' => self.currency || 'GBP', 'TermUrl' => self.term_url, 'MerchantName' => self.merchant_name }, 'CustomerInfo' => self.user_agent, 'PaymentMethod' => {'CreditCard' => self.payment_method }, 'Order' => self.order } end |