@goweekdays/layer-common 0.0.7 → 0.0.9
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/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export default function usePayment() {
|
|
2
|
+
function getPayments({
|
|
3
|
+
search = "",
|
|
4
|
+
id = "",
|
|
5
|
+
page = 1,
|
|
6
|
+
status = "completed",
|
|
7
|
+
} = {}) {
|
|
8
|
+
return useNuxtApp().$api<Record<string, any>>("/api/payments", {
|
|
9
|
+
method: "GET",
|
|
10
|
+
query: {
|
|
11
|
+
search,
|
|
12
|
+
id,
|
|
13
|
+
page,
|
|
14
|
+
status,
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
getPayments,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
export default function usePaymentMethod() {
|
|
2
2
|
function linkEWallet({
|
|
3
|
-
mobile_number = "",
|
|
4
3
|
type = "GCASH",
|
|
5
|
-
|
|
6
|
-
user = "",
|
|
4
|
+
customer_id = "",
|
|
7
5
|
success_return_url = "",
|
|
8
6
|
failure_return_url = "",
|
|
9
7
|
cancel_return_url = "",
|
|
@@ -14,10 +12,8 @@ export default function usePaymentMethod() {
|
|
|
14
12
|
{
|
|
15
13
|
method: "POST",
|
|
16
14
|
body: {
|
|
17
|
-
|
|
15
|
+
customer_id,
|
|
18
16
|
type,
|
|
19
|
-
user,
|
|
20
|
-
org,
|
|
21
17
|
success_return_url,
|
|
22
18
|
failure_return_url,
|
|
23
19
|
cancel_return_url,
|
|
@@ -17,13 +17,15 @@ export default function usePromoCode() {
|
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
function getByCode(code: string) {
|
|
21
|
-
return useNuxtApp().$api<Record<string, any>>(
|
|
22
|
-
|
|
23
|
-
{
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
function getByCode(code: string, type?: string, assigned?: boolean) {
|
|
21
|
+
return useNuxtApp().$api<Record<string, any>>("/api/promo-codes/code", {
|
|
22
|
+
method: "GET",
|
|
23
|
+
params: {
|
|
24
|
+
code,
|
|
25
|
+
type,
|
|
26
|
+
assigned,
|
|
27
|
+
},
|
|
28
|
+
});
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
return {
|
package/composables/useUtils.ts
CHANGED
|
@@ -189,6 +189,25 @@ export default function useUtils() {
|
|
|
189
189
|
// console.log(formatNumber(1234.56, { useSymbol: true, currency: "EUR", locale: "de-DE" })); // "1.234,56 €"
|
|
190
190
|
// console.log(formatNumber(1234.56, { useSymbol: true, currency: "EUR", locale: "de-DE", decimalPlaces: 0 })); // "1.234 €"
|
|
191
191
|
|
|
192
|
+
function computeTieredCost(seats: number, tiers: TPromoTier[]) {
|
|
193
|
+
let totalCost = 0;
|
|
194
|
+
|
|
195
|
+
for (let i = 0; i < tiers.length; i++) {
|
|
196
|
+
let { min, max, price } = tiers[i];
|
|
197
|
+
|
|
198
|
+
if (max === 0) max = Infinity; // Handle unlimited tier
|
|
199
|
+
|
|
200
|
+
if (seats >= min) {
|
|
201
|
+
let seatsInTier = Math.min(seats, max) - min + 1;
|
|
202
|
+
totalCost += seatsInTier * price;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
if (seats <= max) break; // Stop when all seats are counted
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
return totalCost;
|
|
209
|
+
}
|
|
210
|
+
|
|
192
211
|
return {
|
|
193
212
|
requiredRule,
|
|
194
213
|
emailRule,
|
|
@@ -207,5 +226,6 @@ export default function useUtils() {
|
|
|
207
226
|
formatNumber,
|
|
208
227
|
validateDate,
|
|
209
228
|
minOneMonthAdvance,
|
|
229
|
+
computeTieredCost,
|
|
210
230
|
};
|
|
211
231
|
}
|
package/package.json
CHANGED