@silexpert/core 1.1.92 → 1.1.95

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.
Files changed (48) hide show
  1. package/es/api/resources/Stripe.d.ts +3 -1
  2. package/es/api/resources/Stripe.d.ts.map +1 -1
  3. package/es/api/resources/Stripe.js +8 -2
  4. package/es/api/resources/Stripe.js.map +1 -1
  5. package/es/types/Enum/Account.d.ts +12 -0
  6. package/es/types/Enum/Account.d.ts.map +1 -1
  7. package/es/types/Enum/Account.js +12 -0
  8. package/es/types/Enum/Account.js.map +1 -1
  9. package/es/types/Enum/ConnectorType.d.ts +2 -1
  10. package/es/types/Enum/ConnectorType.d.ts.map +1 -1
  11. package/es/types/Enum/ConnectorType.js +1 -0
  12. package/es/types/Enum/ConnectorType.js.map +1 -1
  13. package/es/types/Enum/Currency.d.ts +11 -1
  14. package/es/types/Enum/Currency.d.ts.map +1 -1
  15. package/es/types/Enum/Currency.js +10 -0
  16. package/es/types/Enum/Currency.js.map +1 -1
  17. package/es/types/Enum/TypeBankConnection.d.ts +1 -0
  18. package/es/types/Enum/TypeBankConnection.d.ts.map +1 -1
  19. package/es/types/Enum/TypeBankConnection.js +1 -0
  20. package/es/types/Enum/TypeBankConnection.js.map +1 -1
  21. package/es/types/Interface/models/IApiError.d.ts +1 -0
  22. package/es/types/Interface/models/IApiError.d.ts.map +1 -1
  23. package/es/types/Interface/models/IApiError.js +2 -0
  24. package/es/types/Interface/models/IApiError.js.map +1 -1
  25. package/es/utils/vat/3310/century23.js +18 -18
  26. package/es/utils/vat/3310/century23.js.map +1 -1
  27. package/js/api/resources/Stripe.js +10 -2
  28. package/js/api/resources/Stripe.js.map +1 -1
  29. package/js/types/Enum/Account.js +12 -0
  30. package/js/types/Enum/Account.js.map +1 -1
  31. package/js/types/Enum/ConnectorType.js +1 -0
  32. package/js/types/Enum/ConnectorType.js.map +1 -1
  33. package/js/types/Enum/Currency.js +10 -0
  34. package/js/types/Enum/Currency.js.map +1 -1
  35. package/js/types/Enum/TypeBankConnection.js +1 -0
  36. package/js/types/Enum/TypeBankConnection.js.map +1 -1
  37. package/js/types/Interface/models/IApiError.js +2 -0
  38. package/js/types/Interface/models/IApiError.js.map +1 -1
  39. package/js/utils/vat/3310/century23.js +18 -18
  40. package/js/utils/vat/3310/century23.js.map +1 -1
  41. package/package.json +1 -1
  42. package/ts/api/resources/Stripe.ts +10 -2
  43. package/ts/types/Enum/Account.ts +13 -0
  44. package/ts/types/Enum/ConnectorType.ts +1 -0
  45. package/ts/types/Enum/Currency.ts +10 -0
  46. package/ts/types/Enum/TypeBankConnection.ts +1 -0
  47. package/ts/types/Interface/models/IApiError.ts +3 -0
  48. package/ts/utils/vat/3310/century23.ts +18 -18
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@silexpert/core",
3
- "version": "1.1.92",
3
+ "version": "1.1.95",
4
4
  "description": "Silex Core perform HTTP Request and object binding. Silex core helps developers to retrieve and return formatted object",
5
5
  "homepage": "https://gitlab.compta-clementine.fr/dev/silex-api",
6
6
  "main": "js/index.js",
@@ -2,7 +2,15 @@ import { Resource } from '../Resource';
2
2
  import { IConnector } from '../../types';
3
3
 
