Class: Vpago::AcledaV2::TransactionStatus
- Inherits:
-
Base
- Object
- Base
- Vpago::AcledaV2::TransactionStatus
show all
- Defined in:
- lib/vpago/acleda_v2/transaction_status.rb
Constant Summary
collapse
- FAILED_ERROR_DETAILS =
Terminal failure indicators in result.errorDetails. The PDFs only document
code 0 / "SUCCESS"; decline/expiry wording is conservative and should be
confirmed against real responses during UAT. Anything not success and not
terminal is treated as pending so the poller keeps trying.
%w[EXPIRED DECLINED CANCELLED FAILED REJECTED].freeze
Constants inherited
from Base
Base::CONTENT_TYPE_JSON, Base::PURCHASE_DESC
Instance Method Summary
collapse
Methods inherited from Base
#action_url, #amount, #app_scheme, #callback_url, #continue_success_url, #deeplink?, #expiry_time, #get_txn_status_url, #hmac512, #initialize, #login_id, #merchant_id, #merchant_name, #open_session_hash, #open_session_url, #opr_device, #order_number, #parse_json, #password, #payment_method, #payment_number, #platform, #purchase_currency, #purchase_date, #secret, #txn_status_hash, #xpay_service_base_url
Instance Method Details
#call ⇒ Object
12
13
14
15
|
# File 'lib/vpago/acleda_v2/transaction_status.rb', line 12
def call
@response = check_remote_status
self
end
|
#error_message ⇒ Object
29
30
31
|
# File 'lib/vpago/acleda_v2/transaction_status.rb', line 29
def error_message
result['errorDetails']
end
|
#failed? ⇒ Boolean
39
40
41
42
43
44
|
# File 'lib/vpago/acleda_v2/transaction_status.rb', line 39
def failed?
return false if token.blank?
return false unless http_success?
FAILED_ERROR_DETAILS.include?(error_message.to_s.upcase)
end
|
#json_response ⇒ Object
17
18
19
|
# File 'lib/vpago/acleda_v2/transaction_status.rb', line 17
def json_response
@json_response ||= parse_json(@response.body)
end
|
#pending? ⇒ Boolean
46
47
48
|
# File 'lib/vpago/acleda_v2/transaction_status.rb', line 46
def pending?
!success? && !failed?
end
|
#result ⇒ Object
21
22
23
|
# File 'lib/vpago/acleda_v2/transaction_status.rb', line 21
def result
json_response['result'] || {}
end
|
#result_code ⇒ Object
25
26
27
|
# File 'lib/vpago/acleda_v2/transaction_status.rb', line 25
def result_code
result['code']
end
|
#success? ⇒ Boolean
33
34
35
36
37
|
# File 'lib/vpago/acleda_v2/transaction_status.rb', line 33
def success?
return false if token.blank?
http_success? && result_code.zero? && error_message == 'SUCCESS'
end
|