Class: PaysonAPI::Response::IPN

Inherits:
Object
  • Object
show all
Defined in:
lib/payson_api/response/ipn.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_data) ⇒ IPN

Returns a new instance of IPN.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/payson_api/response/ipn.rb', line 9

def initialize(raw_data)
  @raw = raw_data
  data_hash = PaysonAPI::Client.params_to_hash(raw_data)
  @purchase_id = data_hash['purchaseId']
  @payment_type = data_hash['type']
  @comment = data_hash['custom']
  @tracking_id = data_hash['trackingId']
  @currency = data_hash['currencyCode']
  @sender_email = data_hash['senderEmail']
  @status = data_hash['status']
  @token = data_hash['token']
  @fundings = Funding.parse(data_hash)
  @receivers = Receiver.parse(data_hash)
  @order_items = OrderItem.parse(data_hash)
  @hash = data_hash['HASH']

  case @payment_type
  when 'GUARANTEE'
    @guarantee_status = data_hash['guaranteeStatus']
    @guarantee_deadline_at = Time.parse(data_hash['guaranteeDeadlineTimestamp'])
  when 'INVOICE'
    @invoice_status = data_hash['invoiceStatus']
    @shipping_address = ShippingAddress.parse(data_hash)
  end
end

Instance Attribute Details

#currencyObject

Returns the value of attribute currency.



4
5
6
# File 'lib/payson_api/response/ipn.rb', line 4

def currency
  @currency
end

#customObject

Returns the value of attribute custom.



4
5
6
# File 'lib/payson_api/response/ipn.rb', line 4

def custom
  @custom
end

#fundingsObject

Returns the value of attribute fundings.



4
5
6
# File 'lib/payson_api/response/ipn.rb', line 4

def fundings
  @fundings
end

#guarantee_deadline_atObject

Returns the value of attribute guarantee_deadline_at.



4
5
6
# File 'lib/payson_api/response/ipn.rb', line 4

def guarantee_deadline_at
  @guarantee_deadline_at
end

#guarantee_statusObject

Returns the value of attribute guarantee_status.



4
5
6
# File 'lib/payson_api/response/ipn.rb', line 4

def guarantee_status
  @guarantee_status
end

#hashObject

Returns the value of attribute hash.



4
5
6
# File 'lib/payson_api/response/ipn.rb', line 4

def hash
  @hash
end

#invoice_statusObject

Returns the value of attribute invoice_status.



4
5
6
# File 'lib/payson_api/response/ipn.rb', line 4

def invoice_status
  @invoice_status
end

#order_itemsObject

Returns the value of attribute order_items.



4
5
6
# File 'lib/payson_api/response/ipn.rb', line 4

def order_items
  @order_items
end

#payment_typeObject

Returns the value of attribute payment_type.



4
5
6
# File 'lib/payson_api/response/ipn.rb', line 4

def payment_type
  @payment_type
end

#purchase_idObject

Returns the value of attribute purchase_id.



4
5
6
# File 'lib/payson_api/response/ipn.rb', line 4

def purchase_id
  @purchase_id
end

#rawObject

Returns the value of attribute raw.



4
5
6
# File 'lib/payson_api/response/ipn.rb', line 4

def raw
  @raw
end

#receiversObject

Returns the value of attribute receivers.



4
5
6
# File 'lib/payson_api/response/ipn.rb', line 4

def receivers
  @receivers
end

#sender_emailObject

Returns the value of attribute sender_email.



4
5
6
# File 'lib/payson_api/response/ipn.rb', line 4

def sender_email
  @sender_email
end

#shipping_addressObject

Returns the value of attribute shipping_address.



4
5
6
# File 'lib/payson_api/response/ipn.rb', line 4

def shipping_address
  @shipping_address
end

#statusObject

Returns the value of attribute status.



4
5
6
# File 'lib/payson_api/response/ipn.rb', line 4

def status
  @status
end

#tokenObject

Returns the value of attribute token.



4
5
6
# File 'lib/payson_api/response/ipn.rb', line 4

def token
  @token
end

#tracking_idObject

Returns the value of attribute tracking_id.



4
5
6
# File 'lib/payson_api/response/ipn.rb', line 4

def tracking_id
  @tracking_id
end