Module: RegApi2::Bill

Extended by:
Bill
Includes:
Builder
Included in:
Bill
Defined in:
lib/reg_api2/bill.rb

Overview

REG.API bill category

Instance Method Summary collapse

Methods included from Builder

included

Instance Method Details

#change_pay_type(opts = {}) ⇒ Array<Hash>

Note:

Accessibility: clients

Note:

Support of invoice lists: yes

You can use this function to change payment methods. Some of the methods allow issue of invoices in the defined payment systems, advance payments are made immediately.

Examples:

Example of request

bill.change_pay_type(currency: :RUR, pay_type: :prepay, bills: [ 123456 ])

Parameters:

  • opts (Hash) (defaults to: {})

Options Hash (opts):

  • :bill_id (Fixnum)

    Invoice ID (in case of single invoice request).

  • :bills (Array(Fixnum))

    A list of invoice IDs.

  • :pay_type (String)

    New payment type. Mandatory field. Valid values: prepay — advance payment (to be made immediately); WM — WebMoney. With the WMID defined, the invoices are issued to the customer’s WM account; yamoney, ymbill — Yandex.Dengi. To issue an invoice, define ymbill and in advance allow the receipt of invoices from REG.; bank — bank transfer

  • :currency (String)

    Currency. Mandatory field. «Yandex.Dengi» allows RUR only, «bank» and «prepay» – RUR and USD, «WebMoney» also allows EUR and UAH.

  • :wmid (Fixnum)

    WebMoney ID

Returns:

  • (Array<Hash>)

    Bills.



66
# File 'lib/reg_api2/bill.rb', line 66

define :change_pay_type, required: %w[ currency pay_type ], field: :bills

#delete(opts = {}) ⇒ Array<Hash>

Note:

Accessibility: clients

Note:

Support of invoice lists: yes

Deletion of unpaid invoices.

Examples:

Delete three bills.

bill.delete(bills: [ { bill_id: 12345 }, { bill_id: 12346 }, { bill_id: 12347 } ])    

Parameters:

  • opts (Hash) (defaults to: {})

Options Hash (opts):

  • :bill_id (Fixnum)

    Invoice ID (in case of single invoice request).

  • :bills (Array(Fixnum))

    A list of invoice IDs.

Returns:

  • (Array<Hash>)

    Bills.



78
# File 'lib/reg_api2/bill.rb', line 78

define :delete, field: :bills

#get_for_period(opts = {}) ⇒ Array<Hash>

Note:

Accessibility: partners

Note:

Support of invoice lists: yes

Use this function to obtain a list of invoices for the defined period.

Examples:

List of invoices using Date objects.

require 'date'
RegApi.bill.get_for_period start_date: Date.new(2012, 1, 1), end_date: Date.new(2012, 12, 1)

List of invoices using date strings in ISO format.

RegApi.bill.get_for_period start_date: '2012-01-01', end_date: '2012-12-01'

Parameters:

  • opts (Hash) (defaults to: {})

Options Hash (opts):

  • :start_date (String, Date)

    Starting date of the requested period in the ISO format. Mandatory field.

  • :end_date (String, Date)

    End date of the requested period in the ISO format. Mandatory field.

  • :pay_type (String)

    Payment method. For information about available alternatives refer to the description of response fields.

  • :limit (Fixnum)

    Defines the number of invoices to be included in the output at a time. Default value: 100. Maximum value: 1024.

  • :offset (Fixnum)

    The offset from the starting point, if the number of invoices exceeds the defined limit.

  • :all (Boolean)

    Show inactive invoices, i.e. invoices for outdated services and invoices cancelled due to impossibility of order execution.

Returns:

  • (Array<Hash>)

    Bills.



51
# File 'lib/reg_api2/bill.rb', line 51

define :get_for_period, required: { start_date: { iso_date: true }, end_date: { iso_date: true } }, field: :bills

#get_not_payed(opts = {}) ⇒ Array<Hash>

Note:

Accessibility: clients

Note:

Support of invoice lists: yes

Use this function to obtain a list of unpaid invoices.

Parameters:

  • opts (Hash) (defaults to: {})

Options Hash (opts):

  • :limit (Fixnum)

    Defines the number of invoices to be included in the output at a time. Default value: 100. Maximum value: 1024.

  • :offset (Fixnum)

    The offset from the starting point, if the number of invoices exceeds the defined limit.

Returns:

  • (Array<Hash>)

    Bills.



32
# File 'lib/reg_api2/bill.rb', line 32

define :get_not_payed, field: :bills

#nop(opts = {}) ⇒ NilClass or Array<Hash>

Note:

Accessibility: clients

Note:

Support of invoice lists: yes

For testing purposes.

Examples:

Get single bill

RegApi2.bill.nop bill_id: 12345

Get bills

RegApi2.bill.nop bills: ["12345","12346"]

Parameters:

  • opts (Hash) (defaults to: {})

Options Hash (opts):

  • :bill_id (String)

    Invoice number in case of a single-invoice request.

  • :bills (Array)

    A list if invoice numbers.

Returns:

  • (NilClass or Array<Hash>)

    nil or bills.



22
# File 'lib/reg_api2/bill.rb', line 22

define :nop, field: :bills