payment-kit 1.14.1 → 1.14.3
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/api/src/libs/refund.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BN } from '@ocap/util';
|
|
2
|
-
import type
|
|
2
|
+
import { Op, type WhereOptions } from 'sequelize';
|
|
3
3
|
import { PaymentIntent, Refund } from '../store/models';
|
|
4
4
|
|
|
5
5
|
export async function getRefundAmountSetup({
|
|
@@ -20,7 +20,9 @@ export async function getRefundAmountSetup({
|
|
|
20
20
|
throw new Error('PaymentIntent not found');
|
|
21
21
|
}
|
|
22
22
|
const where: WhereOptions<Refund> = {
|
|
23
|
-
status:
|
|
23
|
+
status: {
|
|
24
|
+
[Op.not]: 'canceled',
|
|
25
|
+
},
|
|
24
26
|
payment_intent_id: paymentIntentId,
|
|
25
27
|
};
|
|
26
28
|
if (currencyId) {
|
|
@@ -6,6 +6,7 @@ import pick from 'lodash/pick';
|
|
|
6
6
|
import type { LiteralUnion } from 'type-fest';
|
|
7
7
|
import { withQuery } from 'ufo';
|
|
8
8
|
|
|
9
|
+
import { Op } from 'sequelize';
|
|
9
10
|
import {
|
|
10
11
|
Customer,
|
|
11
12
|
Invoice,
|
|
@@ -642,7 +643,13 @@ export async function getRemainingStakes(subscriptionIds: string[], subscription
|
|
|
642
643
|
await Promise.all(
|
|
643
644
|
subscriptionIds.map(async (subscriptionId) => {
|
|
644
645
|
const refund = await Refund.findOne({
|
|
645
|
-
where: {
|
|
646
|
+
where: {
|
|
647
|
+
subscription_id: subscriptionId,
|
|
648
|
+
status: {
|
|
649
|
+
[Op.not]: 'canceled',
|
|
650
|
+
},
|
|
651
|
+
type: 'stake_return',
|
|
652
|
+
},
|
|
646
653
|
});
|
|
647
654
|
if (!refund) {
|
|
648
655
|
// this subscription not return stake
|
package/blocklet.yml
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "payment-kit",
|
|
3
|
-
"version": "1.14.
|
|
3
|
+
"version": "1.14.3",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "blocklet dev --open",
|
|
6
6
|
"eject": "vite eject",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@arcblock/validator": "^1.18.124",
|
|
53
53
|
"@blocklet/js-sdk": "1.16.28",
|
|
54
54
|
"@blocklet/logger": "1.16.28",
|
|
55
|
-
"@blocklet/payment-react": "1.14.
|
|
55
|
+
"@blocklet/payment-react": "1.14.3",
|
|
56
56
|
"@blocklet/sdk": "1.16.28",
|
|
57
57
|
"@blocklet/ui-react": "^2.10.3",
|
|
58
58
|
"@blocklet/uploader": "^0.1.20",
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
"devDependencies": {
|
|
119
119
|
"@abtnode/types": "1.16.28",
|
|
120
120
|
"@arcblock/eslint-config-ts": "^0.3.2",
|
|
121
|
-
"@blocklet/payment-types": "1.14.
|
|
121
|
+
"@blocklet/payment-types": "1.14.3",
|
|
122
122
|
"@types/cookie-parser": "^1.4.7",
|
|
123
123
|
"@types/cors": "^2.8.17",
|
|
124
124
|
"@types/debug": "^4.1.12",
|
|
@@ -160,5 +160,5 @@
|
|
|
160
160
|
"parser": "typescript"
|
|
161
161
|
}
|
|
162
162
|
},
|
|
163
|
-
"gitHead": "
|
|
163
|
+
"gitHead": "23e4827487dc9e180191948a58074abfb47dee1d"
|
|
164
164
|
}
|
|
@@ -80,13 +80,12 @@ export const groupData = (data: TPaymentStat[], currencies: { [key: string]: any
|
|
|
80
80
|
export default function Overview() {
|
|
81
81
|
const { t, locale } = useLocaleContext();
|
|
82
82
|
const { settings } = usePaymentContext();
|
|
83
|
-
const maxDate = dayjs().toDate();
|
|
83
|
+
const maxDate = dayjs().endOf('day').toDate();
|
|
84
84
|
const [state, setState] = useSetState({
|
|
85
85
|
anchorEl: null,
|
|
86
|
-
startDate: dayjs().subtract(30, 'day').toDate(),
|
|
86
|
+
startDate: dayjs().subtract(30, 'day').startOf('day').toDate(),
|
|
87
87
|
endDate: maxDate,
|
|
88
88
|
});
|
|
89
|
-
|
|
90
89
|
const trend = useRequest<TPaymentStat[], any>(async () => {
|
|
91
90
|
const result = await api.get('/api/payment-stats', {
|
|
92
91
|
params: {
|
|
@@ -122,7 +121,7 @@ export default function Overview() {
|
|
|
122
121
|
const onRangeChange = (range: any) => {
|
|
123
122
|
setState({
|
|
124
123
|
startDate: range.startDate,
|
|
125
|
-
endDate: range.endDate,
|
|
124
|
+
endDate: dayjs(range.endDate).endOf('day').toDate(),
|
|
126
125
|
anchorEl: null,
|
|
127
126
|
});
|
|
128
127
|
};
|