Class: PaysonAPI::Response::PaymentDetails
- Inherits:
-
Object
- Object
- PaysonAPI::Response::PaymentDetails
- Defined in:
- lib/payson_api/response/payment_details.rb
Instance Attribute Summary collapse
-
#currency ⇒ Object
Returns the value of attribute currency.
-
#custom ⇒ Object
Returns the value of attribute custom.
-
#envelope ⇒ Object
Returns the value of attribute envelope.
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#fundings ⇒ Object
Returns the value of attribute fundings.
-
#guarantee_deadline_at ⇒ Object
Returns the value of attribute guarantee_deadline_at.
-
#guarantee_status ⇒ Object
Returns the value of attribute guarantee_status.
-
#invoice_status ⇒ Object
Returns the value of attribute invoice_status.
-
#order_items ⇒ Object
Returns the value of attribute order_items.
-
#payment_type ⇒ Object
Returns the value of attribute payment_type.
-
#purchase_id ⇒ Object
Returns the value of attribute purchase_id.
-
#receivers ⇒ Object
Returns the value of attribute receivers.
-
#sender_email ⇒ Object
Returns the value of attribute sender_email.
-
#shipping_address ⇒ Object
Returns the value of attribute shipping_address.
-
#status ⇒ Object
Returns the value of attribute status.
-
#token ⇒ Object
Returns the value of attribute token.
-
#tracking_id ⇒ Object
Returns the value of attribute tracking_id.
Instance Method Summary collapse
-
#initialize(data) ⇒ PaymentDetails
constructor
A new instance of PaymentDetails.
- #success? ⇒ Boolean
Constructor Details
#initialize(data) ⇒ PaymentDetails
Returns a new instance of PaymentDetails.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/payson_api/response/payment_details.rb', line 11 def initialize(data) @envelope = 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 = Funding.parse(data) @receivers = Receiver.parse(data) @order_items = OrderItem.parse(data) @errors = RemoteError.parse(data) 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 = ShippingAddress.parse(data) end end end |
Instance Attribute Details
#currency ⇒ Object
Returns the value of attribute currency.
6 7 8 |
# File 'lib/payson_api/response/payment_details.rb', line 6 def currency @currency end |
#custom ⇒ Object
Returns the value of attribute custom.
6 7 8 |
# File 'lib/payson_api/response/payment_details.rb', line 6 def custom @custom end |
#envelope ⇒ Object
Returns the value of attribute envelope.
6 7 8 |
# File 'lib/payson_api/response/payment_details.rb', line 6 def envelope @envelope end |
#errors ⇒ Object
Returns the value of attribute errors.
6 7 8 |
# File 'lib/payson_api/response/payment_details.rb', line 6 def errors @errors end |
#fundings ⇒ Object
Returns the value of attribute fundings.
6 7 8 |
# File 'lib/payson_api/response/payment_details.rb', line 6 def fundings @fundings end |
#guarantee_deadline_at ⇒ Object
Returns the value of attribute guarantee_deadline_at.
6 7 8 |
# File 'lib/payson_api/response/payment_details.rb', line 6 def guarantee_deadline_at @guarantee_deadline_at end |
#guarantee_status ⇒ Object
Returns the value of attribute guarantee_status.
6 7 8 |
# File 'lib/payson_api/response/payment_details.rb', line 6 def guarantee_status @guarantee_status end |
#invoice_status ⇒ Object
Returns the value of attribute invoice_status.
6 7 8 |
# File 'lib/payson_api/response/payment_details.rb', line 6 def invoice_status @invoice_status end |
#order_items ⇒ Object
Returns the value of attribute order_items.
6 7 8 |
# File 'lib/payson_api/response/payment_details.rb', line 6 def order_items @order_items end |
#payment_type ⇒ Object
Returns the value of attribute payment_type.
6 7 8 |
# File 'lib/payson_api/response/payment_details.rb', line 6 def payment_type @payment_type end |
#purchase_id ⇒ Object
Returns the value of attribute purchase_id.
6 7 8 |
# File 'lib/payson_api/response/payment_details.rb', line 6 def purchase_id @purchase_id end |
#receivers ⇒ Object
Returns the value of attribute receivers.
6 7 8 |
# File 'lib/payson_api/response/payment_details.rb', line 6 def receivers @receivers end |
#sender_email ⇒ Object
Returns the value of attribute sender_email.
6 7 8 |
# File 'lib/payson_api/response/payment_details.rb', line 6 def sender_email @sender_email end |
#shipping_address ⇒ Object
Returns the value of attribute shipping_address.
6 7 8 |
# File 'lib/payson_api/response/payment_details.rb', line 6 def shipping_address @shipping_address end |
#status ⇒ Object
Returns the value of attribute status.
6 7 8 |
# File 'lib/payson_api/response/payment_details.rb', line 6 def status @status end |
#token ⇒ Object
Returns the value of attribute token.
6 7 8 |
# File 'lib/payson_api/response/payment_details.rb', line 6 def token @token end |
#tracking_id ⇒ Object
Returns the value of attribute tracking_id.
6 7 8 |
# File 'lib/payson_api/response/payment_details.rb', line 6 def tracking_id @tracking_id end |
Instance Method Details
#success? ⇒ Boolean
38 39 40 |
# File 'lib/payson_api/response/payment_details.rb', line 38 def success? @envelope.ack == 'SUCCESS' end |