@vqnguyen1/piece-fis-ibs 0.0.4 → 0.0.5

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 (36) hide show
  1. package/package.json +2 -2
  2. package/project.json +22 -0
  3. package/src/index.ts +320 -0
  4. package/src/lib/actions/bank-control.ts +378 -0
  5. package/src/lib/actions/customer.ts +1574 -0
  6. package/src/lib/actions/deposit.ts +749 -0
  7. package/src/lib/actions/get-customer.ts +73 -0
  8. package/src/lib/actions/loan.ts +925 -0
  9. package/src/lib/actions/search-customers.ts +143 -0
  10. package/src/lib/actions/security.ts +170 -0
  11. package/tsconfig.json +19 -0
  12. package/tsconfig.lib.json +10 -0
  13. package/src/index.d.ts +0 -16
  14. package/src/index.js +0 -204
  15. package/src/index.js.map +0 -1
  16. package/src/lib/actions/bank-control.d.ts +0 -110
  17. package/src/lib/actions/bank-control.js +0 -371
  18. package/src/lib/actions/bank-control.js.map +0 -1
  19. package/src/lib/actions/customer.d.ts +0 -888
  20. package/src/lib/actions/customer.js +0 -1563
  21. package/src/lib/actions/customer.js.map +0 -1
  22. package/src/lib/actions/deposit.d.ts +0 -406
  23. package/src/lib/actions/deposit.js +0 -739
  24. package/src/lib/actions/deposit.js.map +0 -1
  25. package/src/lib/actions/get-customer.d.ts +0 -12
  26. package/src/lib/actions/get-customer.js +0 -69
  27. package/src/lib/actions/get-customer.js.map +0 -1
  28. package/src/lib/actions/loan.d.ts +0 -506
  29. package/src/lib/actions/loan.js +0 -910
  30. package/src/lib/actions/loan.js.map +0 -1
  31. package/src/lib/actions/search-customers.d.ts +0 -17
  32. package/src/lib/actions/search-customers.js +0 -127
  33. package/src/lib/actions/search-customers.js.map +0 -1
  34. package/src/lib/actions/security.d.ts +0 -38
  35. package/src/lib/actions/security.js +0 -173
  36. package/src/lib/actions/security.js.map +0 -1
@@ -0,0 +1,73 @@
1
+ import {
2
+ createAction,
3
+ Property,
4
+ } from '@activepieces/pieces-framework';
5
+ import { httpClient, HttpMethod } from '@activepieces/pieces-common';
6
+ import { fisIbsAuth } from '../..';
7
+
8
+ export const getCustomer = createAction({
9
+ name: 'customer_get',
10
+ auth: fisIbsAuth,
11
+ displayName: 'Customer - Get',
12
+ description: 'Retrieve customer information by customer number.',
13
+ props: {
14
+ customerNumber: Property.ShortText({
15
+ displayName: 'Customer Number',
16
+ description: 'The customer number to retrieve',
17
+ required: true,
18
+ }),
19
+ effectiveUserId: Property.ShortText({
20
+ displayName: 'Effective User ID',
21
+ description: 'Optional: User ID for audit purposes',
22
+ required: false,
23
+ }),
24
+ safIndicator: Property.StaticDropdown({
25
+ displayName: 'SAF Indicator',
26
+ description: 'Store and forward indicator',
27
+ required: false,
28
+ options: {
29
+ options: [
30
+ { label: 'Yes', value: 'Y' },
31
+ { label: 'No', value: 'N' },
32
+ ],
33
+ },
34
+ }),
35
+ },
36
+ async run(context) {
37
+ const auth = context.auth as any;
38
+ const baseUrl = auth.baseUrl;
39
+ const { customerNumber, effectiveUserId, safIndicator } = context.propsValue;
40
+
41
+ const uuid = crypto.randomUUID();
42
+
43
+ const headers: Record<string, string> = {
44
+ 'accept': 'application/json',
45
+ 'Content-Type': 'application/json',
46
+ 'organization-id': auth.organizationId,
47
+ 'source-id': auth.sourceId,
48
+ 'application-id': auth.applicationId,
49
+ 'uuid': uuid,
50
+ 'ibs-authorization': auth.ibsAuthorization,
51
+ };
52
+
53
+ if (auth.securityTokenType) {
54
+ headers['security-token-type'] = auth.securityTokenType;
55
+ }
56
+
57
+ if (effectiveUserId) {
58
+ headers['effective-user-id'] = effectiveUserId;
59
+ }
60
+
61
+ if (safIndicator) {
62
+ headers['saf-indicator'] = safIndicator;
63
+ }
64
+
65
+ const response = await httpClient.sendRequest({
66
+ method: HttpMethod.GET,
67
+ url: `${baseUrl}/IBSCICUST/v4/customers/${customerNumber}`,
68
+ headers,
69
+ });
70
+
71
+ return response.body;
72
+ },
73
+ });