Class: ActiveMerchant::Billing::Integrations::Pxpay::Notification
- Inherits:
-
Notification
- Object
- Notification
- ActiveMerchant::Billing::Integrations::Pxpay::Notification
show all
- Includes:
- PostsData, RequiresParameters
- Defined in:
- lib/active_merchant/billing/integrations/pxpay/notification.rb
Instance Attribute Summary
Attributes inherited from Notification
#params, #raw
Instance Method Summary
collapse
#amount, #empty!, #gross_cents, #valid_sender?
Constructor Details
#initialize(query_string, options = {}) ⇒ Notification
Returns a new instance of Notification.
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/active_merchant/billing/integrations/pxpay/notification.rb', line 10
def initialize(query_string, options={})
query_string[/\?/] = '&' if query_string[/\?/]
super
@encrypted_params = @params
@params = {}
requires! @encrypted_params, "result"
requires! @options, :credential1, :credential2
decrypt_transaction_result(@encrypted_params["result"])
end
|
Instance Method Details
#account ⇒ Object
59
60
61
|
# File 'lib/active_merchant/billing/integrations/pxpay/notification.rb', line 59
def account
@params['userid']
end
|
#acknowledge(authcode = nil) ⇒ Object
was the notification a validly formed request?
26
27
28
|
# File 'lib/active_merchant/billing/integrations/pxpay/notification.rb', line 26
def acknowledge(authcode = nil)
@valid == '1'
end
|
#auth_code ⇒ Object
71
72
73
|
# File 'lib/active_merchant/billing/integrations/pxpay/notification.rb', line 71
def auth_code
@params['AuthCode']
end
|
#cancelled? ⇒ Boolean
40
41
42
|
# File 'lib/active_merchant/billing/integrations/pxpay/notification.rb', line 40
def cancelled?
!success?
end
|
#card_holder_name ⇒ Object
79
80
81
|
# File 'lib/active_merchant/billing/integrations/pxpay/notification.rb', line 79
def card_holder_name
@params['CardHolderName']
end
|
#card_number ⇒ Object
83
84
85
|
# File 'lib/active_merchant/billing/integrations/pxpay/notification.rb', line 83
def card_number
@params['CardNumber']
end
|
#card_type ⇒ Object
75
76
77
|
# File 'lib/active_merchant/billing/integrations/pxpay/notification.rb', line 75
def card_type
@params['CardName']
end
|
#client_ip ⇒ Object
91
92
93
|
# File 'lib/active_merchant/billing/integrations/pxpay/notification.rb', line 91
def client_ip
@params['ClientInfo']
end
|
#complete? ⇒ Boolean
36
37
38
|
# File 'lib/active_merchant/billing/integrations/pxpay/notification.rb', line 36
def complete?
@params['TxnType'] == 'Purchase' && success?
end
|
#currency ⇒ Object
55
56
57
|
# File 'lib/active_merchant/billing/integrations/pxpay/notification.rb', line 55
def currency
@params['CurrencySettlement']
end
|
67
68
69
|
# File 'lib/active_merchant/billing/integrations/pxpay/notification.rb', line 67
def currency_input
@params['CurrencyInput']
end
|
#expiry_date ⇒ Object
87
88
89
|
# File 'lib/active_merchant/billing/integrations/pxpay/notification.rb', line 87
def expiry_date
@params['DateExpiry']
end
|
#gross ⇒ Object
51
52
53
|
# File 'lib/active_merchant/billing/integrations/pxpay/notification.rb', line 51
def gross
@params['AmountSettlement']
end
|
#item_id ⇒ Object
63
64
65
|
# File 'lib/active_merchant/billing/integrations/pxpay/notification.rb', line 63
def item_id
@params['TxnId']
end
|
#message ⇒ Object
116
117
118
|
# File 'lib/active_merchant/billing/integrations/pxpay/notification.rb', line 116
def message
@params['ResponseText']
end
|
#optional_data ⇒ Object
120
121
122
|
# File 'lib/active_merchant/billing/integrations/pxpay/notification.rb', line 120
def optional_data
[@params['TxnData1'],@fields['TxnData2'],@fields['TxnData3']]
end
|
#order_id ⇒ Object
95
96
97
|
# File 'lib/active_merchant/billing/integrations/pxpay/notification.rb', line 95
def order_id
item_id
end
|
#payer_email ⇒ Object
99
100
101
|
# File 'lib/active_merchant/billing/integrations/pxpay/notification.rb', line 99
def payer_email
@params['EmailAddress']
end
|
#received_at ⇒ Object
When was this payment was received by the client.
125
126
127
|
# File 'lib/active_merchant/billing/integrations/pxpay/notification.rb', line 125
def received_at
settlement_date
end
|
#settlement_date ⇒ Object
107
108
109
|
# File 'lib/active_merchant/billing/integrations/pxpay/notification.rb', line 107
def settlement_date
@params['DateSettlement']
end
|
#status ⇒ Object
30
31
32
33
34
|
# File 'lib/active_merchant/billing/integrations/pxpay/notification.rb', line 30
def status
return 'Failed' unless success?
return 'Completed' if complete?
'Error'
end
|
#success? ⇒ Boolean
47
48
49
|
# File 'lib/active_merchant/billing/integrations/pxpay/notification.rb', line 47
def success?
@params['Success'] == '1'
end
|
#test? ⇒ Boolean
Was this a test transaction?
130
131
132
|
# File 'lib/active_merchant/billing/integrations/pxpay/notification.rb', line 130
def test?
nil
end
|
#transaction_id ⇒ Object
103
104
105
|
# File 'lib/active_merchant/billing/integrations/pxpay/notification.rb', line 103
def transaction_id
@params['DpsTxnRef']
end
|
#txn_mac ⇒ Object
Indication of the uniqueness of a card number
112
113
114
|
# File 'lib/active_merchant/billing/integrations/pxpay/notification.rb', line 112
def txn_mac
@params['TxnMac']
end
|