{"swagger":"2.0","info":{"description":"Retrieve invoices, or a summary of the invoices, for a user or for a certain phone-number of a user.\n\n# Relevant Definitions and concepts\n\n - **Invoice**: Legal document issued by the OB including the charges for services provided by the operator to a postpaid or control customer. Usually are monthly, but invoices may exist for other periods of time, as well as for individual concepts and also can refer to refunds to the user.\n - **Invoice Summary**: A summary of the invoice. This does not reflect to a legal document but to a reduced view of the Invoice retrieved throught the API.\n - **User Friendly Field**:  Some string params in the API are described as User Friendly, meaning that information should be an string directly understandable by a human. Params marked this way may be used for display purposes.\n\n # What is the API for? \n## API Functionality\n This API allows to return the invoices of a user or the invoices of a phone-number of a user, as well as return a summary of the invoices for the same scenarios.\n\n ## Resources and Operations overview\n First, there are two endpoints to fetch the invoices, one to fetch all the invoices of a user, and the other to fetch invoices bound to a certain phone-number. For the latter case, the invoice may be bound to the requested phone-number and other phone-number(s) or identifier(s) (i.e.: bundled products). In both endpoints, API requires the query to be restricted by start and end date and implementations will return at least invoices of the last 6 months. Invoices are identified by id, have a name, indicate the relevant dates of the billed period, the overall amount, the payment status and the details on the billed items.\n Second, there are two endpoitns working exactly the same as the first ones, but returning a summary of the invoices. Invoices summary include the most relevant data of the invoice, such as the amount, dates and url to download the legal document. These endpoints are intended for API Clients having an interface where invoice basic info is presented to the user, but at that point every invoice detail is not needed.\nFinally, there are two endpoints to fetch an specific invoice identified by its id, one to access at user level and the other to access at phone-number level. Reason to decouple the endpoints is that depending on the role, API Client may only have access to the endpoint identified at phone-number level. These endpoints overlap in functionality with first two endpoints, but are created to complement the scenario explained of API Clients first showing to the user the list/summary of invoices and then going into the details of an specific invoice.\n\n Resources in the API can be used in 3-legged or 2-legged mode. When accessed in 3 legged mode, the URI param {user_id} should be substituted by the special keyword ‘me’.\n\n# Further Info and Support\nFind answers to Frequently Asked Questions in **https://qna.baikalplatform.com/c/api-faq**.\n\n Topics with the **tag 'invoicing'** are specific for Invoicing API.","version":"3.4.0","title":"4P-Invoicing","termsOfService":"https://www.telefonica.es/es/","contact":{"name":"4th Platform Team","email":"4pf@tid.es"},"x-ibm-name":"invoicing"},"x-fp-apiPrefix":"/invoicing","basePath":"/invoicing/v3","tags":[{"name":"invoices","description":"API to get invoices for a user or for a phone number of the user"},{"name":"invoices summary","description":"API to get invoices summary for a user or for a phone number of the user"},{"name":"notification-email","description":"Manage email where invoices are sent, if any.\n**DISCLAIMER: This endpoint is deprecated. The functionality is available in Invoice Shipment Management API."},{"name":"debt","description":"Retrieve User debt.\n**DISCLAIMER: This endpoint is deprecated. The functionality is available in Retrieve Debt API."}],"host":"invoicing:8080","schemes":["https"],"consumes":["application/json"],"produces":["application/json"],"paths":{"/users/{user_id}/invoices/summary":{"get":{"tags":["invoices summary"],"operationId":"listInvoicesSummary","description":"List the invoices summary of a user","summary":"Retrieve summary of invoices of a user","x-fp-pi-scopes":["invoicing-user-read"],"parameters":[{"$ref":"#/parameters/UserId"},{"$ref":"#/parameters/StartDate"},{"$ref":"#/parameters/EndDate"},{"$ref":"https://docs.baikalplatform.com/common/v2.2/common.json#/parameters/x-correlator"}],"responses":{"200":{"description":"OK","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"type":"array","description":"Array of Invoices Summary","items":{"$ref":"#/definitions/InvoiceSummary"}},"examples":{"application/json":[{"name":"Factura 01-2021","creation_date":"2021-01-07T03:00:00Z","start_date":"2020-12-07T03:00:00Z","end_date":"2021-01-06T03:00:00Z","total_amount":{"value":492.65,"currency":"ARS","tax_included":true},"identifiers":["89155017"],"id":"FB-2465-36709498"},{"name":"Factura 12-2020","creation_date":"2020-12-07T03:00:00Z","start_date":"2020-11-07T03:00:00Z","end_date":"2020-12-06T03:00:00Z","total_amount":{"value":437.58,"currency":"ARS","tax_included":true},"identifiers":["89155017"],"id":"FB-2465-36307461"},{"name":"Factura 11-2020","creation_date":"2020-11-07T03:00:00Z","start_date":"2020-10-07T03:00:00Z","end_date":"2020-11-06T03:00:00Z","total_amount":{"value":919.89,"currency":"ARS","tax_included":true},"identifiers":["89155017"],"id":"FB-2465-35899175"},{"name":"Factura 10-2020","creation_date":"2020-10-07T03:00:00Z","start_date":"2020-09-07T03:00:00Z","end_date":"2020-10-06T03:00:00Z","total_amount":{"value":772.2,"currency":"ARS","tax_included":true},"identifiers":["89155017"],"id":"FB-2465-35459873"},{"name":"Factura 09-2020","creation_date":"2020-09-07T03:00:00Z","start_date":"2020-08-07T03:00:00Z","end_date":"2020-09-06T03:00:00Z","total_amount":{"value":724.07,"currency":"ARS","tax_included":true},"identifiers":["89155017"],"id":"FB-2465-35140503"},{"name":"Factura 08-2020","creation_date":"2020-08-07T03:00:00Z","start_date":"2020-07-07T03:00:00Z","end_date":"2020-08-06T03:00:00Z","total_amount":{"value":726.38,"currency":"ARS","tax_included":true},"identifiers":["89155017"],"id":"FB-2465-34586508"}]}},"400":{"description":"Problem with the client request","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/InvalidArgument"},"examples":{"application/json":{"code":"INVALID_ARGUMENT","message":"Client specified an invalid argument, request body o query param"}}},"403":{"description":"Client does not have sufficient permission","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/PermissionDenied"},"examples":{"application/json":{"code":"PERMISSION_DENIED","message":"Authenticated user has no permission to access the requested resource"}}},"404":{"description":"Resource not found","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/NotFound"},"examples":{"application/json":{"code":"NOT_FOUND","message":"A specified resource is not found"}}},"500":{"description":"Server error","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/Internal"},"examples":{"application/json":{"code":"INTERNAL","message":"Server error"}}},"504":{"description":"Request timeout exceeded. If it happens repeatedly, consider reducing the request complexity","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/Timeout"},"examples":{"application/json":{"code":"TIMEOUT","message":"Request timeout exceeded. Try it later"}}}}}},"/users/{user_id}/invoices/{invoice_id}":{"get":{"tags":["invoices"],"operationId":"getInvoice","description":"Get an invoice of a user","summary":"Retrieve an invoice of a user","x-fp-pi-scopes":["invoicing-user-read"],"parameters":[{"$ref":"#/parameters/UserId"},{"$ref":"#/parameters/InvoiceId"},{"$ref":"https://docs.baikalplatform.com/common/v2.2/common.json#/parameters/x-correlator"}],"responses":{"200":{"description":"OK","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"#/definitions/Invoice"},"examples":{"application/json":{"id":"FB-2465-36709498","due_date":"2021-01-19T03:00:00Z","download_url":"https://apis4p.telefonica.com.ar/telefonica/api/downloads/v1/facturas?id=It4AoTlTGWylkOK%2B1nv0v%2Bcyt2ZLe%2B7NPlcUi9IJU4L8O%2F05dz9I0Bw3wtgcGNEpHVExUliVW6fVCyZSXf%2B8kxeAdyebPOSv","end_date":"2021-01-06T03:00:00Z","creation_date":"2021-01-07T03:00:00Z","name":"Factura 01-2021","start_date":"2020-12-07T03:00:00Z","payment_status":"unknown","identifiers":["1135058439"],"customer":{"name":"SOFIA YANINA  ARROYO","id_document":{"country":"AR","type":"DNI","value":"33511867"}},"total_amount":{"value":492.65,"currency":"ARS","tax_included":true},"billed_items_summary":[{"id":"2878561875","amount":{"value":1649,"currency":"ARS","tax_included":true},"description":"Plan 5GB","start_date":"2020-12-07T03:00:00Z","end_date":"2021-01-06T03:00:00Z","identifier":"1135058439","category":"tariff"},{"id":"2878561875","amount":{"value":-1154.3,"currency":"ARS","tax_included":true},"description":"Plan 5GB","start_date":"2020-12-07T03:00:00Z","end_date":"2021-01-06T03:00:00Z","identifier":"1135058439","category":"tariff"}]}}},"400":{"description":"Problem with the client request","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/InvalidArgument"},"examples":{"application/json":{"code":"INVALID_ARGUMENT","message":"Client specified an invalid argument, request body o query param"}}},"403":{"description":"Client does not have sufficient permission","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/PermissionDenied"},"examples":{"application/json":{"code":"PERMISSION_DENIED","message":"Authenticated user has no permission to access the requested resource"}}},"404":{"description":"Not Found","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/NotFound"},"examples":{"application/json":{"code":"NOT_FOUND","message":"A specified resource is not found"}}},"500":{"description":"Server error","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/Internal"},"examples":{"application/json":{"code":"INTERNAL","message":"Server error"}}},"504":{"description":"Request timeout exceeded. If it happens repeatedly, consider reducing the request complexity","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/Timeout"},"examples":{"application/json":{"code":"TIMEOUT","message":"Request timeout exceeded. Try it later"}}}}}},"/users/{user_id}/phone-numbers/{phone_number}/invoices/summary":{"get":{"tags":["invoices summary"],"operationId":"listInvoicesSummaryByPhoneNumber","description":"List the invoices summary for the phone number matching the query","summary":"Retrieve summary of invoices for a phone-number","x-fp-pi-scopes":["invoicing-phone-number-read"],"parameters":[{"$ref":"#/parameters/UserId"},{"$ref":"#/parameters/PhoneNumber"},{"$ref":"#/parameters/StartDate"},{"$ref":"#/parameters/EndDate"},{"$ref":"https://docs.baikalplatform.com/common/v2.2/common.json#/parameters/x-correlator"}],"responses":{"200":{"description":"OK","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"#/definitions/ArrayofInvoicesSummary"},"examples":{"application/json":[{"name":"Factura 01-2021","creation_date":"2021-01-07T03:00:00Z","start_date":"2020-12-07T03:00:00Z","end_date":"2021-01-06T03:00:00Z","total_amount":{"value":492.65,"currency":"ARS","tax_included":true},"identifiers":["89155017"],"id":"FB-2465-36709498"},{"name":"Factura 12-2020","creation_date":"2020-12-07T03:00:00Z","start_date":"2020-11-07T03:00:00Z","end_date":"2020-12-06T03:00:00Z","total_amount":{"value":437.58,"currency":"ARS","tax_included":true},"identifiers":["89155017"],"id":"FB-2465-36307461"},{"name":"Factura 11-2020","creation_date":"2020-11-07T03:00:00Z","start_date":"2020-10-07T03:00:00Z","end_date":"2020-11-06T03:00:00Z","total_amount":{"value":919.89,"currency":"ARS","tax_included":true},"identifiers":["89155017"],"id":"FB-2465-35899175"},{"name":"Factura 10-2020","creation_date":"2020-10-07T03:00:00Z","start_date":"2020-09-07T03:00:00Z","end_date":"2020-10-06T03:00:00Z","total_amount":{"value":772.2,"currency":"ARS","tax_included":true},"identifiers":["89155017"],"id":"FB-2465-35459873"},{"name":"Factura 09-2020","creation_date":"2020-09-07T03:00:00Z","start_date":"2020-08-07T03:00:00Z","end_date":"2020-09-06T03:00:00Z","total_amount":{"value":724.07,"currency":"ARS","tax_included":true},"identifiers":["89155017"],"id":"FB-2465-35140503"},{"name":"Factura 08-2020","creation_date":"2020-08-07T03:00:00Z","start_date":"2020-07-07T03:00:00Z","end_date":"2020-08-06T03:00:00Z","total_amount":{"value":726.38,"currency":"ARS","tax_included":true},"identifiers":["89155017"],"id":"FB-2465-34586508"}]}},"400":{"description":"Problem with the client request","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/InvalidArgument"},"examples":{"application/json":{"code":"INVALID_ARGUMENT","message":"Client specified an invalid argument, request body o query param"}}},"403":{"description":"Client does not have sufficient permission","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/PermissionDenied"},"examples":{"application/json":{"code":"PERMISSION_DENIED","message":"Authenticated user has no permission to access the requested resource"}}},"404":{"description":"Resource not found","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/NotFound"},"examples":{"application/json":{"code":"NOT_FOUND","message":"A specified resource is not found"}}},"500":{"description":"Server error","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/Internal"},"examples":{"application/json":{"code":"INTERNAL","message":"Server error"}}},"504":{"description":"Request timeout exceeded. If it happens repeatedly, consider reducing the request complexity","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/Timeout"},"examples":{"application/json":{"code":"TIMEOUT","message":"Request timeout exceeded. Try it later"}}}}}},"/users/{user_id}/phone-numbers/{phone_number}/invoices/{invoice_id}":{"get":{"tags":["invoices"],"operationId":"getInvoiceByPhoneNumber","description":"Get an invoice for the phone number matching the query","summary":"Retrieve an invoice for a phone-number","x-fp-pi-scopes":["invoicing-phone-number-read"],"parameters":[{"$ref":"#/parameters/UserId"},{"$ref":"#/parameters/PhoneNumber"},{"$ref":"#/parameters/InvoiceId"},{"$ref":"https://docs.baikalplatform.com/common/v2.2/common.json#/parameters/x-correlator"}],"responses":{"200":{"description":"OK","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"#/definitions/Invoice"},"examples":{"application/json":{"id":"FB-2465-36709498","due_date":"2021-01-19T03:00:00Z","download_url":"https://apis4p.telefonica.com.ar/telefonica/api/downloads/v1/facturas?id=It4AoTlTGWylkOK%2B1nv0v%2Bcyt2ZLe%2B7NPlcUi9IJU4L8O%2F05dz9I0Bw3wtgcGNEpHVExUliVW6fVCyZSXf%2B8kxeAdyebPOSv","end_date":"2021-01-06T03:00:00Z","creation_date":"2021-01-07T03:00:00Z","name":"Factura 01-2021","start_date":"2020-12-07T03:00:00Z","payment_status":"unknown","identifiers":["1135058439"],"customer":{"name":"SOFIA YANINA  ARROYO","id_document":{"country":"AR","type":"DNI","value":"33511867"}},"total_amount":{"value":492.65,"currency":"ARS","tax_included":true},"billed_items_summary":[{"id":"2878561875","amount":{"value":1649,"currency":"ARS","tax_included":true},"description":"Plan 5GB","start_date":"2020-12-07T03:00:00Z","end_date":"2021-01-06T03:00:00Z","identifier":"1135058439","category":"tariff"},{"id":"2878561875","amount":{"value":-1154.3,"currency":"ARS","tax_included":true},"description":"Plan 5GB","start_date":"2020-12-07T03:00:00Z","end_date":"2021-01-06T03:00:00Z","identifier":"1135058439","category":"tariff"}]}}},"400":{"description":"Problem with the client request","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/InvalidArgument"},"examples":{"application/json":{"code":"INVALID_ARGUMENT","message":"Client specified an invalid argument, request body o query param"}}},"403":{"description":"Client does not have sufficient permission","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/PermissionDenied"},"examples":{"application/json":{"code":"PERMISSION_DENIED","message":"Authenticated user has no permission to access the requested resource"}}},"404":{"description":"Resource not found","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/NotFound"},"examples":{"application/json":{"code":"NOT_FOUND","message":"A specified resource is not found"}}},"500":{"description":"Server error","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/Internal"},"examples":{"application/json":{"code":"INTERNAL","message":"Server error"}}},"504":{"description":"Request timeout exceeded. If it happens repeatedly, consider reducing the request complexity","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/Timeout"},"examples":{"application/json":{"code":"TIMEOUT","message":"Request timeout exceeded. Try it later"}}}}}},"/users/{user_id}/phone-numbers/{phone_number}/amount-due":{"get":{"tags":["debt"],"description":"Amount due for a phone number of the user.\n Note: If an invoice is associated to several phone numbers including the one in the query, such invoice is considered as phone-number debt and therefore is returned.","operationId":"amountDueByPhoneNumber","deprecated":true,"x-fp-pi-scopes":["amount-due-phone-number-read"],"parameters":[{"$ref":"#/parameters/UserId"},{"$ref":"#/parameters/PhoneNumber"},{"$ref":"#/parameters/DebtStatus"},{"$ref":"https://docs.baikalplatform.com/common/v2.0/common.json#/parameters/x-correlator"}],"responses":{"200":{"description":"OK","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"#/definitions/AmountDue"},"examples":{"application/json":[{"start_date":"2016-12-18T00:00:00Z","end_date":"2017-01-17T00:00:00Z","description":"purchase of film Gattaca","status":"open","identifiers":["+34939791073"],"amount":{"value":1,"currency":"EUR","tax_included":false}},{"start_date":"2016-11-18T00:00:00Z","end_date":"2016-12-17T00:00:00Z","description":"November invoice","status":"unpaid","identifiers":["+34939791073"],"amount":{"value":80,"currency":"EUR","tax_included":true}},{"start_date":"2016-10-18T00:00:00Z","description":"October invoice","status":"overdue","identifiers":["+34939791073"],"amount":{"value":75,"currency":"EUR","tax_included":true}}]}},"400":{"description":"Problem with the client request","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/InvalidArgument"},"examples":{"application/json":{"code":"INVALID_ARGUMENT","message":"Client specified an invalid argument, request body o query param"}}},"403":{"description":"Client does not have sufficient permission","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/PermissionDenied"},"examples":{"application/json":{"code":"PERMISSION_DENIED","message":"Authenticated user has no permission to access the requested resource"}}},"404":{"description":"Resource not found","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/NotFound"},"examples":{"application/json":{"code":"NOT_FOUND","message":"A specified resource is not found"}}},"500":{"description":"Server error","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/Internal"},"examples":{"application/json":{"code":"INTERNAL","message":"Server error"}}},"504":{"description":"Request timeout exceeded. If it happens repeatedly, consider reducing the request complexity","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/Timeout"},"examples":{"application/json":{"code":"TIMEOUT","message":"Request timeout exceeded. Try it later"}}}},"x-ms-examples":{"Debt for several identifiers":{"responses":{"200":{"body":[{"start_date":"2016-11-18T00:00:00Z","end_date":"2016-12-17T00:00:00Z","description":"November invoice","status":"unpaid","identifiers":["+34939791073","+346666543210"],"amount":{"value":80,"currency":"EUR","tax_included":true}}]}}}}}},"/users/{user_id}/phone-numbers/{phone_number}/invoices":{"get":{"tags":["invoices"],"operationId":"listInvoicesByPhoneNumber","description":"List the invoices for the phone number matching the query","summary":"Retrieve invoices for a phone-number","x-fp-pi-scopes":["invoicing-phone-number-read"],"parameters":[{"$ref":"#/parameters/UserId"},{"$ref":"#/parameters/PhoneNumber"},{"$ref":"#/parameters/StartDate"},{"$ref":"#/parameters/EndDate"},{"$ref":"https://docs.baikalplatform.com/common/v2.2/common.json#/parameters/x-correlator"}],"responses":{"200":{"description":"OK","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"type":"array","description":"Array of Invoices","items":{"$ref":"#/definitions/Invoice"}},"examples":{"application/json":[{"id":"FB-2465-36709498","due_date":"2021-01-19T03:00:00Z","download_url":"https://apis4p.telefonica.com.ar/telefonica/api/downloads/v1/facturas?id=It4AoTlTGWylkOK%2B1nv0v%2Bcyt2ZLe%2B7NPlcUi9IJU4L8O%2F05dz9I0Bw3wtgcGNEpHVExUliVW6fVCyZSXf%2B8kxeAdyebPOSv","end_date":"2021-01-06T03:00:00Z","creation_date":"2021-01-07T03:00:00Z","name":"Factura 01-2021","start_date":"2020-12-07T03:00:00Z","payment_status":"unknown","identifiers":["1135058439"],"customer":{"name":"SOFIA YANINA  ARROYO","id_document":{"country":"AR","type":"DNI","value":"33511867"}},"total_amount":{"value":492.65,"currency":"ARS","tax_included":true},"billed_items_summary":[{"id":"2878561875","amount":{"value":1649,"currency":"ARS","tax_included":true},"description":"Plan 5GB","start_date":"2020-12-07T03:00:00Z","end_date":"2021-01-06T03:00:00Z","identifier":"1135058439","category":"tariff"},{"id":"2878561875","amount":{"value":-1154.3,"currency":"ARS","tax_included":true},"description":"Plan 5GB","start_date":"2020-12-07T03:00:00Z","end_date":"2021-01-06T03:00:00Z","identifier":"1135058439","category":"tariff"}]}]}},"400":{"description":"Problem with the client request","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/InvalidArgument"},"examples":{"application/json":{"code":"INVALID_ARGUMENT","message":"Client specified an invalid argument, request body o query param"}}},"403":{"description":"Client does not have sufficient permission","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/PermissionDenied"},"examples":{"application/json":{"code":"PERMISSION_DENIED","message":"Authenticated user has no permission to access the requested resource"}}},"404":{"description":"Resource not found","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/NotFound"},"examples":{"application/json":{"code":"NOT_FOUND","message":"A specified resource is not found"}}},"500":{"description":"Server error","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/Internal"},"examples":{"application/json":{"code":"INTERNAL","message":"Server error"}}},"504":{"description":"Request timeout exceeded. If it happens repeatedly, consider reducing the request complexity","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/Timeout"},"examples":{"application/json":{"code":"TIMEOUT","message":"Request timeout exceeded. Try it later"}}}}}},"/users/{user_id}/invoices":{"get":{"tags":["invoices"],"operationId":"listInvoices","description":"List the invoices of a user","summary":"Retrieve invoices of a user","x-fp-pi-scopes":["invoicing-user-read"],"parameters":[{"$ref":"#/parameters/UserId"},{"$ref":"#/parameters/StartDate"},{"$ref":"#/parameters/EndDate"},{"$ref":"https://docs.baikalplatform.com/common/v2.2/common.json#/parameters/x-correlator"}],"responses":{"200":{"description":"OK","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"type":"array","description":"Array of Invoices","items":{"$ref":"#/definitions/Invoice"}},"examples":{"application/json":[{"id":"FB-2465-36709498","due_date":"2021-01-19T03:00:00Z","download_url":"https://apis4p.telefonica.com.ar/telefonica/api/downloads/v1/facturas?id=It4AoTlTGWylkOK%2B1nv0v%2Bcyt2ZLe%2B7NPlcUi9IJU4L8O%2F05dz9I0Bw3wtgcGNEpHVExUliVW6fVCyZSXf%2B8kxeAdyebPOSv","end_date":"2021-01-06T03:00:00Z","creation_date":"2021-01-07T03:00:00Z","name":"Factura 01-2021","start_date":"2020-12-07T03:00:00Z","payment_status":"unknown","identifiers":["1135058439"],"customer":{"name":"SOFIA YANINA  ARROYO","id_document":{"country":"AR","type":"DNI","value":"33511867"}},"total_amount":{"value":492.65,"currency":"ARS","tax_included":true},"billed_items_summary":[{"id":"2878561875","amount":{"value":1649,"currency":"ARS","tax_included":true},"description":"Plan 5GB","start_date":"2020-12-07T03:00:00Z","end_date":"2021-01-06T03:00:00Z","identifier":"1135058439","category":"tariff"},{"id":"2878561875","amount":{"value":-1154.3,"currency":"ARS","tax_included":true},"description":"Plan 5GB","start_date":"2020-12-07T03:00:00Z","end_date":"2021-01-06T03:00:00Z","identifier":"1135058439","category":"tariff"}]}]}},"400":{"description":"Problem with the client request","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/InvalidArgument"},"examples":{"application/json":{"code":"INVALID_ARGUMENT","message":"Client specified an invalid argument, request body o query param"}}},"403":{"description":"Client does not have sufficient permission","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/PermissionDenied"},"examples":{"application/json":{"code":"PERMISSION_DENIED","message":"Authenticated user has no permission to access the requested resource"}}},"404":{"description":"Not Found","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/NotFound"},"examples":{"application/json":{"code":"NOT_FOUND","message":"A specified resource is not found"}}},"500":{"description":"Server error","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/Internal"},"examples":{"application/json":{"code":"INTERNAL","message":"Server error"}}},"504":{"description":"Request timeout exceeded. If it happens repeatedly, consider reducing the request complexity","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/Timeout"},"examples":{"application/json":{"code":"TIMEOUT","message":"Request timeout exceeded. Try it later"}}}}}},"/users/{user_id}/amount-due":{"get":{"tags":["debt"],"description":"Amount due for the user","operationId":"amountDue","deprecated":true,"x-fp-pi-scopes":["amount-due-user-read"],"parameters":[{"$ref":"#/parameters/UserId"},{"$ref":"#/parameters/DebtStatus"},{"$ref":"https://docs.baikalplatform.com/common/v2.0/common.json#/parameters/x-correlator"}],"responses":{"200":{"description":"OK","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"#/definitions/AmountDue"},"examples":{"application/json":[{"start_date":"2021-01-06T00:00:00-03:00","end_date":"2021-02-06T23:59:59-03:00","status":"open","description":"cycle current balance","amount":{"value":0,"currency":"ARS","tax_included":true},"identifiers":["+541135058439"]}]}},"400":{"description":"Problem with the client request","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/InvalidArgument"},"examples":{"application/json":{"code":"INVALID_ARGUMENT","message":"Client specified an invalid argument, request body o query param"}}},"403":{"description":"Client does not have sufficient permission","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/PermissionDenied"},"examples":{"application/json":{"code":"PERMISSION_DENIED","message":"Authenticated user has no permission to access the requested resource"}}},"404":{"description":"Resource not found","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/NotFound"},"examples":{"application/json":{"code":"NOT_FOUND","message":"A specified resource is not found"}}},"500":{"description":"Server error","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/Internal"},"examples":{"application/json":{"code":"INTERNAL","message":"Server error"}}},"504":{"description":"Request timeout exceeded. If it happens repeatedly, consider reducing the request complexity","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/Timeout"},"examples":{"application/json":{"code":"TIMEOUT","message":"Request timeout exceeded. Try it later"}}}},"x-ms-examples":{"Identifiers with different billing-cycle":{"responses":{"200":{"body":[{"start_date":"2016-11-18T00:00:00Z","end_date":"2016-12-17T00:00:00Z","description":"November invoice ABCD","status":"unpaid","identifiers":["+34939791073"],"amount":{"value":80,"currency":"EUR","tax_included":true}},{"start_date":"2016-11-01T00:00:00Z","end_date":"2016-11-30T23:59:59Z","description":"November invoice EFGH","status":"unpaid","identifiers":["+346661234560"],"amount":{"value":25,"currency":"EUR","tax_included":true}}]}}}}}},"/users/{user_id}/notification-email":{"get":{"tags":["notification-email"],"deprecated":true,"description":"Notification email for receive the invoices","operationId":"notificationEmail","x-fp-pi-scopes":["notification-email-read"],"parameters":[{"$ref":"#/parameters/UserId"},{"$ref":"https://docs.baikalplatform.com/common/v2.0/common.json#/parameters/x-correlator"}],"responses":{"200":{"description":"OK","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"#/definitions/NotificationEmail"},"examples":{"application/json":{"email":"example@email.com"}}},"400":{"description":"Problem with the client request","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/InvalidArgument"},"examples":{"application/json":{"code":"INVALID_ARGUMENT","message":"Client specified an invalid argument, request body o query param"}}},"403":{"description":"Client does not have sufficient permission","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/PermissionDenied"},"examples":{"application/json":{"code":"PERMISSION_DENIED","message":"Authenticated user has no permission to access the requested resource"}}},"404":{"description":"Resource not found","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/NotFound"},"examples":{"application/json":{"code":"NOT_FOUND","message":"A specified resource is not found"}}},"500":{"description":"Server error","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/Internal"},"examples":{"application/json":{"code":"INTERNAL","message":"Server error"}}},"504":{"description":"Request timeout exceeded. If it happens repeatedly, consider reducing the request complexity","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/Timeout"},"examples":{"application/json":{"code":"TIMEOUT","message":"Request timeout exceeded. Try it later"}}}}},"post":{"tags":["notification-email"],"description":"Activate notifications to the sending email","operationId":"notificationEmailActivate","deprecated":true,"x-fp-pi-scopes":["notification-email-write"],"parameters":[{"$ref":"#/parameters/UserId"},{"in":"body","name":"notificationEmail","required":true,"schema":{"$ref":"#/definitions/NotificationEmail"}},{"$ref":"https://docs.baikalplatform.com/common/v2.0/common.json#/parameters/x-correlator"}],"responses":{"201":{"description":"Created","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"#/definitions/NotificationEmail"},"examples":{"application/json":{"email":"example@email.com"}}},"400":{"description":"Problem with the client request","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/InvalidArgument"},"examples":{"application/json":{"code":"INVALID_ARGUMENT","message":"Client specified an invalid argument, request body o query param"}}},"403":{"description":"Client does not have sufficient permission","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/PermissionDenied"},"examples":{"application/json":{"code":"PERMISSION_DENIED","message":"Authenticated user has no permission to access the requested resource"}}},"404":{"description":"Resource not found","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/NotFound"},"examples":{"application/json":{"code":"NOT_FOUND","message":"A specified resource is not found"}}},"409":{"description":"The resource already exists","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/AlreadyExists"},"examples":{"application/json":{"code":"ALREADY_EXISTS","message":"The specified resource already exists"}}},"500":{"description":"Server error","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/Internal"},"examples":{"application/json":{"code":"INTERNAL","message":"Server error"}}},"504":{"description":"Request timeout exceeded. If it happens repeatedly, consider reducing the request complexity","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/Timeout"},"examples":{"application/json":{"code":"TIMEOUT","message":"Request timeout exceeded. Try it later"}}}}},"delete":{"tags":["notification-email"],"description":"Deactivate notifications to the sending email","operationId":"notificationEmailDeactivate","deprecated":true,"x-fp-pi-scopes":["notification-email-write"],"parameters":[{"$ref":"#/parameters/UserId"},{"$ref":"https://docs.baikalplatform.com/common/v2.0/common.json#/parameters/x-correlator"}],"responses":{"200":{"description":"Deleted","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}}},"403":{"description":"Client does not have sufficient permission","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/PermissionDenied"},"examples":{"application/json":{"code":"PERMISSION_DENIED","message":"Authenticated user has no permission to access the requested resource"}}},"404":{"description":"Resource not found","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/NotFound"},"examples":{"application/json":{"code":"NOT_FOUND","message":"A specified resource is not found"}}},"500":{"description":"Server error","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/Internal"},"examples":{"application/json":{"code":"INTERNAL","message":"Server error"}}},"504":{"description":"Request timeout exceeded. If it happens repeatedly, consider reducing the request complexity","headers":{"x-correlator":{"type":"string","description":"Correlation id for the different services"}},"schema":{"$ref":"https://docs.baikalplatform.com/errors/v2.0/errors.json#/definitions/Timeout"},"examples":{"application/json":{"code":"TIMEOUT","message":"Request timeout exceeded. Try it later"}}}}}}},"x-fp-health":"http://invoicing:8080/healthz","definitions":{"JSON_exception":{"properties":{"code":{"type":"string"},"message":{"type":"string"}},"additionalProperties":false,"description":"Estructura para soportar code y message requeridos en la respuesta."},"Invoice":{"type":"object","required":["id","name","customer","creation_date","start_date","end_date","due_date","total_amount","payment_status","billed_items_summary","identifiers"],"properties":{"id":{"type":"string","description":"Unique identifier of this invoice"},"name":{"type":"string","description":"Friendly name for the invoice"},"customer":{"$ref":"#/definitions/Customer"},"creation_date":{"type":"string","format":"date-time","description":"Time for the creation/issuance of this invoice, in ISO-8601 extended local date format. Time-offset from UTC may be used to match local OB time."},"start_date":{"type":"string","format":"date-time","description":"Time for the initiation of this invoice period, in ISO-8601 extended local date format. Time-offset from UTC may be used to match local OB time."},"end_date":{"type":"string","format":"date-time","description":"Time for the finalization of this invoice period, in ISO-8601 extended local date format. Time-offset from UTC may be used to match local OB time."},"due_date":{"type":"string","format":"date-time","description":"Time for the due of this invoice period, in ISO-8601 extended local date format. Time-offset from UTC may be used to match local OB time."},"payment_date":{"type":"string","format":"date-time","description":"Time for the date when the payment was made effective, in ISO-8601 extended local date format. Time-offset from UTC may be used to match local OB time."},"next_invoice_date":{"type":"string","format":"date-time","description":"Time for the next invoice creation, in ISO-8601 extended local date format. Time-offset from UTC may be used to match local OB time."},"payment_status":{"type":"string","description":"Payment status of this invoice period.\n'paid' means the invoice has already been paid.\n'unpaid' means the invoice is issued but not paid.\n'unknown' is exceptional scenario for error cases (should not happen).\n'blocked' and 'disputed' are used for scenarios where issue with the user has occurred and has to be solved.\n'pending' means that the invoice is issued but has not been sent to user yet (thus is not set as 'unpaid')\n'partial' is sub-case of unpaid, where part of the invoice has been paid (in OBs where this is possible).\nNot every status may exist in every OB.","enum":["paid","unpaid","unknown","blocked","pending","partial","disputed"]},"total_amount":{"$ref":"https://docs.baikalplatform.com/common/v2.2/common.json#/definitions/MoneyAmount"},"phone_numbers":{"type":"array","description":"List of phone_numbers associated to this invoice. 'E164 with +'' format.\n This field is maintained for backwards compatibility for OBs that already implemented V3.2 or former ones, thus having clients expecting this parameter.\n It will be deprecated in future versions.\n If param is included, values included here will also appear in 'identifiers' field.","items":{"type":"string"}},"identifiers":{"type":"array","description":"List of user identifiers for which this invoice is issued. Every identifier must be included (phone-numbers, uids, etc)","minItems":1,"items":{"type":"string"}},"download_url":{"type":"string","description":"URL of download the invoice on pdf. This endpoints provides the main invoice document, in cases where more than one exist. Must be public access URL, but properly securitized (e.g.: temporary and non predicatable URLs)"},"secondary_download_urls":{"type":"array","description":"URLs for invoice documents on pdf or other relevant documents bound to the invoice, in scenarios where more than one document is generated. E.g.: OBs may provide the legal invoice document together with other documents with 'bill summary' or 'consumption summary' or 'consumption details of a phone-number'; also OBs may provide an image with a code-bar for payment of the invoice.\n Must be public access URL, but properly securitized (e.g.: temporary and non predicatable URLs)","items":{"$ref":"#/definitions/SecondaryInvoiceUrl"}},"billed_items_summary":{"type":"array","description":"Array of billed items associated to this invoice","items":{"$ref":"#/definitions/BilledItem"}}}},"BilledItemMoneyAmount":{"type":"object","description":"Money amount","required":["value","currency"],"properties":{"value":{"type":"number","format":"float","multipleOf":1.0E-4,"description":"Amount value"},"currency":{"type":"string","description":"Currency code in which the amount is expressed. ISO 4217"},"tax_included":{"type":"boolean","description":"true if the amount includes government taxes","default":false}}},"BilledItem":{"type":"object","required":["id","amount","description","start_date","end_date"],"properties":{"id":{"type":"string","description":"Unique id of this item"},"parent_id":{"type":"string","description":"Id of the parent item. It allows to organize billed items hierarchically."},"amount":{"$ref":"#/definitions/BilledItemMoneyAmount"},"description":{"type":"string","description":"Human readable description of the item. Used for display purposes"},"start_date":{"type":"string","format":"date-time","description":"Time for the initiation of the item, in ISO-8601 extended local date format. Time-offset from UTC may be used to match local OB time."},"end_date":{"type":"string","format":"date-time","description":"Time for the finalization of the item, in ISO-8601 extended local date format. Time-offset from UTC may be used to match local OB time."},"identifier":{"type":"string","description":"Identifier (e.g. phone_number, uid, etc), for which this item is specifically associated."},"category":{"type":"string","description":"Category of the billed item, intended for two purposes: 1) Ease UX of consuming applications (e.g.: set icon for Calls without having to parse 'description'). 2) Provide easy linking to Timeline API to see details of billed_items. Values stand for:\n- 'calls': Billed Item for certain calls consumption.\n- 'texts': Billed Item for certain SMSs consumption.\n- 'data': Billed Item for navigation consumption.\n- 'tariff': Billed Item related to some product/sub-product tariff applied in the billing-cycle.\n- 'purchase': Billed item related to one-off purchase (e.g.: bolt-on acquisition, TV movie acquisition)","enum":["calls","texts","data","tariff","purchase"]}}},"Customer":{"type":"object","description":"Customer information","required":["name"],"properties":{"name":{"type":"string","description":"The user full name"},"id_document":{"$ref":"https://docs.baikalplatform.com/common/v2.2/common.json#/definitions/IdDocument"}}},"SecondaryInvoiceUrl":{"type":"object","description":"Link to complementary Invoice documents or other related files","required":["name","url"],"properties":{"name":{"type":"string","description":"The name of the files"},"url":{"type":"string","description":"URL to download the file."},"mime_type":{"type":"string","description":"Mime type of the file available in the URL. E.g.: application/pdf, image/jpg"}}},"InvoiceSummary":{"type":"object","required":["id","name","creation_date","start_date","end_date","total_amount","identifiers"],"properties":{"id":{"type":"string","description":"Unique identifier of this invoice"},"name":{"type":"string","description":"Friendly name for the invoice"},"creation_date":{"type":"string","format":"date-time","description":"Time for the creation/issuance of this invoice, in ISO-8601 extended local date format. Time-offset from UTC may be used to match local OB time."},"start_date":{"type":"string","format":"date-time","description":"Time for the initiation of this invoice period, in ISO-8601 extended local date format. Time-offset from UTC may be used to match local OB time."},"end_date":{"type":"string","format":"date-time","description":"Time for the finalization of this invoice period, in ISO-8601 extended local date format. Time-offset from UTC may be used to match local OB time."},"total_amount":{"$ref":"https://docs.baikalplatform.com/common/v2.2/common.json#/definitions/MoneyAmount"},"identifiers":{"type":"array","description":"List of user identifiers for which this invoice is issued. Every identifier must be included (phone-numbers, uids, etc)","minItems":1,"items":{"type":"string"}},"download_url":{"type":"string","description":"URL of download the invoice on pdf. This endpoints provides the main invoice document, in cases where more than one exist"}}},"NotificationEmail":{"type":"object","required":["email"],"properties":{"email":{"type":"string","description":"Email where wants receive the notifications"}}},"AmountDue":{"type":"array","items":{"$ref":"#/definitions/DebtDue"}},"DebtDue":{"type":"object","required":["start_date","status","description","amount","identifiers"],"properties":{"start_date":{"type":"string","format":"date-time","description":"Time for the initiation of the current debt state, in ISO-8601 extended local date format. Time-offset from UTC may be used to match local OB time."},"end_date":{"type":"string","format":"date-time","description":"Time until the next change of state, in ISO-8601 extended local date format. Time-offset from UTC may be used to match local OB time. It should exist always except when in overdue state."},"status":{"$ref":"#/definitions/DebtStatus"},"description":{"type":"string","description":"Description of the nature of the debt"},"amount":{"$ref":"https://docs.baikalplatform.com/common/v2.0/common.json#/definitions/MoneyAmount"},"identifiers":{"type":"array","description":"List of user identifiers to which debt applies. Every identifier must be included (phone-numbers, uids, etc).","minItems":1,"items":{"type":"string"}}}},"DebtStatus":{"type":"string","description":"'open' stands for debt generated in current billing-cycle, not yet included in an issued invoice.\n'unpaid' stands for debt already included in an issued invoice, but period of payment granted to the user has not finished yet.\n'overdue' stands for debt already included in an issued invoice, and period of payment granted to the user has finished. Existence of debts in this status may imply that debt generates interests, or some user services are suspended/blocked.","enum":["open","unpaid","overdue"]},"ArrayofInvoicesSummary":{"type":"array","items":{"$ref":"#/definitions/InvoiceSummary"}}},"parameters":{"UserId":{"name":"user_id","in":"path","required":true,"type":"string","description":"id of the user for which the methods apply.\nThis value should be changed to the special keyword 'me' to simplify calls when access using OAuth2 with three-legged authentication","x-fp-identifier":"user_id"},"PhoneNumber":{"name":"phone_number","in":"path","required":true,"type":"string","description":"Phone number for which the invoices apply. 'E164 with +'' format.","x-fp-identifier":"phone_number"},"StartDate":{"name":"start_date","in":"query","description":"Start time, in ISO-8601 extended local date format, for searching invoices based on creation_date. Time-offset from UTC may be used to match local OB time.","required":true,"type":"string","format":"date-time"},"EndDate":{"name":"end_date","in":"query","description":"End time, in ISO-8601 extended local date format, for searching invoices based on creation_date. Time-offset from UTC may be used to match local OB time.","required":true,"type":"string","format":"date-time"},"InvoiceId":{"name":"invoice_id","in":"path","required":true,"type":"string","description":"Invoice Unique Identifier."},"DebtStatus":{"name":"status","in":"query","description":"Status of the pending debts which want to filter","required":false,"type":"string","enum":["open","unpaid","overdue"]}},"x-ibm-configuration":{"enforced":true,"testable":true,"phase":"realized","cors":{"enabled":true},"assembly":{"execute":[{"activity-log":{"title":"activity-log","content":"activity","error-content":"payload","version":"1.0.0"}},{"switch":{"title":"switch","case":[{"condition":"(api.operation.id==='listInvoicesSummary')||(api.operation.id==='getInvoice')||(api.operation.id==='listInvoices')||(api.operation.id==='amountDue')||(api.operation.id==='notificationEmail')||(api.operation.id==='notificationEmailActivate')||(api.operation.id==='notificationEmailDeactivate')","execute":[{"throw":{"title":"throw not inplemented","version":"1.0.0","name":"NOT_IMPLEMENTED"}}]},{"otherwise":[{"map":{"title":"map Invoke Utilities","inputs":{"user_id":{"schema":{"type":"string"},"variable":"request.parameters.user_id"},"phone_number":{"schema":{"type":"string"},"variable":"request.parameters.phone_number"},"x-correlator":{"schema":{"type":"string"},"variable":"message.headers.x-correlator"}},"outputs":{"output":{"schema":{"properties":{"user_id":{"type":"string","name":"user_id"},"phone_number":{"type":"string","name":"phone_number"}}},"variable":"message.body"},"content-type":{"schema":{"type":"string"},"variable":"message.headers.content-type"},"x-correlator":{"schema":{"type":"string"},"variable":"x-correlator"}},"actions":[{"set":"output.user_id","from":"user_id"},{"set":"output.phone_number","from":"phone_number"},{"set":"content-type","default":"application/json"},{"set":"x-correlator","from":"x-correlator"}],"version":"1.0.0"}},{"invoke":{"title":"invoke Utilities","timeout":60,"verb":"POST","cache-response":"protocol","cache-ttl":900,"version":"1.0.0","target-url":"$(utilities_end_point)","stop-on-error":["OperationError","ConnectionError"]}},{"map":{"title":"map Response Utilities","inputs":{"user_id":{"schema":{"type":"string"},"variable":"message.body.user_id"},"phone_number":{"schema":{"type":"string"},"variable":"message.body.phone_number"}},"outputs":{"user_id":{"schema":{"type":"string"},"variable":"user_id"},"phone_number":{"schema":{"type":"string"},"variable":"phone_number"}},"actions":[{"set":"user_id","from":"user_id"},{"set":"phone_number","from":"phone_number","value":"$(1).replace(\"+54\",\"\");"}],"version":"1.0.0","options":{"includeEmptyXMLElements":false}}},{"switch":{"title":"switch","case":[{"condition":"(api.operation.id==='listInvoicesSummaryByPhoneNumber')","execute":[{"invoke":{"title":"tokenEjbauthorization","timeout":60,"verb":"GET","cache-response":"protocol","cache-ttl":900,"stop-on-error":["OperationError","ConnectionError"],"version":"1.0.0","target-url":"$(tokenejbauthorization)"}},{"map":{"title":"map InvokeInvoicesSummaryByPhoneNumber","inputs":{"TokenEjbAuthorization":{"schema":{"type":"string"},"variable":"message.headers.ejbauthorization"},"start_date":{"schema":{"type":"string"},"variable":"request.parameters.start_date"},"end_date":{"schema":{"type":"string"},"variable":"request.parameters.end_date"},"x-correlator":{"schema":{"type":"string"},"variable":"x-correlator"}},"outputs":{"start_date":{"schema":{"type":"string"},"variable":"start_date"},"end_date":{"schema":{"type":"string"},"variable":"end_date"},"x-correlator":{"schema":{"type":"string"},"variable":"message.headers.x-correlator"},"authorization":{"schema":{"type":"string"},"variable":"message.headers.authorization"}},"actions":[{"set":"x-correlator","from":"x-correlator"},{"set":"authorization","from":"TokenEjbAuthorization"},{"set":"start_date","from":"start_date"},{"set":"end_date","from":"end_date"}],"version":"1.0.0"}},{"invoke":{"title":"InvokeInvoicesSummaryByPhoneNumber","timeout":60,"verb":"GET","cache-response":"protocol","cache-ttl":900,"stop-on-error":["OperationError","ConnectionError"],"version":"1.0.0","target-url":"$(endpointInvoices)/users/$(user_id)/phone-numbers/$(phone_number)/invoices/summary$(request.search)"}}]},{"condition":"(api.operation.id==='getInvoiceByPhoneNumber')","execute":[{"invoke":{"title":"tokenEjbauthorization","timeout":60,"verb":"GET","cache-response":"protocol","cache-ttl":900,"stop-on-error":["ConnectionError","OperationError"],"version":"1.0.0","target-url":"$(tokenejbauthorization)"}},{"map":{"title":"map InvokeInvoiceByPhoneNumber","inputs":{"TokenEjbAuthorization":{"schema":{"type":"string"},"variable":"message.headers.ejbauthorization"},"x-correlator":{"schema":{"type":"string"},"variable":"x-correlator"},"invoice_id":{"schema":{"type":"string"},"variable":"request.parameters.invoice_id"}},"outputs":{"x-correlator":{"schema":{"type":"string"},"variable":"message.headers.x-correlator"},"authorization":{"schema":{"type":"string"},"variable":"message.headers.authorization"},"invoice_id":{"schema":{"type":"string"},"variable":"invoice_id"}},"actions":[{"set":"x-correlator","from":"x-correlator"},{"set":"authorization","from":"TokenEjbAuthorization"},{"set":"invoice_id","from":"invoice_id"}],"version":"1.0.0"}},{"invoke":{"title":"InvokeInvoiceByPhoneNumber","timeout":60,"verb":"GET","cache-response":"protocol","cache-ttl":900,"stop-on-error":["OperationError","ConnectionError"],"version":"1.0.0","target-url":"$(endpointInvoices)/users/$(user_id)/phone-numbers/$(phone_number)/invoices/$(invoice_id)"}}]},{"condition":"(api.operation.id==='listInvoicesByPhoneNumber')","execute":[{"invoke":{"title":"tokenEjbauthorization","timeout":60,"verb":"GET","cache-response":"protocol","cache-ttl":900,"stop-on-error":["OperationError","ConnectionError"],"version":"1.0.0","target-url":"$(tokenejbauthorization)"}},{"gatewayscript":{"title":"CompletaHoraEnFechas","version":"1.0.0","source":"//Por compatibilidad con la versión anterior (3.2.1) se agrega la hora en las fechas si la misma no viene informada\n\nvar start_date = apim.getvariable('request.parameters.start_date');\nvar end_date = apim.getvariable('request.parameters.end_date');\n\nif (start_date.length<11) {\n   start_date = start_date.concat('T00:00:00Z');\n}\n\nif (end_date.length<11) {\n   end_date = end_date.concat('T00:00:00Z');\n}\n\napim.setvariable('start_date', start_date);\napim.setvariable('end_date', end_date);"}},{"map":{"title":"map InvokelistInvoicesByPhoneNumber","inputs":{"TokenEjbAuthorization":{"schema":{"type":"string"},"variable":"message.headers.ejbauthorization"},"start_date":{"schema":{"type":"string"},"variable":"start_date"},"end_date":{"schema":{"type":"string"},"variable":"end_date"},"x-correlator":{"schema":{"type":"string"},"variable":"x-correlator"}},"outputs":{"start_date":{"schema":{"type":"string"},"variable":"start_date"},"end_date":{"schema":{"type":"string"},"variable":"end_date"},"x-correlator":{"schema":{"type":"string"},"variable":"message.headers.x-correlator"},"authorization":{"schema":{"type":"string"},"variable":"message.headers.authorization"}},"actions":[{"set":"x-correlator","from":"x-correlator"},{"set":"authorization","from":"TokenEjbAuthorization"},{"set":"start_date","from":"start_date"},{"set":"end_date","from":"end_date"}],"version":"1.0.0"}},{"invoke":{"title":"InvokelistInvoicesByPhoneNumber","timeout":60,"verb":"GET","cache-response":"protocol","cache-ttl":900,"stop-on-error":["OperationError","ConnectionError"],"version":"1.0.0","target-url":"$(endpointInvoices)/users/$(user_id)/phone-numbers/$(phone_number)/invoices?start_date=$(start_date)&end_date=$(end_date)"}}]},{"condition":"(api.operation.id==='amountDueByPhoneNumber')","execute":[{"gatewayscript":{"title":"gatewayscript","version":"1.0.0","source":"const OVERDUE_STATUS = \"overdue\";\r\nconst UNPAID_STATUS = \"unpaid\";\r\nconst OPEN_STATUS = \"open\";\r\n\r\nvar query_status = apim.getvariable(\"request.parameters.status\");\r\n\r\n//Valido parametro status\r\nif ( query_status ) {\r\n    var estados = decodeURI(query_status).split(\",\");\r\n\r\n    for(var i = 0; i < estados.length; i++) {\r\n        \r\n        var estado = estados[i].trim();\r\n        \r\n        if ( estado != undefined  && estado !== OPEN_STATUS && estado !== OVERDUE_STATUS && estado !== UNPAID_STATUS ) {\r\n            apim.setvariable(\"message.status.code\",400);\r\n            apim.error('Error', 400, 'Bad Request', 'Status invalid');\r\n        }\r\n    }\r\n}"}},{"map":{"title":"map","inputs":{"phone_number":{"schema":{"type":"string"},"variable":"request.parameters.phone_number"}},"outputs":{"ClientId":{"schema":{"type":"string"},"variable":"message.headers.x-ibm-client-id"},"Authorization":{"schema":{"type":"string"},"variable":"message.headers.Authorization"},"phone_number":{"schema":{"type":"string"},"variable":"phone_number"}},"actions":[{"set":"ClientId","value":"apim.getvariable('client.app.id');"},{"set":"Authorization","value":"apim.getvariable('request.authorization');"},{"set":"phone_number","from":"phone_number","value":"$(1).replace(\"+54\",\"\");"}],"version":"1.0.0"}},{"invoke":{"title":"invoke","timeout":60,"verb":"GET","cache-response":"protocol","cache-ttl":900,"stop-on-error":["ConnectionError","OperationError","SOAPError"],"version":"1.0.0","target-url":"$(BalanceManagementEndpoint)/$(phone_number)"}},{"gatewayscript":{"title":"ArmaRespuesta","version":"1.0.0","source":"apim.output('application/json');\r\n\r\nconst OVERDUE_STATUS = \"overdue\";\r\nconst UNPAID_STATUS = \"unpaid\";\r\nconst OPEN_STATUS = \"open\";\r\n\r\nvar status = apim.getvariable(\"request.parameters.status\");\r\nvar phone_number = apim.getvariable(\"request.parameters.phone_number\");\r\nvar resultBody = apim.getvariable(\"message.body\");\r\n\r\nvar response=[];\r\n\r\nif (status == undefined || status == \"\" || status.includes(OPEN_STATUS) ) {\r\n   var balance_cycle = Number(resultBody.data.overallCurrentBalance) - (Number(resultBody.data.notOverdueBalanceAmount.amount) + Number(resultBody.data.overdueBalanceAmount.amount));\r\n   response.push(create_body(resultBody.data.lastCycleCloseDate, resultBody.data.currentCycleCloseDate, OPEN_STATUS,  \"cycle current balance\", balance_cycle, phone_number));\r\n}\r\n\r\nif (status == undefined || status == \"\" || status.includes(UNPAID_STATUS) ) {\r\n    if (resultBody.data.notOverdueBalanceAmount.amount>0) {\r\n        response.push(create_body(resultBody.data.lastCycleCloseDate, resultBody.data.lastCycleDueDate, UNPAID_STATUS,  \"unpaid current balance\", resultBody.data.notOverdueBalanceAmount.amount, phone_number));\r\n    }\r\n}\r\n\r\nif (status == undefined || status == \"\"  || status.includes(OVERDUE_STATUS) ) {\r\n    if (resultBody.data.overdueBalanceAmount.amount>0) {\r\n        response.push(create_body(resultBody.data.lastCycleDueDate, null, OVERDUE_STATUS,  \"overdue current balance\",\r\n            resultBody.data.overdueBalanceAmount.amount, phone_number));\r\n    }\r\n}\r\n\r\napim.setvariable(\"message.body\",response);\r\n\r\nfunction create_body(start_date, end_date, status, description, amount, phone_number){\r\n    var body = {};\r\n    \r\n    body.start_date = start_date;\r\n    if(end_date != null) {\r\n        body.end_date = end_date;\r\n    }\r\n    body.status = status;\r\n    body.description = description;\r\n    body.amount = {};\r\n    body.amount.value = Number(amount);\r\n    body.amount.currency = \"ARS\";\r\n    body.amount.tax_included = true;\r\n    body.identifiers = [];\r\n    body.identifiers.push(''+phone_number);\r\n\r\n    return body;\r\n};"}},{"gatewayscript":{"title":"remove headers","version":"1.0.0","source":"apim.setvariable('message.headers.x-token-info','','clear');\r\napim.setvariable('message.headers.x-Scope','','clear');\r\napim.setvariable('message.headers.raw-request-uri','','clear');\r\napim.setvariable('message.headers.x-authorization-id','','clear');\r\napim.setvariable('message.headers.x-forwarded-for','','clear');\r\napim.setvariable('message.headers.access-control-expose-headers','','clear');\r\napim.setvariable('message.headers.IBM-App-User','','clear');\r\napim.setvariable('message.headers.x-ibm-client-id','','clear');\r\napim.setvariable('message.headers.Authorization','','clear');\r\napim.setvariable('message.headers.country','','clear');\r\napim.setvariable('message.headers.lang','','clear');\r\napim.setvariable('message.headers.entity','','clear');\r\napim.setvariable('message.headers.system','','clear');\r\napim.setvariable('message.headers.subsystem','','clear');\r\napim.setvariable('message.headers.originator','','clear');\r\napim.setvariable('message.headers.sender','','clear');\r\napim.setvariable('message.headers.userId','','clear');\r\napim.setvariable('message.headers.wsId','','clear');\r\napim.setvariable('message.headers.wsIp','','clear');\r\napim.setvariable('message.headers.operation','','clear');\r\napim.setvariable('message.headers.destination','','clear');\r\napim.setvariable('message.headers.pid','','clear');\r\napim.setvariable('message.headers.execId','','clear');\r\napim.setvariable('message.headers.msgId','','clear');\r\napim.setvariable('message.headers.timestamp','','clear');\r\napim.setvariable('message.headers.msgType','','clear');"}}]},{"otherwise":[{"throw":{"title":"throw not inplemented","version":"1.0.0","name":"NOT_IMPLEMENTED"}}]}],"version":"1.0.0"}}]}],"version":"1.0.0"}}],"catch":[{"errors":["NOT_IMPLEMENTED"],"execute":[{"map":{"title":"map","inputs":{},"outputs":{"output":{"schema":{"type":"object","properties":{"code":{"type":"string","name":"code"},"message":{"type":"string","name":"message"}}},"variable":"message.body"},"httpstatus":{"schema":{"type":"integer"},"variable":"message.status.code"},"httpreason":{"schema":{"type":"string"},"variable":"message.status.reason"}},"actions":[{"set":"output.code","default":"NOT_IMPLEMENTED"},{"set":"output.message","default":"This functionality is not implemented yet"},{"set":"httpstatus","default":"501"},{"set":"httpreason","default":"Not Implemented"}],"version":"1.0.0"}}]},{"errors":["DEBUG"],"execute":[{"gatewayscript":{"title":"gatewayscript","version":"1.0.0","source":"var body = {};\n\nbody.apiName = apim.getvariable('api.name');\nbody.operationId = apim.getvariable('api.operation.id');\nbody.operationPath = apim.getvariable('api.operation.path');\nbody.requestParameters = apim.getvariable('request.parameters');\nbody.requestSearch = apim.getvariable('request.search');\n\nbody.start_date = apim.getvariable('start_date');\nbody.end_date = apim.getvariable('end_date');\n\n\napim.setvariable('message.body',body);"}}]},{"default":[{"switch":{"title":"switch","case":[{"condition":"apim.getvariable('message.status.code')=='400'","execute":[{"map":{"title":"map","inputs":{},"outputs":{"output":{"schema":{"$ref":"#/definitions/JSON_exception"},"variable":"message.body"}},"actions":[{"set":"output.code","default":"INVALID_ARGUMENT"},{"set":"output.message","default":"Client specified an invalid argument, request body o query param"}],"version":"1.0.0"}}]},{"condition":"apim.getvariable('message.status.code')=='403'","execute":[{"map":{"title":"map","inputs":{},"outputs":{"output":{"schema":{"$ref":"#/definitions/JSON_exception"},"variable":"message.body"}},"actions":[{"set":"output.code","default":"PERMISSION_DENIED"},{"set":"output.message","default":"Authenticated user has no permission to access the requested resource"}],"version":"1.0.0"}}]},{"condition":"apim.getvariable('message.status.code')=='404' || apim.getvariable('message.status.code')=='500'","execute":[{"map":{"title":"map","inputs":{},"outputs":{"output":{"schema":{"$ref":"#/definitions/JSON_exception"},"variable":"message.body"},"httpstatus":{"schema":{"type":"integer"},"variable":"message.status.code"}},"actions":[{"set":"output.code","default":"NOT_FOUND"},{"set":"output.message","default":"A specified resource is not found"},{"set":"httpstatus","value":"404"}],"version":"1.0.0"}}]},{"condition":"apim.getvariable('message.status.code')=='409'","execute":[{"map":{"title":"map","inputs":{},"outputs":{"output":{"schema":{"$ref":"#/definitions/JSON_exception"},"variable":"message.body"}},"actions":[{"set":"output.code","default":"ALREADY_EXISTS"},{"set":"output.message","default":"The resource already exists"}],"version":"1.0.0"}}]},{"condition":"apim.getvariable('message.status.code')=='504'","execute":[{"map":{"title":"map","inputs":{},"outputs":{"output":{"schema":{"$ref":"#/definitions/JSON_exception"},"variable":"message.body"}},"actions":[{"set":"output.code","default":"TIMEOUT"},{"set":"output.message","default":"Request timeout exceeded. Try it later"}],"version":"1.0.0"}}]},{"condition":"apim.getvariable('message.status.code')=='502'","execute":[{"map":{"title":"map","inputs":{},"outputs":{"output":{"schema":{"$ref":"#/definitions/JSON_exception"},"variable":"message.body"},"httpstatus":{"schema":{"type":"integer"},"variable":"message.status.code"}},"actions":[{"set":"output.code","default":"NOT_FOUND"},{"set":"output.message","default":"A specified resource is not found"},{"set":"httpstatus","default":"404"}],"version":"1.0.0"}}]},{"otherwise":[{"map":{"title":"map","inputs":{},"outputs":{"output":{"schema":{"$ref":"#/definitions/JSON_exception"},"variable":"message.body"},"httpstatus":{"schema":{"type":"integer"},"variable":"message.status.code"}},"actions":[{"set":"output.code","default":"INTERNAL"},{"set":"output.message","default":"Server error"},{"set":"httpstatus","default":"500"}],"version":"1.0.0"}}]}],"version":"1.0.0"}}]}]},"properties":{"BalanceManagementEndpoint":{"value":"","description":"","encoded":false},"utilities_end_point":{"value":"","description":"","encoded":false},"endpointInvoices":{"value":"","description":"","encoded":false},"tokenejbauthorization":{"value":"","description":"","encoded":false}},"catalogs":{"Certificación":{"properties":{"tokenejbauthorization":"http://10.249.16.123:20551/ASM3LoginServices/login","endpointInvoices":"http://10.249.16.123:20555","utilities_end_point":"https://10.167.192.197/telefonica/sandbox/utils/validates/4p/minimal-parameters-in-path","BalanceManagementEndpoint":"https://10.167.192.197/telefonica/sandbox/balancemanagement/oauth/v1/balances"}},"Produccion":{"properties":{"utilities_end_point":"https://10.167.192.197/telefonica/api/utils/validates/4p/minimal-parameters-in-path","BalanceManagementEndpoint":"https://10.167.192.197/telefonica/api/balancemanagement/oauth/v1/balances","endpointInvoices":"http://10.167.205.100:43016","tokenejbauthorization":"http://10.204.164.38:43013/ASM3LoginServices/login"}},"Pre Produccion":{"properties":{"utilities_end_point":"https://10.167.192.204/telefonica/sb/utils/validates/4p/minimal-parameters-in-path","endpointInvoices":"http://10.249.16.123:20555","tokenejbauthorization":"http://10.249.16.123:20551/ASM3LoginServices/login","BalanceManagementEndpoint":"https://10.167.192.200/preproduccion/api/balancemanagement/oauth/v1/balances"}},"Arquitectura":{"properties":{"utilities_end_point":"https://10.167.192.204/telefonica/sb/utils/validates/4p/minimal-parameters-in-path","tokenejbauthorization":"http://10.249.16.123:20551/ASM3LoginServices/login","endpointInvoices":"http://10.249.16.123:20555","BalanceManagementEndpoint":"https://10.167.192.204/telefonica/sb/balancemanagement/oauth/v1/balances"}}}},"securityDefinitions":{"oauth-1":{"type":"oauth2","description":"","flow":"application","scopes":{"scope1":""},"tokenUrl":"https://apiinternos.movistar.com.ar/telefonica/api/v1/oauth2/token"},"ClientId":{"type":"apiKey","description":"","in":"header","name":"X-IBM-Client-Id"}},"security":[{"oauth-1":["scope1"],"ClientId":[]}]}