Class: ActiveMerchant::Billing::Integrations::SagePayForm::Notification
- Inherits:
-
Notification
- Object
- Notification
- ActiveMerchant::Billing::Integrations::SagePayForm::Notification
- Includes:
- Encryption
- Defined in:
- lib/active_merchant/billing/integrations/sage_pay_form/notification.rb
Defined Under Namespace
Classes: CryptError, InvalidCryptData, MissingCryptData, MissingCryptKey
Instance Attribute Summary
Attributes inherited from Notification
Instance Method Summary collapse
- #acknowledge ⇒ Object
-
#address_result ⇒ Object
Numeric address check.
-
#address_status ⇒ Object
Address confirmation status.
-
#auth_id ⇒ Object
Authorization number (only if #completed?).
-
#avs_cv2_result ⇒ Object
AVS and CV2 check results.
-
#buyer_auth_result ⇒ Object
Result of 3D Secure checks.
-
#buyer_auth_result_code ⇒ Object
Encoded 3D Secure result code.
-
#cancelled? ⇒ Boolean
Was the transaction cancelled? Unfortunately, we can’t distinguish “user abort” from “idle too long”.
-
#complete? ⇒ Boolean
Was the transaction complete?.
-
#credit_card_last_4_digits ⇒ Object
Last four digits of credit card.
-
#credit_card_type ⇒ Object
Credit card type.
-
#currency ⇒ Object
Used by composition methods, but not supplied by SagePay.
-
#cv2_result ⇒ Object
CV2 code check.
-
#gift_aid? ⇒ Boolean
Was the Gift Aid box checked?.
-
#gross ⇒ Object
Total amount (no fees).
-
#initialize(post_data, options) ⇒ Notification
constructor
A new instance of Notification.
-
#item_id ⇒ Object
Vendor-supplied code (:order mapping).
-
#message ⇒ Object
Check this if #completed? is false.
-
#payer_verified? ⇒ Boolean
Payer verification.
-
#post_code_result ⇒ Object
Post code check.
-
#status ⇒ Object
Text version of #complete?, since we don’t support Pending.
-
#status_code ⇒ Object
Status of transaction.
- #test? ⇒ Boolean
-
#transaction_id ⇒ Object
Internal SagePay code, typically “LONG-UUID”.
Methods included from Encryption
#sage_decrypt, #sage_encrypt, #sage_encrypt_salt
Methods inherited from Notification
#amount, #empty!, #gross_cents, #valid_sender?
Constructor Details
#initialize(post_data, options) ⇒ Notification
Returns a new instance of Notification.
12 13 14 15 |
# File 'lib/active_merchant/billing/integrations/sage_pay_form/notification.rb', line 12 def initialize(post_data, ) super load_crypt_params(params['crypt'], [:credential2]) end |
Instance Method Details
#acknowledge ⇒ Object
173 174 175 |
# File 'lib/active_merchant/billing/integrations/sage_pay_form/notification.rb', line 173 def acknowledge true end |
#address_result ⇒ Object
Numeric address check. Possible values:
NOTPROVIDED
NOTCHECKED
MATCHED
NOTMATCHED
87 88 89 |
# File 'lib/active_merchant/billing/integrations/sage_pay_form/notification.rb', line 87 def address_result params['AddressResult'] end |
#address_status ⇒ Object
Address confirmation status. PayPal only. Possible values:
NONE
CONFIRMED
UNCONFIRMED
134 135 136 |
# File 'lib/active_merchant/billing/integrations/sage_pay_form/notification.rb', line 134 def address_status params['AddressStatus'] end |
#auth_id ⇒ Object
Authorization number (only if #completed?).
63 64 65 |
# File 'lib/active_merchant/billing/integrations/sage_pay_form/notification.rb', line 63 def auth_id params['TxAuthNo'] end |
#avs_cv2_result ⇒ Object
AVS and CV2 check results. Possible values:
ALL MATCH
SECURITY CODE MATCH ONLY
ADDRESS MATCH ONLY
NO DATA MATCHES
DATA NOT CHECKED
78 79 80 |
# File 'lib/active_merchant/billing/integrations/sage_pay_form/notification.rb', line 78 def avs_cv2_result params['AVSCV2'] end |
#buyer_auth_result ⇒ Object
Result of 3D Secure checks. Possible values:
OK
-
Authenticated correctly.
NOTCHECKED
-
Authentication not performed.
NOTAVAILABLE
-
Card not auth-capable, or auth is otherwise impossible.
NOTAUTHED
-
User failed authentication.
INCOMPLETE
-
Authentication unable to complete.
ERROR
-
Unable to attempt authentication due to data / service errors.
121 122 123 |
# File 'lib/active_merchant/billing/integrations/sage_pay_form/notification.rb', line 121 def buyer_auth_result params['3DSecureStatus'] end |
#buyer_auth_result_code ⇒ Object
Encoded 3D Secure result code.
126 127 128 |
# File 'lib/active_merchant/billing/integrations/sage_pay_form/notification.rb', line 126 def buyer_auth_result_code params['CAVV'] end |
#cancelled? ⇒ Boolean
Was the transaction cancelled? Unfortunately, we can’t distinguish “user abort” from “idle too long”.
24 25 26 |
# File 'lib/active_merchant/billing/integrations/sage_pay_form/notification.rb', line 24 def cancelled? status_code == 'ABORT' end |
#complete? ⇒ Boolean
Was the transaction complete?
18 19 20 |
# File 'lib/active_merchant/billing/integrations/sage_pay_form/notification.rb', line 18 def complete? status_code == 'OK' end |
#credit_card_last_4_digits ⇒ Object
Last four digits of credit card.
160 161 162 |
# File 'lib/active_merchant/billing/integrations/sage_pay_form/notification.rb', line 160 def credit_card_last_4_digits params['Last4Digits'] end |
#credit_card_type ⇒ Object
Credit card type. Possible values:
VISA
-
Visa
MC
-
MasterCard
DELTA
-
Delta
SOLO
-
Solo
MAESTRO
-
Maestro (UK and International)
UKE
-
Visa Electron
AMEX
-
American Express
DC
-
Diners Club
JCB
-
JCB
LASER
-
Laser
PAYPAL
-
PayPal
155 156 157 |
# File 'lib/active_merchant/billing/integrations/sage_pay_form/notification.rb', line 155 def credit_card_type params['CardType'] end |
#currency ⇒ Object
Used by composition methods, but not supplied by SagePay.
165 166 167 |
# File 'lib/active_merchant/billing/integrations/sage_pay_form/notification.rb', line 165 def currency nil end |
#cv2_result ⇒ Object
CV2 code check. Possible values:
NOTPROVIDED
NOTCHECKED
MATCHED
NOTMATCHED
105 106 107 |
# File 'lib/active_merchant/billing/integrations/sage_pay_form/notification.rb', line 105 def cv2_result params['CV2Result'] end |
#gift_aid? ⇒ Boolean
Was the Gift Aid box checked?
110 111 112 |
# File 'lib/active_merchant/billing/integrations/sage_pay_form/notification.rb', line 110 def gift_aid? params['GiftAid'] == '1' end |
#gross ⇒ Object
Total amount (no fees).
68 69 70 |
# File 'lib/active_merchant/billing/integrations/sage_pay_form/notification.rb', line 68 def gross params['Amount'] end |
#item_id ⇒ Object
Vendor-supplied code (:order mapping).
53 54 55 |
# File 'lib/active_merchant/billing/integrations/sage_pay_form/notification.rb', line 53 def item_id params['VendorTxCode'] end |
#message ⇒ Object
Check this if #completed? is false.
48 49 50 |
# File 'lib/active_merchant/billing/integrations/sage_pay_form/notification.rb', line 48 def params['StatusDetail'] end |
#payer_verified? ⇒ Boolean
Payer verification. Undocumented.
139 140 141 |
# File 'lib/active_merchant/billing/integrations/sage_pay_form/notification.rb', line 139 def payer_verified? params['PayerStatus'] == 'VERIFIED' end |
#post_code_result ⇒ Object
Post code check. Possible values:
NOTPROVIDED
NOTCHECKED
MATCHED
NOTMATCHED
96 97 98 |
# File 'lib/active_merchant/billing/integrations/sage_pay_form/notification.rb', line 96 def post_code_result params['PostCodeResult'] end |
#status ⇒ Object
Text version of #complete?, since we don’t support Pending.
29 30 31 |
# File 'lib/active_merchant/billing/integrations/sage_pay_form/notification.rb', line 29 def status complete? ? 'Completed' : 'Failed' end |
#status_code ⇒ Object
Status of transaction. List of possible values:
OK
-
Transaction completed successfully.
NOTAUTHED
-
Incorrect card details / insufficient funds.
MALFORMED
-
Invalid input data.
INVALID
-
Valid input data, but some fields are incorrect.
ABORT
-
User hit cancel button or went idle for 15+ minutes.
REJECTED
-
Rejected by account fraud screening rules.
AUTHENTICATED
-
Authenticated card details secured at SagePay.
REGISTERED
-
Non-authenticated card details secured at SagePay.
ERROR
-
Problem internal to SagePay.
43 44 45 |
# File 'lib/active_merchant/billing/integrations/sage_pay_form/notification.rb', line 43 def status_code params['Status'] end |
#test? ⇒ Boolean
169 170 171 |
# File 'lib/active_merchant/billing/integrations/sage_pay_form/notification.rb', line 169 def test? false end |
#transaction_id ⇒ Object
Internal SagePay code, typically “LONG-UUID”.
58 59 60 |
# File 'lib/active_merchant/billing/integrations/sage_pay_form/notification.rb', line 58 def transaction_id params['VPSTxId'] end |