Class: Yoomoney::Resources::Payments
- Inherits:
-
Object
- Object
- Yoomoney::Resources::Payments
- Defined in:
- lib/yoomoney/resources/payments.rb
Instance Method Summary collapse
-
#cancel(payment_id, idempotence_key:, request_options: {}) ⇒ Yoomoney::Models::Payment
Отмена платежа.
-
#capture(payment_id, idempotence_key:, airline: nil, amount: nil, deal: nil, receipt: nil, transfers: nil, request_options: {}) ⇒ Yoomoney::Models::Payment
Подтверждение платежа.
-
#create(amount:, idempotence_key:, airline: nil, capture: nil, client_ip: nil, confirmation: nil, deal: nil, description: nil, merchant_customer_id: nil, metadata: nil, payment_method_data: nil, payment_method_id: nil, payment_order: nil, payment_token: nil, receipt: nil, receiver: nil, recipient: nil, save_payment_method: nil, statements: nil, transfers: nil, request_options: {}) ⇒ Yoomoney::Models::Payment
Some parameter documentations has been truncated, see Models::PaymentCreateParams for more details.
-
#initialize(client:) ⇒ Payments
constructor
private
A new instance of Payments.
-
#list(captured_at: nil, created_at: nil, cursor: nil, limit: nil, payment_method: nil, status: nil, request_options: {}) ⇒ Yoomoney::Models::PaymentListResponse
Список платежей.
-
#retrieve(payment_id, request_options: {}) ⇒ Yoomoney::Models::Payment
Информация о платеже.
Constructor Details
#initialize(client:) ⇒ Payments
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Payments.
177 178 179 |
# File 'lib/yoomoney/resources/payments.rb', line 177 def initialize(client:) @client = client end |
Instance Method Details
#cancel(payment_id, idempotence_key:, request_options: {}) ⇒ Yoomoney::Models::Payment
Отмена платежа
127 128 129 130 131 132 133 134 135 136 |
# File 'lib/yoomoney/resources/payments.rb', line 127 def cancel(payment_id, params) parsed, = Yoomoney::PaymentCancelParams.dump_request(params) @client.request( method: :post, path: ["payments/%1$s/cancel", payment_id], headers: parsed.transform_keys(idempotence_key: "idempotence-key"), model: Yoomoney::Payment, options: ) end |
#capture(payment_id, idempotence_key:, airline: nil, amount: nil, deal: nil, receipt: nil, transfers: nil, request_options: {}) ⇒ Yoomoney::Models::Payment
Подтверждение платежа
161 162 163 164 165 166 167 168 169 170 171 172 |
# File 'lib/yoomoney/resources/payments.rb', line 161 def capture(payment_id, params) parsed, = Yoomoney::PaymentCaptureParams.dump_request(params) header_params = {idempotence_key: "idempotence-key"} @client.request( method: :post, path: ["payments/%1$s/capture", payment_id], headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Yoomoney::Payment, options: ) end |
#create(amount:, idempotence_key:, airline: nil, capture: nil, client_ip: nil, confirmation: nil, deal: nil, description: nil, merchant_customer_id: nil, metadata: nil, payment_method_data: nil, payment_method_id: nil, payment_order: nil, payment_token: nil, receipt: nil, receiver: nil, recipient: nil, save_payment_method: nil, statements: nil, transfers: nil, request_options: {}) ⇒ Yoomoney::Models::Payment
Some parameter documentations has been truncated, see Models::PaymentCreateParams for more details.
Создание платежа
58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/yoomoney/resources/payments.rb', line 58 def create(params) parsed, = Yoomoney::PaymentCreateParams.dump_request(params) header_params = {idempotence_key: "idempotence-key"} @client.request( method: :post, path: "payments", headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Yoomoney::Payment, options: ) end |
#list(captured_at: nil, created_at: nil, cursor: nil, limit: nil, payment_method: nil, status: nil, request_options: {}) ⇒ Yoomoney::Models::PaymentListResponse
Список платежей
105 106 107 108 109 110 111 112 113 114 |
# File 'lib/yoomoney/resources/payments.rb', line 105 def list(params = {}) parsed, = Yoomoney::PaymentListParams.dump_request(params) @client.request( method: :get, path: "payments", query: parsed, model: Yoomoney::Models::PaymentListResponse, options: ) end |
#retrieve(payment_id, request_options: {}) ⇒ Yoomoney::Models::Payment
Информация о платеже
81 82 83 84 85 86 87 88 |
# File 'lib/yoomoney/resources/payments.rb', line 81 def retrieve(payment_id, params = {}) @client.request( method: :get, path: ["payments/%1$s", payment_id], model: Yoomoney::Payment, options: params[:request_options] ) end |