{"info":{"_postman_id":"4ee2d539-6ebe-44c5-81d8-3097e7363e61","name":"PorCobrar.com","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","toc":[],"description":"<html><head></head><body></body></html>","owner":"7764640","collectionId":"4ee2d539-6ebe-44c5-81d8-3097e7363e61","publishedId":"SW17SFPw","public":true,"customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"EF5B25"},"publishDate":"2022-03-23T20:34:54.000Z"},"item":[{"name":"Customers","item":[{"name":"create customer","event":[{"listen":"prerequest","script":{"id":"d1418946-62c6-427f-9e97-9ae06f309ced","exec":["function getRandom() {","   return Math.floor((Math.random() * 1000000) + 1000000);","}","","function getRandomTax() {","   return Math.floor((Math.random() * 100000) + 100000);","}","","function getCustomer() {","    return \"test\" + getRandom();","}","","function getTax() {","    return \"ABC\" + getRandomTax() + \"TRE\";","}","","pm.environment.set(\"legal_name\",getCustomer());","pm.environment.set(\"tax_profile\",getTax());"],"type":"text/javascript"}},{"listen":"test","script":{"id":"a8121698-f425-4b69-93f8-457efe25ce9c","exec":["pm.test(\"Must return a valid body\", function() {","  pm.response.to.have.status(201);","   pm.response.to.be.withBody;","   pm.response.to.be.json;","});","","pm.test(\"Response time < 1000ms\", function () {","   pm.expect(pm.response.responseTime).to.be.below(1000);","});","","var schema = {","   data : {","       type : \"object\",","        ","        required : [\"uuid\",\"name\",\"email\",\"legal_name\",\"tax_profile\",\"agreement\"],","        properties : ","        {","            uuid:           {type: \"string\"},","            name:           {type: \"string\"},","            email:          {type: \"string\"},","            legal_name:     {type: \"string\"},","            tax_profile:    {type: \"string\"},","            agreement:{","                type: \"object\",","                    required:[\"amount\",\"payment_term\"],","                        amount:             {type: \"string\" },","                        payment_term:       {type: \"integer\"},","            ","            }","   }","   }","};","","pm.test(\"Valid JSON schema\", function() {","   pm.expect(tv4.validate(pm.response.json(), schema)).to.be.true;","});","","let customer_email = pm.response.json().data.email;","pm.test(\"Valid customer email\", function() {","   pm.expect(pm.response.json().data.email).to.eql((customer_email));","});","pm.test(\"Valid customer data\", function() {","    pm.expect(pm.response.json().data.name.length).not.to.equal(0);","    pm.expect(pm.response.json().data.legal_name.length).not.to.equal(0);","    pm.expect(pm.response.json().data.tax_profile.length).not.to.equal(0);","    pm.expect(pm.response.json().data.agreement.length).not.to.equal(0);","    ","    pm.expect(pm.response.json().message).to.equal(\"Successfull\");","    pm.expect(pm.response.json().code).to.equal(112);","});","","pm.test(\"Apropiate payment term\", function() {","   pm.expect(pm.response.json().data.agreement.payment_term).not.to.be.below(0);","});","","pm.environment.set(\"customer_id\",  pm.response.json().data.uuid);"],"type":"text/javascript"}}],"id":"1afe1d8d-4b88-405a-a1b2-4e216e7dd4fe","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Authorization","value":"{{access_token}}"},{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n  \"legal_name\": \"Público en general\",\n  \"tax_profile\": \"XAXX010101000\",\n  \"name\" : \"Público en general\",\n  \"email\" : \"cuenta@gmail.com\",\n  \"phone\": \"5556581111\",\n  \"agreement\": {\n    \"payment_term\": 15\n  }\n}"},"url":"https://api.porcobrar.com/v1/customer","description":"<p>Permite crear un cliente.</p>\n","urlObject":{"protocol":"https","path":["v1","customer"],"host":["api","porcobrar","com"],"query":[],"variable":[]}},"response":[],"_postman_id":"1afe1d8d-4b88-405a-a1b2-4e216e7dd4fe"},{"name":"update customer","id":"e17d02f1-f3db-46a3-97d9-4930f71525ff","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PUT","header":[{"key":"Content-Type","value":"application/json"},{"key":"Authorization","value":"{{access_token}}"}],"body":{"mode":"raw","raw":"{\n  \"name\": \"Exmaple 1S.A.P.I. DE C.V.\",\n  \"email\": \"pruebausuarioyay1@gmail.com\",\n  \"legal_name\": \"Exmaple 1S.A.P.I. DE C.V.\",\n  \"tax_profile\": \"DBZ161018001\",\n  \"phone\": \"5556581111\",\n  \"agreement\" : {\n    \"payment_term\": 10\n  }\n}\n"},"url":"https://api.porcobrar.com/v1/customer/e1e62839-1e57-4bb3-a2e5-b82d99c66215","description":"<p>Podemos editar los datos del cliente utilizando este endpoint.</p>\n","urlObject":{"protocol":"https","path":["v1","customer","e1e62839-1e57-4bb3-a2e5-b82d99c66215"],"host":["api","porcobrar","com"],"query":[],"variable":[]}},"response":[],"_postman_id":"e17d02f1-f3db-46a3-97d9-4930f71525ff"},{"name":"customer detail","event":[{"listen":"test","script":{"id":"47d98308-cf3c-4176-8bf4-05987f4b1e60","exec":["pm.test(\"Status code is 200\", function () {","    pm.response.to.have.status(200);","});","pm.test(\"Must return a valid body\", function() {","   pm.response.to.have.status(200);","   pm.response.to.be.withBody;","   pm.response.to.be.json;","});","var schema = {","   data : {","       type : \"object\",","        ","        required : [\"uuid\",\"name\",\"email\",\"phone\"],","        properties :                           ","        {","            uuid:       {type: \"string\"},","            name:       {type: \"string\"},","            email:      {type: \"string\"},","            phone:      {type: \"string\"},","   }","   }","};","pm.test(\"Valid JSON schema\", function() {","   pm.expect(tv4.validate(pm.response.json(), schema)).to.be.true;","});","","pm.test(\"Response time < 1000ms\", function () {","   pm.expect(pm.response.responseTime).to.be.below(1000);","});",""],"type":"text/javascript"}}],"id":"21cda238-07f6-4cc0-8a4e-ceb26d1d5d5d","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"Authorization","value":"{{access_token}}"}],"url":"https://api.porcobrar.com/v1/customer/e1e62839-1e57-4bb3-a2e5-b82d99c66215","description":"<p>Regresa el detalle de un cliente por medio del ID.</p>\n","urlObject":{"protocol":"https","path":["v1","customer","e1e62839-1e57-4bb3-a2e5-b82d99c66215"],"host":["api","porcobrar","com"],"query":[],"variable":[]}},"response":[],"_postman_id":"21cda238-07f6-4cc0-8a4e-ceb26d1d5d5d"},{"name":"get all customers","event":[{"listen":"test","script":{"id":"f24b2e28-bfda-4ed9-a0bb-0c081f7092ce","exec":["pm.test(\"Must return a valid body\", function() {","   pm.response.to.have.status(200);","   pm.response.to.be.withBody;","   pm.response.to.be.json;","});","","pm.test(\"Response time < 1000ms\", function () {","   pm.expect(pm.response.responseTime).to.be.below(1000);","});","","var schema = {","    data : {","        type : \"array\",","        required : [\"uuid\",\"name\",\"email\",\"legal_name\",\"tax_profile\",\"due\",\"agreement\",\"message\",\"code\",\"count\",\"pages\"],","        properties: {","            \"uuid\" : {","                \"type\" : \"string\"","            },","            \"name\" : {","                \"type\" : \"string\"","            },","            \"email\" : {","                \"type\" : \"string\"","            },","            \"legal_name\" : {","                \"type\" : \"string\"","            },","            \"tax_profile\" : {","                \"type\" : \"string\"","            },","            \"due\" : {","                \"type\" : \"integer\"","            },","            \"agreement\" : {","                \"type\" : \"object\",","                required: [\"payment_term\"],","                properties : {","                    \"payment_term\" : {","                        \"type\" : \"integer\"","                    }","                }","            },","            \"message\" : {","                \"type\" : \"string\"","            },","            \"code\" : {","                \"type\" : \"integer\"","            },","            \"count\" : {","                \"type\" : \"integer\"","            },","            \"pages\" : {","                \"type\" : \"integer\"","            },","        }","    }","};","pm.test(\"Valid JSON schema\", function() {","   pm.expect(tv4.validate(pm.response.json(), schema)).to.be.true;","});","","","pm.test(\"Valid customer data\", function() {","    pm.expect(pm.response.json().data[0].name.length).not.to.equal(0);","    pm.expect(pm.response.json().data[0].legal_name.length).not.to.equal(0);","    pm.expect(pm.response.json().data[0].tax_profile.length).not.to.equal(0);","    pm.expect(pm.response.json().data[0].agreement.length).not.to.equal(0);","    ","    ","    pm.expect(pm.response.json().message).to.equal(\"Successfull\");","    pm.expect(pm.response.json().code).to.equal(101);","    pm.expect(pm.response.json().pages).not.to.be.below(0);","});","","pm.test(\"Apropiate payment term\", function() {","   pm.expect(pm.response.json().data[0].agreement.payment_term).not.to.be.below(0);","});",""],"type":"text/javascript"}}],"id":"2f9be26e-8274-4d92-bf94-ed2daabbd47e","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"Authorization","value":"{{access_token}}"}],"url":"https://api.porcobrar.com/v1/customer/?page=1","description":"<p>Regresa la lista de todos los clientes de la cuenta.</p>\n","urlObject":{"protocol":"https","path":["v1","customer",""],"host":["api","porcobrar","com"],"query":[{"key":"page","value":"1"},{"disabled":true,"key":"valid","value":"1"},{"disabled":true,"key":"q","value":""},{"disabled":true,"key":"due","value":"true"}],"variable":[]}},"response":[],"_postman_id":"2f9be26e-8274-4d92-bf94-ed2daabbd47e"}],"id":"509477a0-1242-4a5d-ba0f-f695826a46c0","_postman_id":"509477a0-1242-4a5d-ba0f-f695826a46c0","description":""},{"name":"Item (product)","item":[{"name":"Create item","event":[{"listen":"test","script":{"id":"a972a634-4f85-41a2-b197-f73920403398","exec":["let jsonData = pm.response.json();","pm.environment.set(\"item_uuid\", jsonData.data.uuid);","","var schema = {","   data : {","       type : \"object\",","       required:[\"uuid\", \"description\",\"long_description\",\"unit_id\",\"sku\",\"price\",\"attributes\"],","       properties : {","         \"uuid\" :               {type: \"string\"},","         \"description\" :        {type: \"string\"},","         \"long_description\" :   {type: \"string\"},","         \"unit_id\" :            {type: \"integer\"},","         \"sku\" :                {type: \"string\"},","         \"price\" :              {type: \"integer\"},","         \"attributes\" :         {type: \"object\",","             required : [\"cfdi_code\",\"cfdi_unit_code\"],","                 properties : {","                    \"cfdi_code\" :       {type: \"string\"},","                    \"cfdi_unit_code\" :  {type: \"string\"},       ","                 }","             },","        \"taxes\" :               {type: \"array\",","            required : [\"name\",\"code\",\"amount\",\"total\",\"base\"],","            properties : {","            \"name\" :            {type: \"string\"},","            \"code\" :            {type: \"string\"},","            \"amount\" :          {type: \"integer\"},","            \"total\" :           {type: \"integer\"},","            \"base\" :            {type: \"integer\"},","            }","        }","       }","   }","};","","pm.test(\"Valid JSON schema\", function() {","   pm.expect(tv4.validate(pm.response.json(), schema)).to.be.true;","});","","pm.test(\"Status: 201 Created\", function() {","   pm.response.to.have.status(201);","   pm.response.to.be.withBody;","   pm.response.to.be.json;","});","","pm.test(\"Response time < 1 s\", function () {","   pm.expect(pm.response.responseTime).to.be.below(1000);","});","","pm.test(\"Valid message & Code\", function() {","    pm.expect(pm.response.json().message).to.equal(\"Successfull\");","    pm.expect(pm.response.json().code).to.equal(112);","});","","pm.test(\"Valid invoice data\", function() {","   pm.expect(pm.response.json().data.description.length).to.be.above(0);","   pm.expect(pm.response.json().data.unit_id).not.to.eql(null);","   pm.expect(pm.response.json().data.amount).not.to.eql(0);","   pm.expect(pm.response.json().data.total).not.to.eql(0);","   pm.expect(pm.response.json().data.base).not.to.eql(0);","});"],"type":"text/javascript"}}],"id":"61fb0280-7bcc-4860-9300-44cfe9e0e16e","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Authorization","value":"{{access_token}}","type":"text"},{"key":"Content-Type","name":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"description\": \"Adenda Cinco\",\n    \"long_description\": \"description to pozolito\",\n    \"price\": 500,\n    \"unit_id\": 9,\n    \"sku\": \"sku\",\n    \"currency\": \"MXN\",\n    \"taxes\": [\n        {\n            \"id\": 45368,\n            \"name\": \"IVA 16%\",\n            \"code\": \"002\",\n            \"amount\": 0.16,\n            \"total\": 16,\n            \"base\": 100,\n            \"added\": 1,\n            \"is_percentage\": 1\n        }\n    ],\n    \"attr\": {\n        \"adenda\": true,\n        \"cfdi_autRvoe\": \"\",\n            \"cfdi_code\": \"86122301\",\n            \"cfdi_curp\": \"\",\n            \"cfdi_education_level\": \"\",\n            \"cfdi_payment_rfc\": \"\",\n            \"cfdi_student_name\": \"\",\n            \"cfdi_unit_code\": \"ADN\"\n    }\n}"},"url":"{{base_url}}/v1/item","urlObject":{"path":["v1","item"],"host":["{{base_url}}"],"query":[],"variable":[]}},"response":[{"id":"b0d9bef0-507f-47a3-86e7-89ec5af7b65d","name":"Create item","originalRequest":{"method":"POST","header":[{"key":"Authorization","value":"{{access_token}}","type":"text"},{"key":"Content-Type","name":"Content-Type","value":"application/json","type":"text"},{"key":"Authorization","value":"","type":"text","disabled":true}],"body":{"mode":"raw","raw":"{\n    \"description\": \"Nuevo producto con adenda\",\n    \"long_description\": \"This is a long description to pozolito\",\n    \"price\": 100,\n    \"unit_id\": 9,\n    \"sku\": \"sku\",\n    \"taxes\": [\n        {\n            \"id\": 18,\n            \"name\": \"IVA 16%\",\n            \"code\": \"002\",\n            \"amount\": 0.16,\n            \"total\": 16,\n            \"base\": 100,\n            \"added\": 1,\n            \"is_percentage\": 1\n        },\n        {\n            \"id\": 44,\n            \"name\": \"ISR 0%\",\n            \"code\": \"001\",\n            \"amount\": 0,\n            \"total\": 0,\n            \"base\": 100,\n            \"added\": 1,\n            \"is_percentage\": 1\n        }\n    ],\n    \"attr\": {\n        \"adenda\": true,\n        \"cfdi_code\": \"86122301\",\n        \"cfdi_unit_code\": \"ADN\"\n    }\n}"},"url":"{{base_url}}/v1/item"},"status":"Internal Server Error","code":500,"_postman_previewlanguage":"json","header":[{"key":"Server","value":"nginx"},{"key":"Date","value":"Fri, 03 Jan 2020 18:14:02 GMT"},{"key":"Content-Type","value":"application/json; charset=utf-8"},{"key":"Content-Length","value":"39"},{"key":"Connection","value":"keep-alive"},{"key":"Strict-Transport-Security","value":"max-age=15552000; includeSubDomains"},{"key":"X-Content-Type-Options","value":"nosniff"},{"key":"X-XSS-Protection","value":"1; mode=block"},{"key":"Access-Control-Allow-Origin","value":"*"},{"key":"ETag","value":"W/\"27-1i6IYdV0j6qwnblEiyHcLItl4FY\""}],"cookie":[],"responseTime":null,"body":"{\n    \"message\": \"Internal error\",\n    \"code\": 104\n}"}],"_postman_id":"61fb0280-7bcc-4860-9300-44cfe9e0e16e"},{"name":"Get all items","event":[{"listen":"test","script":{"id":"d6dd8749-f977-41e6-9e0a-090eef2275f0","exec":["var schema = {","   data : {","       type : \"array\",","       required:[\"uuid\", \"description\",\"long_description\",\"unit_id\",\"sku\",\"price\",\"attributes\"],","       properties : {","         \"uuid\" :               {type: \"string\"},","         \"description\" :        {type: \"string\"},","         \"long_description\" :   {type: \"string\"},","         \"unit_id\" :            {type: \"integer\"},","         \"sku\" :                {type: \"string\"},","         \"price\" :              {type: \"integer\"},","         \"attributes\" :         {type: \"object\",","             required : [\"cfdi_code\",\"cfdi_unit_code\"],","                 properties : {","                    \"cfdi_code\" :       {type: \"string\"},","                    \"cfdi_unit_code\" :  {type: \"string\"},       ","                 }","             },","        \"taxes\" :               {type: \"array\",","            required : [\"name\",\"code\",\"amount\",\"total\",\"base\"],","            properties : {","            \"name\" :            {type: \"string\"},","            \"code\" :            {type: \"string\"},","            \"amount\" :          {type: \"integer\"},","            \"total\" :           {type: \"integer\"},","            \"base\" :            {type: \"integer\"},","            }","        }","       }","   }","};","","pm.test(\"Valid JSON schema\", function() {","   pm.expect(tv4.validate(pm.response.json(), schema)).to.be.true;","});","","pm.test(\"Status: 200 OK\", function() {","   pm.response.to.have.status(200);","   pm.response.to.be.withBody;","   pm.response.to.be.json;","});","","pm.test(\"Response time < 1000ms\", function () {","   pm.expect(pm.response.responseTime).to.be.below(1000);","});","","pm.test(\"Valid Message, Code & data\", function() {","    pm.expect(pm.response.json().message).to.equal(\"Successfull\");","    pm.expect(pm.response.json().code).to.equal(101);","});","","pm.test(\"Validate invoice data\", function(){","    pm.expect(pm.response.json().data[0].uuid.length).not.to.equal(0);","    pm.expect(pm.response.json().data[0].description.length).not.to.equal(0);","   pm.expect(pm.response.json().data[0].taxes[0].amount).to.be.above(0);","   pm.expect(pm.response.json().data[0].taxes[0].total).to.be.above(0);","   pm.expect(pm.response.json().data[0].taxes[0].base).to.be.above(0);","});","",""],"type":"text/javascript"}}],"id":"eeae5e77-5a3c-49f6-94a8-08859c017dae","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"Authorization","value":"{{access_token}}","type":"text"},{"key":"Content-Type","value":"application/json","type":"text"}],"url":"{{base_url}}/v1/item","urlObject":{"path":["v1","item"],"host":["{{base_url}}"],"query":[{"disabled":true,"key":"q","value":"ADENDA"}],"variable":[]}},"response":[],"_postman_id":"eeae5e77-5a3c-49f6-94a8-08859c017dae"},{"name":"Item detail","event":[{"listen":"test","script":{"id":"72c971ec-ea38-4340-bb91-5b73114b494b","exec":["var schema = {","   data : {","       type : \"array\",","       required:[\"uuid\", \"description\",\"long_description\",\"unit_id\",\"sku\",\"price\",\"attributes\"],","       properties : {","         \"uuid\" :               {type: \"string\"},","         \"description\" :        {type: \"string\"},","         \"long_description\" :   {type: \"string\"},","         \"unit_id\" :            {type: \"integer\"},","         \"sku\" :                {type: \"string\"},","         \"price\" :              {type: \"integer\"},","         \"attributes\" :         {type: \"object\",","             required : [\"cfdi_code\",\"cfdi_unit_code\"],","                 properties : {","                    \"cfdi_code\" :       {type: \"string\"},","                    \"cfdi_unit_code\" :  {type: \"string\"},       ","                 }","             },","        \"taxes\" :               {type: \"array\",","            required : [\"name\",\"code\",\"amount\",\"total\",\"base\"],","            properties : {","            \"name\" :            {type: \"string\"},","            \"code\" :            {type: \"string\"},","            \"amount\" :          {type: \"integer\"},","            \"total\" :           {type: \"integer\"},","            \"base\" :            {type: \"integer\"},","            }","        }","       }","   }","};","","pm.test(\"Valid JSON schema\", function() {","   pm.expect(tv4.validate(pm.response.json(), schema)).to.be.true;","});","","pm.test(\"Status: 200 OK\", function() {","   pm.response.to.have.status(200);","   pm.response.to.be.withBody;","   pm.response.to.be.json;","});","","pm.test(\"Response time < 1000ms\", function () {","   pm.expect(pm.response.responseTime).to.be.below(1000);","});","","pm.test(\"Valid Message, Code & data\", function() {","    pm.expect(pm.response.json().message).to.equal(\"Successfull\");","    pm.expect(pm.response.json().code).to.equal(101);","});","","pm.test(\"Validate invoice data\", function(){","    pm.expect(pm.response.json().data.uuid.length).not.to.equal(0);","    pm.expect(pm.response.json().data.description.length).not.to.equal(0);","   pm.expect(pm.response.json().data.taxes[0].amount).to.be.above(-1);","   pm.expect(pm.response.json().data.taxes[0].total).to.be.above(-1);","   pm.expect(pm.response.json().data.taxes[0].base).to.be.above(-1);","","});"],"type":"text/javascript"}}],"id":"9b2390b7-5066-4d06-86fe-abdf3425cd4c","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"Authorization","value":"{{access_token}}","type":"text"}],"url":"{{base_url}}/v1/item/ddb7b077-2f65-4e5f-ae68-d31ac970b450","urlObject":{"path":["v1","item","ddb7b077-2f65-4e5f-ae68-d31ac970b450"],"host":["{{base_url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"9b2390b7-5066-4d06-86fe-abdf3425cd4c"},{"name":"Update item","event":[{"listen":"test","script":{"id":"1b593f6f-3abc-42db-917e-1f31333a227b","exec":["pm.test(\"Status: 204 No Content\", function() {","   pm.response.to.have.status(204);","});","","pm.test(\"Response time < 1000ms\", function () {","   pm.expect(pm.response.responseTime).to.be.below(1000);","});"],"type":"text/javascript"}}],"id":"205113dc-88f8-495a-9a5e-dca7f8763235","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PUT","header":[{"key":"Content-Type","name":"Content-Type","value":"application/json","type":"text"},{"key":"Authorization","value":"{{access_token}}","type":"text"}],"body":{"mode":"raw","raw":"{\n\t\n\t\"attr\": {\n\t\t\"adenda\": true,\n\t\t\"cfdi_autRvoe\": \"123123\",\n        \"cfdi_curp\": \"VASM880712SLMNRN08\",\n        \"cfdi_education_level\": \"Secundaria\",\n        \"cfdi_payment_rfc\": \"YAY161018CX7\",\n        \"cfdi_student_name\": \"Juanito bananas\",\n        \"cfdi_code\": \"50221100\",\n        \"cfdi_unit_code\": \"XBX\"\n\t}\n}"},"url":"{{base_url}}/v1/item/5790879b-8bb2-40c0-989c-3e69a06aca8e","urlObject":{"path":["v1","item","5790879b-8bb2-40c0-989c-3e69a06aca8e"],"host":["{{base_url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"205113dc-88f8-495a-9a5e-dca7f8763235"},{"name":"Delete item","event":[{"listen":"test","script":{"id":"99ca90e2-a947-4617-8ada-70154af6a082","exec":["pm.test(\"Status: 204 No Content\", function() {","   pm.response.to.have.status(204);","});","","pm.test(\"Response time < 1000ms\", function () {","   pm.expect(pm.response.responseTime).to.be.below(1000);","});"],"type":"text/javascript"}}],"id":"b18d7721-1b40-4222-8416-a43e9ff2f744","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"DELETE","header":[{"key":"Authorization","value":"{{Token}}","type":"text"}],"body":{"mode":"formdata","formdata":[]},"url":"{{base_url}}/v1/item/{{item_uuid}}","urlObject":{"path":["v1","item","{{item_uuid}}"],"host":["{{base_url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"b18d7721-1b40-4222-8416-a43e9ff2f744"},{"name":"Create item tax","id":"8cb72acb-2006-4b88-a869-f87b4ad1c837","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Authorization","value":"{{access_token}}","type":"text"},{"key":"Content-Type","name":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":" {\n      \"id\": 536,\n      \"name\": \"IEPS\",\n      \"code\": \"003\",\n      \"amount\": 0.00,\n      \"total\": 0,\n      \"base\": 200,\n      \"added\": 1,\n      \"is_percentage\": 1\n}"},"url":"{{base_url}}/v1/item/bd1135eb-37d7-4dc2-866f-d85154fe749e/tax","urlObject":{"path":["v1","item","bd1135eb-37d7-4dc2-866f-d85154fe749e","tax"],"host":["{{base_url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"8cb72acb-2006-4b88-a869-f87b4ad1c837"},{"name":"Delete Item tax","id":"4fcefbec-d2d7-498a-ad52-7595a5ba5499","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"DELETE","header":[{"key":"Authorization","value":"{{access_token}}","type":"text"}],"url":"{{base_url}}/v1/item/bd1135eb-37d7-4dc2-866f-d85154fe749e/tax/55454","urlObject":{"path":["v1","item","bd1135eb-37d7-4dc2-866f-d85154fe749e","tax","55454"],"host":["{{base_url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"4fcefbec-d2d7-498a-ad52-7595a5ba5499"},{"name":"Get taxes by team","event":[{"listen":"test","script":{"id":"752e08c1-021c-4985-adf3-dbe3ce48aabd","exec":["var schema = {","   data : {","       type : \"array\",","       required:[\"code\", \"name\",\"amount\"],","       properties : {","         \"code\" :               {type: \"string\"},","         \"name\" :               {type: \"string\"},","         \"amount\" :             {type: \"double\"},","       }","   }","};","","pm.test(\"Valid JSON schema\", function() {","   pm.expect(tv4.validate(pm.response.json(), schema)).to.be.true;","});","","pm.test(\"Status: 200 OK\", function() {","   pm.response.to.have.status(200);","   pm.response.to.be.withBody;","   pm.response.to.be.json;","});","","pm.test(\"Response time < 1 s\", function () {","   pm.expect(pm.response.responseTime).to.be.below(1000);","});","","pm.test(\"Validate value count\", function () {","    pm.expect(pm.response.json().data.length).to.eq(44);","});","","pm.test(\"Valid Message, Code & data\", function() {","    pm.expect(pm.response.json().message).to.equal(\"Successfull\");","    pm.expect(pm.response.json().code).to.equal(101);","});","","pm.test(\"At least 1 tax selected\", function(){","    pm.expect(pm.response.json().data.length).to.be.above(0);","","});"],"type":"text/javascript"}}],"id":"dfb0fb52-270f-4a95-a5a8-d03e7ab16cc6","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"Authorization","value":"{{access_token}}","type":"text"}],"url":"{{base_url}}/v1/settings/tax?price=100","urlObject":{"path":["v1","settings","tax"],"host":["{{base_url}}"],"query":[{"key":"price","value":"100"}],"variable":[]}},"response":[],"_postman_id":"dfb0fb52-270f-4a95-a5a8-d03e7ab16cc6"}],"id":"6a3d3425-4842-4850-8e6d-3e94ec0e73d5","_postman_id":"6a3d3425-4842-4850-8e6d-3e94ec0e73d5","description":""},{"name":"Invoices","item":[{"name":"Create Invoice","id":"f88c8dd5-f7b2-402c-83ca-9b5c025939e6","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Content-Type","name":"Content-Type","value":"application/json","type":"text"},{"key":"Authorization","value":"{{access_token}}","type":"text"}],"body":{"mode":"raw","raw":"{\n  \"customer\": {\n\t\t\"id\": \"e1e62839-1e57-4bb3-a2e5-b82d99c66215\",\n        \"legal_name\": \"Público en general\",\n        \"tax_profile\": \"XAXX010101000\"\n  },\n  \"invoice\": {\n            \"attributes\": {\n                \"cfdi_payment_conditions\": \"7\",\n                \"cfdi_emit\": false\n            },\n\n            \"landing_url\": \"https://example.com.mx/login\",\n            \"on_success_url\":\"https://example.com.mx/order/21379?payment=success\", \n            \"on_error_url\":\"https://example.com.mx/order/21379?payment=error\",\n\n            \"identifier\": \"ID\",\n            \"purchase_order\": \"PIO\",\n            \"notes\": \"notes1, notes2\",\n            \"comment\": \"no comment\",\n            \"issue_date\": 1606844804,\n            \"due_date\": 1606847804,\n            \"currency\": \"MXN\",\n            \"currency_rate\": 1,\n            \"discount\": 0,\n            \"subtotal\": 100,\n            \"tax\": 16,\n            \"total\": 116,\n            \"items\": [\n                {\n                    \"attributes\": {\n                        \"cfdi_code\": 50171800,\n                        \"cfdi_unit_code\": \"H87\"\n                    },\n                    \"description\": \"Item 1\",\n                    \"long_description\": \"\",\n                    \"price\": 10,\n                    \"quantity\": 10,\n                    \"discount\": 0,\n                    \"subtotal\": 100,\n                    \"tax\": 16,\n                    \"total\": 116,\n                    \"sku\": null,\n                    \"unit_id\": 1,\n                    \"taxes\": [\n                        {\n                            \"added\": 1,\n                            \"amount\": 0.16,\n                            \"base\": 100,\n                            \"code\": \"002\",\n                            \"is_percentage\": 1,\n                            \"total\": 16,\n                            \"name\": \"IVA 16%\"\n                        }\n                    ]\n                }\n            ]\n        }\n}"},"url":"https://api.porcobrar.com/v1/invoice/invoice","description":"<p>Servicio para la conversión de XML con estructura de CFDI a su representación gráfica en PDF, a continuación encontrarás información para personalizar, automatizar, enviar y generar el PDF de tus documentos CFDI.</p>\n<p>¿Qué puedo hacer?\nConvertir archivos CFDI a PDF.</p>\n<p>Autenticación:</p>\n<p>Para realizar cualquier llamado es necesario utilizar la llave de acceso {{access_token}}.</p>\n","urlObject":{"protocol":"https","path":["v1","invoice","invoice"],"host":["api","porcobrar","com"],"query":[],"variable":[]}},"response":[],"_postman_id":"f88c8dd5-f7b2-402c-83ca-9b5c025939e6"},{"name":"Create CFDI Invoice","event":[{"listen":"test","script":{"id":"db1d2155-106e-461f-9ad2-b0b6b33956b6","exec":["pm.test(\"Must Status: 201 Created\", function() {","  pm.response.to.have.status(201);","   pm.response.to.be.withBody;","   pm.response.to.be.json;","});","","pm.test(\"Response time < 3 s\", function () {","   pm.expect(pm.response.responseTime).to.be.below(3000);","});","","var schema = {","   data : {","       type : \"object\",","        ","        required : [\"status\",\"issue_date\",\"due_date\",\"created_at\",\"updated_at\",\"format_id\",\"uuid\",\"code\",\"subtotal\",\"discount\",\"tax\",\"total\",\"balance\",\"currency\",\"status_id\",\"collectible\",\"domain\",\"number\",\"notes\",\"customer\",\"items\",\"attachment\",\"transaction\"],","        properties : ","        {","            status:                 {type: \"string\" },","            issue_date:             {type: \"integer\"},","            due_date:               {type: \"integer\"}, ","            created_at:             {type: \"integer\"},","            updated_at:             {type: \"integer\"},","            format_id:              {type: \"integer\"},","            uuid:                   {type: \"string\" },","            code:                   {type: \"string\" },","            subtotal:               {type: \"float\"  },","            discount:               {type: \"float\"  },","            tax:                    {type: \"float\"  },","            total:                  {type: \"float\"  },","            balance:                {type: \"float\"  },","            currency:               {type: \"string\" },","            status_id:              {type: \"integer\"},","            collectible:            {type: \"integer\"},","            domain:                 {type: \"string\" },","            number:                 {type: \"integer\"},","            notes:                  {type: \"integer\"},","            transaction:            {type: \"array\"  },","            customer:{","                type: \"object\",","                required:[\"uuid\",\"name\",\"email\",\"legal_name\",\"tax_profile\",\"agreement\"],","                properties: {","                 uuid:                  {type: \"string\"},","                 name:                  {type: \"string\"},","                 email:                 {type: \"string\"},","                 legal_name:            {type: \"string\"},","                 tax_profile:           {type: \"string\"},","                 agreement:{","                     type: \"object\",","                     required:[\"amount\",\"payment_term\"],","                     properties:{","                         amount:            {type: \"string\" },","                         payment_term:      {type: \"integer\"},","                     },","                     ","                 },","                },","            },","            ","            items:{","                type: \"array\",","                required:[\"created_at\",\"updated_at\",\"uuid\",\"description\",\"sku\",\"unit_id\",\"quantity\",\"subtotal\",\"discount\",\"tax\",\"total\",\"attributes\"],","                properties: {","                 created_at:             {type: \"integer\"},","                 updated_at:             {type: \"integer\"},","                 uuid:                   {type: \"string\" },","                 description:            {type: \"string\" },","                 sku:                    {type: \"string\" },","                 unit_id:                {type: \"string\" },","                 quantity:               {type: \"integer\"},","                 subtotal:               {type: \"float\"  },","                 discount:               {type: \"integer\"},","                 tax:                    {type: \"float\"  },","                 total:                  {type: \"float\"  },","                 attributes:             {type: \"array\"  },","                     },","                 },","            attachment:{","                type: \"array\",","                required:[\"uuid\",\"path\"],","                properties: {","                 uuid:             {type: \"string\"},","                 path:             {type: \"string\"},","                },","            },","        }","   }","   };","","pm.test(\"Valid JSON schema\", function() {","   pm.expect(tv4.validate(pm.response.json(), schema)).to.be.true;","});","","pm.test(\"Response data format/ data is correct\", function() { ","    var regEx = /^[0-9]{10}$/;","    var regEx2 = /[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/;","    var sum = ((pm.response.json().data.total)*1);","    var iva = ((pm.response.json().data.tax)*1);","    var precio = ((pm.response.json().data.subtotal)*1);","    var costo = ((pm.response.json().data.items[0].total)*1);","    var impuesto = ((pm.response.json().data.items[0].tax)*1);","    var valor = ((pm.response.json().data.items[0].subtotal)*1);","    ","    pm.expect(pm.response.json().data.issue_date).to.match(regEx);","    pm.expect(pm.response.json().data.due_date).to.match(regEx);","    pm.expect(pm.response.json().data.created_at).to.match(regEx);","    pm.expect(pm.response.json().data.updated_at).to.match(regEx);","    pm.expect(pm.response.json().data.items[0].updated_at).to.match(regEx);","    pm.expect(pm.response.json().data.items[0].created_at).to.match(regEx);","    pm.expect(pm.response.json().data.total).to.equal(sum);","    pm.expect(pm.response.json().data.tax).to.equal(iva);","    pm.expect(pm.response.json().data.subtotal).to.equal(precio);","    pm.expect(pm.response.json().data.items[0].total).to.equal(costo);","    pm.expect(pm.response.json().data.items[0].tax).to.equal(impuesto);","    pm.expect(pm.response.json().data.items[0].subtotal).to.equal(valor);","    pm.expect(pm.response.json().data.customer.uuid).to.match(regEx2);","});","","pm.test(\"Valid invoice data\", function() {","    pm.expect(pm.response.json().data.currency).to.equal(\"MXN\");","});","","pm.test(\"Valid Message & Code\", function() {","    pm.expect(pm.response.json().message).to.equal(\"Successfull\");","    pm.expect(pm.response.json().code).to.equal(112);","});","","pm.environment.set(\"invoice_uuid\", pm.response.json().data.uuid);","","","","","","",""],"type":"text/javascript"}}],"id":"2a5c58e5-eeb2-408c-9521-ea793f2d88f2","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Authorization","value":"{{access_token}}","type":"text"},{"key":"Content-Type","name":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\n  \"customer\": {\n    \"id\": \"e1e62839-1e57-4bb3-a2e5-b82d99c66215\",\n    \"legal_name\": \"Público en general\",\n    \"tax_profile\": \"XAXX010101000\"\n  },\n  \"invoice\": {\n    \"attributes\": {\n      \"cfdi_exchange_rate\": \"\",\n      \"cfdi_expedition_place\": \"03800\",\n      \"cfdi_folio\": \"78\",\n      \"cfdi_payment_conditions\": 7,\n      \"cfdi_payment_method\": \"PPD\",\n      \"cfdi_payment_type\": \"\",\n      \"cfdi_serie\": \"F\",\n      \"cfdi_usage\": \"G03\"\n    },\n    \"identifier\": \"identificador\",\n    \"currency\": \"MXN\",\n    \"currency_rate\": 1,\n    \"discount\": 0,\n    \"issue_date\": \"1572462639\",\n    \"due_date\": \"1573067439\",\n    \"subtotal\": 26167,\n    \"tax\": -1975.0200000000002,\n    \"total\": 24191.98,\n    \"purchase_order\": \"#1234\",\n    \"notes\": \"notes ...\",\n    \"comment\": \"comentarios ...\",\n    \n    \"landing_url\": \"https://example.com.mx/login\",\n    \"on_success_url\":\"https://example.com.mx/order/21379?payment=success\", \n    \"on_error_url\":\"https://example.com.mx/order/21379?payment=error\",\n    \n    \"items\": [\n      {\n        \"attributes\": {\n          \"cfdi_code\": \"10215400\",\n          \"cfdi_unit_code\": \"H87\"\n        },\n        \"quantity\": 2,\n        \"price\": 1234,\n        \"description\": \"Primer Item\",\n        \"sku\": \"10215400\",\n        \"unit_id\": 1,\n        \"subtotal\": 2468,\n        \"discount\": 0,\n        \"tax\": 394.88,\n        \"total\": 2862.88,\n        \"taxes\": [\n          {\n            \"added\": 1,\n            \"amount\": 0.16,\n            \"base\": 2468,\n            \"code\": \"002\",\n            \"is_percentage\": 1,\n            \"name\": \"IVA 16%\",\n            \"total\": 394.88\n          }\n        ]\n      },\n      {\n        \"attributes\": {\n          \"cfdi_code\": \"10215438\",\n          \"cfdi_unit_code\": \"AE\"\n        },\n        \"quantity\": 4,\n        \"price\": 5678,\n        \"description\": \"Segundo Item\",\n        \"sku\": \"10215438\",\n        \"unit_id\": 2,\n        \"subtotal\": 22712,\n        \"discount\": 0,\n        \"tax\": -2271.2000000000003,\n        \"total\": 20440.8,\n        \"taxes\": [\n          {\n            \"added\": 0,\n            \"amount\": 0.1,\n            \"base\": 22712,\n            \"code\": \"002\",\n            \"is_percentage\": 1,\n            \"name\": \"IVA Retenido 10%\",\n            \"total\": -2271.2000000000003\n          }\n        ]\n      },\n      {\n        \"attributes\": {\n          \"cfdi_code\": \"10315400\",\n          \"cfdi_unit_code\": \"E48\"\n        },\n        \"quantity\": 1,\n        \"price\": 987,\n        \"description\": \"Tercer Item\",\n        \"sku\": \"10315400\",\n        \"unit_id\": 3,\n        \"subtotal\": 987,\n        \"discount\": 0,\n        \"tax\": -98.7,\n        \"total\": 888.3,\n        \"taxes\": [\n          {\n            \"added\": 0,\n            \"amount\": 0.1,\n            \"base\": 987,\n            \"code\": \"001\",\n            \"is_percentage\": 1,\n            \"name\": \"ISR 10%\",\n            \"total\": -98.7\n          }\n        ]\n      }\n    ]\n  }\n}"},"url":"https://api.porcobrar.com/v1/invoice/cfdi","description":"<p>En este servicio se incluyen los atributos necesarios para timbrar una factura con CFDI.</p>\n","urlObject":{"protocol":"https","path":["v1","invoice","cfdi"],"host":["api","porcobrar","com"],"query":[],"variable":[]}},"response":[],"_postman_id":"2a5c58e5-eeb2-408c-9521-ea793f2d88f2"},{"name":"update invoice","id":"3c399987-d174-486c-a95d-a9d01119a905","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PUT","header":[{"key":"Content-Type","name":"Content-Type","value":"application/json","type":"text"},{"key":"Authorization","value":"{{access_token}}","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"due_date\": 1607844804   ,\n    \"identifier\": \"new ID\",\n    \"notes\": \"The notes updated\",\n    \"comment\": \"Comment updated\",\n    \"purchase_order\": \"PO updated\",\n    \"collectible\": 1,\n    \"landing_url\": \"http://xataka.com.mx\",\n    \"on_success_url\": \"google.com.mx?q=node\",\n    \"on_error_url\": \"yahoo.com.mx?q=node\",\n    \"attributes\": {\n        \"cfdi_payment_conditions\": 45,\n        \"cfdi_emit\": 1\n    }\n}"},"url":"https://api.porcobrar.com/v1/invoice/{{invoice_uuid}}","description":"<p>Nos permite editar los datos de una factura.</p>\n","urlObject":{"protocol":"https","path":["v1","invoice","{{invoice_uuid}}"],"host":["api","porcobrar","com"],"query":[],"variable":[]}},"response":[],"_postman_id":"3c399987-d174-486c-a95d-a9d01119a905"},{"name":"invoice detail","event":[{"listen":"test","script":{"id":"0be0965a-3d9f-4a64-ad55-89b10e885fab","exec":["pm.test(\"Must return a valid body\", function() {","  pm.response.to.have.status(200);","   pm.response.to.be.withBody;","   pm.response.to.be.json;","});","","","pm.test(\"Response time < 3 s\", function () {","   pm.expect(pm.response.responseTime).to.be.below(3000);","});","","","var schema = {","   data : {","       type : \"object\",","        ","        required : [\"status\",\"issue_date\",\"due_date\",\"created_at\",\"updated_at\",\"format_id\",\"uuid\",\"code\",\"subtotal\",\"discount\",\"tax\",\"total\",\"balance\",\"currency\",\"status_id\",\"collectible\",\"domain\",\"number\",\"customer\",\"items\",\"attachment\",\"transaction\"],","        properties : ","        {","            status:                 {type: \"string\"},","            issue_date:             {type: \"integer\"},","            due_date:               {type: \"integer\"},","            created_at:             {type: \"integer\"},","            updated_at:             {type: \"integer\"},","            format_id:              {type: \"integer\"},","            uuid:                   {type: \"string\"},","            code:                   {type: \"string\"},","            subtotal:               {type: \"float\"},","            discount:               {type: \"float\"},","            tax:                    {type: \"float\"},","            total:                  {type: \"float\"},","            balance:                {type: \"float\"},","            currency:               {type: \"string\"},","            status_id:              {type: \"integer\"},","            collectible:            {type: \"integer\"},","            domain:                 {type: \"string\"},","            number:                 {type: \"integer\"},","            transaction:            {type: \"array\"},","            customer:{","                type: \"object\",","                required:[\"uuid\",\"name\",\"email\",\"legal_name\",\"tax_profile\",\"agreement\"],","                properties: {","                 uuid:                  {type: \"string\"},","                 name:                  {type: \"string\"},","                 email:                 {type: \"string\"},","                 legal_name:            {type: \"string\"},","                 tax_profile:           {type: \"string\"},","                 agreement:{","                     type: \"object\",","                     required:[\"amount\",\"payment_term\"],","                     properties:{","                         amount:            {type: \"string\"},","                         payment_term:      {type: \"integer\"},","                     },","                     ","                 },","                },","            },","            ","            items:{","                type: \"array\",","                required:[\"created_at\",\"updated_at\",\"uuid\",\"description\",\"sku\",\"unit_id\",\"quantity\",\"subtotal\",\"discount\",\"tax\",\"total\",\"attributes\"],","                properties: {","                 created_at:             {type: \"integer\"},","                 updated_at:             {type: \"integer\"},","                 uuid:                   {type: \"string\"},","                 description:            {type: \"string\"},","                 sku:                    {type: \"string\"},","                 unit_id:                {type: \"string\"},","                 quantity:               {type: \"integer\"},","                 subtotal:               {type: \"float\"},","                 discount:               {type: \"integer\"},","                 tax:                    {type: \"float\"},","                 total:                  {type: \"float\"},","                 attributes:             {type: \"array\"},","                     },","                 },","            attachment:{","                type: \"array\",","                required:[\"uuid\",\"path\"],","                properties: {","                 uuid:             {type: \"string\"},","                 path:             {type: \"string\"},","                },","            },","        }","   }","   };","","pm.test(\"Valid JSON schema\", function() {","   pm.expect(tv4.validate(pm.response.json(), schema)).to.be.true;","});","","pm.test(\"Response data format/ data is correct\", function() { ","    var regEx = /^[0-9]{10}$/;","    var sum = ((pm.response.json().data.total)*1);","    var iva = ((pm.response.json().data.tax)*1);","    var precio = ((pm.response.json().data.subtotal)*1);","    var costo = ((pm.response.json().data.items[0].total)*1);","    var impuesto = ((pm.response.json().data.items[0].tax)*1);","    var valor = ((pm.response.json().data.items[0].subtotal)*1);","    ","    pm.expect(pm.response.json().data.issue_date).to.match(regEx);","    pm.expect(pm.response.json().data.due_date).to.match(regEx);","    pm.expect(pm.response.json().data.created_at).to.match(regEx);","    pm.expect(pm.response.json().data.updated_at).to.match(regEx);","    pm.expect(pm.response.json().data.items[0].updated_at).to.match(regEx);","    pm.expect(pm.response.json().data.items[0].created_at).to.match(regEx);","    pm.expect(pm.response.json().data.total).to.equal(sum);","    pm.expect(pm.response.json().data.tax).to.equal(iva);","    pm.expect(pm.response.json().data.subtotal).to.equal(precio);","    pm.expect(pm.response.json().data.items[0].total).to.equal(costo);","    pm.expect(pm.response.json().data.items[0].tax).to.equal(impuesto);","    pm.expect(pm.response.json().data.items[0].subtotal).to.equal(valor);","});","","pm.test(\"Valid invoice data\", function() {","    pm.expect(pm.response.json().data.currency).to.equal(\"MXN\");","});"],"type":"text/javascript"}}],"id":"190f1003-85eb-42d1-9dba-3336b5c35b98","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"Authorization","value":"{{access_token}}"},{"key":"Content-Type","value":"multipart/encrypted"}],"url":"https://api.porcobrar.com/v1/invoice/a4ca50fc-f0aa-4cdb-8b1d-e1d23842f1a8","description":"<p>Regresa el detalle de una factura por medio del ID.</p>\n","urlObject":{"protocol":"https","path":["v1","invoice","a4ca50fc-f0aa-4cdb-8b1d-e1d23842f1a8"],"host":["api","porcobrar","com"],"query":[],"variable":[]}},"response":[],"_postman_id":"190f1003-85eb-42d1-9dba-3336b5c35b98"},{"name":"get all invoice","event":[{"listen":"test","script":{"id":"547cf65c-6672-4873-a7d8-50a884ae59a3","exec":["pm.test(\"Must return a valid body\", function() {","  pm.response.to.have.status(200);","   pm.response.to.be.withBody;","   pm.response.to.be.json;","});","pm.test(\"Response time < 3 s\", function () {","   pm.expect(pm.response.responseTime).to.be.below(3000);","});","var schema = {","   data : {","       type : \"array\",","        required : [\"status\",\"issue_date\",\"due_date\",\"created_at\",\"updated_at\",\"format_id\",\"uuid\",\"code\",\"subtotal\",\"discount\",\"tax\",\"total\",\"balance\",\"currency\",\"status_id\",\"collectible\",\"domain\",\"number\",\"customer\",\"attachment\",\"transaction\"],","        properties : ","        {","            status:                 {type: \"string\"},","            issue_date:             {type: \"integer\"},","            due_date:               {type: \"integer\"},","            created_at:             {type: \"integer\"},","            updated_at:             {type: \"integer\"},","            format_id:              {type: \"integer\"},","            uuid:                   {type: \"string\"},","            code:                   {type: \"string\"},","            subtotal:               {type: \"float\"},","            discount:               {type: \"float\"},","            tax:                    {type: \"float\"},","            total:                  {type: \"float\"},","            balance:                {type: \"float\"},","            currency:               {type: \"string\"},","            status_id:              {type: \"integer\"},","            collectible:            {type: \"integer\"},","            domain:                 {type: \"string\"},","            number:                 {type: \"integer\"},","            transaction:            {type: \"array\"},","            customer:{","                type: \"object\",","                required:[\"due\",\"uuid\",\"name\",\"email\",\"legal_name\",\"tax_profile\",\"agreement\"],","                properties: {","                 due:                   {type: \"float\"},","                 uuid:                  {type: \"string\"},","                 name:                  {type: \"string\"},","                 email:                 {type: \"string\"},","                 legal_name:            {type: \"string\"},","                 tax_profile:           {type: \"string\"},","                 agreement:{","                     type: \"object\",","                     required:[\"amount\",\"payment_term\"],","                     properties:{","                         amount:            {type: \"string\"},","                         payment_term:      {type: \"integer\"},","                     },","                     ","                 },","                },","            },","            attachment:{","                type: \"array\",","                required:[\"uuid\",\"path\"],","                properties: {","                 uuid:             {type: \"string\"},","                 path:             {type: \"string\"},","                },","            },","        }","   }","   };","","pm.test(\"Valid JSON schema\", function() {","   pm.expect(tv4.validate(pm.response.json(), schema)).to.be.true;","});","","pm.test(\"Response data format/info is correct\", function() { ","    var regEx = /^[0-9]{10}$/;","    var sum = ((pm.response.json().data[0].total)*1);","    var iva = ((pm.response.json().data[0].tax)*1);","    var precio = ((pm.response.json().data[0].subtotal)*1);","    ","    pm.expect(pm.response.json().data[0].issue_date).to.match(regEx);","    pm.expect(pm.response.json().data[0].due_date).to.match(regEx);","    pm.expect(pm.response.json().data[0].created_at).to.match(regEx);","    pm.expect(pm.response.json().data[0].updated_at).to.match(regEx);","    pm.expect(pm.response.json().data[0].total).to.equal(sum);","    pm.expect(pm.response.json().data[0].tax).to.equal(iva);","    pm.expect(pm.response.json().data[0].subtotal).to.equal(precio);","","});","","pm.test(\"Valid invoice data\", function() {","    pm.expect(pm.response.json().data[0].currency).to.equal(\"MXN\");","});","","pm.environment.set(\"attachment\",pm.response.json().data[0].attachment[0].path);","pm.sendRequest(pm.environment.get(\"attachment\"), function (err, res) {","    pm.test(\"Valid XML File\", function () {","        pm.expect(err).to.equal(null);","        pm.expect(res).to.have.property('status', 'OK');","    });","});","","pm.test(\"Valid invoice data\", function() {","    pm.expect(pm.response.json().message).to.equal(\"Successfull\");","    pm.expect(pm.response.json().code).to.equal(101);","});","",""],"type":"text/javascript"}}],"id":"f73da9ba-1ab7-452c-b1b6-411a01a8ea32","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"Authorization","value":"{{access_token}}"},{"key":"Content-Type","name":"Content-Type","type":"text","value":"application/json"}],"body":{"mode":"formdata","formdata":[]},"url":"{{base_url}}/v1/invoice?tax_profile=XEXX010101000&code=F-97712&total=580&issue=1635249600&tax=80&status=paid&origin=ar","description":"<p>Regresa el total de las facturas de los clientes.</p>\n","urlObject":{"path":["v1","invoice"],"host":["{{base_url}}"],"query":[{"disabled":true,"description":{"content":"<p>string</p>\n","type":"text/plain"},"key":"customer","value":""},{"disabled":true,"description":{"content":"<p>string</p>\n","type":"text/plain"},"key":"customer_name","value":"Cliente Editado"},{"disabled":true,"description":{"content":"<p>string</p>\n","type":"text/plain"},"key":"legal_name","value":"MAB2 SA de CV"},{"description":{"content":"<p>string</p>\n","type":"text/plain"},"key":"tax_profile","value":"XEXX010101000"},{"disabled":true,"description":{"content":"<p>string</p>\n","type":"text/plain"},"key":"identifier","value":"null"},{"description":{"content":"<p>string</p>\n","type":"text/plain"},"key":"code","value":"F-97712"},{"disabled":true,"description":{"content":"<p>balance</p>\n","type":"text/plain"},"key":"balance","value":"580"},{"description":{"content":"<p>number</p>\n","type":"text/plain"},"key":"total","value":"580"},{"disabled":true,"description":{"content":"<p>date</p>\n","type":"text/plain"},"key":"due","value":"2021-04-01"},{"description":{"content":"<p>date</p>\n","type":"text/plain"},"key":"issue","value":"1635249600"},{"disabled":true,"description":{"content":"<p>date</p>\n","type":"text/plain"},"key":"created","value":"1616101696"},{"description":{"content":"<p>number</p>\n","type":"text/plain"},"key":"tax","value":"80"},{"disabled":true,"description":{"content":"<p>number</p>\n","type":"text/plain"},"key":"discount","value":"0"},{"description":{"content":"<p>cancel,current,paid,unpaid,late_payment</p>\n","type":"text/plain"},"key":"status","value":"paid"},{"disabled":true,"description":{"content":"<p>invoice,cfdi</p>\n","type":"text/plain"},"key":"type","value":"cfdi"},{"disabled":true,"description":{"content":"<p>boolean</p>\n","type":"text/plain"},"key":"is_recurrent","value":"1"},{"description":{"content":"<p>ar, bar, xml, sat</p>\n","type":"text/plain"},"key":"origin","value":"ar"}],"variable":[]}},"response":[{"id":"66f84453-47a9-4e44-851a-5fbce980c842","name":"get all invoice","originalRequest":{"method":"GET","header":[{"key":"Authorization","value":"{{access_token}}"},{"key":"Content-Type","name":"Content-Type","type":"text","value":"application/json"}],"body":{"mode":"formdata","formdata":[]},"url":{"raw":"{{base_url}}/v1/invoice?tax_profile=XEXX010101000&code=F-97712&total=580&issue=1635249600&tax=80&status=paid&origin=ar","host":["{{base_url}}"],"path":["v1","invoice"],"query":[{"key":"customer","value":"","type":"text","description":"string","disabled":true},{"key":"customer_name","value":"Cliente Editado","description":"string","disabled":true},{"key":"legal_name","value":"MAB2 SA de CV","description":"string","type":"text","disabled":true},{"key":"tax_profile","value":"XEXX010101000","description":"string"},{"key":"identifier","value":"null","description":"string","type":"text","disabled":true},{"key":"code","value":"F-97712","description":"string"},{"key":"balance","value":"580","description":"balance","type":"text","disabled":true},{"key":"total","value":"580","description":"number"},{"key":"due","value":"2021-04-01","type":"text","description":"date","disabled":true},{"key":"issue","value":"1635249600","description":"date"},{"key":"created","value":"1616101696","description":"date","type":"text","disabled":true},{"key":"tax","value":"80","description":"number"},{"key":"discount","value":"0","description":"number","type":"text","disabled":true},{"key":"status","value":"paid","description":"cancel,current,paid,unpaid,late_payment"},{"key":"type","value":"cfdi","description":"invoice,cfdi","disabled":true},{"key":"is_recurrent","value":"1","description":"boolean","disabled":true},{"key":"origin","value":"ar","description":"ar, bar, xml, sat"}]}},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Server","value":"nginx"},{"key":"Date","value":"Fri, 14 May 2021 15:18:49 GMT"},{"key":"Content-Type","value":"application/json; charset=utf-8"},{"key":"Content-Length","value":"1347"},{"key":"Connection","value":"keep-alive"},{"key":"Strict-Transport-Security","value":"max-age=15552000; includeSubDomains"},{"key":"X-Content-Type-Options","value":"nosniff"},{"key":"X-XSS-Protection","value":"1; mode=block"},{"key":"Access-Control-Allow-Origin","value":"*"},{"key":"ETag","value":"W/\"543-MrOZK1Pp30XQQ2o0l28OW/NQ88k\""}],"cookie":[],"responseTime":null,"body":"{\n    \"data\": [\n        {\n            \"status\": \"status message 5\",\n            \"issue_date\": 1619026390,\n            \"due_date\": 1621618390,\n            \"created_at\": 1619026753,\n            \"updated_at\": 1619027084,\n            \"id\": 61187,\n            \"team_id\": 3144,\n            \"format_id\": 1,\n            \"identifier\": null,\n            \"uuid\": \"3026feb8-23de-4a36-8615-14e2e11e5129\",\n            \"code\": \"F-97712\",\n            \"subtotal\": 19979.49,\n            \"discount\": 0,\n            \"tax\": 3196.72,\n            \"total\": 23176.21,\n            \"balance\": 0,\n            \"currency\": \"MXN\",\n            \"currency_rate\": 1,\n            \"status_id\": 5,\n            \"collectible\": 1,\n            \"domain\": \"AR\",\n            \"number\": 3262,\n            \"notes\": null,\n            \"comment\": null,\n            \"purchase_order\": null,\n            \"cfdi_type\": \"I\",\n            \"scheduled_reminder\": 0,\n            \"reminders_sent\": 0,\n            \"reminders_seen\": 0,\n            \"customer\": {\n                \"updated_at\": 1608220725,\n                \"created_at\": 1606149798,\n                \"uuid\": \"9c191b6b-6dbd-476f-bb36-abcc305b35c0\",\n                \"name\": \"Publico en General\",\n                \"email\": \"y.yanely.solis@gmail.com\",\n                \"phone\": \"5554663069\",\n                \"legal_name\": \"Publico en general\",\n                \"tax_profile\": \"XAXX010101000\",\n                \"domain\": \"AR\",\n                \"identifier\": null,\n                \"deleted_at\": null\n            },\n            \"attachment\": [\n                {\n                    \"id\": 118681,\n                    \"uuid\": \"447f653d-3f77-4cb9-86da-5d5d6597c2f9\",\n                    \"path\": \"https://ar-app.s3.us-east-2.amazonaws.com/staging/0dc16bb6-cd20-42e6-8274-1b546d5adb35.xml\",\n                    \"name\": null,\n                    \"is_voucher\": false\n                },\n                {\n                    \"id\": 118682,\n                    \"uuid\": \"017cc31f-6d6f-4c6d-973d-893634e182aa\",\n                    \"path\": \"https://ar-app.s3.us-east-2.amazonaws.com/staging/0dc16bb6-cd20-42e6-8274-1b546d5adb35.pdf\",\n                    \"name\": null,\n                    \"is_voucher\": false\n                }\n            ],\n            \"files\": [],\n            \"contract\": null,\n            \"cfdi\": true\n        }\n    ],\n    \"message\": \"Successfull\",\n    \"code\": 101,\n    \"count\": 1,\n    \"pages\": 1\n}"}],"_postman_id":"f73da9ba-1ab7-452c-b1b6-411a01a8ea32"},{"name":"delete invoice","id":"8815edad-6ee6-482e-8b44-b03fb758b273","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"DELETE","header":[{"key":"Authorization","type":"text","value":"{{access_token}}"}],"body":{"mode":"formdata","formdata":[]},"url":"https://api.porcobrar.com/v1/invoice/27f7648c-4dbf-413b-b2a7-61a21b606386","description":"<p>Esta operación elimina el objeto de factura.</p>\n","urlObject":{"protocol":"https","path":["v1","invoice","27f7648c-4dbf-413b-b2a7-61a21b606386"],"host":["api","porcobrar","com"],"query":[],"variable":[]}},"response":[],"_postman_id":"8815edad-6ee6-482e-8b44-b03fb758b273"},{"name":"Add invoice item","id":"8641364e-63f6-4580-b703-8c9c39566558","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Authorization","value":"{{access_token}}","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"attributes\": {\n        \"cfdi_code\": 50171800,\n        \"cfdi_unit_code\": \"H87\"\n    },\n    \"description\": \"Item 1\",    \n    \"price\": 100,\n    \"quantity\": 1,\n    \"discount\": 0,\n    \"sku\": \"0110wer4\",\n    \"taxes\": [\n        {\n            \"added\": 1,\n            \"amount\": 0.16,\n            \"code\": \"002\",\n            \"is_percentage\": 1,\n            \"name\": \"IVA 16%\"\n        }\n    ]\n}","options":{"raw":{"language":"json"}}},"url":"https://api.porcobrar.com/v1/{{invoice_uuid}}/item","urlObject":{"protocol":"https","path":["v1","{{invoice_uuid}}","item"],"host":["api","porcobrar","com"],"query":[],"variable":[]}},"response":[],"_postman_id":"8641364e-63f6-4580-b703-8c9c39566558"},{"name":"Update invoice item","id":"0f044eee-8ed4-4b4f-879c-95033367056a","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PUT","header":[{"key":"Authorization","type":"text","value":"{{access_token}}"}],"body":{"mode":"raw","raw":"{\n    \"description\": \"Item 1 - description udated - new price\",\n    \"sku\": \"\",\n    \"quantity\": 5,\n    \"discount\": 0,\n    \"price\": 200\n}","options":{"raw":{"language":"json"}}},"url":"https://api.porcobrar.com/v1/invoice/{{invoice_uuid}}/item/{{item_uuid}}","urlObject":{"protocol":"https","path":["v1","invoice","{{invoice_uuid}}","item","{{item_uuid}}"],"host":["api","porcobrar","com"],"query":[],"variable":[]}},"response":[],"_postman_id":"0f044eee-8ed4-4b4f-879c-95033367056a"},{"name":"Remove invoice item","id":"acf75553-44a1-4c5a-b014-9a104b1f46d2","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"DELETE","header":[{"key":"Authorization","type":"text","value":"{{access_token}}"}],"url":"https://api.porcobrar.com/v1/invoice/{{invoice_uuid}}/item/{{item_uuid}}","urlObject":{"protocol":"https","path":["v1","invoice","{{invoice_uuid}}","item","{{item_uuid}}"],"host":["api","porcobrar","com"],"query":[],"variable":[]}},"response":[],"_postman_id":"acf75553-44a1-4c5a-b014-9a104b1f46d2"},{"name":"Get all invoice item","id":"262c8234-e086-4c4f-b13f-13f314a15943","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"Authorization","type":"text","value":"{{access_token}}"}],"url":"https://api.porcobrar.com/v1/invoice/{{invoice_uuid}}/item","urlObject":{"protocol":"https","path":["v1","invoice","{{invoice_uuid}}","item"],"host":["api","porcobrar","com"],"query":[],"variable":[]}},"response":[],"_postman_id":"262c8234-e086-4c4f-b13f-13f314a15943"}],"id":"8d4d2586-a37d-4ce9-a21b-6276efef051d","description":"<p>Servicio para la conversión de XML con estructura de CFDI a su representación gráfica en PDF, a continuación encontrarás información para personalizar, automatizar, enviar y generar el PDF de tus documentos CFDI.</p>\n<h2 id=\"¿qué-puedo-hacer\">¿Qué puedo hacer?</h2>\n<ul>\n<li>Convertir archivos CFDI a PDF.</li>\n</ul>\n<h2 id=\"autenticación\">Autenticación</h2>\n<p>Para realizar cualquier llamado es necesario utilizar la llave de acceso {{access_token}}.</p>\n<h1 id=\"documentacion-de-filtracion\">Documentacion de filtracion</h1>\n<h2 id=\"filtros-por-atributos-condicionados\">Filtros por atributos condicionados</h2>\n<h3 id=\"estructura\">Estructura</h3>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code>attributo: {\n    condicion: valor\n}\n</code></pre><br />\n\n<ul>\n<li>Condiciones para cadenas</li>\n</ul>\n<table>\n  <tr>\n    <th>Key</th>\n    <th>Traducción</th>\n    <th>Codificación</th>\n  </tr>\n  <tr>\n    <td>eq</td>\n    <td>igual</td>\n    <td>==</td>\n  </tr>\n  <tr>\n    <td>ne</td>\n    <td>no igual</td>\n    <td>!=</td>\n  </tr>\n  <tr>\n    <td>sw</td>\n    <td>inicia con</td>\n    <td>STRING%</td>\n  </tr>\n  <tr>\n    <td>ew</td>\n    <td>termina con</td>\n    <td>%STRING</td>\n  </tr>\n  <tr>\n    <td>cont</td>\n    <td>contiene</td>\n    <td>%STRING%</td>\n  </tr>\n  <tr>\n    <td>ncont</td>\n    <td>no contiene</td>\n    <td>NOT %STRING%</td>\n  </tr>\n</table>\n\n<br />\n\n<ul>\n<li>Condiciones aritmetica/logica (Aplica a numeros y fechas)</li>\n</ul>\n<table>\n  <tr>\n    <th>key</th>\n    <th>Traducción</th>\n    <th>Codificación</th>\n  </tr>\n  <tr>\n    <td>eq</td>\n    <td>igual</td>\n    <td>==</td>\n  </tr>\n  <tr>\n    <td>ne</td>\n    <td>no igual</td>\n    <td>!=</td>\n  </tr>\n  <tr>\n    <td>gt</td>\n    <td>mayor que</td>\n    <td>&gt;</td>\n  </tr>\n  <tr>\n    <td>gte</td>\n    <td>mayor o igual que</td>\n    <td>&gt;=</td>\n  </tr>\n  <tr>\n    <td>lt</td>\n    <td>menor que</td>\n    <td>&lt;</td>\n  </tr>\n  <tr>\n    <td>lte</td>\n    <td>menor o igual que</td>\n    <td>&lt;=</td>\n  </tr>\n  <tr>\n    <td>btw</td>\n    <td>entre</td>\n    <td>[A, B]</td>\n  </tr>\n  <tr>\n    <td>notbtw</td>\n    <td>no entre</td>\n    <td>NOT [A, B]</td>\n  </tr>\n</table>\n\n<br />\n\n<h2 id=\"filtros-personalizados\">Filtros personalizados</h2>\n<p>Valores simples en el querystring</p>\n<p><code>status=cancel,paid</code></p>\n<br />\n\n<h1 id=\"filtros\">Filtros</h1>\n<h2 id=\"facturas--nota-de-credito\">Facturas / Nota de credito</h2>\n<h3 id=\"atributos\">Atributos</h3>\n<table>\n  <tr>\n    <td>customer</td>\n    <td>string</td>\n  </tr>\n  <tr>\n    <td>customer_name</td>\n    <td>string</td>\n  </tr>\n  <tr>\n    <td>legal_name</td>\n    <td>string</td>\n  </tr>\n  <tr>\n    <td>tax_profile</td>\n    <td>string</td>\n  </tr>\n  <tr>\n    <td>identifier</td>\n    <td>string</td>\n  </tr>\n  <tr>\n    <td>code</td>\n    <td>string</td>\n  </tr>\n  <tr>\n    <td>balance</td>\n    <td>balance</td>\n  </tr>\n  <tr>\n    <td>total</td>\n    <td>number</td>\n  </tr>\n  <tr>\n    <td>due</td>\n    <td>date</td>\n  </tr>\n  <tr>\n    <td>issye</td>\n    <td>date</td>\n  </tr>\n  <tr>\n    <td>created</td>\n    <td>date</td>\n  </tr>\n  <tr>\n    <td>comment</td>\n    <td>string</td>\n  </tr>\n  <tr>\n    <td>tax</td>\n    <td>number</td>\n  </tr>\n  <tr>\n    <td>discount</td>\n    <td>number</td>\n  </tr>\n</table>\n\n<br />\n\n<h3 id=\"personalizados\">Personalizados</h3>\n<table>\n  <tr>\n    <td>status</td>\n    <td>cancel\n      current\n      paid\n      unpaid\n      late_payment</td>\n  </tr>\n  <tr>\n    <td>type</td>\n    <td>invoice\n      cfdi</td>\n  </tr>\n  <tr>\n    <td>is_recurrent</td>\n    <td>boolean</td>\n  </tr>\n  <tr>\n    <td>origin</td>\n    <td>ar\n      bar\n      xml\n      sat</td>\n  </tr>\n</table>\n\n<hr />\n<h2 id=\"pagos\">Pagos</h2>\n<h3 id=\"atributos-1\">Atributos</h3>\n<table>\n  <tr>\n    <td>customer</td>\n    <td>string</td>\n  </tr>\n  <tr>\n    <td>customer_name</td>\n    <td>string</td>\n  </tr>\n  <tr>\n    <td>legal_name</td>\n    <td>string</td>\n  </tr>\n  <tr>\n    <td>tax_profile</td>\n    <td>string</td>\n  </tr>\n  <tr>\n    <td>identifier</td>\n    <td>string</td>\n  </tr>\n  <tr>\n    <td>total</td>\n    <td>number</td>\n  </tr>\n  <tr>\n    <td>number</td>\n    <td>number</td>\n  </tr>\n  <tr>\n    <td>paid_at</td>\n    <td>date</td>\n  </tr>\n  <tr>\n    <td>reasons</td>\n    <td>string</td>\n  </tr>\n  <tr>\n    <td>code</td>\n    <td>string</td>\n  </tr>\n  <tr>\n    <td>balance</td>\n    <td>balance</td>\n  </tr>\n  <tr>\n    <td>total_invoice</td>\n    <td>number</td>\n  </tr>\n  <tr>\n    <td>due</td>\n    <td>date</td>\n  </tr>\n  <tr>\n    <td>issue</td>\n    <td>date</td>\n  </tr>\n  <tr>\n    <td>created</td>\n    <td>date</td>\n  </tr>\n  <tr>\n    <td>comment</td>\n    <td>string</td>\n  </tr>\n</table>\n\n\n<h3 id=\"personalizados-1\">Personalizados</h3>\n<table>\n  <tr>\n    <td>status</td>\n    <td>cancel\n    pending\n    confirmed\n    reject</td>\n  </tr>\n  <tr>\n    <td>origin</td>\n    <td>ar\n    xml\n    sat</td>\n  </tr>\n  <tr>\n    <td>is_cfdi</td>\n    <td>boolean</td>\n  </tr>\n</table>\n\n<hr />\n<h2 id=\"contratos\">Contratos</h2>\n<h3 id=\"atributos-2\">Atributos</h3>\n<table>\n  <tr>\n    <td>customer</td>\n    <td>string</td>\n  </tr>\n  <tr>\n    <td>customer_name</td>\n    <td>string</td>\n  </tr>\n  <tr>\n    <td>legal_name</td>\n    <td>string</td>\n  </tr>\n  <tr>\n    <td>legal_name</td>\n    <td>string</td>\n  </tr>\n  <tr>\n    <td>tax_profile</td>\n    <td>string</td>\n  </tr>\n  <tr>\n    <td>identifier</td>\n    <td>string</td>\n  </tr>\n  <tr>\n    <td>number</td>\n    <td>number</td>\n  </tr>\n  <tr>\n    <td>total</td>\n    <td>number</td>\n  </tr>\n  <tr>\n    <td>started_at</td>\n    <td>date</td>\n  </tr>\n  <tr>\n    <td>ended_at</td>\n    <td>date</td>\n  </tr>\n  <tr>\n    <td>first_invoice_date</td>\n    <td>date</td>\n  </tr>\n  <tr>\n    <td>next_billing_cycle</td>\n    <td>date</td>\n  </tr>\n</table>\n\n<h3 id=\"personalizados-2\">Personalizados</h3>\n<table>\n  <tr>\n    <td>frequency</td>\n    <td>monthtly\n    weekly</td>\n  </tr>\n  <tr>\n    <td>status</td>\n    <td>active\n    inactive\n    no_ended</td>\n  </tr>\n  <tr>\n    <td>is_recurrent</td>\n    <td>boolean</td>\n  </tr>\n</table>\n\n\n<p>Se debe ocupar la libreria <strong>qs</strong> para convertir el objeto con los filtros que \nse require a un query string, si deseamos buscar las facturas mayores a la \nfecha de 2021-01-20 seria asi:</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code>const qs = require('qs');\n\nconsole.log( qs.stringify({\n    created_at:{\n        gt: '2021-01-20'\n    }\n}) );\n</code></pre><p>output :</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code>created_at%5Bgt%5D=2021-01-20\n</code></pre>","event":[{"listen":"prerequest","script":{"id":"e1bb5437-c843-4599-b419-4ae99a1a2fe0","type":"text/javascript","exec":[""]}},{"listen":"test","script":{"id":"0cc1e04d-068f-46ad-bbe6-747c029a61f8","type":"text/javascript","exec":[""]}}],"_postman_id":"8d4d2586-a37d-4ce9-a21b-6276efef051d"},{"name":"Contract","item":[{"name":"Create a contract","id":"eb31f765-df9b-420b-981c-09803ca9a676","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Content-Type","name":"Content-Type","type":"text","value":"application/json"},{"key":"Authorization","value":"{{access_token}}","type":"text"}],"body":{"mode":"raw","raw":"{ \n    \"first_invoice_date\": \"1612180800\",  \n    \"started_at\": \"1603454400\",  \n    \"ended_at\": \"1671883200\",\n    \"currency\": \"MXN\",\n    \"currency_rate\": 1,\n    \"exchange_offset\": 10,\n    \"discount\": 0,\n    \"subtotal\": 579,\n    \"tax\": -25.92,\n    \"total\": 553.08,\n\t\"customer\": { \n\t\t\"id\": \"ad07ecfe-9f8e-49a0-a805-cd759d91aa66\"\n\t},\n\t\"attributes\": {\n    \t\"cfdi_payment_conditions\": 7\n\t},\n\t\"items\": [\n\t\t{\n        \"attributes\": {\n          \"cfdi_code\": \"10215400\",\n          \"cfdi_unit_code\": \"H87\"\n        },\n        \"discount\": 0,\n        \"sku\": \"sku\",\n        \"description\": \"Producto 2000\",\n        \"price\": 123,\n        \"quantity\": 1,\n        \"subtotal\": 123,\n        \"tax\": 19.68,\n        \"total\": 142.68,\n        \"unit_id\": 1,\n        \"taxes\": [\n          {\n            \"added\": 1,\n            \"amount\": 0.16,\n            \"base\": 123,\n            \"code\": \"002\",\n            \"is_percentage\": 1,\n            \"name\": \"IVA 16%\",\n            \"total\": 19.68\n          }\n        ]\n      },\n      {\n        \"attributes\": {\n          \"cfdi_code\": \"10215438\",\n          \"cfdi_unit_code\": \"AE\"\n        },\n        \"discount\": 0,\n        \"sku\": \"sku\",\n        \"description\": \"Producto 23939\",\n        \"price\": 456,\n        \"quantity\": 1,\n        \"subtotal\": 456,\n        \"tax\": -45.6,\n        \"total\": 410.4,\n        \"unit_id\": 1,\n        \"taxes\": [\n          {\n            \"added\": 0,\n            \"amount\": 0.1,\n            \"base\": 456,\n            \"code\": \"002\",\n            \"is_percentage\": 1,\n            \"name\": \"IVA Retenido 10%\",\n            \"total\": -45.6\n          }\n        ]\n      }\n\t],\n\t\"schedule\": {\n        \"started_at\": \"1603454400\",  \n        \"ended_at\": \"1671883200\",\n        \"repeat_unit\": \"monthly\",\n        \"repeat_every\": 1,\n        \"repeat_mode\": \"on_day\",\n        \"repeat_day\": 1\n\t}\n}\n\n","options":{"raw":{"language":"json"}}},"url":"{{base_url}}/v1/contract","description":"<h1 id=\"atributos\">Atributos</h1>\n<h2 id=\"first_invoice_date\">first_invoice_date</h2>\n<p>En este atributo va la fecha para generación de la primera factura en formato Timestamp.</p>\n<h2 id=\"started_at\">started_at</h2>\n<p>En este atributo va la fecha de inicio del contrato en formato Timestamp.</p>\n<h2 id=\"ended_at\">ended_at</h2>\n<p>En este atributo va la fecha en la que termina el contrato en formato Timestamp.</p>\n<h2 id=\"curency\">curency</h2>\n<p>Se indica el tipo de moneda a utilizar en el contrato (ISO 4217 Curency Codes), normalmente se utiliza \"MXN\".</p>\n<h2 id=\"currency_rate\">currency_rate</h2>\n<p>Indica el tipo de cambio en caso. En caso de ser la misma moneda base, deberá ser 1, en caso de ser otra moneda deberá ser llenado en base al tipo de conversion deseado contra la moneda base.</p>\n<h2 id=\"exchange_offset\">exchange_offset</h2>\n<p>Es la suma de currency_rate, en otras palabras es el equivalente al \"colchón\"</p>\n<h2 id=\"discount\">discount</h2>\n<p>Indica el descuento a aplicar en la factura.</p>\n<h2 id=\"subtotal\">subtotal</h2>\n<p>Es el total de items + impuestos (taxes), es necesario que se calcule manualmente.</p>\n<h2 id=\"tax\">tax</h2>\n<p>Es el total de los impuestos, al igual que el subtotal, es necesario que sea calculado manualmente.</p>\n<h2 id=\"total\">total</h2>\n<p>Se debe calcular manualmente con la siguiente formula:\n<code>subtotal + tax - discount</code>. Posteriormente se procede a colocar en este atributo el resultado.</p>\n<h2 id=\"customer\">customer</h2>\n<p>  A continuación se mostrará el atributo relacionado con la información del cliente a realizar el contrato:</p>\n<ul>\n<li><h2 id=\"id\">id</h2>\n  Es el identificador del cliente al cual se le va a crear el contrato.</li>\n</ul>\n<h2 id=\"attributes\">attributes</h2>\n<p>Dentro de este, se encuentra el siguiente atributo:</p>\n<ul>\n<li><h2 id=\"cfdi_payment_conditions\">cfdi_payment_conditions</h2>\n  Son los días de crédito. Se puede usar este campo para especificar los días de gracia por contrato, es decir, en este ejemplo indica que el cliente tendrá 7 dias de crédito. Al momento de emitir la factura, la fecha de vencimiento será en ese periodo de tiempo.</li>\n</ul>\n<h2 id=\"items\">items</h2>\n<p>En esta lista, se encuentran los atributos relacionados a los productos a registrar bajo el esquema de producto. Dicha lista se describe a continuación:</p>\n<ul>\n<li><h2 id=\"attributes-1\">attributes</h2>\n<p>  A continuación, se va a mostrar los dos atributos relacionados al catalogo de SAT, es decir, al timbrado CFDI (Para más información puede consultar en <code>http://pys.sat.gob.mx/PyS/catPyS.aspx</code>).</p>\n<ul>\n<li><h2 id=\"cfdi_code\">cfdi_code</h2>\n<p>  Es el código del producto acorde al catalogo del SAT.</p>\n</li>\n<li><h2 id=\"cfdi_unit_code\">cfdi_unit_code</h2>\n<p>  Es el código de unidad acorde al catalogo del SAT.</p>\n</li>\n</ul>\n</li>\n<li><h2 id=\"discount-1\">discount</h2>\n<p>  Indica el descuento que se le aplica a la factura.</p>\n</li>\n<li><h2 id=\"sku\">sku</h2>\n<p> Indica el SKU de un documento.</p>\n</li>\n<li><h2 id=\"description\">description</h2>\n<p>  Se describe el producto en cuestión. Poseé un limite de 4096 caracteres.</p>\n</li>\n<li><h2 id=\"price\">price</h2>\n<p>  Se agrega el precio del producto.</p>\n</li>\n<li><h2 id=\"quantity\">quantity</h2>\n<p>  Aqui se agrega la cantidad de unidades.</p>\n</li>\n<li><h2 id=\"subtotal-1\">subtotal</h2>\n<p> Es la multiplicación de precio por cantidad (<code>quantity * price</code>).</p>\n</li>\n<li><h2 id=\"tax-1\">tax</h2>\n<p>  Es la cantidad del impuesto calculada por operación (Es necesario calcular el impuesto que ampare todos los productos contemplando la cantidad de productos).</p>\n</li>\n<li><h2 id=\"total-1\">total</h2>\n<p>  Se obtiene este atributo con la siguiente formula:\n  <code>price * quantity * tax</code>\n  La cual price es el precio, quantity es la cantidad y el tax se debe calcular completando la cantidad de productos.</p>\n</li>\n<li><h2 id=\"type\">Type</h2>\n<p>  Es el identificador en base al siguiente catalogo:</p>\n<ol>\n<li>Pieza</li>\n<li>Elemento</li>\n<li>Unidad de servicio</li>\n<li>Actividad</li>\n<li>Kilogramo</li>\n<li>Trabajo</li>\n<li>Tarifa</li>\n<li>Metro</li>\n<li>Paquete a granel</li>\n<li>Caja base</li>\n<li>Kit</li>\n<li>Conjunto</li>\n<li>Litro</li>\n<li>Caja</li>\n<li>Mes</li>\n<li>Hora</li>\n<li>Metro cuadrado</li>\n<li>Equipos</li>\n<li>Miligramo</li>\n<li>Paquete</li>\n<li>Kit</li>\n<li>Variedad</li>\n<li>Gramo</li>\n<li>Par</li>\n<li>Docena de piezas</li>\n<li>Unidad</li>\n<li>Día</li>\n<li>Lote</li>\n<li>Grupos</li>\n<li>Mililitro</li>\n<li>Viaje</li>\n<li>Cada mes</li>\n<li>Sin descripción</li>\n<li>Año</li>\n<li>Metro lineal</li>\n<li>Kilo bruto</li>\n<li>Uno</li>\n<li>Botella cilíndrica protegida</li>\n<li>Mutuamente definido</li>\n<li>Empaque a granel</li>\n<li>Unidades de tiempo y espacio</li>\n</ol>\n</li>\n<li><h2 id=\"taxes\">taxes</h2>\n<p>  A continuación, se van a mostrar los atributos relacionados a los impuestos:</p>\n<ul>\n<li><h2 id=\"added\">added</h2>\n<p>  Si el valor es 1, se va a sumar el impuesto, en caso de que sea 0, se va a retener el impuesto.</p>\n</li>\n<li><h2 id=\"amount\">amount</h2>\n<p>  Es la tasa porcentual o la cantidad.\n  Por ejemplo: Para calcular el IVA el atributo <code>is_percentage</code> deberá ser <code>1</code> y el valor de este atributo debe ser <code>0.16</code>.</p>\n</li>\n<li><h2 id=\"base\">base</h2>\n<p>  Es el monto base sobre el cual se va a calcular el impuesto, es decir, igual que el subtotal de los conceptos considerando que el subtotal es <code>concepto * cantidad</code>.</p>\n</li>\n<li><h2 id=\"is_percentage\">is_percentage</h2>\n<p>  Es el indicador si el impuesto es con porcentaje o cantidad.\n  Si el valor de este es <code>1</code>, entonces va a indicar que se va a manejar por porcentajes, en caso de que sea <code>0</code>, se va a manejar por cantidad.</p>\n</li>\n<li><h2 id=\"name\">name</h2>\n<p>  Es el nombre del impuesto.</p>\n</li>\n<li><h2 id=\"total-2\">total</h2>\n<p>  Si el impuesto es porcentaje debe calcularse manualmente con la siguiente formula: <code>base * amount</code>.\n  En caso contrario, el impuesto es igual a amount y debe ser definido.</p>\n</li>\n</ul>\n</li>\n<li><h2 id=\"schedule\">schedule</h2>\n<p>  A continuación se van a mostrar los datos relacionados al contrato:</p>\n<ul>\n<li><h2 id=\"started_at-1\">started_at</h2>\n  Es la fecha de inicio del contrato. El valor se tiene que agregar bajo el formato de Timestamp.</li>\n<li><h2 id=\"ended_at-1\">ended_at</h2>\n  Es la fecha de termino de contrato. El valor se tiene que agregar bajo el formato de Timestamp.</li>\n<li><h2 id=\"repeat_unit\">repeat_unit</h2>\n  Es la frecuencia de emisión del contrato.\n  Los valores de este son los siguientes:<ul>\n<li><code>monthly</code>: Indica que será mensual.</li>\n<li><code>weekly</code>: Indica que será semanal.</li>\n</ul>\n</li>\n<li><h2 id=\"repeat_every\">repeat_every</h2>\n  Indica la recurrencia de acuerdo a la unidad a repetir, digase al mes o a la semana.</li>\n<li><h2 id=\"repeat_mode\">repeat_mode</h2>\n  La recurrencia será el mismo día de la emisión.\n  Los valores de este son los siguientes:<ul>\n<li><code>last_day</code>: Indica que será el último día de cada contrato.</li>\n<li><code>on_day</code>: Indica que será el dia de cada contrato. Ademas, es necesario indicar que día se va a emitir el cobro recurrente.</li>\n</ul>\n</li>\n<li><h2 id=\"repeat_day\">repeat_day</h2>\n  Indica el dia en el que se va a emitir el cobro (solo en caso de que el valor del atributo anterior sea <code>on_day</code>).</li>\n</ul>\n</li>\n</ul>\n","urlObject":{"path":["v1","contract"],"host":["{{base_url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"eb31f765-df9b-420b-981c-09803ca9a676"},{"name":"Create a CFDI contract","id":"027dc960-fe70-48c8-bf53-ed34e84a9c27","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Authorization","type":"text","value":"{{access_token}}"},{"key":"Content-Type","name":"Content-Type","type":"text","value":"application/json"}],"body":{"mode":"raw","raw":"{\n  \"first_invoice_date\": 1603131294,\n  \"started_at\": \"1602195905\",\n  \"ended_at\": \"1618844720\",\n  \"currency\": \"MXN\",\n  \"exchange_offset\": 0,\n  \"currency_rate\": 1,\n  \"discount\": 0,\n  \"subtotal\": 579,\n  \"tax\": -25.92,\n  \"total\": 553.08,\n  \"identifier\": \"\",\n  \"customer\": {\n    \"id\": \"ad07ecfe-9f8e-49a0-a805-cd759d91aa66\"\n  },\n\t\"attributes\": {\n    \t\"cfdi_payment_conditions\": 7,\n    \t\"cfdi_payment_method\": \"PUE\",\n    \t\"cfdi_payment_type\": \"07\",\n    \t\"cfdi_usage\": \"G03\",\n    \t\"cfdi_exchange_rate\": \"\"\n\t},\n\t\"items\": [\n\t\t{\n        \"attributes\": {\n          \"cfdi_code\": \"10215400\",\n          \"cfdi_unit_code\": \"H87\"\n        },\n        \"discount\": 0,\n        \"sku\": \"sku\",\n        \"description\": \"Producto 100\",\n        \"price\": 123,\n        \"quantity\": 1,\n        \"subtotal\": 123,\n        \"tax\": 19.68,\n        \"total\": 142.68,\n        \"unit_id\": 1,\n        \"taxes\": [\n          {\n            \"added\": 1,\n            \"amount\": 0.16,\n            \"base\": 123,\n            \"code\": \"002\",\n            \"is_percentage\": 1,\n            \"name\": \"IVA 16%\",\n            \"total\": 19.68\n          }\n        ]\n      },\n      {\n        \"attributes\": {\n          \"cfdi_code\": \"10215438\",\n          \"cfdi_unit_code\": \"AE\"\n        },\n        \"discount\": 0,\n        \"sku\": \"sku\",\n        \"description\": \"Producto 29939\",\n        \"price\": 456,\n        \"quantity\": 1,\n        \"subtotal\": 456,\n        \"tax\": -45.6,\n        \"total\": 410.4,\n        \"unit_id\": 1,\n        \"taxes\": [\n          {\n            \"added\": 0,\n            \"amount\": 0.1,\n            \"base\": 456,\n            \"code\": \"002\",\n            \"is_percentage\": 1,\n            \"name\": \"IVA Retenido 10%\",\n            \"total\": -45.6\n          }\n        ]\n      }\n\t],\n\t\"schedule\": {\n\t    \"started_at\": \"1602195905\",\n        \"ended_at\": \"1618844720\",      \n\t    \"repeat_unit\": \"weekly\",\n\t    \"repeat_every\": 1,\n\t    \"repeat_mode\": \"on_day\",\n\t    \"repeat_day\": 6\n\t }\n}\n\n","options":{"raw":{"language":"json"}}},"url":"{{base_url}}/v1/contract","urlObject":{"path":["v1","contract"],"host":["{{base_url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"027dc960-fe70-48c8-bf53-ed34e84a9c27"},{"name":"Contract detail","id":"a1be0adb-4059-4fa6-9876-3eef9421742f","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"Authorization","value":"{{access_token}}","type":"text"}],"url":"{{base_url}}/v1/contract/398dc2af-2901-4a4e-a4e3-5f7a5ad96460","urlObject":{"path":["v1","contract","398dc2af-2901-4a4e-a4e3-5f7a5ad96460"],"host":["{{base_url}}"],"query":[{"disabled":true,"key":"weekly","value":"398dc2af-2901-4a4e-a4e3-5f7a5ad96460"},{"disabled":true,"key":"monthly","value":"64f08832-355f-41fb-a9f8-5b8bc1f34c2a"}],"variable":[]}},"response":[],"_postman_id":"a1be0adb-4059-4fa6-9876-3eef9421742f"},{"name":"Get all contracts","id":"03bccb2b-e513-4bd1-af45-26162c7b6404","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"Authorization","value":"{{access_token}}","type":"text"}],"url":"{{base_url}}/v1/contract","urlObject":{"path":["v1","contract"],"host":["{{base_url}}"],"query":[{"disabled":true,"key":"page","value":"1"},{"disabled":true,"key":"filters","value":"due%5Bbtw%5D%5B0%5D=2020-09-01%26due%5Bbtw%5D%5B1%5D=2020-10-08"},{"disabled":true,"description":{"content":"<p>monthly, weekly</p>\n","type":"text/plain"},"key":"frecuency","value":"monthly"},{"disabled":true,"description":{"content":"<p>active,inactive,no_ended</p>\n","type":"text/plain"},"key":"status","value":"active"},{"disabled":true,"description":{"content":"<p>bool</p>\n","type":"text/plain"},"key":"is_recurrent","value":"1"}],"variable":[]}},"response":[],"_postman_id":"03bccb2b-e513-4bd1-af45-26162c7b6404"},{"name":"Update contract","id":"07020b4a-cded-4252-b038-5c14cb7bf1be","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PUT","header":[{"key":"Authorization","value":"{{access_token}}","type":"text"},{"key":"Content-Type","name":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"\n {\n   \"identifier\": \"CONTRACT-002\",\n   \"attributes\": {\n    \t\"cfdi_payment_conditions\": 7,\n    \t\"cfdi_payment_method\": \"PPD\",\n    \t\"cfdi_payment_type\": \"\",\n    \t\"cfdi_usage\": \"G03\",\n    \t\"cfdi_exchange_rate\": \"\"\n\t}\n }","options":{"raw":{"language":"json"}}},"url":"{{base_url}}/v1/contract/e5174580-7b0b-4897-9b6e-b68cacc8e44d","urlObject":{"path":["v1","contract","e5174580-7b0b-4897-9b6e-b68cacc8e44d"],"host":["{{base_url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"07020b4a-cded-4252-b038-5c14cb7bf1be"},{"name":"Delete a contract Copy","id":"6fb3ba32-4227-4a71-a472-a86eb99c196a","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"DELETE","header":[{"key":"Authorization","value":"{{access_token}}","type":"text"}],"url":"{{base_url}}/v1/contract/46ec035b-f965-4721-a668-646deb320f43","urlObject":{"path":["v1","contract","46ec035b-f965-4721-a668-646deb320f43"],"host":["{{base_url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"6fb3ba32-4227-4a71-a472-a86eb99c196a"}],"id":"3978b8e6-09ce-4d6f-8e5b-d36b089ab734","_postman_id":"3978b8e6-09ce-4d6f-8e5b-d36b089ab734","description":""},{"name":"Payments","item":[{"name":"add payment","event":[{"listen":"test","script":{"id":"eea79993-eae0-4235-b8f2-86573ce6b874","exec":["pm.test(\"Must return a valid body\", function() {","   pm.response.to.have.status(200);","   pm.response.to.be.withBody;","   pm.response.to.be.json;});","","","pm.test(\"Response time is less than 1000ms\", function () {","   pm.expect(pm.response.responseTime).to.be.below(1000);","});","","","var schema = {","   data : {","       type : \"object\",","       required:[\"paid_at\",\"created_at\",\"updated_ad\",\"uuid\",\"payment_method_id\",\"reference\",\"total\",\"currency\",\"invoices\"],","        properties : {","            paid_at :           {type: \"integer\"},","            created_at :        {type: \"integer\"},","            updated_ad :        {type: \"integer\"},","            uuid :              {type: \"string\" },","            payment_method_id : {type: \"string\" },","            reference :         {type: \"integer\"},","            total :             {type: \"integer\"},","            currency :          {type: \"string\" },","            invoices :          {type: \"array\"  },","        },","   }","};","","","pm.test(\"Valid JSON schema\", function() {","    pm.expect(tv4.validate(pm.response.json(),schema)).to.be.true;});","","","pm.test(\"Valid invoice data\", function() {","    pm.expect(pm.response.json().data.currency).to.equal(\"MXN\");","});","","","pm.test(\"Valid invoice data\", function() {","    pm.expect(pm.response.json().data.invoices.length).not.to.eql(0);","});","","pm.test(\"Response data format is correct\", function() { ","    var regEx = /^[0-9]{10}$/;","    var sum = ((pm.response.json().data.total)*1);","    pm.expect(pm.response.json().data.paid_at).to.match(regEx);","    pm.expect(pm.response.json().data.updated_at).to.match(regEx);","    pm.expect(pm.response.json().data.created_at).to.match(regEx);","    pm.expect(pm.response.json().data.total).to.equal(sum);","","});"],"type":"text/javascript"}}],"id":"ed67c4d1-a12c-44ce-90ef-9962b967e206","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Authorization","value":"{{access_token}}"},{"key":"Content-Type","name":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\n\t\"payment_method_id\": 3,\n\t\"paid_at\": 1676422102,\n\t\"currency\": \"MXN\",\n    \"currency_rate\": 1,\n    \"exchange_loss\": 0, \n    \"identifier\": \"Un ejemplo\",\n\t\"send_invoice\": false,\n\t\"receipt\": false,\n\t\"customer_id\": \"b4d317a6-4e65-4012-92eb-cf0b35cc6761\",\n\t\"invoices\": [\"21a0c5d7-2cd5-47b7-a5fb-4353387022ed\"],\n\t\"total\": [1000000]\n}"},"url":"https://api.porcobrar.com/v1/payment","description":"<p>Agrega el pago de una factura utilizando este endpoint.</p>\n","urlObject":{"protocol":"https","path":["v1","payment"],"host":["api","porcobrar","com"],"query":[],"variable":[]}},"response":[],"_postman_id":"ed67c4d1-a12c-44ce-90ef-9962b967e206"},{"name":"payment detail","event":[{"listen":"test","script":{"id":"aba88ddf-305e-4fa8-a7c2-f2a29c0ad4b6","exec":["pm.test(\"Status code is 200\", function () {","    pm.response.to.have.status(200);","});","","","pm.test(\"Must return a valid body\", function() {","   pm.response.to.have.status(200);","   pm.response.to.be.withBody;","   pm.response.to.be.json;});","   ","","pm.test(\"Response time is less than 1 s\", function () {","    pm.expect(pm.response.responseTime).to.be.below(1000);","});   ","","","var schema = {","   data : {","       type : \"object\",","       required:[\"paid_at\",\"created_at\",\"updated_ad\",\"uuid\",\"payment_method_id\",\"reference\",\"total\",\"currency\",\"invoices\"],","        properties : {","            paid_at :           {type: \"integer\"},","            created_at :        {type: \"integer\"},","            updated_ad :        {type: \"integer\"},","            uuid :              {type: \"string\"},","            payment_method_id : {type: \"integer\"},","            reference :         {type: \"integer\"},","            total :             {type: \"integer\"},","            currency :          {type: \"string\"},","            invoices :          {type: \"array\"},","        },","   }","};","","","pm.test(\"Valid JSON schema\", function() {","    pm.expect(tv4.validate(pm.response.json(),schema)).to.be.true;});","","","pm.test(\"Valid invoice data\", function() {","    pm.expect(pm.response.json().data.currency).to.equal(\"MXN\");","});","","","pm.test(\"Valid invoice data\", function() {","    pm.expect(pm.response.json().data.invoices.length).not.to.eql(0);","});",""],"type":"text/javascript"}}],"id":"f537fe19-e1d3-48d7-84fd-1fbcf23bcafe","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"Authorization","value":"{{access_token}}"},{"key":"Content-Type","value":"application/json"}],"url":"https://api.porcobrar.com/v1/payment/e1e62839-1e57-4bb3-a2e5-b82d99c66215","description":"<p>Regresa el detalle de un pago utilizando el ID.</p>\n","urlObject":{"protocol":"https","path":["v1","payment","e1e62839-1e57-4bb3-a2e5-b82d99c66215"],"host":["api","porcobrar","com"],"query":[],"variable":[]}},"response":[],"_postman_id":"f537fe19-e1d3-48d7-84fd-1fbcf23bcafe"},{"name":"get all payments","id":"5491847b-dacb-42c9-bb0b-0e976afe07d3","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"Authorization","value":"{{access_token}}","type":"text"}],"url":"https://api.porcobrar.com/v1/payment?page=1&customer=Exmaple&code=Z","description":"<p>Regresa la consulta de los pagos realizados.</p>\n","urlObject":{"protocol":"https","path":["v1","payment"],"host":["api","porcobrar","com"],"query":[{"key":"page","value":"1"},{"key":"customer","value":"Exmaple"},{"key":"code","value":"Z"},{"disabled":true,"key":"identifier","value":null}],"variable":[]}},"response":[],"_postman_id":"5491847b-dacb-42c9-bb0b-0e976afe07d3"},{"name":"delete payment","id":"85eca7df-c092-4b0b-8ccd-5c194143a74a","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"DELETE","header":[{"key":"Authorization","value":"{{access_token}}","type":"text"}],"body":{"mode":"formdata","formdata":[]},"url":"https://api.porcobrar.com/v1/payment/0b29c28e-34ff-400d-8f6b-cc5915a3f5a6","description":"<p>Nos permite eliminar el pago de una factura.</p>\n","urlObject":{"protocol":"https","path":["v1","payment","0b29c28e-34ff-400d-8f6b-cc5915a3f5a6"],"host":["api","porcobrar","com"],"query":[],"variable":[]}},"response":[],"_postman_id":"85eca7df-c092-4b0b-8ccd-5c194143a74a"}],"id":"0a16adb0-5a30-4879-be38-7754e9b791e9","_postman_id":"0a16adb0-5a30-4879-be38-7754e9b791e9","description":""},{"name":"Webhook","item":[{"name":"get Webhook","id":"7f3854e1-cde1-484d-80e1-311d48032cb0","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"Authorization","value":"{{access_token}}","type":"text"},{"key":"Content-Type","value":"application/json","type":"text"}],"url":"https://api.porcobrar.com/v1/webhook_endpoint/","urlObject":{"protocol":"https","path":["v1","webhook_endpoint",""],"host":["api","porcobrar","com"],"query":[],"variable":[]}},"response":[],"_postman_id":"7f3854e1-cde1-484d-80e1-311d48032cb0"},{"name":"Create webhook","id":"d50cf006-e52a-427b-8022-6a6439c1f72c","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Authorization","value":"{{access_token}}","type":"text"},{"key":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\r\n    \"url\":\"http://localhost:2019/webhook\"\r\n}","options":{"raw":{"language":"json"}}},"url":"https://api.porcobrar.com/v1/webhook_endpoint/","urlObject":{"protocol":"https","path":["v1","webhook_endpoint",""],"host":["api","porcobrar","com"],"query":[],"variable":[]}},"response":[],"_postman_id":"d50cf006-e52a-427b-8022-6a6439c1f72c"},{"name":"delete webhook","id":"7cdc393d-98de-4384-8a9e-01d4f2280c3a","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"DELETE","header":[{"key":"Authorization","value":"{{access_token}}","type":"text"},{"key":"Content-Type","value":"application/json","type":"text"}],"url":"https://api.porcobrar.com/v1/webhook_endpoint/904e51a7-548b-4705-8be7-31d2a5f98f6e","urlObject":{"protocol":"https","path":["v1","webhook_endpoint","904e51a7-548b-4705-8be7-31d2a5f98f6e"],"host":["api","porcobrar","com"],"query":[],"variable":[]}},"response":[],"_postman_id":"7cdc393d-98de-4384-8a9e-01d4f2280c3a"}],"id":"486dd9dd-497e-4cb6-9f20-ccd2d2ccd62d","_postman_id":"486dd9dd-497e-4cb6-9f20-ccd2d2ccd62d","description":""},{"name":"Currency","item":[{"name":"Fetch Currency","id":"f86fdf4d-e4ff-4e05-a6e1-81ee720a9e28","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"Authorization","value":"{{access_token}}","type":"text"},{"key":"Content-Type","value":"application/json","type":"text"}],"url":"{{base_url}}/v1/currency/rates?q=USD","urlObject":{"path":["v1","currency","rates"],"host":["{{base_url}}"],"query":[{"key":"q","value":"USD"}],"variable":[]}},"response":[],"_postman_id":"f86fdf4d-e4ff-4e05-a6e1-81ee720a9e28"},{"name":"Add Currency","id":"27b876f4-816c-4d4f-8d70-ed4af84aa52e","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Authorization","value":"{{access_token}}","type":"text"},{"key":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\r\n    \"description\": \"Dolares Estaods unidos\", \r\n    \"prefix\": \"USD\", \r\n    \"rate\": 21.07,\r\n    \"automatic\": 1,\r\n    \"principal\": 1\r\n}"},"url":"{{base_url}}/v1/currency","urlObject":{"path":["v1","currency"],"host":["{{base_url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"27b876f4-816c-4d4f-8d70-ed4af84aa52e"},{"name":"Update Currency","id":"399edd34-6dc8-4599-935f-89f8d9dcd850","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PUT","header":[{"key":"Authorization","value":"{{access_token}}","type":"text"},{"key":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\r\n    \"description\": \"Dolares Estaods unidos\", \r\n    \"prefix\": \"USD\", \r\n    \"rate\": 21.07,\r\n    \"automatic\": 1,\r\n    \"principal\": 1\r\n}"},"url":"{{base_url}}/v1/currency","urlObject":{"path":["v1","currency"],"host":["{{base_url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"399edd34-6dc8-4599-935f-89f8d9dcd850"},{"name":"Delete Currency","id":"d35b5904-8e45-4a2d-b1ee-74aa9fd2f52b","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"DELETE","header":[{"key":"Authorization","value":"{{access_token}}","type":"text"},{"key":"Content-Type","value":"application/json","type":"text"}],"url":"{{base_url}}/v1/currency/bc32adb0-4ff9-4385-80c4-4c36e06c364a","urlObject":{"path":["v1","currency","bc32adb0-4ff9-4385-80c4-4c36e06c364a"],"host":["{{base_url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"d35b5904-8e45-4a2d-b1ee-74aa9fd2f52b"},{"name":"Get Currency ","id":"4f2d8a5e-ce91-4220-8ee3-a8e3e275d15d","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"Authorization","value":"{{access_token}}","type":"text"},{"key":"Content-Type","value":"application/json","type":"text"}],"url":"{{base_url}}/v1/currency","urlObject":{"path":["v1","currency"],"host":["{{base_url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"4f2d8a5e-ce91-4220-8ee3-a8e3e275d15d"}],"id":"fff6bc2c-b015-47d9-b665-381ff502ff6e","_postman_id":"fff6bc2c-b015-47d9-b665-381ff502ff6e","description":""},{"name":"Import data","item":[{"name":"Import invoices","id":"3d4f90c8-7ac1-499a-8f46-2fb10603837a","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Authorization","type":"text","value":"{{access_token}}"}],"body":{"mode":"raw","raw":"[ \n  { \n    \"Nombre del cliente\": \"MAB 666 04\",\n    \"Razón Social\": \"MAB Sa de CV\",\n    \"Moneda\": \"MXN\",\n    \"Fecha de emisión\": \"2020/10/19\",\n    \"Fecha de vencimiento\": \"2020/11/03\",\n    \"Código de producto\": 50171800,\n    \"Código de unidad\": \"H87\",\n    \"Nombre del producto\": \"Item 1\",\n    \"Precio\": 52.62,\n    \"Cantidad\": 10,\n    \"Es retención\": \"No\",\n    \"Tasa de impuestos\": 0.16,\n    \"Código\": \"IVA\" \n  },\n  { \n    \"Nombre del cliente\": \"MAB2\",\n    \"Razón Social\": \"MAB2 SA de CV\",\n    \"RFC\": \"XEXX010101000\",\n    \"Correo\": \"mab2@mail.com\",\n    \"Teléfono\": \"5556581111\",\n    \"Términos de pago\": 21,\n    \"Identificador\": 1001,\n    \"Orden de compra\": \"PO 123\",\n    \"Notas\": \"NOta de venta 2\",\n    \"Comentarios\": \"Comentarios en PDF\",\n    \"Moneda\": \"USD\",\n    \"Tipo de cambio\": 20.43,\n    \"Fecha de emisión\": \"2020/10/26\",\n    \"Fecha de vencimiento\": \"2020/11/03\",\n    \"Código de producto\": 50171800,\n    \"Código de unidad\": \"H87\",\n    \"Nombre del producto\": \"Item 2.2\",\n    \"Descripción\": \"Esta es una descripción para el item 2\",\n    \"SKU\": \"sku\",\n    \"Descuento\": 0,\n    \"Precio\": 100,\n    \"Cantidad\": 5,\n    \"Es retención\": \"No\",\n    \"Tasa de impuestos\": 0.16,\n    \"Código\": \"IVA\" },\n  { \n    \"Nombre del cliente\": \"MAB 12\",\n    \"Razón Social\": \"MAB Sa de CV\",    \n    \"Términos de pago\": 7,\n    \"Moneda\": \"MXN\",\n    \"Fecha de emisión\": \"2020/10/27\",\n    \"Fecha de vencimiento\": \"2020/11/03\",\n    \"Código de producto\": 50171800,\n    \"Código de unidad\": \"H87\",   \n    \"Nombre del producto\": \"Item 3.2\",\n    \"Precio\": 152.62,\n    \"Cantidad\": 4,\n    \"Es retención\": \"No\",\n    \"Tasa de impuestos\": 0.16,\n    \"Código\": \"IVA\" \n  }\n]\n","options":{"raw":{"language":"json"}}},"url":"{{base_url}}/v1/import/invoice","urlObject":{"path":["v1","import","invoice"],"host":["{{base_url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"3d4f90c8-7ac1-499a-8f46-2fb10603837a"},{"name":"Import customers","id":"66c7bffb-0eec-4398-af3a-23ba5b1d49d4","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Authorization","type":"text","value":"{{access_token}}"}],"body":{"mode":"raw","raw":"[ \n  { \"Nombre del cliente\": \"MAB 666 07 test\",\n    \"Razón Social\": \"MAB 666 SAPI\",\n    \"RFC\": \"XAXX010101000\",\n    \"Correo\": \"mab.test@gmail.com\",\n    \"Teléfono\": 56581111,\n    \"Términos de pago\": 15,\n    \"Calle\": \"Avenida 1\",\n    \"No. ext\": \"131\",\n    \"No. int\": \"\",\n    \"C.P.\": \"03800\",\n    \"País\": \"México\",\n    \"Estado\": \"CDMX\",\n    \"Municipio/Alcaldía\": \"B.J.\",\n    \"Colonia\": \"San pedro de los pinos\"\n  },\n  { \n    \"Nombre del cliente\": \"MAB04\",\n    \"RFC\": \"XAXX010101000\",\n    \"Términos de pago\": 90 \n  },\n  { \"Nombre del cliente\": \"KRG04\",\n    \"Razón Social\": \"KRG SAPI\",\n    \"RFC\": \"XAXX010101000\",\n    \"Correo\": \"ksg.test@gmail.com\",\n    \"Teléfono\": 56581111,\n    \"Términos de pago\": 15\n  },\n  { \n    \"Razón Social\": \"Sin nombre\"\n  },\n  { \n    \"Nombre del cliente\": \"USER04\",    \n    \"Correo\": \"user01@mail.com\"\n  },\n  { \n    \"Razón Social\": \"no válido\"\n  }\n]","options":{"raw":{"language":"json"}}},"url":"{{base_url}}/v1/import/customer","urlObject":{"path":["v1","import","customer"],"host":["{{base_url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"66c7bffb-0eec-4398-af3a-23ba5b1d49d4"}],"id":"e503e652-0eb9-4889-a6fd-ffcc3150c0f3","_postman_id":"e503e652-0eb9-4889-a6fd-ffcc3150c0f3","description":""}],"event":[{"listen":"prerequest","script":{"id":"55743321-3835-4e7c-ad8e-7963fddc024a","type":"text/javascript","exec":[""]}},{"listen":"test","script":{"id":"198bd129-9173-400d-bcb1-3edc97a70f5a","type":"text/javascript","exec":[""]}}]}