Class: ActiveMerchant::Billing::Integrations::SagePayForm::Notification

Inherits:
Notification
  • Object
show all
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

#params, #raw

Instance Method Summary collapse

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, options)
  super
  load_crypt_params(params['crypt'], options[:credential2])
end

Instance Method Details

#acknowledgeObject



167
168
169
# File 'lib/active_merchant/billing/integrations/sage_pay_form/notification.rb', line 167

def acknowledge      
  true
end

#address_resultObject

Numeric address check. Possible values:

NOTPROVIDED
NOTCHECKED
MATCHED
NOTMATCHED


81
82
83
# File 'lib/active_merchant/billing/integrations/sage_pay_form/notification.rb', line 81

def address_result
  params['AddressResult']
end

#address_statusObject

Address confirmation status. PayPal only. Possible values:

NONE
CONFIRMED
UNCONFIRMED


128
129
130
# File 'lib/active_merchant/billing/integrations/sage_pay_form/notification.rb', line 128

def address_status
  params['AddressStatus']
end

#auth_idObject

Authorization number (only if #completed?).



57
58
59
# File 'lib/active_merchant/billing/integrations/sage_pay_form/notification.rb', line 57

def auth_id
  params['TxAuthNo']
end

#avs_cv2_resultObject

AVS and CV2 check results. Possible values:

ALL MATCH
SECURITY CODE MATCH ONLY
ADDRESS MATCH ONLY
NO DATA MATCHES
DATA NOT CHECKED


72
73
74
# File 'lib/active_merchant/billing/integrations/sage_pay_form/notification.rb', line 72

def avs_cv2_result
  params['AVSCV2']
end

#buyer_auth_resultObject

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.



115
116
117
# File 'lib/active_merchant/billing/integrations/sage_pay_form/notification.rb', line 115

def buyer_auth_result
  params['3DSecureStatus']
end

#buyer_auth_result_codeObject

Encoded 3D Secure result code.



120
121
122
# File 'lib/active_merchant/billing/integrations/sage_pay_form/notification.rb', line 120

def buyer_auth_result_code
  params['CAVV']
end

#complete?Boolean

Was the transaction complete?

Returns:

  • (Boolean)


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_digitsObject

Last four digits of credit card.



154
155
156
# File 'lib/active_merchant/billing/integrations/sage_pay_form/notification.rb', line 154

def credit_card_last_4_digits
  params['Last4Digits']
end

#credit_card_typeObject

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



149
150
151
# File 'lib/active_merchant/billing/integrations/sage_pay_form/notification.rb', line 149

def credit_card_type
  params['CardType']
end

#currencyObject

Used by composition methods, but not supplied by SagePay.



159
160
161
# File 'lib/active_merchant/billing/integrations/sage_pay_form/notification.rb', line 159

def currency
  nil
end

#cv2_resultObject

CV2 code check. Possible values:

NOTPROVIDED
NOTCHECKED
MATCHED
NOTMATCHED


99
100
101
# File 'lib/active_merchant/billing/integrations/sage_pay_form/notification.rb', line 99

def cv2_result
  params['CV2Result']
end

#gift_aid?Boolean

Was the Gift Aid box checked?

Returns:

  • (Boolean)


104
105
106
# File 'lib/active_merchant/billing/integrations/sage_pay_form/notification.rb', line 104

def gift_aid?
  params['GiftAid'] == '1'
end

#grossObject

Total amount (no fees).



62
63
64
# File 'lib/active_merchant/billing/integrations/sage_pay_form/notification.rb', line 62

def gross
  params['Amount']
end

#item_idObject

Vendor-supplied code (:order mapping).



47
48
49
# File 'lib/active_merchant/billing/integrations/sage_pay_form/notification.rb', line 47

def item_id
  params['VendorTxCode']
end

#messageObject

Check this if #completed? is false.



42
43
44
# File 'lib/active_merchant/billing/integrations/sage_pay_form/notification.rb', line 42

def message
  params['StatusDetail']
end

#payer_verified?Boolean

Payer verification. Undocumented.

Returns:

  • (Boolean)


133
134
135
# File 'lib/active_merchant/billing/integrations/sage_pay_form/notification.rb', line 133

def payer_verified?
  params['PayerStatus'] == 'VERIFIED'
end

#post_code_resultObject

Post code check. Possible values:

NOTPROVIDED
NOTCHECKED
MATCHED
NOTMATCHED


90
91
92
# File 'lib/active_merchant/billing/integrations/sage_pay_form/notification.rb', line 90

def post_code_result
  params['PostCodeResult']
end

#statusObject

Text version of #complete?, since we don’t support Pending.



23
24
25
# File 'lib/active_merchant/billing/integrations/sage_pay_form/notification.rb', line 23

def status
  complete? ? 'Completed' : 'Failed'
end

#status_codeObject

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.



37
38
39
# File 'lib/active_merchant/billing/integrations/sage_pay_form/notification.rb', line 37

def status_code
  params['Status']
end

#test?Boolean

Returns:

  • (Boolean)


163
164
165
# File 'lib/active_merchant/billing/integrations/sage_pay_form/notification.rb', line 163

def test?
  false
end

#transaction_idObject

Internal SagePay code, typically “LONG-UUID”.



52
53
54
# File 'lib/active_merchant/billing/integrations/sage_pay_form/notification.rb', line 52

def transaction_id
  params['VPSTxId']
end