@bigbinary/neeto-payments-frontend 1.4.17 → 1.4.19
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/README.md +4 -0
- package/dist/AccountsDashboard.js +472 -0
- package/dist/AccountsDashboard.js.map +1 -0
- package/dist/Dashboard.js +597 -0
- package/dist/Dashboard.js.map +1 -0
- package/dist/ExportModal-a00544db.js +643 -0
- package/dist/ExportModal-a00544db.js.map +1 -0
- package/dist/IdentifierButton-73cadb18.js +20 -0
- package/dist/IdentifierButton-73cadb18.js.map +1 -0
- package/dist/PaymentKindRestrictionAlert.js +34 -0
- package/dist/PaymentKindRestrictionAlert.js.map +1 -0
- package/dist/PayoutsDashboard.js +502 -0
- package/dist/PayoutsDashboard.js.map +1 -0
- package/dist/PayoutsPage.js +184 -0
- package/dist/PayoutsPage.js.map +1 -0
- package/dist/RazorpayDashboard.js +246 -0
- package/dist/RazorpayDashboard.js.map +1 -0
- package/dist/RazorpayPaymentButton.js +108 -0
- package/dist/RazorpayPaymentButton.js.map +1 -0
- package/dist/SquareCard.js +65 -0
- package/dist/SquareCard.js.map +1 -0
- package/dist/SquareDashboard.js +294 -0
- package/dist/SquareDashboard.js.map +1 -0
- package/dist/StripeConnect.js +2067 -0
- package/dist/StripeConnect.js.map +1 -0
- package/dist/UpiConnect.js +148 -0
- package/dist/UpiConnect.js.map +1 -0
- package/dist/UpiMarkAsPaidButton.js +39 -0
- package/dist/UpiMarkAsPaidButton.js.map +1 -0
- package/dist/UpiPayment.js +91 -0
- package/dist/UpiPayment.js.map +1 -0
- package/dist/V2PaymentsDashboard.js +298 -0
- package/dist/V2PaymentsDashboard.js.map +1 -0
- package/dist/buildStripeTransactionLink.js +6 -0
- package/dist/buildStripeTransactionLink.js.map +1 -0
- package/dist/cjs/AccountsDashboard.js +489 -0
- package/dist/cjs/AccountsDashboard.js.map +1 -0
- package/dist/cjs/Dashboard.js +612 -0
- package/dist/cjs/Dashboard.js.map +1 -0
- package/dist/cjs/ExportModal-408e0ed8.js +667 -0
- package/dist/cjs/ExportModal-408e0ed8.js.map +1 -0
- package/dist/cjs/IdentifierButton-40b5459d.js +27 -0
- package/dist/cjs/IdentifierButton-40b5459d.js.map +1 -0
- package/dist/cjs/PaymentKindRestrictionAlert.js +41 -0
- package/dist/cjs/PaymentKindRestrictionAlert.js.map +1 -0
- package/dist/cjs/PayoutsDashboard.js +518 -0
- package/dist/cjs/PayoutsDashboard.js.map +1 -0
- package/dist/cjs/PayoutsPage.js +193 -0
- package/dist/cjs/PayoutsPage.js.map +1 -0
- package/dist/cjs/RazorpayDashboard.js +257 -0
- package/dist/cjs/RazorpayDashboard.js.map +1 -0
- package/dist/cjs/RazorpayPaymentButton.js +115 -0
- package/dist/cjs/RazorpayPaymentButton.js.map +1 -0
- package/dist/cjs/SquareCard.js +73 -0
- package/dist/cjs/SquareCard.js.map +1 -0
- package/dist/cjs/SquareDashboard.js +305 -0
- package/dist/cjs/SquareDashboard.js.map +1 -0
- package/dist/cjs/StripeConnect.js +2102 -0
- package/dist/cjs/StripeConnect.js.map +1 -0
- package/dist/cjs/UpiConnect.js +181 -0
- package/dist/cjs/UpiConnect.js.map +1 -0
- package/dist/cjs/UpiMarkAsPaidButton.js +46 -0
- package/dist/cjs/UpiMarkAsPaidButton.js.map +1 -0
- package/dist/cjs/UpiPayment.js +121 -0
- package/dist/cjs/UpiPayment.js.map +1 -0
- package/dist/cjs/V2PaymentsDashboard.js +309 -0
- package/dist/cjs/V2PaymentsDashboard.js.map +1 -0
- package/dist/cjs/buildStripeTransactionLink.js +11 -0
- package/dist/cjs/buildStripeTransactionLink.js.map +1 -0
- package/dist/cjs/constants.js +495 -0
- package/dist/cjs/constants.js.map +1 -0
- package/dist/cjs/exportChannel-e4cc2bb1.js +37 -0
- package/dist/cjs/exportChannel-e4cc2bb1.js.map +1 -0
- package/dist/cjs/extends-1b35a664.js +19 -0
- package/dist/cjs/extends-1b35a664.js.map +1 -0
- package/dist/cjs/index-042b6907.js.map +1 -0
- package/dist/cjs/index-b097dce8.js +41 -0
- package/dist/cjs/index-b097dce8.js.map +1 -0
- package/dist/cjs/index-b7badf96.js +88 -0
- package/dist/cjs/index-b7badf96.js.map +1 -0
- package/dist/cjs/index.js +106 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/queryConstants-a6a3c360.js +26 -0
- package/dist/cjs/queryConstants-a6a3c360.js.map +1 -0
- package/dist/cjs/renderFunctions-5e706b7a.js +168 -0
- package/dist/cjs/renderFunctions-5e706b7a.js.map +1 -0
- package/dist/cjs/stripe.esm-4218a1e9.js.map +1 -0
- package/dist/cjs/useConnectApi-b8770f71.js +2170 -0
- package/dist/cjs/useConnectApi-b8770f71.js.map +1 -0
- package/dist/cjs/useFiltersAndPagination-a5f10d80.js +410 -0
- package/dist/cjs/useFiltersAndPagination-a5f10d80.js.map +1 -0
- package/dist/cjs/usePaymentApi-a0b4ea86.js +41 -0
- package/dist/cjs/usePaymentApi-a0b4ea86.js.map +1 -0
- package/dist/cjs/usePaymentsApi-5eba9184.js +30 -0
- package/dist/cjs/usePaymentsApi-5eba9184.js.map +1 -0
- package/dist/cjs/usePlatformApi-c77f6fdd.js +89 -0
- package/dist/cjs/usePlatformApi-c77f6fdd.js.map +1 -0
- package/dist/cjs/useRazorpayPayment.js +87 -0
- package/dist/cjs/useRazorpayPayment.js.map +1 -0
- package/dist/cjs/useSquareCard.js +32 -0
- package/dist/cjs/useSquareCard.js.map +1 -0
- package/dist/cjs/useStripePromise.js +27 -0
- package/dist/cjs/useStripePromise.js.map +1 -0
- package/dist/constants.js +480 -0
- package/dist/constants.js.map +1 -0
- package/dist/exportChannel-e0822151.js +30 -0
- package/dist/exportChannel-e0822151.js.map +1 -0
- package/dist/extends-093996c9.js +17 -0
- package/dist/extends-093996c9.js.map +1 -0
- package/dist/index-1aedc364.js +80 -0
- package/dist/index-1aedc364.js.map +1 -0
- package/dist/index-48f8b281.js +32 -0
- package/dist/index-48f8b281.js.map +1 -0
- package/dist/index.js +80 -10090
- package/dist/index.js.map +1 -1
- package/dist/queryConstants-9b7fe0cf.js +24 -0
- package/dist/queryConstants-9b7fe0cf.js.map +1 -0
- package/dist/renderFunctions-5f829290.js +147 -0
- package/dist/renderFunctions-5f829290.js.map +1 -0
- package/dist/useConnectApi-185a67ad.js +2155 -0
- package/dist/useConnectApi-185a67ad.js.map +1 -0
- package/dist/useFiltersAndPagination-e5dc4b96.js +392 -0
- package/dist/useFiltersAndPagination-e5dc4b96.js.map +1 -0
- package/dist/usePaymentApi-8b68e636.js +34 -0
- package/dist/usePaymentApi-8b68e636.js.map +1 -0
- package/dist/usePaymentsApi-c1c0e6ab.js +23 -0
- package/dist/usePaymentsApi-c1c0e6ab.js.map +1 -0
- package/dist/usePlatformApi-5dba6b28.js +77 -0
- package/dist/usePlatformApi-5dba6b28.js.map +1 -0
- package/dist/useRazorpayPayment.js +85 -0
- package/dist/useRazorpayPayment.js.map +1 -0
- package/dist/useSquareCard.js +30 -0
- package/dist/useSquareCard.js.map +1 -0
- package/dist/useStripePromise.js +25 -0
- package/dist/useStripePromise.js.map +1 -0
- package/package.json +17 -8
- package/types/AccountsDashboard.d.ts +3 -0
- package/types/Dashboard.d.ts +15 -0
- package/types/PaymentKindRestrictionAlert.d.ts +11 -0
- package/types/PayoutsDashboard.d.ts +10 -0
- package/types/PayoutsPage.d.ts +11 -0
- package/types/SquareCard.d.ts +14 -0
- package/types/SquareDashboard.d.ts +13 -0
- package/types/StripeConnect.d.ts +13 -0
- package/types/buildStripeTransactionLink.d.ts +6 -0
- package/types/useSquareCard.d.ts +9 -0
- package/types/useStripePromise.d.ts +5 -0
- package/types.d.ts +11 -75
- package/dist/index-042b6907.js.map +0 -1
- package/dist/index.cjs.js +0 -10166
- package/dist/index.cjs.js.map +0 -1
- package/dist/stripe.esm-4218a1e9.js.map +0 -1
- /package/dist/{index-042b6907.js → cjs/index-042b6907.js} +0 -0
- /package/dist/{stripe.esm-4218a1e9.js → cjs/stripe.esm-4218a1e9.js} +0 -0
|
@@ -0,0 +1,643 @@
|
|
|
1
|
+
import React__default, { useState, useMemo, useEffect } from 'react';
|
|
2
|
+
import { Download } from '@bigbinary/neeto-icons';
|
|
3
|
+
import Button from '@bigbinary/neetoui/Button';
|
|
4
|
+
import Modal from '@bigbinary/neetoui/Modal';
|
|
5
|
+
import Typography from '@bigbinary/neetoui/Typography';
|
|
6
|
+
import { useTranslation } from 'react-i18next';
|
|
7
|
+
import { useMutation } from 'react-query';
|
|
8
|
+
import axios from 'axios';
|
|
9
|
+
import { BASE_URL } from './constants.js';
|
|
10
|
+
import { u as useExportData, e as exportChannel } from './exportChannel-e0822151.js';
|
|
11
|
+
import { a as buildStripeTransactionLink, c as buildStripeSplitLink, d as buildStripeTransferLink, b as buildStripeAccountLink, e as buildStripeRefundLink, u as uuidV4 } from './index-48f8b281.js';
|
|
12
|
+
import { isPresent, snakeToCamelCase, filterBy } from '@bigbinary/neeto-cist';
|
|
13
|
+
import { curry, equals, sortBy, prop, concat, map, evolve } from 'ramda';
|
|
14
|
+
import { t } from 'i18next';
|
|
15
|
+
import Tag from '@bigbinary/neetoui/Tag';
|
|
16
|
+
import Tooltip from '@bigbinary/neetoui/Tooltip';
|
|
17
|
+
import { C as CopyButtonWrapper, c as renderDate, r as renderStatus } from './renderFunctions-5f829290.js';
|
|
18
|
+
import { I as IdentifierButton } from './IdentifierButton-73cadb18.js';
|
|
19
|
+
import { K as KIND, A as APPENDABLE_SEARCH_PROPS } from './index-1aedc364.js';
|
|
20
|
+
|
|
21
|
+
const exportData = payload => axios.post(`${BASE_URL}/api/v1/razorpay/exports`, payload);
|
|
22
|
+
const exportsApi = {
|
|
23
|
+
exportData
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const useExportRazorpayData = () => useMutation(payload => exportsApi.exportData(payload));
|
|
27
|
+
|
|
28
|
+
const renderIdentifier = function () {
|
|
29
|
+
let {
|
|
30
|
+
identifier = "",
|
|
31
|
+
live: isLive = false
|
|
32
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
33
|
+
return /*#__PURE__*/React__default.createElement(CopyButtonWrapper, {
|
|
34
|
+
content: identifier
|
|
35
|
+
}, /*#__PURE__*/React__default.createElement(IdentifierButton, {
|
|
36
|
+
href: buildStripeTransactionLink(identifier, isLive),
|
|
37
|
+
label: identifier
|
|
38
|
+
}));
|
|
39
|
+
};
|
|
40
|
+
curry((type, kind) => /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
41
|
+
content: t(`neetoPayments.tooltipContent.${type}.${kind}`),
|
|
42
|
+
position: "top"
|
|
43
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
44
|
+
className: "w-fit"
|
|
45
|
+
}, /*#__PURE__*/React__default.createElement(Tag, {
|
|
46
|
+
label: t(`neetoPayments.tagLabels.${type}.${kind}`),
|
|
47
|
+
style: "secondary"
|
|
48
|
+
}))));
|
|
49
|
+
const renderSplitIdentifier = _ref => {
|
|
50
|
+
let {
|
|
51
|
+
identifier,
|
|
52
|
+
live: isLive
|
|
53
|
+
} = _ref;
|
|
54
|
+
return identifier ? /*#__PURE__*/React__default.createElement(CopyButtonWrapper, {
|
|
55
|
+
content: identifier
|
|
56
|
+
}, /*#__PURE__*/React__default.createElement(IdentifierButton, {
|
|
57
|
+
href: buildStripeSplitLink(identifier, isLive),
|
|
58
|
+
label: identifier
|
|
59
|
+
})) : /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
60
|
+
content: t("neetoPayments.tooltipContent.identifierUnavailable"),
|
|
61
|
+
position: "top"
|
|
62
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
63
|
+
className: "text-center"
|
|
64
|
+
}, /*#__PURE__*/React__default.createElement(Typography, {
|
|
65
|
+
style: "body2"
|
|
66
|
+
}, t("neetoPayments.common.notAvailable"))));
|
|
67
|
+
};
|
|
68
|
+
const renderTransferIdentifier = function () {
|
|
69
|
+
let {
|
|
70
|
+
identifier = "",
|
|
71
|
+
account = {},
|
|
72
|
+
live: isLive = false
|
|
73
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
74
|
+
return identifier ? /*#__PURE__*/React__default.createElement(CopyButtonWrapper, {
|
|
75
|
+
content: identifier
|
|
76
|
+
}, /*#__PURE__*/React__default.createElement(IdentifierButton, {
|
|
77
|
+
label: identifier,
|
|
78
|
+
href: identifier.startsWith("py") ? buildStripeTransferLink(identifier, account?.identifier, isLive) : buildStripeTransactionLink(identifier, isLive)
|
|
79
|
+
})) : /*#__PURE__*/React__default.createElement("div", {
|
|
80
|
+
className: "text-center"
|
|
81
|
+
}, /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
82
|
+
position: "top",
|
|
83
|
+
content: t("neetoPayments.tooltipContent.connectedTransactionUnavailable")
|
|
84
|
+
}, /*#__PURE__*/React__default.createElement(Typography, {
|
|
85
|
+
style: "body2"
|
|
86
|
+
}, t("neetoPayments.common.notAvailable"))));
|
|
87
|
+
};
|
|
88
|
+
const renderPlatformIdentifier = curry((setPaneStatus, data) => /*#__PURE__*/React__default.createElement(CopyButtonWrapper, {
|
|
89
|
+
content: data?.identifier
|
|
90
|
+
}, /*#__PURE__*/React__default.createElement(Button, {
|
|
91
|
+
label: data?.identifier,
|
|
92
|
+
size: "small",
|
|
93
|
+
style: "link",
|
|
94
|
+
onClick: () => setPaneStatus({
|
|
95
|
+
transactionId: data?.id,
|
|
96
|
+
isOpen: true
|
|
97
|
+
})
|
|
98
|
+
})));
|
|
99
|
+
const renderAccountIdentifier = _ref2 => {
|
|
100
|
+
let {
|
|
101
|
+
identifier = "",
|
|
102
|
+
live: isLive = false
|
|
103
|
+
} = _ref2;
|
|
104
|
+
return /*#__PURE__*/React__default.createElement(CopyButtonWrapper, {
|
|
105
|
+
content: identifier
|
|
106
|
+
}, /*#__PURE__*/React__default.createElement(IdentifierButton, {
|
|
107
|
+
href: buildStripeAccountLink(identifier, isLive),
|
|
108
|
+
label: identifier
|
|
109
|
+
}));
|
|
110
|
+
};
|
|
111
|
+
const renderSplitDate = date => isPresent(date) ? renderDate(date) : /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
112
|
+
content: t("neetoPayments.tooltipContent.dateUnavailable"),
|
|
113
|
+
position: "top"
|
|
114
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
115
|
+
className: "text-center"
|
|
116
|
+
}, /*#__PURE__*/React__default.createElement(Typography, {
|
|
117
|
+
style: "body2"
|
|
118
|
+
}, t("neetoPayments.common.notAvailable"))));
|
|
119
|
+
const renderRefundIdentifier = function () {
|
|
120
|
+
let {
|
|
121
|
+
identifier = "",
|
|
122
|
+
live: isLive = false
|
|
123
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
124
|
+
return /*#__PURE__*/React__default.createElement(CopyButtonWrapper, {
|
|
125
|
+
content: identifier
|
|
126
|
+
}, /*#__PURE__*/React__default.createElement(IdentifierButton, {
|
|
127
|
+
href: buildStripeRefundLink(identifier, isLive),
|
|
128
|
+
label: identifier
|
|
129
|
+
}));
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
const generateSpecialColumns = _ref => {
|
|
133
|
+
let {
|
|
134
|
+
setPaneStatus
|
|
135
|
+
} = _ref;
|
|
136
|
+
return [{
|
|
137
|
+
title: t("neetoPayments.common.platformTransaction"),
|
|
138
|
+
dataIndex: "paymentIntent",
|
|
139
|
+
key: "paymentIntent",
|
|
140
|
+
width: "290px",
|
|
141
|
+
position: 9,
|
|
142
|
+
render: renderPlatformIdentifier(setPaneStatus)
|
|
143
|
+
}];
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
const COLUMNS = [{
|
|
147
|
+
title: t("neetoPayments.common.id"),
|
|
148
|
+
dataIndex: "id",
|
|
149
|
+
key: "id",
|
|
150
|
+
width: "72px",
|
|
151
|
+
position: 0,
|
|
152
|
+
isHidable: false
|
|
153
|
+
}, {
|
|
154
|
+
title: t("neetoPayments.common.identifier"),
|
|
155
|
+
dataIndex: "identifier",
|
|
156
|
+
key: "identifier",
|
|
157
|
+
width: "300px",
|
|
158
|
+
render: renderIdentifier,
|
|
159
|
+
position: 1,
|
|
160
|
+
isHidable: false
|
|
161
|
+
}, {
|
|
162
|
+
title: t("neetoPayments.common.identifier"),
|
|
163
|
+
dataIndex: "identifier",
|
|
164
|
+
key: "splitIdentifier",
|
|
165
|
+
width: "300px",
|
|
166
|
+
render: renderSplitIdentifier,
|
|
167
|
+
position: 1,
|
|
168
|
+
isHidable: false
|
|
169
|
+
}, {
|
|
170
|
+
title: t("neetoPayments.common.identifier"),
|
|
171
|
+
dataIndex: "identifier",
|
|
172
|
+
key: "refundIdentifier",
|
|
173
|
+
width: "300px",
|
|
174
|
+
render: renderRefundIdentifier,
|
|
175
|
+
position: 1,
|
|
176
|
+
isHidable: false
|
|
177
|
+
}, {
|
|
178
|
+
title: t("neetoPayments.common.identifier"),
|
|
179
|
+
dataIndex: "identifier",
|
|
180
|
+
key: "transferIdentifier",
|
|
181
|
+
width: "300px",
|
|
182
|
+
render: renderTransferIdentifier,
|
|
183
|
+
position: 1,
|
|
184
|
+
isHidable: false
|
|
185
|
+
}, {
|
|
186
|
+
title: t("neetoPayments.common.status"),
|
|
187
|
+
dataIndex: "status",
|
|
188
|
+
key: "status",
|
|
189
|
+
width: "150px",
|
|
190
|
+
render: renderStatus("transaction"),
|
|
191
|
+
sorter: true,
|
|
192
|
+
position: 2,
|
|
193
|
+
isHidable: false
|
|
194
|
+
}, {
|
|
195
|
+
title: t("neetoPayments.common.amount"),
|
|
196
|
+
dataIndex: "amount",
|
|
197
|
+
key: "amount",
|
|
198
|
+
width: "150px",
|
|
199
|
+
sorter: true,
|
|
200
|
+
position: 3
|
|
201
|
+
}, {
|
|
202
|
+
title: t("neetoPayments.common.platformSplitAmount"),
|
|
203
|
+
dataIndex: "platformSplitAmount",
|
|
204
|
+
key: "platformSplitAmount",
|
|
205
|
+
width: "280px",
|
|
206
|
+
position: 3
|
|
207
|
+
}, {
|
|
208
|
+
title: t("neetoPayments.common.paymentTime"),
|
|
209
|
+
dataIndex: "paymentAt",
|
|
210
|
+
key: "paymentTime",
|
|
211
|
+
width: "220px",
|
|
212
|
+
render: renderDate,
|
|
213
|
+
sorter: true,
|
|
214
|
+
position: 5
|
|
215
|
+
}, {
|
|
216
|
+
title: t("neetoPayments.common.refundTime"),
|
|
217
|
+
dataIndex: "refunds",
|
|
218
|
+
key: "refundsTime",
|
|
219
|
+
width: "220px",
|
|
220
|
+
render: function () {
|
|
221
|
+
let refunds = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
222
|
+
return renderDate(refunds[0]?.updatedAt);
|
|
223
|
+
},
|
|
224
|
+
position: 6
|
|
225
|
+
}, {
|
|
226
|
+
title: t("neetoPayments.common.status"),
|
|
227
|
+
dataIndex: "status",
|
|
228
|
+
width: "150px",
|
|
229
|
+
key: "refundStatus",
|
|
230
|
+
render: renderStatus("refund"),
|
|
231
|
+
sorter: true,
|
|
232
|
+
position: 3,
|
|
233
|
+
isHidable: false
|
|
234
|
+
}, {
|
|
235
|
+
title: t("neetoPayments.common.paymentAmount"),
|
|
236
|
+
dataIndex: "paymentAmount",
|
|
237
|
+
key: "paymentAmount",
|
|
238
|
+
width: "240px",
|
|
239
|
+
sorter: true,
|
|
240
|
+
position: 4
|
|
241
|
+
}, {
|
|
242
|
+
title: t("neetoPayments.common.refundAmount"),
|
|
243
|
+
dataIndex: "amount",
|
|
244
|
+
key: "refundAmount",
|
|
245
|
+
width: "200px",
|
|
246
|
+
sorter: true,
|
|
247
|
+
position: 3
|
|
248
|
+
}, {
|
|
249
|
+
title: t("neetoPayments.common.refundTime"),
|
|
250
|
+
dataIndex: "updatedAt",
|
|
251
|
+
key: "refundTime",
|
|
252
|
+
width: "220px",
|
|
253
|
+
render: renderDate,
|
|
254
|
+
sorter: true,
|
|
255
|
+
position: 9
|
|
256
|
+
}, {
|
|
257
|
+
title: t("neetoPayments.common.status"),
|
|
258
|
+
dataIndex: "status",
|
|
259
|
+
key: "splitStatus",
|
|
260
|
+
width: "150px",
|
|
261
|
+
render: renderStatus("split"),
|
|
262
|
+
sorter: true,
|
|
263
|
+
position: 3,
|
|
264
|
+
isHidable: false
|
|
265
|
+
}, {
|
|
266
|
+
title: t("neetoPayments.common.transferTime"),
|
|
267
|
+
key: "splitTime",
|
|
268
|
+
dataIndex: "paymentAt",
|
|
269
|
+
width: "220px",
|
|
270
|
+
render: renderSplitDate,
|
|
271
|
+
sorter: true,
|
|
272
|
+
position: 7
|
|
273
|
+
}, {
|
|
274
|
+
title: t("neetoPayments.common.paymentIdentifier"),
|
|
275
|
+
key: "refundPaymentIdentifier",
|
|
276
|
+
dataIndex: "transaction",
|
|
277
|
+
width: "300px",
|
|
278
|
+
render: renderTransferIdentifier,
|
|
279
|
+
position: 8
|
|
280
|
+
}, {
|
|
281
|
+
title: t("neetoPayments.common.connectedTransaction"),
|
|
282
|
+
dataIndex: "connectedPayment",
|
|
283
|
+
key: "connectedPayment",
|
|
284
|
+
width: "300px",
|
|
285
|
+
render: renderTransferIdentifier,
|
|
286
|
+
position: 9
|
|
287
|
+
}, {
|
|
288
|
+
title: t("neetoPayments.common.accountIdentifier"),
|
|
289
|
+
dataIndex: "account",
|
|
290
|
+
key: "destinationAccount",
|
|
291
|
+
width: "160px",
|
|
292
|
+
render: renderAccountIdentifier,
|
|
293
|
+
position: 10
|
|
294
|
+
}];
|
|
295
|
+
const COLUMN_METADATA = {
|
|
296
|
+
identifier: {
|
|
297
|
+
isHidden: {
|
|
298
|
+
split: true,
|
|
299
|
+
transfer: true,
|
|
300
|
+
refund: true
|
|
301
|
+
}
|
|
302
|
+
},
|
|
303
|
+
amount: {
|
|
304
|
+
isHidden: {
|
|
305
|
+
refund: true
|
|
306
|
+
}
|
|
307
|
+
},
|
|
308
|
+
paymentTime: {
|
|
309
|
+
isHidden: {
|
|
310
|
+
refund: true,
|
|
311
|
+
split: true
|
|
312
|
+
}
|
|
313
|
+
},
|
|
314
|
+
splitIdentifier: {
|
|
315
|
+
isHidden: {
|
|
316
|
+
platform: true,
|
|
317
|
+
refund: true,
|
|
318
|
+
connected: true,
|
|
319
|
+
transfer: true,
|
|
320
|
+
pending: true
|
|
321
|
+
}
|
|
322
|
+
},
|
|
323
|
+
transferIdentifier: {
|
|
324
|
+
isHidden: {
|
|
325
|
+
platform: true,
|
|
326
|
+
split: true,
|
|
327
|
+
connected: true,
|
|
328
|
+
refund: true
|
|
329
|
+
}
|
|
330
|
+
},
|
|
331
|
+
platformSplitAmount: {
|
|
332
|
+
isHidden: {
|
|
333
|
+
platform: true,
|
|
334
|
+
connected: true,
|
|
335
|
+
transfer: true,
|
|
336
|
+
refund: true
|
|
337
|
+
}
|
|
338
|
+
},
|
|
339
|
+
status: {
|
|
340
|
+
isHidden: {
|
|
341
|
+
refund: true,
|
|
342
|
+
split: true,
|
|
343
|
+
declined: true,
|
|
344
|
+
pending: true,
|
|
345
|
+
successful: true,
|
|
346
|
+
refunded: true
|
|
347
|
+
}
|
|
348
|
+
},
|
|
349
|
+
refundStatus: {
|
|
350
|
+
isHidden: {
|
|
351
|
+
platform: true,
|
|
352
|
+
split: true,
|
|
353
|
+
connected: true,
|
|
354
|
+
transfer: true,
|
|
355
|
+
failed: true,
|
|
356
|
+
pending: true,
|
|
357
|
+
successful: true
|
|
358
|
+
}
|
|
359
|
+
},
|
|
360
|
+
refundAmount: {
|
|
361
|
+
isHidden: {
|
|
362
|
+
platform: true,
|
|
363
|
+
split: true,
|
|
364
|
+
connected: true,
|
|
365
|
+
transfer: true
|
|
366
|
+
}
|
|
367
|
+
},
|
|
368
|
+
refundTime: {
|
|
369
|
+
isHidden: {
|
|
370
|
+
platform: true,
|
|
371
|
+
split: true,
|
|
372
|
+
connected: true,
|
|
373
|
+
transfer: true
|
|
374
|
+
}
|
|
375
|
+
},
|
|
376
|
+
splitStatus: {
|
|
377
|
+
isHidden: {
|
|
378
|
+
platform: true,
|
|
379
|
+
refund: true,
|
|
380
|
+
connected: true,
|
|
381
|
+
transfer: true,
|
|
382
|
+
declined: true,
|
|
383
|
+
pending: true,
|
|
384
|
+
successful: true,
|
|
385
|
+
cancelled: true
|
|
386
|
+
}
|
|
387
|
+
},
|
|
388
|
+
splitTime: {
|
|
389
|
+
isHidden: {
|
|
390
|
+
platform: true,
|
|
391
|
+
refund: true,
|
|
392
|
+
connected: true,
|
|
393
|
+
transfer: true
|
|
394
|
+
}
|
|
395
|
+
},
|
|
396
|
+
paymentIntent: {
|
|
397
|
+
isHidden: {
|
|
398
|
+
platform: true,
|
|
399
|
+
refund: true,
|
|
400
|
+
connected: true,
|
|
401
|
+
transfer: true
|
|
402
|
+
}
|
|
403
|
+
},
|
|
404
|
+
connectedPayment: {
|
|
405
|
+
isHidden: {
|
|
406
|
+
platform: true,
|
|
407
|
+
refund: true,
|
|
408
|
+
connected: true,
|
|
409
|
+
transfer: true,
|
|
410
|
+
pending: true
|
|
411
|
+
}
|
|
412
|
+
},
|
|
413
|
+
refundPaymentIdentifier: {
|
|
414
|
+
isHidden: {
|
|
415
|
+
platform: true,
|
|
416
|
+
split: true,
|
|
417
|
+
connected: true,
|
|
418
|
+
transfer: true
|
|
419
|
+
}
|
|
420
|
+
},
|
|
421
|
+
refundIdentifier: {
|
|
422
|
+
isHidden: {
|
|
423
|
+
platform: true,
|
|
424
|
+
split: true,
|
|
425
|
+
connected: true,
|
|
426
|
+
transfer: true
|
|
427
|
+
}
|
|
428
|
+
},
|
|
429
|
+
destinationAccount: {
|
|
430
|
+
isHidden: {
|
|
431
|
+
platform: true,
|
|
432
|
+
refund: true,
|
|
433
|
+
connected: true,
|
|
434
|
+
transfer: true
|
|
435
|
+
}
|
|
436
|
+
},
|
|
437
|
+
paymentAmount: {
|
|
438
|
+
isHidden: {
|
|
439
|
+
platform: true,
|
|
440
|
+
split: true,
|
|
441
|
+
connected: true,
|
|
442
|
+
transfer: true
|
|
443
|
+
}
|
|
444
|
+
},
|
|
445
|
+
refundsTime: {
|
|
446
|
+
isHidden: {
|
|
447
|
+
split: true,
|
|
448
|
+
all: true,
|
|
449
|
+
declined: true,
|
|
450
|
+
pending: true,
|
|
451
|
+
successful: true
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
};
|
|
455
|
+
const FILTER_COLUMNS = [{
|
|
456
|
+
key: "amount",
|
|
457
|
+
label: t("neetoPayments.common.amount"),
|
|
458
|
+
node: "amount",
|
|
459
|
+
type: "decimal",
|
|
460
|
+
showRuleSelector: true
|
|
461
|
+
}, {
|
|
462
|
+
key: "payment_amount",
|
|
463
|
+
label: t("neetoPayments.common.paymentAmount"),
|
|
464
|
+
node: "payment_intent.amount",
|
|
465
|
+
model: "NeetoPaymentsEngine::Stripe::Transaction",
|
|
466
|
+
type: "decimal",
|
|
467
|
+
showRuleSelector: true
|
|
468
|
+
}, {
|
|
469
|
+
key: "refund_amount",
|
|
470
|
+
label: t("neetoPayments.common.refundAmount"),
|
|
471
|
+
node: "amount",
|
|
472
|
+
type: "decimal",
|
|
473
|
+
showRuleSelector: true
|
|
474
|
+
}, {
|
|
475
|
+
key: "payment_time",
|
|
476
|
+
label: t("neetoPayments.common.paymentTime"),
|
|
477
|
+
node: "payment_at",
|
|
478
|
+
type: "date",
|
|
479
|
+
showRuleSelector: true
|
|
480
|
+
}, {
|
|
481
|
+
key: "refund_time",
|
|
482
|
+
label: t("neetoPayments.common.refundTime"),
|
|
483
|
+
node: "updated_at",
|
|
484
|
+
type: "date",
|
|
485
|
+
showRuleSelector: true
|
|
486
|
+
}, {
|
|
487
|
+
key: "split_time",
|
|
488
|
+
label: t("neetoPayments.common.transferTime"),
|
|
489
|
+
node: "payment_at",
|
|
490
|
+
type: "date",
|
|
491
|
+
showRuleSelector: true
|
|
492
|
+
}];
|
|
493
|
+
|
|
494
|
+
const isPlatformKind = equals(KIND.platform);
|
|
495
|
+
const isConnectedKind = equals(KIND.connected);
|
|
496
|
+
const isSplitKind = equals(KIND.split);
|
|
497
|
+
const isTransferKind = equals(KIND.transfer);
|
|
498
|
+
const isRefundKind = equals(KIND.refund);
|
|
499
|
+
const buildPaymentColumns = _ref => {
|
|
500
|
+
let {
|
|
501
|
+
tab,
|
|
502
|
+
kind,
|
|
503
|
+
payableEntityColumns = [],
|
|
504
|
+
specialColumnArguments = {}
|
|
505
|
+
} = _ref;
|
|
506
|
+
return sortBy(prop("position"), COLUMNS.concat(generateSpecialColumns(specialColumnArguments)).filter(_ref2 => {
|
|
507
|
+
let {
|
|
508
|
+
key
|
|
509
|
+
} = _ref2;
|
|
510
|
+
return !(COLUMN_METADATA[key]?.isHidden?.[kind] || COLUMN_METADATA[key]?.isHidden?.[tab]);
|
|
511
|
+
}).concat(payableEntityColumns.filter(_ref3 => {
|
|
512
|
+
let {
|
|
513
|
+
isHidden
|
|
514
|
+
} = _ref3;
|
|
515
|
+
return !(isHidden?.[tab] || isHidden?.[kind]);
|
|
516
|
+
})));
|
|
517
|
+
};
|
|
518
|
+
const buildFilterColumns = function (tab, kind) {
|
|
519
|
+
let payableEntityColumns = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
520
|
+
const filterColumns = FILTER_COLUMNS.filter(_ref4 => {
|
|
521
|
+
let {
|
|
522
|
+
key
|
|
523
|
+
} = _ref4;
|
|
524
|
+
return !COLUMN_METADATA[snakeToCamelCase(key)]?.isHidden?.[kind];
|
|
525
|
+
});
|
|
526
|
+
return concat(filterColumns, map(prop("filterProps"), filterBy({
|
|
527
|
+
isFilterable: true,
|
|
528
|
+
isHidden: isHidden => !(isHidden?.[tab] || isHidden?.[kind])
|
|
529
|
+
}, payableEntityColumns)));
|
|
530
|
+
};
|
|
531
|
+
const processResponse = (data, kind) => {
|
|
532
|
+
if (isSplitKind(kind)) return data?.splits;
|
|
533
|
+
if (isRefundKind(kind)) return data?.refunds;
|
|
534
|
+
return data?.transactions;
|
|
535
|
+
};
|
|
536
|
+
const modifySearchProps = _ref5 => {
|
|
537
|
+
let {
|
|
538
|
+
searchProps,
|
|
539
|
+
kind
|
|
540
|
+
} = _ref5;
|
|
541
|
+
return evolve({
|
|
542
|
+
node: concat(APPENDABLE_SEARCH_PROPS[kind]?.node),
|
|
543
|
+
model: concat(APPENDABLE_SEARCH_PROPS[kind]?.model)
|
|
544
|
+
}, searchProps);
|
|
545
|
+
};
|
|
546
|
+
|
|
547
|
+
const ExportModal = _ref => {
|
|
548
|
+
let {
|
|
549
|
+
showExportModal,
|
|
550
|
+
setShowExportModal,
|
|
551
|
+
kind,
|
|
552
|
+
tab,
|
|
553
|
+
filters,
|
|
554
|
+
holdableId,
|
|
555
|
+
sortProperties = {}
|
|
556
|
+
} = _ref;
|
|
557
|
+
const {
|
|
558
|
+
t
|
|
559
|
+
} = useTranslation();
|
|
560
|
+
const [downloadUrl, setDownloadUrl] = useState("");
|
|
561
|
+
const [isGenerating, setIsGenerating] = useState(false);
|
|
562
|
+
const {
|
|
563
|
+
mutate: exportRazorpayPaymentsCsv,
|
|
564
|
+
isLoading: isRazorpayLoading
|
|
565
|
+
} = useExportRazorpayData();
|
|
566
|
+
const {
|
|
567
|
+
mutate: exportCsv,
|
|
568
|
+
isLoading
|
|
569
|
+
} = useExportData();
|
|
570
|
+
const isFileLoading = isLoading || isGenerating || isRazorpayLoading;
|
|
571
|
+
const token = useMemo(() => `${kind}-report-${uuidV4()}`, [kind]);
|
|
572
|
+
const receivedCallback = data => {
|
|
573
|
+
if (!data.download_url) return;
|
|
574
|
+
setDownloadUrl(data.download_url);
|
|
575
|
+
setIsGenerating(false);
|
|
576
|
+
};
|
|
577
|
+
const handleGenerateClick = () => {
|
|
578
|
+
const payload = {
|
|
579
|
+
kind: isTransferKind(kind) ? "connected" : kind,
|
|
580
|
+
token,
|
|
581
|
+
filters,
|
|
582
|
+
tab,
|
|
583
|
+
holdableId,
|
|
584
|
+
...sortProperties
|
|
585
|
+
};
|
|
586
|
+
if (kind === "razorpayPayment") {
|
|
587
|
+
return exportRazorpayPaymentsCsv(payload, {
|
|
588
|
+
onSuccess: () => {
|
|
589
|
+
setDownloadUrl("");
|
|
590
|
+
setIsGenerating(true);
|
|
591
|
+
}
|
|
592
|
+
});
|
|
593
|
+
}
|
|
594
|
+
return exportCsv(payload, {
|
|
595
|
+
onSuccess: () => {
|
|
596
|
+
setDownloadUrl("");
|
|
597
|
+
setIsGenerating(true);
|
|
598
|
+
}
|
|
599
|
+
});
|
|
600
|
+
};
|
|
601
|
+
useEffect(() => {
|
|
602
|
+
if (showExportModal) {
|
|
603
|
+
const channel = exportChannel(token, receivedCallback);
|
|
604
|
+
setDownloadUrl("");
|
|
605
|
+
setIsGenerating(false);
|
|
606
|
+
return () => {
|
|
607
|
+
channel.disconnected();
|
|
608
|
+
};
|
|
609
|
+
}
|
|
610
|
+
return undefined;
|
|
611
|
+
}, [showExportModal, token]);
|
|
612
|
+
const onClose = () => setShowExportModal(false);
|
|
613
|
+
return /*#__PURE__*/React__default.createElement(Modal, {
|
|
614
|
+
onClose,
|
|
615
|
+
isOpen: showExportModal
|
|
616
|
+
}, /*#__PURE__*/React__default.createElement(Modal.Header, null, /*#__PURE__*/React__default.createElement(Typography, {
|
|
617
|
+
style: "h2"
|
|
618
|
+
}, t(`neetoPayments.export.title.${kind}`))), /*#__PURE__*/React__default.createElement(Modal.Body, null, isFileLoading ? /*#__PURE__*/React__default.createElement(Typography, {
|
|
619
|
+
style: "body2"
|
|
620
|
+
}, t("neetoPayments.export.pleaseWait")) : /*#__PURE__*/React__default.createElement(Typography, {
|
|
621
|
+
style: "body2"
|
|
622
|
+
}, downloadUrl ? t("neetoPayments.export.fileReady") : t(`neetoPayments.export.download.${kind}`))), /*#__PURE__*/React__default.createElement(Modal.Footer, {
|
|
623
|
+
className: "space-x-2"
|
|
624
|
+
}, downloadUrl ? /*#__PURE__*/React__default.createElement(Button, {
|
|
625
|
+
href: downloadUrl,
|
|
626
|
+
icon: Download,
|
|
627
|
+
label: t("neetoPayments.common.download"),
|
|
628
|
+
onClick: onClose
|
|
629
|
+
}) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Button, {
|
|
630
|
+
disabled: isFileLoading,
|
|
631
|
+
label: t("neetoPayments.common.cancel"),
|
|
632
|
+
style: "tertiary",
|
|
633
|
+
onClick: onClose
|
|
634
|
+
}), /*#__PURE__*/React__default.createElement(Button, {
|
|
635
|
+
disabled: isFileLoading,
|
|
636
|
+
label: t("neetoPayments.common.export"),
|
|
637
|
+
loading: isFileLoading,
|
|
638
|
+
onClick: handleGenerateClick
|
|
639
|
+
}))));
|
|
640
|
+
};
|
|
641
|
+
|
|
642
|
+
export { ExportModal as E, buildPaymentColumns as a, buildFilterColumns as b, renderRefundIdentifier as c, isTransferKind as d, isConnectedKind as e, isRefundKind as f, isPlatformKind as g, renderIdentifier as h, isSplitKind as i, modifySearchProps as m, processResponse as p, renderSplitIdentifier as r };
|
|
643
|
+
//# sourceMappingURL=ExportModal-a00544db.js.map
|