Class: Yoomoney::Resources::Invoices

Inherits:
Object
  • Object
show all
Defined in:
lib/yoomoney/resources/invoices.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Invoices

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 Invoices.

Parameters:



67
68
69
# File 'lib/yoomoney/resources/invoices.rb', line 67

def initialize(client:)
  @client = client
end

Instance Method Details

#create(cart:, delivery_method:, idempotence_key:, description: nil, expires_at: nil, metadata: nil, payment_data: nil, request_options: {}) ⇒ Yoomoney::Models::Invoice

Some parameter documentations has been truncated, see Models::InvoiceCreateParams for more details.

Создание счета

Parameters:

Returns:

See Also:



32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/yoomoney/resources/invoices.rb', line 32

def create(params)
  parsed, options = Yoomoney::InvoiceCreateParams.dump_request(params)
  header_params = {idempotence_key: "idempotence-key"}
  @client.request(
    method: :post,
    path: "invoices",
    headers: parsed.slice(*header_params.keys).transform_keys(header_params),
    body: parsed.except(*header_params.keys),
    model: Yoomoney::Invoice,
    options: options
  )
end

#retrieve(invoice_id, request_options: {}) ⇒ Yoomoney::Models::Invoice

Информация о счете

Parameters:

Returns:

See Also:



55
56
57
58
59
60
61
62
# File 'lib/yoomoney/resources/invoices.rb', line 55

def retrieve(invoice_id, params = {})
  @client.request(
    method: :get,
    path: ["invoices/%1$s", invoice_id],
    model: Yoomoney::Invoice,
    options: params[:request_options]
  )
end