phoenixnap.bmc.invoice_info (1.17.0) — module

List invoices.

| "added in version" 1.17.0 of phoenixnap.bmc"

Authors: Pavle Jojkic (@pajuga) <pavlej@phoenixnap.com>, Goran Jelenic (@goranje) <goranje@phoenixnap.com>

preview | supported by certified

Install collection

Install with ansible-galaxy collection install phoenixnap.bmc:==1.17.0


Add to requirements.yml

  collections:
    - name: phoenixnap.bmc
      version: 1.17.0

Description

List invoices.

This module has a dependency on requests

API is documented at U(https://developers.phoenixnap.com/docs/invoicing/1/routes/invoices/get).

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# All the examples assume that you have file config.yaml with your 'clientId' and 'clientSecret'
# in location: ~/.pnap/config.yaml

- name: List all invoices.
  hosts: localhost
  gather_facts: false
  vars_files:
    - ~/.pnap/config.yaml
  tasks:
    - name: List invoices.
      phoenixnap.bmc.invoice_info:
        client_id: "{{ clientId }}"
        client_secret: "{{ clientSecret }}"
      register: output
    - name: Print the gathered infos
      ansible.builtin.debug:
        var: output.invoices
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Get invoice details.
  hosts: localhost
  gather_facts: false
  vars_files:
    - ~/.pnap/config.yaml
  tasks:
    - name: Get invoice details.
      phoenixnap.bmc.invoice_info:
        client_id: "{{ clientId }}"
        client_secret: "{{ clientSecret }}"
        invoice_id: 5fa54d1e91867c03a0a7b4a4
      register: output
    - name: Print the gathered infos
      ansible.builtin.debug:
        var: output.invoices
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Generate the invoice details as a PDF and save it in the same directory as the playbook
  hosts: localhost
  gather_facts: false
  vars_files:
    - ~/.pnap/config.yaml
  tasks:
    - name: Generate invoice details as PDF.
      phoenixnap.bmc.invoice_info:
        client_id: "{{ clientId }}"
        client_secret: "{{ clientSecret }}"
        invoice_id: 5fa54d1e91867c03a0a7b4a4
        generate_pdf: true
      register: output
    - name: Print the gathered infos
      ansible.builtin.debug:
        var: output.invoices
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Generate invoice details as a PDF and specify the save destination using the save_as parameter.
  hosts: localhost
  gather_facts: false
  vars_files:
    - ~/.pnap/config.yaml
  tasks:
    - name: Generate invoice details as PDF.
      phoenixnap.bmc.invoice_info:
        client_id: "{{ clientId }}"
        client_secret: "{{ clientSecret }}"
        invoice_id: 5fa54d1e91867c03a0a7b4a4
        generate_pdf: true
        save_as: /home/ubuntu/my_invoice.pdf
      register: output
    - name: Print the gathered infos
      ansible.builtin.debug:
        var: output.invoices

Inputs

    
limit:
    description: The limit of the number of results returned. The number of records returned
      may be smaller than the limit.
    type: int

number:
    description: A user-friendly reference number assigned to the invoice.
    type: str

offset:
    description: The number of items to skip in the results.
    type: int

status:
    description: Payment status of the invoice.
    type: str

save_as:
    description:
    - Save PDF to a specified destination with a specified file name.
    - If not defined, the PDF will be saved in the same directory as the playbook, with
      the filename set to the invoice_id parameter.
    type: str

client_id:
    description: Client ID (Application Management)
    type: str

invoice_id:
    description:
    - The unique resource identifier of the Invoice.
    - Can be used either alone or in conjunction with the "generate_pdf" and "save_as"
      parameters.
    type: str

sent_on_to:
    description: Maximum value to filter invoices by sent on date.
    type: str

sort_field:
    description: If a sortField is requested, pagination will be done after sorting. Default
      sorting is by number.
    type: str

generate_pdf:
    default: false
    description: Generate invoice details as PDF. The invoice_id parameter is required
      for this operation.
    type: bool

sent_on_from:
    description: Minimum value to filter invoices by sent on date.
    type: str

client_secret:
    description: Client Secret (Application Management)
    type: str

sort_direction:
    description: Sort Given Field depending on the desired direction. Default sorting
      is descending.
    type: str

Outputs

invoices:
  contains:
    limit:
      description: Maximum number of items in the page (actual returned length can
        be less).
      sample: 5
      type: int
    offset:
      description: The number of returned items skipped.
      sample: 25
      type: int
    results:
      contains:
        amount:
          description: The invoice amount.
          sample: 100.99
          type: float
        currency:
          description: The currency of the invoice.
          sample: EUR
          type: str
        dueDate:
          description: Date and time when the invoice payment is due.
          type: str
        id:
          description: The unique resource identifier of the Invoice.
          sample: 5fa54d1e91867c03a0a7b4a4
          type: str
        number:
          description: A user-friendly reference number assigned to the invoice.
          sample: 34440-2488782
          type: str
        outstandingAmount:
          description: The invoice outstanding amount.
          type: float
        sentOn:
          description: Date and time when the invoice was sent.
          type: str
        status:
          description: The status of the invoice.
          type: str
      description: invoice details
      type: list
    total:
      description: The total number of records available for retrieval.
      sample: 400
      type: int
  description: The invoices information as list
  returned: success
  type: dict