@agnocon/piece-billplz 0.0.8
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/LICENSE.MIT-AP +24 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/actions/create-bill.d.ts +17 -0
- package/dist/lib/actions/create-bill.d.ts.map +1 -0
- package/dist/lib/actions/create-bill.js +140 -0
- package/dist/lib/actions/create-bill.js.map +1 -0
- package/dist/lib/actions/get-bill.d.ts +4 -0
- package/dist/lib/actions/get-bill.d.ts.map +1 -0
- package/dist/lib/actions/get-bill.js +40 -0
- package/dist/lib/actions/get-bill.js.map +1 -0
- package/dist/lib/actions/index.d.ts +3 -0
- package/dist/lib/actions/index.d.ts.map +1 -0
- package/dist/lib/actions/index.js +8 -0
- package/dist/lib/actions/index.js.map +1 -0
- package/dist/lib/common/api.d.ts +8 -0
- package/dist/lib/common/api.d.ts.map +1 -0
- package/dist/lib/common/api.js +49 -0
- package/dist/lib/common/api.js.map +1 -0
- package/dist/lib/common/auth.d.ts +2 -0
- package/dist/lib/common/auth.d.ts.map +1 -0
- package/dist/lib/common/auth.js +12 -0
- package/dist/lib/common/auth.js.map +1 -0
- package/dist/lib/common/index.d.ts +3 -0
- package/dist/lib/common/index.d.ts.map +1 -0
- package/dist/lib/common/index.js +8 -0
- package/dist/lib/common/index.js.map +1 -0
- package/dist/lib/triggers/get-collections.trigger.d.ts +3 -0
- package/dist/lib/triggers/get-collections.trigger.d.ts.map +1 -0
- package/dist/lib/triggers/get-collections.trigger.js +74 -0
- package/dist/lib/triggers/get-collections.trigger.js.map +1 -0
- package/dist/lib/triggers/index.d.ts +2 -0
- package/dist/lib/triggers/index.d.ts.map +1 -0
- package/dist/lib/triggers/index.js +7 -0
- package/dist/lib/triggers/index.js.map +1 -0
- package/package.json +46 -0
- package/src/index.ts +18 -0
- package/src/lib/actions/create-bill.ts +154 -0
- package/src/lib/actions/get-bill.ts +36 -0
- package/src/lib/actions/index.ts +2 -0
- package/src/lib/common/api.ts +45 -0
- package/src/lib/common/auth.ts +7 -0
- package/src/lib/common/index.ts +2 -0
- package/src/lib/triggers/get-collections.trigger.ts +69 -0
- package/src/lib/triggers/index.ts +1 -0
package/LICENSE.MIT-AP
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Activepieces AB
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
Derived helpers in this folder are adapted from Activepieces (MIT) for use
|
|
24
|
+
inside CX without depending on @activepieces/* packages at runtime.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASI,eAAO,MAAM,OAAO,yGASlB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Vendored from Activepieces packages/pieces/community/billplz/src/index.ts (MIT).
|
|
3
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.billplz = void 0;
|
|
6
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
7
|
+
const auth_1 = require("./lib/common/auth");
|
|
8
|
+
const create_bill_1 = require("./lib/actions/create-bill");
|
|
9
|
+
const get_bill_1 = require("./lib/actions/get-bill");
|
|
10
|
+
const get_collections_trigger_1 = require("./lib/triggers/get-collections.trigger");
|
|
11
|
+
exports.billplz = (0, pieces_framework_1.createPiece)({
|
|
12
|
+
displayName: "Billplz",
|
|
13
|
+
description: "Create and manage bills and collections with Billplz API",
|
|
14
|
+
auth: auth_1.billplzAuth,
|
|
15
|
+
minimumSupportedRelease: '0.36.1',
|
|
16
|
+
logoUrl: "https://cdn.activepieces.com/pieces/billplz.png",
|
|
17
|
+
authors: ['onyedikachi-david'],
|
|
18
|
+
actions: [create_bill_1.createBill, get_bill_1.getBill],
|
|
19
|
+
triggers: [get_collections_trigger_1.getCollectionsTrigger],
|
|
20
|
+
});
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,mFAAmF;AACnF,qEAAqE;;;AAEjE,gEAAmE;AACvE,4CAAgD;AAChD,2DAAuD;AACvD,qDAAiD;AACjD,oFAA+E;AAE9D,QAAA,OAAO,GAAG,IAAA,8BAAW,EAAC;IACjC,WAAW,EAAE,SAAS;IACtB,WAAW,EAAE,0DAA0D;IACvE,IAAI,EAAE,kBAAW;IACjB,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,iDAAiD;IAC1D,OAAO,EAAE,CAAC,mBAAmB,CAAC;IAC9B,OAAO,EAAE,CAAC,wBAAU,EAAE,kBAAO,CAAC;IAC9B,QAAQ,EAAE,CAAC,+CAAqB,CAAC;CAClC,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const createBill: import("@agnocon/pieces-framework").IAction<import("@agnocon/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
collection_id: import("@agnocon/pieces-framework").DropdownProperty<any, true, import("@agnocon/pieces-framework").SecretTextProperty<true>>;
|
|
3
|
+
email: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
4
|
+
mobile: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
5
|
+
name: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
6
|
+
amount: import("@agnocon/pieces-framework").NumberProperty<true>;
|
|
7
|
+
description: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
8
|
+
callback_url: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
9
|
+
due_at: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
10
|
+
redirect_url: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
11
|
+
deliver: import("@agnocon/pieces-framework").CheckboxProperty<false>;
|
|
12
|
+
reference_1_label: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
13
|
+
reference_1: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
14
|
+
reference_2_label: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
15
|
+
reference_2: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
16
|
+
}>;
|
|
17
|
+
//# sourceMappingURL=create-bill.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-bill.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/create-bill.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;EAkJrB,CAAC"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createBill = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/billplz/src/lib/actions/create-bill.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
8
|
+
const api_1 = require("../common/api");
|
|
9
|
+
const auth_1 = require("../common/auth");
|
|
10
|
+
exports.createBill = (0, pieces_framework_1.createAction)({
|
|
11
|
+
name: 'create_bill',
|
|
12
|
+
displayName: 'Create Bill',
|
|
13
|
+
description: 'Create a new bill within a collection',
|
|
14
|
+
audience: 'both',
|
|
15
|
+
aiMetadata: { description: 'Creates a new Billplz bill (payment request) inside a given collection, charging a recipient identified by email and/or mobile for an amount in Malaysian Ringgit. Either email or mobile is required, along with a recipient name, description, and callback URL; optionally set a due date, redirect URL, and reference fields. Enabling the deliver option sends the recipient an email/SMS notification. Not idempotent: each call creates a distinct bill and may dispatch a notification.', idempotent: false },
|
|
16
|
+
auth: auth_1.billplzAuth,
|
|
17
|
+
props: {
|
|
18
|
+
collection_id: pieces_framework_1.Property.Dropdown({
|
|
19
|
+
displayName: 'Collection',
|
|
20
|
+
description: 'Select the collection to create the bill in',
|
|
21
|
+
required: true,
|
|
22
|
+
refreshers: [],
|
|
23
|
+
auth: auth_1.billplzAuth,
|
|
24
|
+
options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
25
|
+
if (!auth) {
|
|
26
|
+
return {
|
|
27
|
+
disabled: true,
|
|
28
|
+
options: [],
|
|
29
|
+
placeholder: 'Please authenticate first'
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
try {
|
|
33
|
+
const response = yield api_1.billplzApi.getCollections(auth.secret_text);
|
|
34
|
+
const collections = response.body;
|
|
35
|
+
return {
|
|
36
|
+
options: collections.map((collection) => ({
|
|
37
|
+
label: collection.title || collection.name || collection.id,
|
|
38
|
+
value: collection.id
|
|
39
|
+
}))
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
return {
|
|
44
|
+
disabled: true,
|
|
45
|
+
options: [],
|
|
46
|
+
placeholder: 'Failed to load collections'
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
})
|
|
50
|
+
}),
|
|
51
|
+
email: pieces_framework_1.Property.ShortText({
|
|
52
|
+
displayName: 'Email',
|
|
53
|
+
description: 'Recipient email address (required if mobile not provided)',
|
|
54
|
+
required: false
|
|
55
|
+
}),
|
|
56
|
+
mobile: pieces_framework_1.Property.ShortText({
|
|
57
|
+
displayName: 'Mobile Number',
|
|
58
|
+
description: 'Recipient mobile number with country code (required if email not provided)',
|
|
59
|
+
required: false
|
|
60
|
+
}),
|
|
61
|
+
name: pieces_framework_1.Property.ShortText({
|
|
62
|
+
displayName: 'Recipient Name',
|
|
63
|
+
description: 'Name of the bill recipient',
|
|
64
|
+
required: true,
|
|
65
|
+
}),
|
|
66
|
+
amount: pieces_framework_1.Property.Number({
|
|
67
|
+
displayName: 'Amount (RM)',
|
|
68
|
+
description: 'Amount in Malaysian Ringgit (e.g., 2.00 for RM 2.00)',
|
|
69
|
+
required: true,
|
|
70
|
+
}),
|
|
71
|
+
description: pieces_framework_1.Property.ShortText({
|
|
72
|
+
displayName: 'Description',
|
|
73
|
+
description: 'Bill description that will be displayed on the bill',
|
|
74
|
+
required: true,
|
|
75
|
+
}),
|
|
76
|
+
callback_url: pieces_framework_1.Property.ShortText({
|
|
77
|
+
displayName: 'Callback URL',
|
|
78
|
+
description: 'Webhook URL to receive payment completion notifications',
|
|
79
|
+
required: true
|
|
80
|
+
}),
|
|
81
|
+
due_at: pieces_framework_1.Property.ShortText({
|
|
82
|
+
displayName: 'Due Date',
|
|
83
|
+
description: 'Due date in YYYY-MM-DD format (optional, defaults to today)',
|
|
84
|
+
required: false
|
|
85
|
+
}),
|
|
86
|
+
redirect_url: pieces_framework_1.Property.ShortText({
|
|
87
|
+
displayName: 'Redirect URL',
|
|
88
|
+
description: 'URL to redirect customer after payment completion',
|
|
89
|
+
required: false
|
|
90
|
+
}),
|
|
91
|
+
deliver: pieces_framework_1.Property.Checkbox({
|
|
92
|
+
displayName: 'Send Email/SMS',
|
|
93
|
+
description: 'Automatically send email and SMS notification to recipient',
|
|
94
|
+
required: false,
|
|
95
|
+
defaultValue: false
|
|
96
|
+
}),
|
|
97
|
+
reference_1_label: pieces_framework_1.Property.ShortText({
|
|
98
|
+
displayName: 'Reference 1 Label',
|
|
99
|
+
description: 'Label for first reference field',
|
|
100
|
+
required: false,
|
|
101
|
+
defaultValue: 'Reference 1',
|
|
102
|
+
}),
|
|
103
|
+
reference_1: pieces_framework_1.Property.ShortText({
|
|
104
|
+
displayName: 'Reference 1 Value',
|
|
105
|
+
description: 'Value for first reference field',
|
|
106
|
+
required: false,
|
|
107
|
+
}),
|
|
108
|
+
reference_2_label: pieces_framework_1.Property.ShortText({
|
|
109
|
+
displayName: 'Reference 2 Label',
|
|
110
|
+
description: 'Label for second reference field',
|
|
111
|
+
required: false,
|
|
112
|
+
defaultValue: 'Reference 2',
|
|
113
|
+
}),
|
|
114
|
+
reference_2: pieces_framework_1.Property.ShortText({
|
|
115
|
+
displayName: 'Reference 2 Value',
|
|
116
|
+
description: 'Value for second reference field',
|
|
117
|
+
required: false,
|
|
118
|
+
})
|
|
119
|
+
},
|
|
120
|
+
run(context) {
|
|
121
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
122
|
+
const { auth, propsValue } = context;
|
|
123
|
+
// Convert amount to smallest currency unit (cents)
|
|
124
|
+
const amountInCents = Math.round(propsValue.amount * 100);
|
|
125
|
+
// Validate that either email or mobile is provided
|
|
126
|
+
if (!propsValue.email && !propsValue.mobile) {
|
|
127
|
+
throw new Error('Either email or mobile number must be provided');
|
|
128
|
+
}
|
|
129
|
+
const billData = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ collection_id: propsValue.collection_id, email: propsValue.email, mobile: propsValue.mobile, name: propsValue.name, amount: amountInCents, description: propsValue.description, callback_url: propsValue.callback_url }, (propsValue.due_at && { due_at: propsValue.due_at })), (propsValue.redirect_url && { redirect_url: propsValue.redirect_url })), (propsValue.deliver !== undefined && { deliver: propsValue.deliver })), (propsValue.reference_1_label && { reference_1_label: propsValue.reference_1_label })), (propsValue.reference_1 && { reference_1: propsValue.reference_1 })), (propsValue.reference_2_label && { reference_2_label: propsValue.reference_2_label })), (propsValue.reference_2 && { reference_2: propsValue.reference_2 }));
|
|
130
|
+
try {
|
|
131
|
+
const response = yield api_1.billplzApi.createBill(auth.secret_text, billData);
|
|
132
|
+
return response.body;
|
|
133
|
+
}
|
|
134
|
+
catch (error) {
|
|
135
|
+
throw new Error(`Failed to create bill: ${error.message}`);
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
//# sourceMappingURL=create-bill.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-bill.js","sourceRoot":"","sources":["../../../src/lib/actions/create-bill.ts"],"names":[],"mappings":";;;;AAAA,qGAAqG;AACrG,qEAAqE;AACrE,gEAGmC;AACnC,uCAA2C;AAC3C,yCAA6C;AAEhC,QAAA,UAAU,GAAG,IAAA,+BAAY,EAAC;IACrC,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,uCAAuC;IACpD,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,ieAAie,EAAE,UAAU,EAAE,KAAK,EAAE;IACjhB,IAAI,EAAE,kBAAW;I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AC,iBAAiB,IAAI,EAAE,iBAAiB,EAAE,UAAU,CAAC,iBAAiB,EAAE,CAAC,GACrF,CAAC,UAAU,CAAC,WAAW,IAAI,EAAE,WAAW,EAAE,UAAU,CAAC,WAAW,EAAE,CAAC,GACnE,CAAC,UAAU,CAAC,iBAAiB,IAAI,EAAE,iBAAiB,EAAE,UAAU,CAAC,iBAAiB,EAAE,CAAC,GACrF,CAAC,UAAU,CAAC,WAAW,IAAI,EAAE,WAAW,EAAE,UAAU,CAAC,WAAW,EAAE,CAAC,CACvE,CAAC;YAEF,IAAI,CAAC;gBACH,MAAM,QAAQ,GAAG,MAAM,gBAAU,CAAC,UAAU,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;gBACzE,OAAO,QAAQ,CAAC,IAAI,CAAC;YACvB,CAAC;YAAC,OAAO,KAAc,EAAE,CAAC;gBACxB,MAAM,IAAI,KAAK,CAAC,0BAA2B,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC;YACxE,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-bill.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/get-bill.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,OAAO;;EA4BlB,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getBill = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/billplz/src/lib/actions/get-bill.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
8
|
+
const api_1 = require("../common/api");
|
|
9
|
+
const auth_1 = require("../common/auth");
|
|
10
|
+
exports.getBill = (0, pieces_framework_1.createAction)({
|
|
11
|
+
name: 'get_bill',
|
|
12
|
+
displayName: 'Get Bill',
|
|
13
|
+
description: 'Retrieve information about a specific bill',
|
|
14
|
+
audience: 'both',
|
|
15
|
+
aiMetadata: { description: 'Looks up a single Billplz bill by its bill ID, returning its details and payment status. Use to check whether a bill has been paid or to fetch its current state. Requires a known bill ID. Idempotent: a read-only lookup with no side effects.', idempotent: true },
|
|
16
|
+
auth: auth_1.billplzAuth,
|
|
17
|
+
props: {
|
|
18
|
+
bill_id: pieces_framework_1.Property.ShortText({
|
|
19
|
+
displayName: 'Bill ID',
|
|
20
|
+
description: 'The ID of the bill to retrieve',
|
|
21
|
+
required: true
|
|
22
|
+
})
|
|
23
|
+
},
|
|
24
|
+
run(context) {
|
|
25
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
const { auth, propsValue } = context;
|
|
27
|
+
if (!propsValue.bill_id) {
|
|
28
|
+
throw new Error('Bill ID is required');
|
|
29
|
+
}
|
|
30
|
+
try {
|
|
31
|
+
const response = yield api_1.billplzApi.getBill(auth.secret_text, propsValue.bill_id);
|
|
32
|
+
return response.body;
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
throw new Error(`Failed to get bill: ${error.message}`);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
//# sourceMappingURL=get-bill.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-bill.js","sourceRoot":"","sources":["../../../src/lib/actions/get-bill.ts"],"names":[],"mappings":";;;;AAAA,kGAAkG;AAClG,qEAAqE;AACrE,gEAGmC;AACnC,uCAA2C;AAC3C,yCAA6C;AAEhC,QAAA,OAAO,GAAG,IAAA,+BAAY,EAAC;IAClC,IAAI,EAAE,UAAU;IAChB,WAAW,EAAE,UAAU;IACvB,WAAW,EAAE,4CAA4C;IACzD,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,kPAAkP,EAAE,UAAU,EAAE,IAAI,EAAE;IACjS,IAAI,EAAE,kBAAW;IACjB,KAAK,EAAE;QACL,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,gCAAgC;YAC7C,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;YAErC,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;gBACxB,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;YACzC,CAAC;YAED,IAAI,CAAC;gBACH,MAAM,QAAQ,GAAG,MAAM,gBAAU,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;gBAChF,OAAO,QAAQ,CAAC,IAAI,CAAC;YACvB,CAAC;YAAC,OAAO,KAAc,EAAE,CAAC;gBACxB,MAAM,IAAI,KAAK,CAAC,uBAAwB,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC;YACrE,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/index.ts"],"names":[],"mappings":"AAEA,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
// Vendored from Activepieces packages/pieces/community/billplz/src/lib/actions/index.ts (MIT).
|
|
5
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
6
|
+
tslib_1.__exportStar(require("./create-bill"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./get-bill"), exports);
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/actions/index.ts"],"names":[],"mappings":";;;AAAA,+FAA+F;AAC/F,qEAAqE;AACrE,wDAA8B;AAC9B,qDAA2B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { HttpRequest } from '@agnocon/pieces-common';
|
|
2
|
+
export declare const billplzApi: {
|
|
3
|
+
makeRequest(auth: string, request: HttpRequest): Promise<import("@agnocon/pieces-common").HttpResponse<any>>;
|
|
4
|
+
getCollections(auth: string): Promise<import("@agnocon/pieces-common").HttpResponse<any>>;
|
|
5
|
+
createBill(auth: string, billData: Record<string, unknown>): Promise<import("@agnocon/pieces-common").HttpResponse<any>>;
|
|
6
|
+
getBill(auth: string, billId: string): Promise<import("@agnocon/pieces-common").HttpResponse<any>>;
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/lib/common/api.ts"],"names":[],"mappings":"AAEA,OAAO,EAA8C,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAKjG,eAAO,MAAM,UAAU;sBACG,MAAM,WAAW,WAAW;yBAiBzB,MAAM;qBAOV,MAAM,YAAY,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;kBAQ5C,MAAM,UAAU,MAAM;CAM3C,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.billplzApi = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/billplz/src/lib/common/api.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_common_1 = require("@agnocon/pieces-common");
|
|
8
|
+
const BILLPLZ_API_URL = 'https://www.billplz.com/api';
|
|
9
|
+
const BILLPLZ_SANDBOX_API_URL = 'https://www.billplz-sandbox.com/api';
|
|
10
|
+
exports.billplzApi = {
|
|
11
|
+
makeRequest(auth, request) {
|
|
12
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
13
|
+
const baseUrl = auth.includes('sandbox') ? BILLPLZ_SANDBOX_API_URL : BILLPLZ_API_URL;
|
|
14
|
+
return pieces_common_1.httpClient.sendRequest(Object.assign(Object.assign({}, request), { url: `${baseUrl}${request.url}`, authentication: {
|
|
15
|
+
type: pieces_common_1.AuthenticationType.BASIC,
|
|
16
|
+
username: auth,
|
|
17
|
+
password: ''
|
|
18
|
+
}, headers: {
|
|
19
|
+
'Content-Type': 'application/json'
|
|
20
|
+
} }));
|
|
21
|
+
});
|
|
22
|
+
},
|
|
23
|
+
getCollections(auth) {
|
|
24
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
return this.makeRequest(auth, {
|
|
26
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
27
|
+
url: '/v3/collections'
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
createBill(auth, billData) {
|
|
32
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
return this.makeRequest(auth, {
|
|
34
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
35
|
+
url: '/v3/bills',
|
|
36
|
+
body: billData
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
},
|
|
40
|
+
getBill(auth, billId) {
|
|
41
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
return this.makeRequest(auth, {
|
|
43
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
44
|
+
url: `/v3/bills/${billId}`
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=api.js.map
|
|
@@ -0,0 +1 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MAAM,EAAE;aAC3B,CAAC,CAAC;QACL,CAAC;KAAA;CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/lib/common/auth.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW,8DAItB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.billplzAuth = void 0;
|
|
4
|
+
// Vendored from Activepieces packages/pieces/community/billplz/src/lib/common/auth.ts (MIT).
|
|
5
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
6
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
7
|
+
exports.billplzAuth = pieces_framework_1.PieceAuth.SecretText({
|
|
8
|
+
displayName: 'API Secret Key',
|
|
9
|
+
description: 'Enter your Billplz API Secret Key. You can find this in your Billplz account settings.',
|
|
10
|
+
required: true,
|
|
11
|
+
});
|
|
12
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/lib/common/auth.ts"],"names":[],"mappings":";;;AAAA,6FAA6F;AAC7F,qEAAqE;AACrE,gEAAsD;AAEzC,QAAA,WAAW,GAAG,4BAAS,CAAC,UAAU,CAAC;IAC9C,WAAW,EAAE,gBAAgB;IAC7B,WAAW,EAAE,wFAAwF;IACrG,QAAQ,EAAE,IAAI;CACf,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/common/index.ts"],"names":[],"mappings":"AAEA,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
// Vendored from Activepieces packages/pieces/community/billplz/src/lib/common/index.ts (MIT).
|
|
5
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
6
|
+
tslib_1.__exportStar(require("./auth"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./api"), exports);
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/common/index.ts"],"names":[],"mappings":";;;AAAA,8FAA8F;AAC9F,qEAAqE;AACrE,iDAAuB;AACvB,gDAAsB"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { TriggerStrategy } from '@agnocon/pieces-framework';
|
|
2
|
+
export declare const getCollectionsTrigger: import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@agnocon/pieces-framework").SecretTextProperty<true>, {}> | import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@agnocon/pieces-framework").SecretTextProperty<true>, {}> | import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@agnocon/pieces-framework").SecretTextProperty<true>, {}> | import("@agnocon/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@agnocon/pieces-framework").SecretTextProperty<true>, {}>;
|
|
3
|
+
//# sourceMappingURL=get-collections.trigger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-collections.trigger.d.ts","sourceRoot":"","sources":["../../../src/lib/triggers/get-collections.trigger.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,eAAe,EAIhB,MAAM,2BAA2B,CAAC;AAyBnC,eAAO,MAAM,qBAAqB,0iBAqChC,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCollectionsTrigger = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/billplz/src/lib/triggers/get-collections.trigger.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
8
|
+
const api_1 = require("../common/api");
|
|
9
|
+
const auth_1 = require("../common/auth");
|
|
10
|
+
const pieces_common_1 = require("@agnocon/pieces-common");
|
|
11
|
+
const polling = {
|
|
12
|
+
strategy: pieces_common_1.DedupeStrategy.LAST_ITEM,
|
|
13
|
+
items: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
14
|
+
try {
|
|
15
|
+
const response = yield api_1.billplzApi.getCollections(auth.secret_text);
|
|
16
|
+
const collections = response.body.collections || [];
|
|
17
|
+
return collections.map((collection) => ({
|
|
18
|
+
epochMilliSeconds: Date.now(),
|
|
19
|
+
data: collection
|
|
20
|
+
}));
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
console.error('Failed to fetch collections:', error);
|
|
24
|
+
return [];
|
|
25
|
+
}
|
|
26
|
+
}),
|
|
27
|
+
};
|
|
28
|
+
exports.getCollectionsTrigger = (0, pieces_framework_1.createTrigger)({
|
|
29
|
+
name: 'get_collections',
|
|
30
|
+
displayName: 'Get Collections',
|
|
31
|
+
description: 'Triggers when there are new collections',
|
|
32
|
+
aiMetadata: {
|
|
33
|
+
description: 'Fires when a new Billplz collection appears on the authenticated account. Polls the collections list and emits one event per newly detected collection, representing a container into which bills can be created.',
|
|
34
|
+
},
|
|
35
|
+
auth: auth_1.billplzAuth,
|
|
36
|
+
props: {},
|
|
37
|
+
type: pieces_framework_1.TriggerStrategy.POLLING,
|
|
38
|
+
sampleData: {
|
|
39
|
+
id: "inbmmepb",
|
|
40
|
+
title: "My First API Collection",
|
|
41
|
+
logo: {
|
|
42
|
+
thumb_url: null,
|
|
43
|
+
avatar_url: null
|
|
44
|
+
},
|
|
45
|
+
split_payment: {
|
|
46
|
+
email: null,
|
|
47
|
+
fixed_cut: null,
|
|
48
|
+
variable_cut: null,
|
|
49
|
+
split_header: false
|
|
50
|
+
},
|
|
51
|
+
status: "active"
|
|
52
|
+
},
|
|
53
|
+
onEnable(context) {
|
|
54
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
55
|
+
yield pieces_common_1.pollingHelper.onEnable(polling, context);
|
|
56
|
+
});
|
|
57
|
+
},
|
|
58
|
+
onDisable(context) {
|
|
59
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
yield pieces_common_1.pollingHelper.onDisable(polling, context);
|
|
61
|
+
});
|
|
62
|
+
},
|
|
63
|
+
run(context) {
|
|
64
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
65
|
+
return yield pieces_common_1.pollingHelper.poll(polling, context);
|
|
66
|
+
});
|
|
67
|
+
},
|
|
68
|
+
test(context) {
|
|
69
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
70
|
+
return yield pieces_common_1.pollingHelper.test(polling, context);
|
|
71
|
+
});
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
//# sourceMappingURL=get-collections.trigger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-collections.trigger.js","sourceRoot":"","sources":["../../../src/lib/triggers/get-collections.trigger.ts"],"names":[],"mappings":";;;;AAAA,kHAAkH;AAClH,qEAAqE;AACrE,gEAMmC;AACnC,uCAA2C;AAC3C,yCAA6C;AAC7C,0DAAgF;AAIhF,MAAM,OAAO,GAAkE;IAC7E,QAAQ,EAAE,8BAAc,CAAC,SAAS;IAClC,KAAK,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;QACpB,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,gBAAU,CAAC,cAAc,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YACnE,MAA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OAAO,EAAE,OAAO,CAAC,CAAC;QACpD,CAAC;KAAA;IACK,IAAI,CAAC,OAAO;;YAChB,OAAO,MAAM,6BAAa,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACpD,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/triggers/index.ts"],"names":[],"mappings":"AAEA,cAAc,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
// Vendored from Activepieces packages/pieces/community/billplz/src/lib/triggers/index.ts (MIT).
|
|
5
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
6
|
+
tslib_1.__exportStar(require("./get-collections.trigger"), exports);
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/triggers/index.ts"],"names":[],"mappings":";;;AAAA,gGAAgG;AAChG,qEAAqE;AACrE,oEAA0C"}
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@agnocon/piece-billplz",
|
|
3
|
+
"version": "0.0.8",
|
|
4
|
+
"description": "AgnoCon billplz connector",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"require": "./dist/index.js",
|
|
11
|
+
"default": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"src",
|
|
17
|
+
"LICENSE.MIT-AP"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsc -p tsconfig.json",
|
|
21
|
+
"vendor": "node ../scripts/vendor-ap.mjs piece-billplz"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@agnocon/core-utils": "0.2.0",
|
|
25
|
+
"@agnocon/piece-types": "0.3.1",
|
|
26
|
+
"@agnocon/pieces-common": "0.12.8",
|
|
27
|
+
"@agnocon/pieces-framework": "0.36.0",
|
|
28
|
+
"tslib": "2.6.2"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@types/node": "20.17.6",
|
|
32
|
+
"typescript": "5.5.4"
|
|
33
|
+
},
|
|
34
|
+
"license": "MIT",
|
|
35
|
+
"agnocon": {
|
|
36
|
+
"originVersion": "0.0.8"
|
|
37
|
+
},
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"access": "restricted",
|
|
40
|
+
"tag": "latest"
|
|
41
|
+
},
|
|
42
|
+
"keywords": [
|
|
43
|
+
"agnocon",
|
|
44
|
+
"connector"
|
|
45
|
+
]
|
|
46
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
import { createPiece, PieceAuth } from "@agnocon/pieces-framework";
|
|
3
|
+
import { billplzAuth } from "./lib/common/auth";
|
|
4
|
+
import { createBill } from "./lib/actions/create-bill";
|
|
5
|
+
import { getBill } from "./lib/actions/get-bill";
|
|
6
|
+
import { getCollectionsTrigger } from "./lib/triggers/get-collections.trigger";
|
|
7
|
+
|
|
8
|
+
export const billplz = createPiece({
|
|
9
|
+
displayName: "Billplz",
|
|
10
|
+
description: "Create and manage bills and collections with Billplz API",
|
|
11
|
+
auth: billplzAuth,
|
|
12
|
+
minimumSupportedRelease: '0.36.1',
|
|
13
|
+
logoUrl: "https://cdn.activepieces.com/pieces/billplz.png",
|
|
14
|
+
authors: ['onyedikachi-david'],
|
|
15
|
+
actions: [createBill, getBill],
|
|
16
|
+
triggers: [getCollectionsTrigger],
|
|
17
|
+
});
|
|
18
|
+
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createAction,
|
|
3
|
+
Property,
|
|
4
|
+
} from '@agnocon/pieces-framework';
|
|
5
|
+
import { billplzApi } from '../common/api';
|
|
6
|
+
import { billplzAuth } from '../common/auth';
|
|
7
|
+
|
|
8
|
+
export const createBill = createAction({
|
|
9
|
+
name: 'create_bill',
|
|
10
|
+
displayName: 'Create Bill',
|
|
11
|
+
description: 'Create a new bill within a collection',
|
|
12
|
+
audience: 'both',
|
|
13
|
+
aiMetadata: { description: 'Creates a new Billplz bill (payment request) inside a given collection, charging a recipient identified by email and/or mobile for an amount in Malaysian Ringgit. Either email or mobile is required, along with a recipient name, description, and callback URL; optionally set a due date, redirect URL, and reference fields. Enabling the deliver option sends the recipient an email/SMS notification. Not idempotent: each call creates a distinct bill and may dispatch a notification.', idempotent: false },
|
|
14
|
+
auth: billplzAuth,
|
|
15
|
+
props: {
|
|
16
|
+
collection_id: Property.Dropdown({
|
|
17
|
+
displayName: 'Collection',
|
|
18
|
+
description: 'Select the collection to create the bill in',
|
|
19
|
+
required: true,
|
|
20
|
+
refreshers: [],
|
|
21
|
+
auth: billplzAuth,
|
|
22
|
+
options: async ({ auth }) => {
|
|
23
|
+
if (!auth) {
|
|
24
|
+
return {
|
|
25
|
+
disabled: true,
|
|
26
|
+
options: [],
|
|
27
|
+
placeholder: 'Please authenticate first'
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
try {
|
|
32
|
+
const response = await billplzApi.getCollections(auth.secret_text);
|
|
33
|
+
const collections = response.body;
|
|
34
|
+
|
|
35
|
+
return {
|
|
36
|
+
options: collections.map((collection: any) => ({
|
|
37
|
+
label: collection.title || collection.name || collection.id,
|
|
38
|
+
value: collection.id
|
|
39
|
+
}))
|
|
40
|
+
};
|
|
41
|
+
} catch (error) {
|
|
42
|
+
return {
|
|
43
|
+
disabled: true,
|
|
44
|
+
options: [],
|
|
45
|
+
placeholder: 'Failed to load collections'
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}),
|
|
50
|
+
email: Property.ShortText({
|
|
51
|
+
displayName: 'Email',
|
|
52
|
+
description: 'Recipient email address (required if mobile not provided)',
|
|
53
|
+
required: false
|
|
54
|
+
}),
|
|
55
|
+
mobile: Property.ShortText({
|
|
56
|
+
displayName: 'Mobile Number',
|
|
57
|
+
description: 'Recipient mobile number with country code (required if email not provided)',
|
|
58
|
+
required: false
|
|
59
|
+
}),
|
|
60
|
+
name: Property.ShortText({
|
|
61
|
+
displayName: 'Recipient Name',
|
|
62
|
+
description: 'Name of the bill recipient',
|
|
63
|
+
required: true,
|
|
64
|
+
}),
|
|
65
|
+
amount: Property.Number({
|
|
66
|
+
displayName: 'Amount (RM)',
|
|
67
|
+
description: 'Amount in Malaysian Ringgit (e.g., 2.00 for RM 2.00)',
|
|
68
|
+
required: true,
|
|
69
|
+
}),
|
|
70
|
+
description: Property.ShortText({
|
|
71
|
+
displayName: 'Description',
|
|
72
|
+
description: 'Bill description that will be displayed on the bill',
|
|
73
|
+
required: true,
|
|
74
|
+
}),
|
|
75
|
+
callback_url: Property.ShortText({
|
|
76
|
+
displayName: 'Callback URL',
|
|
77
|
+
description: 'Webhook URL to receive payment completion notifications',
|
|
78
|
+
required: true
|
|
79
|
+
}),
|
|
80
|
+
due_at: Property.ShortText({
|
|
81
|
+
displayName: 'Due Date',
|
|
82
|
+
description: 'Due date in YYYY-MM-DD format (optional, defaults to today)',
|
|
83
|
+
required: false
|
|
84
|
+
}),
|
|
85
|
+
redirect_url: Property.ShortText({
|
|
86
|
+
displayName: 'Redirect URL',
|
|
87
|
+
description: 'URL to redirect customer after payment completion',
|
|
88
|
+
required: false
|
|
89
|
+
}),
|
|
90
|
+
deliver: Property.Checkbox({
|
|
91
|
+
displayName: 'Send Email/SMS',
|
|
92
|
+
description: 'Automatically send email and SMS notification to recipient',
|
|
93
|
+
required: false,
|
|
94
|
+
defaultValue: false
|
|
95
|
+
}),
|
|
96
|
+
reference_1_label: Property.ShortText({
|
|
97
|
+
displayName: 'Reference 1 Label',
|
|
98
|
+
description: 'Label for first reference field',
|
|
99
|
+
required: false,
|
|
100
|
+
defaultValue: 'Reference 1',
|
|
101
|
+
}),
|
|
102
|
+
reference_1: Property.ShortText({
|
|
103
|
+
displayName: 'Reference 1 Value',
|
|
104
|
+
description: 'Value for first reference field',
|
|
105
|
+
required: false,
|
|
106
|
+
}),
|
|
107
|
+
reference_2_label: Property.ShortText({
|
|
108
|
+
displayName: 'Reference 2 Label',
|
|
109
|
+
description: 'Label for second reference field',
|
|
110
|
+
required: false,
|
|
111
|
+
defaultValue: 'Reference 2',
|
|
112
|
+
}),
|
|
113
|
+
reference_2: Property.ShortText({
|
|
114
|
+
displayName: 'Reference 2 Value',
|
|
115
|
+
description: 'Value for second reference field',
|
|
116
|
+
required: false,
|
|
117
|
+
})
|
|
118
|
+
},
|
|
119
|
+
async run(context) {
|
|
120
|
+
const { auth, propsValue } = context;
|
|
121
|
+
|
|
122
|
+
// Convert amount to smallest currency unit (cents)
|
|
123
|
+
const amountInCents = Math.round(propsValue.amount * 100);
|
|
124
|
+
|
|
125
|
+
// Validate that either email or mobile is provided
|
|
126
|
+
if (!propsValue.email && !propsValue.mobile) {
|
|
127
|
+
throw new Error('Either email or mobile number must be provided');
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const billData = {
|
|
131
|
+
collection_id: propsValue.collection_id,
|
|
132
|
+
email: propsValue.email,
|
|
133
|
+
mobile: propsValue.mobile,
|
|
134
|
+
name: propsValue.name,
|
|
135
|
+
amount: amountInCents,
|
|
136
|
+
description: propsValue.description,
|
|
137
|
+
callback_url: propsValue.callback_url,
|
|
138
|
+
...(propsValue.due_at && { due_at: propsValue.due_at }),
|
|
139
|
+
...(propsValue.redirect_url && { redirect_url: propsValue.redirect_url }),
|
|
140
|
+
...(propsValue.deliver !== undefined && { deliver: propsValue.deliver }),
|
|
141
|
+
...(propsValue.reference_1_label && { reference_1_label: propsValue.reference_1_label }),
|
|
142
|
+
...(propsValue.reference_1 && { reference_1: propsValue.reference_1 }),
|
|
143
|
+
...(propsValue.reference_2_label && { reference_2_label: propsValue.reference_2_label }),
|
|
144
|
+
...(propsValue.reference_2 && { reference_2: propsValue.reference_2 })
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
try {
|
|
148
|
+
const response = await billplzApi.createBill(auth.secret_text, billData);
|
|
149
|
+
return response.body;
|
|
150
|
+
} catch (error: unknown) {
|
|
151
|
+
throw new Error(`Failed to create bill: ${(error as Error).message}`);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createAction,
|
|
3
|
+
Property,
|
|
4
|
+
} from '@agnocon/pieces-framework';
|
|
5
|
+
import { billplzApi } from '../common/api';
|
|
6
|
+
import { billplzAuth } from '../common/auth';
|
|
7
|
+
|
|
8
|
+
export const getBill = createAction({
|
|
9
|
+
name: 'get_bill',
|
|
10
|
+
displayName: 'Get Bill',
|
|
11
|
+
description: 'Retrieve information about a specific bill',
|
|
12
|
+
audience: 'both',
|
|
13
|
+
aiMetadata: { description: 'Looks up a single Billplz bill by its bill ID, returning its details and payment status. Use to check whether a bill has been paid or to fetch its current state. Requires a known bill ID. Idempotent: a read-only lookup with no side effects.', idempotent: true },
|
|
14
|
+
auth: billplzAuth,
|
|
15
|
+
props: {
|
|
16
|
+
bill_id: Property.ShortText({
|
|
17
|
+
displayName: 'Bill ID',
|
|
18
|
+
description: 'The ID of the bill to retrieve',
|
|
19
|
+
required: true
|
|
20
|
+
})
|
|
21
|
+
},
|
|
22
|
+
async run(context) {
|
|
23
|
+
const { auth, propsValue } = context;
|
|
24
|
+
|
|
25
|
+
if (!propsValue.bill_id) {
|
|
26
|
+
throw new Error('Bill ID is required');
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
try {
|
|
30
|
+
const response = await billplzApi.getBill(auth.secret_text, propsValue.bill_id);
|
|
31
|
+
return response.body;
|
|
32
|
+
} catch (error: unknown) {
|
|
33
|
+
throw new Error(`Failed to get bill: ${(error as Error).message}`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { AuthenticationType, httpClient, HttpMethod, HttpRequest } from '@agnocon/pieces-common';
|
|
2
|
+
|
|
3
|
+
const BILLPLZ_API_URL = 'https://www.billplz.com/api';
|
|
4
|
+
const BILLPLZ_SANDBOX_API_URL = 'https://www.billplz-sandbox.com/api';
|
|
5
|
+
|
|
6
|
+
export const billplzApi = {
|
|
7
|
+
async makeRequest(auth: string, request: HttpRequest) {
|
|
8
|
+
const baseUrl = auth.includes('sandbox') ? BILLPLZ_SANDBOX_API_URL : BILLPLZ_API_URL;
|
|
9
|
+
|
|
10
|
+
return httpClient.sendRequest({
|
|
11
|
+
...request,
|
|
12
|
+
url: `${baseUrl}${request.url}`,
|
|
13
|
+
authentication: {
|
|
14
|
+
type: AuthenticationType.BASIC,
|
|
15
|
+
username: auth,
|
|
16
|
+
password: ''
|
|
17
|
+
},
|
|
18
|
+
headers: {
|
|
19
|
+
'Content-Type': 'application/json'
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
async getCollections(auth: string) {
|
|
25
|
+
return this.makeRequest(auth, {
|
|
26
|
+
method: HttpMethod.GET,
|
|
27
|
+
url: '/v3/collections'
|
|
28
|
+
});
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
async createBill(auth: string, billData: Record<string, unknown>) {
|
|
32
|
+
return this.makeRequest(auth, {
|
|
33
|
+
method: HttpMethod.POST,
|
|
34
|
+
url: '/v3/bills',
|
|
35
|
+
body: billData
|
|
36
|
+
});
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
async getBill(auth: string, billId: string) {
|
|
40
|
+
return this.makeRequest(auth, {
|
|
41
|
+
method: HttpMethod.GET,
|
|
42
|
+
url: `/v3/bills/${billId}`
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PieceAuth } from '@agnocon/pieces-framework';
|
|
2
|
+
|
|
3
|
+
export const billplzAuth = PieceAuth.SecretText({
|
|
4
|
+
displayName: 'API Secret Key',
|
|
5
|
+
description: 'Enter your Billplz API Secret Key. You can find this in your Billplz account settings.',
|
|
6
|
+
required: true,
|
|
7
|
+
});
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createTrigger,
|
|
3
|
+
TriggerStrategy,
|
|
4
|
+
Property,
|
|
5
|
+
AppConnectionValueForAuthProperty,
|
|
6
|
+
StaticPropsValue
|
|
7
|
+
} from '@agnocon/pieces-framework';
|
|
8
|
+
import { billplzApi } from '../common/api';
|
|
9
|
+
import { billplzAuth } from '../common/auth';
|
|
10
|
+
import { DedupeStrategy, Polling, pollingHelper } from '@agnocon/pieces-common';
|
|
11
|
+
|
|
12
|
+
type BillplzAuth = AppConnectionValueForAuthProperty<typeof billplzAuth>;
|
|
13
|
+
|
|
14
|
+
const polling: Polling<BillplzAuth, StaticPropsValue<Record<string, never>>> = {
|
|
15
|
+
strategy: DedupeStrategy.LAST_ITEM,
|
|
16
|
+
items: async ({ auth }) => {
|
|
17
|
+
try {
|
|
18
|
+
const response = await billplzApi.getCollections(auth.secret_text);
|
|
19
|
+
const collections = response.body.collections || [];
|
|
20
|
+
|
|
21
|
+
return collections.map((collection: any) => ({
|
|
22
|
+
epochMilliSeconds: Date.now(),
|
|
23
|
+
data: collection
|
|
24
|
+
}));
|
|
25
|
+
} catch (error) {
|
|
26
|
+
console.error('Failed to fetch collections:', error);
|
|
27
|
+
return [];
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const getCollectionsTrigger = createTrigger({
|
|
33
|
+
name: 'get_collections',
|
|
34
|
+
displayName: 'Get Collections',
|
|
35
|
+
description: 'Triggers when there are new collections',
|
|
36
|
+
aiMetadata: {
|
|
37
|
+
description: 'Fires when a new Billplz collection appears on the authenticated account. Polls the collections list and emits one event per newly detected collection, representing a container into which bills can be created.',
|
|
38
|
+
},
|
|
39
|
+
auth: billplzAuth,
|
|
40
|
+
props: {},
|
|
41
|
+
type: TriggerStrategy.POLLING,
|
|
42
|
+
sampleData: {
|
|
43
|
+
id: "inbmmepb",
|
|
44
|
+
title: "My First API Collection",
|
|
45
|
+
logo: {
|
|
46
|
+
thumb_url: null,
|
|
47
|
+
avatar_url: null
|
|
48
|
+
},
|
|
49
|
+
split_payment: {
|
|
50
|
+
email: null,
|
|
51
|
+
fixed_cut: null,
|
|
52
|
+
variable_cut: null,
|
|
53
|
+
split_header: false
|
|
54
|
+
},
|
|
55
|
+
status: "active"
|
|
56
|
+
},
|
|
57
|
+
async onEnable(context) {
|
|
58
|
+
await pollingHelper.onEnable(polling, context);
|
|
59
|
+
},
|
|
60
|
+
async onDisable(context) {
|
|
61
|
+
await pollingHelper.onDisable(polling, context);
|
|
62
|
+
},
|
|
63
|
+
async run(context) {
|
|
64
|
+
return await pollingHelper.poll(polling, context);
|
|
65
|
+
},
|
|
66
|
+
async test(context) {
|
|
67
|
+
return await pollingHelper.test(polling, context);
|
|
68
|
+
},
|
|
69
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './get-collections.trigger';
|