Class: Workarea::GlobalE::Merchant::ResponseInfo
- Inherits:
-
Object
- Object
- Workarea::GlobalE::Merchant::ResponseInfo
- Defined in:
- app/services/workarea/global_e/merchant/response_info.rb
Instance Attribute Summary collapse
-
#order ⇒ Object
readonly
Returns the value of attribute order.
Class Method Summary collapse
Instance Method Summary collapse
- #as_json(*args) ⇒ Object
-
#description ⇒ String
Optional response description.
-
#error_code ⇒ String
Error code to be returned when an error occurs.
-
#initialize(order: nil, message: nil, success: true) ⇒ ResponseInfo
constructor
A new instance of ResponseInfo.
-
#internal_order_id ⇒ String
Order unique identifier on the Merchant’s site (optional in case of error, failure or if the action is not related to a specific order).
-
#message ⇒ String
Optional response message.
-
#order_id ⇒ String
Order identifier on the Merchant’s site used for display and reporting purposes only.
-
#payment_amount ⇒ String
The total payment amount in PaymentCurrency charged for the order (if payment was processed in the respective API method call).
-
#payment_currency_code ⇒ String
3-char ISO currency code for the order (if payment was processed in the respective API method call).
-
#status_code ⇒ String
Code denoting the order status on the Merchant’s site (to be mapped on Global-e side).
-
#success ⇒ Boolean
Indicates if the call has succeeded.
- #to_h ⇒ Object
Constructor Details
#initialize(order: nil, message: nil, success: true) ⇒ ResponseInfo
Returns a new instance of ResponseInfo.
11 12 13 14 15 |
# File 'app/services/workarea/global_e/merchant/response_info.rb', line 11 def initialize(order: nil, message: nil, success: true) @order = order @message = @success = success end |
Instance Attribute Details
#order ⇒ Object (readonly)
Returns the value of attribute order.
5 6 7 |
# File 'app/services/workarea/global_e/merchant/response_info.rb', line 5 def order @order end |
Class Method Details
.error(message:, order: nil) ⇒ Object
7 8 9 |
# File 'app/services/workarea/global_e/merchant/response_info.rb', line 7 def self.error(message:, order: nil) new(success: false, message: , order: order) end |
Instance Method Details
#as_json(*args) ⇒ Object
31 32 33 |
# File 'app/services/workarea/global_e/merchant/response_info.rb', line 31 def as_json(*args) to_h end |
#description ⇒ String
Optional response description. In case of an error, this property indicates the error message description.
110 111 |
# File 'app/services/workarea/global_e/merchant/response_info.rb', line 110 def description end |
#error_code ⇒ String
Error code to be returned when an error occurs.
93 94 |
# File 'app/services/workarea/global_e/merchant/response_info.rb', line 93 def error_code end |
#internal_order_id ⇒ String
Order unique identifier on the Merchant’s site (optional in case of error, failure or if the action is not related to a specific order)
41 42 43 |
# File 'app/services/workarea/global_e/merchant/response_info.rb', line 41 def internal_order_id order&.id end |
#message ⇒ String
Optional response message. In case of an error, this property indicates the error message text.
101 102 103 |
# File 'app/services/workarea/global_e/merchant/response_info.rb', line 101 def @message end |
#order_id ⇒ String
Order identifier on the Merchant’s site used for display and reporting purposes only. Unlike InternalOrderId, this identifier is not necessarily unique over time, as the Merchant’s site may potentially reuse it (for example after deleting the old order having the same OrderId).
53 54 |
# File 'app/services/workarea/global_e/merchant/response_info.rb', line 53 def order_id end |
#payment_amount ⇒ String
The total payment amount in PaymentCurrency charged for the order (if payment was processed in the respective API method call).
78 79 |
# File 'app/services/workarea/global_e/merchant/response_info.rb', line 78 def payment_amount end |
#payment_currency_code ⇒ String
3-char ISO currency code for the order (if payment was processed in the respective API method call).
70 71 |
# File 'app/services/workarea/global_e/merchant/response_info.rb', line 70 def payment_currency_code end |
#status_code ⇒ String
Code denoting the order status on the Merchant’s site (to be mapped on Global-e side). (optional in case of error or failure)
62 63 |
# File 'app/services/workarea/global_e/merchant/response_info.rb', line 62 def status_code end |
#success ⇒ Boolean
Indicates if the call has succeeded. FALSE denotes an error or failure.
85 86 87 |
# File 'app/services/workarea/global_e/merchant/response_info.rb', line 85 def success @success end |
#to_h ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/services/workarea/global_e/merchant/response_info.rb', line 17 def to_h { InternalOrderId: internal_order_id, OrderId: order_id, StatusCode: status_code, PaymentCurrencyCode: payment_currency_code, PaymentAmount: payment_amount, Success: success, ErrorCode: error_code, Message: , Description: description } end |