Skip to content

Commit da04a95

Browse files
authored
Merge pull request #63 from FacturAPI/feature/customer-edit-links
Add support for customer edit links
2 parents 452c003 + a230af0 commit da04a95

File tree

6 files changed

+67
-6
lines changed

6 files changed

+67
-6
lines changed

.github/workflows/deploy.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Deploy to npm
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
deploy:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v2
15+
16+
- name: Set up Node.js
17+
uses: actions/setup-node@v2
18+
with:
19+
node-version: '20'
20+
registry-url: 'https://registry.npmjs.org/'
21+
22+
- name: Install dependencies
23+
run: npm install
24+
25+
- name: Build project
26+
run: npm run build
27+
28+
- name: Check if version exists
29+
id: check-version
30+
run: |
31+
if npm view $(node -p "require('./package.json').name")@$(node -p "require('./package.json').version") > /dev/null 2>&1; then
32+
echo "::set-output name=exists::true"
33+
else
34+
echo "::set-output name=exists::false"
35+
fi
36+
37+
- name: Publish to npm
38+
if: steps.check-version.outputs.exists == 'false'
39+
run: npm publish
40+
env:
41+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
66
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
77

8+
## [4.6.0] 2025-02-25
9+
10+
### Added
11+
12+
- Allow creating edit links for customers, passing query params to create and edit customer methods.
13+
- Edit link properties for customers.
14+
815
## [4.5.0] 2025-01-07
916

1017
### Added

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "facturapi",
3-
"version": "4.5.1",
3+
"version": "4.6.0",
44
"description": "Librería oficial de Facturapi. Crea CFDIs timbrados y enviados al SAT, XML y PDF",
55
"main": "dist/index.cjs.js",
66
"module": "dist/index.es.js",

src/resources/customers.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,14 @@ export default class Customers {
1010
/**
1111
* Creates a new customer in your organization
1212
* @param data Customer data
13+
* @param params Query params
1314
* @returns Customer object
1415
*/
15-
create(data: Record<string, any>): Promise<Customer> {
16-
return this.client.post('/customers', { body: data });
16+
create(
17+
data: Record<string, any>,
18+
params: Record<string, any> | null = null,
19+
): Promise<Customer> {
20+
return this.client.post('/customers', { body: data, params });
1721
}
1822

1923
/**
@@ -40,10 +44,15 @@ export default class Customers {
4044
* Updates a customer
4145
* @param id Customer Id
4246
* @param data Customer data to update
47+
* @param params Query params
4348
* @returns Updated customer
4449
*/
45-
update(id: string, data: Record<string, any>): Promise<Customer> {
46-
return this.client.put('/customers/' + id, { body: data });
50+
update(
51+
id: string,
52+
data: Record<string, any>,
53+
params: Record<string, any> | null = null,
54+
): Promise<Customer> {
55+
return this.client.put('/customers/' + id, { body: data, params });
4756
}
4857

4958
/**

src/resources/invoices.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export default class Invoices {
1717
/**
1818
* Creates a new valid invoice (CFDI).
1919
* @param body Invoice data
20+
* @param params Query params
2021
* @returns Invoice object
2122
*/
2223
create(
@@ -129,7 +130,7 @@ export default class Invoices {
129130
/**
130131
* Stamps an invoice with "draft" status.
131132
* @param id Invoice Id
132-
* @param options Query options
133+
* @param params Query params
133134
* @returns Stamped invoice
134135
*/
135136
stampDraft(

src/types/customer.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,7 @@ export interface Customer {
2525
address: Address;
2626
external_id?: string;
2727
default_invoice_use?: InvoiceUse;
28+
sat_validated_at?: Date;
29+
edit_link?: string;
30+
edit_link_expires_at?: Date;
2831
}

0 commit comments

Comments
 (0)