update paid time to utc time
This commit is contained in:
parent
730d1b4fb6
commit
6dbfbddeb6
@ -72,7 +72,8 @@
|
||||
"export_excel": "Export Transaction Excel",
|
||||
"import": {
|
||||
"error_require_file": "Please select the transaction record file to import",
|
||||
"error_require_payment_channel": "Please select a payment channel"
|
||||
"error_require_payment_channel": "Please select a payment channel",
|
||||
"error_require_records": "File data incorrect"
|
||||
},
|
||||
"import_bill": "Import Transaction Record",
|
||||
"import_excel": "Import Transaction Excel",
|
||||
|
@ -72,7 +72,8 @@
|
||||
"export_excel": "导出交易记录",
|
||||
"import": {
|
||||
"error_require_file": "请选择要导入的交易记录文件",
|
||||
"error_require_payment_channel": "请选择支付渠道"
|
||||
"error_require_payment_channel": "请选择支付渠道",
|
||||
"error_require_records": "文件数据不正确"
|
||||
},
|
||||
"import_bill": "导入交易记录",
|
||||
"import_excel": "导入交易记录",
|
||||
|
@ -72,7 +72,8 @@
|
||||
"export_excel": "導出交易记录",
|
||||
"import": {
|
||||
"error_require_file": "請選擇要匯入的交易記錄文件",
|
||||
"error_require_payment_channel": "請選擇支付管道"
|
||||
"error_require_payment_channel": "請選擇支付管道",
|
||||
"error_require_records": "文件資料不正確"
|
||||
},
|
||||
"import_bill": "導入交易記錄",
|
||||
"import_excel": "導入交易记录",
|
||||
|
@ -39,10 +39,14 @@ export const ImportBillModal: React.FC<BillPaidModalProps> = (props) => {
|
||||
setState({errorMessage:'bill.import.error_require_payment_channel'})
|
||||
return;
|
||||
}
|
||||
if(records.length == 0 || !state.currentFile){
|
||||
if(!state.currentFile){
|
||||
setState({errorMessage:'bill.import.error_require_file'})
|
||||
return;
|
||||
}
|
||||
if(records.length == 0){
|
||||
setState({errorMessage:'bill.import.error_require_records'})
|
||||
return;
|
||||
}
|
||||
setState({
|
||||
loading: true,
|
||||
errorMessage:undefined
|
||||
@ -59,6 +63,10 @@ export const ImportBillModal: React.FC<BillPaidModalProps> = (props) => {
|
||||
setImportRecords([])
|
||||
return;
|
||||
}
|
||||
if(!currentFile.fileInstance || currentFile.fileInstance.size < 10){
|
||||
setState({errorMessage:'bill.import.error_require_file'})
|
||||
return;
|
||||
}
|
||||
if (currentFile.fileInstance) {
|
||||
readXlsxFile(currentFile.fileInstance).then(rows => {
|
||||
const records = rows.map((row) => {
|
||||
@ -67,8 +75,15 @@ export const ImportBillModal: React.FC<BillPaidModalProps> = (props) => {
|
||||
return String(item)
|
||||
})
|
||||
})
|
||||
if(records.length == 0){
|
||||
setState({errorMessage:'bill.import.error_require_records'})
|
||||
return;
|
||||
}
|
||||
setImportRecords(records)
|
||||
setState({currentFile:currentFile.fileInstance})
|
||||
}).catch(e=>{
|
||||
console.log('parse error',e)
|
||||
setState({errorMessage:'bill.import.error_require_file'} )
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -138,7 +153,7 @@ export const ImportBillModal: React.FC<BillPaidModalProps> = (props) => {
|
||||
<Button onClick={closeModal} type={'tertiary'}>{t('base.cancel')}</Button>
|
||||
<Button
|
||||
loading={state.loading} htmlType={'submit'} theme={'solid'}
|
||||
type={'primary'} onClick={onSubmit}
|
||||
type={'primary'} onClick={onSubmit} disabled={records.length == 0}
|
||||
>{t('base.confirm_import')}</Button>
|
||||
</Space>
|
||||
</div>
|
||||
|
@ -2,6 +2,8 @@ import {get, post, put, uploadFile} from "@/service/request.ts";
|
||||
import dayjs from "dayjs";
|
||||
import {getAuthToken} from "@/hooks/useAuth.ts";
|
||||
import {stringify} from "qs";
|
||||
import utc from "dayjs/plugin/utc"
|
||||
dayjs.extend(utc)
|
||||
|
||||
export type BillQueryResult = {
|
||||
result: BillModel[];
|
||||
@ -109,7 +111,7 @@ export async function finishAsiapay({param}: BillUpdateFormParams) {
|
||||
const paramUrl = `?prc=0&src=0&Ord=12345678&Ref=${param.merchant_ref}&PayRef=123456&successcode=0&Amt=10.00&Cur=344&Holder=Test Card&AuthId=123456&AlertCode=&remark=
|
||||
&eci=07&payerAuth=U&sourceIp=192.1.1.1&ipCountry=HK&payMethod=VISA
|
||||
x&cardIssuingCountry=HK&channelType=SPC&`
|
||||
const ret = await post<string>(`/flywire/feedback?${paramUrl}`, {}, true)
|
||||
const ret = await post<string>(`/asiapay/feedback?${paramUrl}`, {}, true)
|
||||
|
||||
return ret?.toLowerCase() == 'ok'
|
||||
}
|
||||
@ -117,7 +119,7 @@ x&cardIssuingCountry=HK&channelType=SPC&`
|
||||
export async function finishFlywire({bill, param}: BillUpdateFormParams) {
|
||||
const eventData = {
|
||||
"event_type": "guaranteed",
|
||||
"event_date": dayjs().format('YYYY-MM-DDTHH:mm:ss[Z]'),
|
||||
"event_date": dayjs().utc().format('YYYY-MM-DDTHH:mm:ss[Z]'),
|
||||
"event_resource": "payments",
|
||||
"data": {
|
||||
"remark": param.remark,
|
||||
@ -127,7 +129,7 @@ export async function finishFlywire({bill, param}: BillUpdateFormParams) {
|
||||
"amount_to": Number(param.payment_amount) * 100,
|
||||
"currency_to": "HKD",
|
||||
"status": "guaranteed",
|
||||
"expiration_date": dayjs().format('YYYY-MM-DDTHH:mm:ss[Z]'),
|
||||
"expiration_date": dayjs().utc().format('YYYY-MM-DDTHH:mm:ss[Z]'),
|
||||
"external_reference": bill.id,
|
||||
"country": "CN",
|
||||
"payment_method": {
|
||||
@ -150,7 +152,7 @@ export async function finishFlywire({bill, param}: BillUpdateFormParams) {
|
||||
}
|
||||
|
||||
export function finishBill(params: BillUpdateFormParams) {
|
||||
if (params.param.payment_channel === 'flywire') {
|
||||
if (params.param.payment_channel.toLowerCase() === 'asiapay') {
|
||||
return finishAsiapay(params)
|
||||
}
|
||||
return finishFlywire(params)
|
||||
|
Loading…
x
Reference in New Issue
Block a user