Class: Vpago::WingSdk::TransactionStatusResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/vpago/wing_sdk/transaction_status_response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(wing_payment_source) ⇒ TransactionStatusResponse

Returns a new instance of TransactionStatusResponse.



6
7
8
9
# File 'lib/vpago/wing_sdk/transaction_status_response.rb', line 6

def initialize(wing_payment_source)
  @wing_payment_source = wing_payment_source
  @result = {}
end

Instance Attribute Details

#resultObject

Returns the value of attribute result.



4
5
6
# File 'lib/vpago/wing_sdk/transaction_status_response.rb', line 4

def result
  @result
end

Instance Method Details

#callObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/vpago/wing_sdk/transaction_status_response.rb', line 11

def call
  return unless @wing_payment_source.preferred_wing_response.present?

  wing_response = @wing_payment_source.preferred_wing_response.with_indifferent_access

  @result = {
    response_code: 200,
    response_msg: 'Transaction success',
    customer_name: wing_response['customer_name'],
    amount: wing_response['amount'],
    currency: wing_response['currency'],
    partner_txn_id: @wing_payment_source.payment.number,
    transaction_id: wing_response['transaction_id'],
    transaction_date: wing_response['transaction_date']
  }
end

#success?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/vpago/wing_sdk/transaction_status_response.rb', line 28

def success?
  @result.present?
end