softycomp-node 1.0.0 → 1.0.2
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/dist/index.js +6 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -113,8 +113,8 @@ class SoftyComp {
|
|
|
113
113
|
*/
|
|
114
114
|
async createBill(params) {
|
|
115
115
|
const isRecurring = params.frequency !== 'once-off';
|
|
116
|
-
// Frequency type mapping: 1=once-off, 2=monthly,
|
|
117
|
-
const frequencyTypeID = params.frequency === 'yearly' ?
|
|
116
|
+
// Frequency type mapping: 1=once-off, 2=monthly, 6=yearly (valid range is 1-6)
|
|
117
|
+
const frequencyTypeID = params.frequency === 'yearly' ? 6 : params.frequency === 'monthly' ? 2 : 1;
|
|
118
118
|
// Build the bill item
|
|
119
119
|
const item = {
|
|
120
120
|
Description: params.description || 'Payment',
|
|
@@ -285,10 +285,12 @@ class SoftyComp {
|
|
|
285
285
|
*/
|
|
286
286
|
parseWebhook(body) {
|
|
287
287
|
const event = typeof body === 'string' ? JSON.parse(body) : body;
|
|
288
|
-
//
|
|
288
|
+
// Handle both field names: activityTypeID (docs) and WebhookTypeID (observed)
|
|
289
|
+
// Mapping: 1=Pending, 2=Successful, 3=Failed, 4=Cancelled
|
|
290
|
+
const typeId = event.activityTypeID || event.WebhookTypeID || 1;
|
|
289
291
|
let type = 'pending';
|
|
290
292
|
let status = 'pending';
|
|
291
|
-
switch (
|
|
293
|
+
switch (typeId) {
|
|
292
294
|
case 2:
|
|
293
295
|
type = 'successful';
|
|
294
296
|
status = 'completed';
|