4
4
  export class Stripe extends Resource {
5
- connect(code: string): Promise<IConnector> {
6
- return this.axios.$post('/stripe/connect', { code });
5
+ connect(code: string, idSociety: number): Promise<IConnector> {
6
+ return this.axios.$post(`/stripe/${idSociety}/connect`, { code });
7
+ }
8
+
9
+ connectBank(code: string, idSociety: number): Promise<number> {
10
+ return this.axios.$post(`/stripe/${idSociety}/banks`, { code });
11
+ }
12
+
13
+ importForSociety(idSociety: number): Promise<number> {
14
+ return this.axios.$post(`/stripe/${idSociety}/importation`);
7
15
  }
8
16
  }
@@ -87,6 +87,11 @@ export const Account = {
87
87
  id: 110,
88
88
  number: 623400,
89
89
  },
90
+ VAT_COLLECTED_20_PERCENT: {
91
+ id: 211,
92
+ number: 445720,
93
+ },
94
+
90
95
  INCOME: {
91
96
  id: 213,
92
97
  number: 706100,
@@ -95,6 +100,10 @@ export const Account = {
95
100
  id: 214,
96
101
  number: 707100,
97
102
  },
103
+ INTERNAL_TRANSFER: {
104
+ id: 215,
105
+ number: 581100,
106
+ },
98
107
  CASH_WITHDRAWAL: {
99
108
  id: 205,
100
109
  number: 580000,
@@ -103,4 +112,8 @@ export const Account = {
103
112
  id: 206,
104
113
  number: 580000,
105
114
  },
115
+ VAT_DEDUCTIBLE_20_PERCENT: {
116
+ id: 6,
117
+ number: 445660,
118
+ },
106
119
  };
@@ -10,4 +10,5 @@ export enum ConnectorType {
10
10
  SHOPIFY = 9,
11
11
  WOOCOMMERCE = 10,
12
12
  ACTIVATION = 11,
13
+ STRIPE_BANK = 12,
13
14
  }
@@ -1,3 +1,13 @@
1
1
  export enum Currency {
2
2
  EUR = 1,
3
+ USD = 2,
4
+ JPY = 3,
5
+ GBP = 4,
6
+ CHF = 5,
7
+ HUF = 6,
8
+ CAD = 7,
9
+ ILS = 8,
10
+ AUD = 9,
11
+ CNY = 10,
12
+ PLN = 11,
3
13
  }
@@ -2,5 +2,6 @@ export enum TypeBankConnection {
2
2
  BUDGET_CONNECTION = 'Budget',
3
3
  QONTO_CONNECTION = 'Qonto',
4
4
  SHINE_CONNECTION = 'Shine',
5
+ STRIPE_CONNECTION = 'Stripe',
5
6
  JEDECLARE = 'JeDeclare',
6
7
  }
@@ -153,6 +153,9 @@ export enum Code {
153
153
  // qonto
154
154
  CONNECTION_ALREADY_EXISTS = 'CONNECTION_ALREADY_EXISTS',
155
155
 
156
+ // Stripe
157
+ bankConnectionAlreadyExist = 'bank_connection_already_exist',
158
+
156
159
  // Accounts
157
160
  GENERIC_ACCOUNT_NOT_FOUND = 'GENERIC_ACCOUNT_NOT_FOUND',
158
161
 
@@ -49,8 +49,8 @@ export function getCerfa3310Century23Payload(accountingEntries: IAccountingEntry
49
49
  // Opérations taxées -
50
50
  const taxedServicesEntries = vatEntries.filter((ae) => frenchVat.includes(ae.idVat) && withTaxVat.includes(ae.idVat));
51
51
  const servicesAccounts = ['701', '702', '703', '704', '705', '706', '707', '708', '472'];
52
- const taxedServicesFromFrance = setZeroIfIsNegative(getAmountByAccountNumber(taxedServicesEntries, servicesAccounts, 0, true));
53
- const taxedOther = setZeroIfIsNegative(getAmountByAccountNumber(vatEntries.filter((ae) => withTaxVat.includes(ae.idVat)), ['775'], 0, true));
52
+ const taxedServicesFromFrance = setZeroIfIsNegative(getAmountByAccountNumber(taxedServicesEntries, servicesAccounts, 0));
53
+ const taxedOther = setZeroIfIsNegative(getAmountByAccountNumber(vatEntries.filter((ae) => withTaxVat.includes(ae.idVat)), ['775'], 0));
54
54
  const intracommunityServiceAccounts = ['604', '611', '612', '613', '614', '615', '616', '617', '618', '619', '62'];
55
55
  const intracommunityServiceEntries = vatEntries.filter((ae) => withTaxVat.includes(ae.idVat) && intracomVat.includes(ae.idVat));
56
56
 
@@ -59,50 +59,50 @@ export function getCerfa3310Century23Payload(accountingEntries: IAccountingEntry
59
59
 
60
60
  const taxedImportEntries = vatEntries.filter((ae) => importationVat.includes(ae.idVat) && withTaxVat.includes(ae.idVat));
61
61
  const taxedImportAccounts = ['6'];
62
- const taxedImport = setZeroIfIsNegative(getAmountByAccountNumber(taxedImportEntries, taxedImportAccounts, 0, true));
62
+ const taxedImport = setZeroIfIsNegative(getAmountByAccountNumber(taxedImportEntries, taxedImportAccounts, 0));
63
63
 
64
64
  const intracommunityAccounts2 = ['601', '602', '603', '605', '606', '607', '651'];
65
65
  const taxedIntracommunityAcquisitions = getAmountByAccountNumber(vatEntries.filter((ae) => intracomVat.includes(ae.idVat) && withTaxVat.includes(ae.idVat)), [...intracommunityAccounts2, ...intracommunityServiceAccounts], 0, true);
66
66
 
67
67
  // Opérations non taxées
68
- const untaxedExportationNotInEurope = setZeroIfIsNegative(getAmountByAccountNumber(vatEntries.filter((ae) => importationVat.includes(ae.idVat) && withoutTaxVat.includes(ae.idVat)), servicesAccounts, 0, true));
68
+ const untaxedExportationNotInEurope = setZeroIfIsNegative(getAmountByAccountNumber(vatEntries.filter((ae) => importationVat.includes(ae.idVat) && withoutTaxVat.includes(ae.idVat)), servicesAccounts, 0));
69
69
  const untaxedOther = setZeroIfIsNegative(getAmountByAccountNumber(vatEntries.filter((ae) => frenchVat.includes(ae.idVat) && withoutTaxVat.includes(ae.idVat)), ['70', '71', '72', '73', '75', '77', '78', '790', '792', '793', '794', '795', '796', '797', '798', '799'], 0, true)); // 02/08/23 - ne plus prendre en compte les comptes 76,74,791 - Chloé R.
70
- const untaxedImport = setZeroIfIsNegative(getAmountByAccountNumber(vatEntries.filter((ae) => importationVat.includes(ae.idVat) && withoutTaxVat.includes(ae.idVat)), ['6'], 0, true));
71
- const untaxedIntracomunity = setZeroIfIsNegative(getAmountByAccountNumber(vatEntries.filter((ae) => intracomVat.includes(ae.idVat) && withoutTaxVat.includes(ae.idVat)), intracommunityAccounts2, 0, true));
72
- const untaxedIntracommunityDelivery = setZeroIfIsNegative(getAmountByAccountNumber(vatEntries.filter((ae) => withoutTaxVat.includes(ae.idVat) && intracomVat.includes(ae.idVat)), ['701', '707'], 0, true));
70
+ const untaxedImport = setZeroIfIsNegative(getAmountByAccountNumber(vatEntries.filter((ae) => importationVat.includes(ae.idVat) && withoutTaxVat.includes(ae.idVat)), ['6'], 0));
71
+ const untaxedIntracomunity = setZeroIfIsNegative(getAmountByAccountNumber(vatEntries.filter((ae) => intracomVat.includes(ae.idVat) && withoutTaxVat.includes(ae.idVat)), intracommunityAccounts2, 0));
72
+ const untaxedIntracommunityDelivery = setZeroIfIsNegative(getAmountByAccountNumber(vatEntries.filter((ae) => withoutTaxVat.includes(ae.idVat) && intracomVat.includes(ae.idVat)), ['701', '707'], 0));
73
73
  // TVA brute
74
- const normalRate = setZeroIfIsNegative(getAmountByAccountNumber(taxedServicesEntries.filter((e) => vats.filter((v) => v.value === 20).map((v) => v.id).includes(e.idVat)), servicesAccounts, 0, true)
74
+ const normalRate = setZeroIfIsNegative(getAmountByAccountNumber(taxedServicesEntries.filter((e) => vats.filter((v) => v.value === 20).map((v) => v.id).includes(e.idVat)), servicesAccounts, 0)
75
75
  + getAmountByAccountNumber(intracommunityServiceEntries.filter((e) => vats.filter((v) => v.value === 20).map((v) => v.id).includes(e.idVat)), ['6'], 0, true));
76
76
 
77
77
  const normalRateTax = _round(normalRate * 0.2);
78
78
 
79
- const reducedRate5Dot5 = setZeroIfIsNegative(getAmountByAccountNumber(taxedServicesEntries.filter((e) => vats.filter((v) => v.value === 5.5).map((v) => v.id).includes(e.idVat)), servicesAccounts, 0, true)
79
+ const reducedRate5Dot5 = setZeroIfIsNegative(getAmountByAccountNumber(taxedServicesEntries.filter((e) => vats.filter((v) => v.value === 5.5).map((v) => v.id).includes(e.idVat)), servicesAccounts, 0)
80
80
  + getAmountByAccountNumber(intracommunityServiceEntries.filter((e) => vats.filter((v) => v.value === 5.5).map((v) => v.id).includes(e.idVat)), ['6'], 0, true));
81
81
  const reducedRate5Dot5Tax = _round(reducedRate5Dot5 * 0.055);
82
82
 
83
- const reducedRate10 = setZeroIfIsNegative(getAmountByAccountNumber(taxedServicesEntries.filter((e) => vats.filter((v) => v.value === 10).map((v) => v.id).includes(e.idVat)), servicesAccounts, 0, true)
83
+ const reducedRate10 = setZeroIfIsNegative(getAmountByAccountNumber(taxedServicesEntries.filter((e) => vats.filter((v) => v.value === 10).map((v) => v.id).includes(e.idVat)), servicesAccounts, 0)
84
84
  + getAmountByAccountNumber(intracommunityServiceEntries.filter((e) => vats.filter((v) => v.value === 10).map((v) => v.id).includes(e.idVat)), ['6'], 0, true));
85
85
  const reducedRate10Tax = _round(reducedRate10 * 0.1);
86
86
 
87
- const reducedRate8Dot5 = setZeroIfIsNegative(getAmountByAccountNumber(taxedServicesEntries.filter((e) => vats.filter((v) => v.value === 8.5).map((v) => v.id).includes(e.idVat)), servicesAccounts, 0, true)
87
+ const reducedRate8Dot5 = setZeroIfIsNegative(getAmountByAccountNumber(taxedServicesEntries.filter((e) => vats.filter((v) => v.value === 8.5).map((v) => v.id).includes(e.idVat)), servicesAccounts, 0)
88
88
  + getAmountByAccountNumber(intracommunityServiceEntries.filter((e) => vats.filter((v) => v.value === 8.5).map((v) => v.id).includes(e.idVat)), ['6'], 0, true));
89
89
  const reducedRate8Dot5Tax = _round(reducedRate8Dot5 * 0.085);
90
90
 
91
- const reducedRate2Dot1 = setZeroIfIsNegative(getAmountByAccountNumber(taxedServicesEntries.filter((e) => vats.filter((v) => v.value === 2.1).map((v) => v.id).includes(e.idVat)), servicesAccounts, 0, true)
91
+ const reducedRate2Dot1 = setZeroIfIsNegative(getAmountByAccountNumber(taxedServicesEntries.filter((e) => vats.filter((v) => v.value === 2.1).map((v) => v.id).includes(e.idVat)), servicesAccounts, 0)
92
92
  + getAmountByAccountNumber(intracommunityServiceEntries.filter((e) => vats.filter((v) => v.value === 2.1).map((v) => v.id).includes(e.idVat)), ['6'], 0, true));
93
93
  const reducedRate2Dot1Tax = _round(reducedRate2Dot1 * 0.021);
94
94
 
95
- const importNormalRate = setZeroIfIsNegative(getAmountByAccountNumber(taxedImportEntries.filter((e) => vats.filter((v) => v.value === 20).map((v) => v.id).includes(e.idVat)), taxedImportAccounts, 0, true));
95
+ const importNormalRate = setZeroIfIsNegative(getAmountByAccountNumber(taxedImportEntries.filter((e) => vats.filter((v) => v.value === 20).map((v) => v.id).includes(e.idVat)), taxedImportAccounts, 0));
96
96
  const importNormalRateTax = _round(importNormalRate * 0.2);
97
- const importReducedRate10 = setZeroIfIsNegative(getAmountByAccountNumber(taxedImportEntries.filter((e) => vats.filter((v) => v.value === 10).map((v) => v.id).includes(e.idVat)), taxedImportAccounts, 0, true));
97
+ const importReducedRate10 = setZeroIfIsNegative(getAmountByAccountNumber(taxedImportEntries.filter((e) => vats.filter((v) => v.value === 10).map((v) => v.id).includes(e.idVat)), taxedImportAccounts, 0));
98
98
  const importReducedRate10Tax = _round(importReducedRate10 * 0.1);
99
- const importReducedRate8Dot5 = setZeroIfIsNegative(getAmountByAccountNumber(taxedImportEntries.filter((e) => vats.filter((v) => v.value === 8.5).map((v) => v.id).includes(e.idVat)), taxedImportAccounts, 0, true));
99
+ const importReducedRate8Dot5 = setZeroIfIsNegative(getAmountByAccountNumber(taxedImportEntries.filter((e) => vats.filter((v) => v.value === 8.5).map((v) => v.id).includes(e.idVat)), taxedImportAccounts, 0));
100
100
  const importReducedRate8Dot5Tax = _round(importReducedRate8Dot5 * 0.085);
101
- const importReducedRate5Dot5 = setZeroIfIsNegative(getAmountByAccountNumber(taxedImportEntries.filter((e) => vats.filter((v) => v.value === 5.5).map((v) => v.id).includes(e.idVat)), taxedImportAccounts, 0, true));
101
+ const importReducedRate5Dot5 = setZeroIfIsNegative(getAmountByAccountNumber(taxedImportEntries.filter((e) => vats.filter((v) => v.value === 5.5).map((v) => v.id).includes(e.idVat)), taxedImportAccounts, 0));
102
102
  const importReducedRate5Dot5Tax = _round(importReducedRate8Dot5 * 0.055);
103
- const importReducedRate2Dot1 = setZeroIfIsNegative(getAmountByAccountNumber(taxedImportEntries.filter((e) => vats.filter((v) => v.value === 2.1).map((v) => v.id).includes(e.idVat)), taxedImportAccounts, 0, true));
103
+ const importReducedRate2Dot1 = setZeroIfIsNegative(getAmountByAccountNumber(taxedImportEntries.filter((e) => vats.filter((v) => v.value === 2.1).map((v) => v.id).includes(e.idVat)), taxedImportAccounts, 0));
104
104
  const importReducedRate2Dot1Tax = _round(importReducedRate2Dot1 * 0.021);
105
- const importReducedRate1Dot05 = setZeroIfIsNegative(getAmountByAccountNumber(taxedImportEntries.filter((e) => vats.filter((v) => v.value === 1.05).map((v) => v.id).includes(e.idVat)), taxedImportAccounts, 0, true));
105
+ const importReducedRate1Dot05 = setZeroIfIsNegative(getAmountByAccountNumber(taxedImportEntries.filter((e) => vats.filter((v) => v.value === 1.05).map((v) => v.id).includes(e.idVat)), taxedImportAccounts, 0));
106
106
  const importReducedRate1Dot05Tax = _round(importReducedRate1Dot05 * 0.0105);
107
107
  const intracommunityTax = setZeroIfIsNegative(getTaxAmountByAccountNumber(intracommunityServiceEntries, [...intracommunityServiceAccounts, ...intracommunityAccounts2], 0));
108
108