Class: QiwiPay::PaymentOperation
- Inherits:
-
Object
- Object
- QiwiPay::PaymentOperation
- Defined in:
- lib/qiwi-pay/payment_operation.rb
Overview
General patment operation
Direct Known Subclasses
Api::CaptureOperation, Api::PaymentOperation, Api::RefundOperation, Api::StatusOperation, Wpf::AuthOperation, Wpf::PaymentOperation, Wpf::SaleOperation
Constant Summary collapse
- ATTRIBUTES =
%i[ txn_id merchant_site currency sign amount order_id email country city region address phone cf1 cf2 cf3 cf4 cf5 product_name merchant_uid modifiers card_token order_expire callback_url success_url decline_url cheque merchant_cheque ].freeze
Instance Attribute Summary collapse
-
#credentials ⇒ Object
writeonly
Sets the attribute credentials.
Class Method Summary collapse
-
.description ⇒ Object
Описание операции.
-
.opcode ⇒ Object
Код операции.
Instance Method Summary collapse
-
#amount ⇒ String
Formatted amount.
- #callback_url=(url) ⇒ Object
- #description ⇒ Object
-
#initialize(credentials, params = {}) ⇒ PaymentOperation
constructor
A new instance of PaymentOperation.
- #opcode ⇒ Object
- #order_expire=(time) ⇒ Object
Constructor Details
#initialize(credentials, params = {}) ⇒ PaymentOperation
Returns a new instance of PaymentOperation.
31 32 33 34 35 36 |
# File 'lib/qiwi-pay/payment_operation.rb', line 31 def initialize(credentials, params = {}) params.each do |k, v| send("#{k}=", v) if in_params.include?(k.to_sym) end @credentials = credentials end |
Instance Attribute Details
#credentials=(value) ⇒ Object
Sets the attribute credentials
29 30 31 |
# File 'lib/qiwi-pay/payment_operation.rb', line 29 def credentials=(value) @credentials = value end |
Class Method Details
.description ⇒ Object
Описание операции
14 15 16 |
# File 'lib/qiwi-pay/payment_operation.rb', line 14 def self.description raise NotImplementedError end |
.opcode ⇒ Object
Код операции
9 10 11 |
# File 'lib/qiwi-pay/payment_operation.rb', line 9 def self.opcode raise NotImplementedError end |
Instance Method Details
#amount ⇒ String
Formatted amount
48 49 50 51 |
# File 'lib/qiwi-pay/payment_operation.rb', line 48 def amount return unless @amount format '%.2f', @amount end |
#callback_url=(url) ⇒ Object
53 54 55 56 |
# File 'lib/qiwi-pay/payment_operation.rb', line 53 def callback_url=(url) raise ArgumentError, 'Use https URI as callback_url' unless url.start_with?('https://') @callback_url = url end |
#description ⇒ Object
42 43 44 |
# File 'lib/qiwi-pay/payment_operation.rb', line 42 def description self.class.description end |
#opcode ⇒ Object
38 39 40 |
# File 'lib/qiwi-pay/payment_operation.rb', line 38 def opcode self.class.opcode end |
#order_expire=(time) ⇒ Object
64 65 66 67 68 69 70 71 |
# File 'lib/qiwi-pay/payment_operation.rb', line 64 def order_expire=(time) @order_expire = if time.respond_to? :strftime time.strftime('%FT%T%:z') else time.to_s end end |