class PaysonAPI::V1::Responses::PaymentDetails
Attributes
currency[RW]
custom[RW]
envelope[RW]
errors[RW]
fundings[RW]
guarantee_deadline_at[RW]
guarantee_status[RW]
invoice_status[RW]
order_items[RW]
payment_type[RW]
purchase_id[RW]
receivers[RW]
sender_email[RW]
shipping_address[RW]
status[RW]
token[RW]
tracking_id[RW]
Public Class Methods
new(data)
click to toggle source
# File lib/payson_api/v1/responses/payment_details.rb, line 14 def initialize(data) @envelope = PaysonAPI::V1::Envelope.parse(data) @purchase_id = data['purchaseId'] @payment_type = data['type'] @comment = data['custom'] @tracking_id = data['trackingId'] @currency = data['currencyCode'] @sender_email = data['senderEmail'] @status = data['status'] @token = data['token'] @fundings = PaysonAPI::V1::Funding.parse(data) @receivers = PaysonAPI::V1::Receiver.parse(data) @order_items = PaysonAPI::V1::OrderItem.parse(data) @errors = PaysonAPI::V1::RemoteError.parse(data) append_payment_type_conditionals end
Public Instance Methods
append_payment_type_conditionals()
click to toggle source
# File lib/payson_api/v1/responses/payment_details.rb, line 31 def append_payment_type_conditionals case @payment_type when 'GUARANTEE' @guarantee_status = data['guaranteeStatus'] @guarantee_deadline_at = Time.parse(CGI.unescape(data['guaranteeDeadlineTimestamp'])) when 'INVOICE' @invoice_status = data['invoiceStatus'] if %w[ORDERCREATED SHIPPED DONE CREDITED].include?(@invoice_status) @shipping_address = PaysonAPI::V1::ShippingAddress.parse(data) end end end
success?()
click to toggle source
# File lib/payson_api/v1/responses/payment_details.rb, line 44 def success? @envelope.ack == 'SUCCESS' end