@infrab4a/connect 5.1.0-beta.12 → 5.1.0-beta.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs.js CHANGED
@@ -9209,43 +9209,49 @@ class PagarmeV5CardAxiosAdapter {
9209
9209
  // return data
9210
9210
  // }
9211
9211
  async createOrUpdateCustomer(customer) {
9212
- const { data } = await axios__default["default"]({
9213
- method: 'POST',
9214
- url: `${this.credentials.URL}/customers`,
9215
- headers: {
9216
- Authorization: 'Basic ' + Buffer.from(`${this.credentials.API_KEY}:`).toString('base64'),
9217
- 'Content-Type': 'application/json',
9218
- },
9219
- data: {
9220
- name: customer.displayName,
9221
- email: customer.email,
9222
- document: customer.cpf,
9223
- type: 'individual',
9224
- document_type: 'CPF',
9225
- address: {
9226
- line_1: `${customer.billindAddress.number}, ${customer.billindAddress.street}, ${customer.billindAddress.district}`,
9227
- line_2: `${customer.billindAddress.extension}`,
9228
- zip_code: customer.billindAddress.zip,
9229
- city: customer.billindAddress.city,
9230
- state: customer.billindAddress.state,
9231
- country: 'BR',
9212
+ try {
9213
+ const { data } = await axios__default["default"]({
9214
+ method: 'POST',
9215
+ url: `${this.credentials.URL}/customers`,
9216
+ headers: {
9217
+ Authorization: 'Basic ' + Buffer.from(`${this.credentials.API_KEY}:`).toString('base64'),
9218
+ 'Content-Type': 'application/json',
9232
9219
  },
9233
- birthdate: dateFns.format(customer.birthday, 'mm/dd/AAAA'),
9234
- phones: {
9235
- home_phone: {
9236
- country_code: '55',
9237
- number: customer.phone.slice(2),
9238
- area_code: customer.phone.slice(0, 2),
9220
+ data: {
9221
+ name: customer.displayName,
9222
+ email: customer.email,
9223
+ document: customer.cpf,
9224
+ type: 'individual',
9225
+ document_type: 'CPF',
9226
+ address: {
9227
+ line_1: `${customer.billindAddress.number}, ${customer.billindAddress.street}, ${customer.billindAddress.district}`,
9228
+ line_2: `${customer.billindAddress.extension}`,
9229
+ zip_code: customer.billindAddress.zip,
9230
+ city: customer.billindAddress.city,
9231
+ state: customer.billindAddress.state,
9232
+ country: 'BR',
9239
9233
  },
9240
- mobile_phone: {
9241
- country_code: '55',
9242
- number: customer.phone.slice(2),
9243
- area_code: customer.phone.slice(0, 2),
9234
+ birthdate: dateFns.format(customer.birthday, 'MM/dd/yyyy'),
9235
+ phones: {
9236
+ home_phone: {
9237
+ country_code: '55',
9238
+ number: customer.phone.slice(2),
9239
+ area_code: customer.phone.slice(0, 2),
9240
+ },
9241
+ mobile_phone: {
9242
+ country_code: '55',
9243
+ number: customer.phone.slice(2),
9244
+ area_code: customer.phone.slice(0, 2),
9245
+ },
9244
9246
  },
9245
9247
  },
9246
- },
9247
- });
9248
- return data;
9248
+ });
9249
+ return data;
9250
+ }
9251
+ catch (error) {
9252
+ console.warn(error);
9253
+ throw error;
9254
+ }
9249
9255
  }
9250
9256
  }
9251
9257
 
package/index.esm.js CHANGED
@@ -9184,43 +9184,49 @@ class PagarmeV5CardAxiosAdapter {
9184
9184
  // return data
9185
9185
  // }
9186
9186
  async createOrUpdateCustomer(customer) {
9187
- const { data } = await axios({
9188
- method: 'POST',
9189
- url: `${this.credentials.URL}/customers`,
9190
- headers: {
9191
- Authorization: 'Basic ' + Buffer.from(`${this.credentials.API_KEY}:`).toString('base64'),
9192
- 'Content-Type': 'application/json',
9193
- },
9194
- data: {
9195
- name: customer.displayName,
9196
- email: customer.email,
9197
- document: customer.cpf,
9198
- type: 'individual',
9199
- document_type: 'CPF',
9200
- address: {
9201
- line_1: `${customer.billindAddress.number}, ${customer.billindAddress.street}, ${customer.billindAddress.district}`,
9202
- line_2: `${customer.billindAddress.extension}`,
9203
- zip_code: customer.billindAddress.zip,
9204
- city: customer.billindAddress.city,
9205
- state: customer.billindAddress.state,
9206
- country: 'BR',
9187
+ try {
9188
+ const { data } = await axios({
9189
+ method: 'POST',
9190
+ url: `${this.credentials.URL}/customers`,
9191
+ headers: {
9192
+ Authorization: 'Basic ' + Buffer.from(`${this.credentials.API_KEY}:`).toString('base64'),
9193
+ 'Content-Type': 'application/json',
9207
9194
  },
9208
- birthdate: format(customer.birthday, 'mm/dd/AAAA'),
9209
- phones: {
9210
- home_phone: {
9211
- country_code: '55',
9212
- number: customer.phone.slice(2),
9213
- area_code: customer.phone.slice(0, 2),
9195
+ data: {
9196
+ name: customer.displayName,
9197
+ email: customer.email,
9198
+ document: customer.cpf,
9199
+ type: 'individual',
9200
+ document_type: 'CPF',
9201
+ address: {
9202
+ line_1: `${customer.billindAddress.number}, ${customer.billindAddress.street}, ${customer.billindAddress.district}`,
9203
+ line_2: `${customer.billindAddress.extension}`,
9204
+ zip_code: customer.billindAddress.zip,
9205
+ city: customer.billindAddress.city,
9206
+ state: customer.billindAddress.state,
9207
+ country: 'BR',
9214
9208
  },
9215
- mobile_phone: {
9216
- country_code: '55',
9217
- number: customer.phone.slice(2),
9218
- area_code: customer.phone.slice(0, 2),
9209
+ birthdate: format(customer.birthday, 'MM/dd/yyyy'),
9210
+ phones: {
9211
+ home_phone: {
9212
+ country_code: '55',
9213
+ number: customer.phone.slice(2),
9214
+ area_code: customer.phone.slice(0, 2),
9215
+ },
9216
+ mobile_phone: {
9217
+ country_code: '55',
9218
+ number: customer.phone.slice(2),
9219
+ area_code: customer.phone.slice(0, 2),
9220
+ },
9219
9221
  },
9220
9222
  },
9221
- },
9222
- });
9223
- return data;
9223
+ });
9224
+ return data;
9225
+ }
9226
+ catch (error) {
9227
+ console.warn(error);
9228
+ throw error;
9229
+ }
9224
9230
  }
9225
9231
  }
9226
9232
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infrab4a/connect",
3
- "version": "5.1.0-beta.12",
3
+ "version": "5.1.0-beta.13",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org"
6
6
  },
@@ -15,4 +15,7 @@ export interface PaymentProviderCard<Card extends BaseCard = BaseCard> {
15
15
  getCardByToken(customerId: string, token: string): Promise<Card>;
16
16
  createCardHash<T>(bu: BusinessUnitEnum, shop: Shops, card?: CardInfo): Promise<string | T>;
17
17
  createTransaction(info: any): Promise<PaymentTransaction>;
18
+ createOrUpdateCustomer(customer: User & {
19
+ billindAddress: Partial<UserAddress>;
20
+ }): any;
18
21
  }