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