Merge branch 'dev' into release
This commit is contained in:
commit
f54d2ecdc0
|
|
@ -100,7 +100,7 @@ export default function Render(props) {
|
||||||
]} onAction={(row, action) => {
|
]} onAction={(row, action) => {
|
||||||
const { entity } = row.pay;
|
const { entity } = row.pay;
|
||||||
assert(entity !== 'account');
|
assert(entity !== 'account');
|
||||||
if (entity !== 'offlineAccount' || !amIRoot) {
|
if (entity !== 'offlineAccount' && !amIRoot) {
|
||||||
setMessage({
|
setMessage({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
title: t('cantOperateOnline'),
|
title: t('cantOperateOnline'),
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,10 @@ const attrUpdateMatrix = {
|
||||||
},
|
},
|
||||||
successAt: {
|
successAt: {
|
||||||
actions: ['succeed'],
|
actions: ['succeed'],
|
||||||
}
|
},
|
||||||
|
externalMeta: {
|
||||||
|
actions: ['succeed', 'fail'],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
withdraw: {
|
withdraw: {
|
||||||
dealLoss: {
|
dealLoss: {
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ export interface Schema extends EntityShape {
|
||||||
loss: Price;
|
loss: Price;
|
||||||
pay: Pay;
|
pay: Pay;
|
||||||
meta?: Object;
|
meta?: Object;
|
||||||
|
externalMeta?: Object;
|
||||||
externalId?: String<128>;
|
externalId?: String<128>;
|
||||||
price: Price;
|
price: Price;
|
||||||
creator: User;
|
creator: User;
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ export const entityDesc = {
|
||||||
loss: '损耗',
|
loss: '损耗',
|
||||||
withdraw: '关联提现',
|
withdraw: '关联提现',
|
||||||
meta: 'metadata',
|
meta: 'metadata',
|
||||||
|
externalMeta: '外部meta信息',
|
||||||
externalId: '外部退款流水号',
|
externalId: '外部退款流水号',
|
||||||
iState: '状态',
|
iState: '状态',
|
||||||
creator: '创建者',
|
creator: '创建者',
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ export type OpSchema = EntityShape & {
|
||||||
loss: Price;
|
loss: Price;
|
||||||
payId: ForeignKey<"pay">;
|
payId: ForeignKey<"pay">;
|
||||||
meta?: Object | null;
|
meta?: Object | null;
|
||||||
|
externalMeta?: Object | null;
|
||||||
externalId?: String<128> | null;
|
externalId?: String<128> | null;
|
||||||
price: Price;
|
price: Price;
|
||||||
creatorId: ForeignKey<"user">;
|
creatorId: ForeignKey<"user">;
|
||||||
|
|
@ -27,6 +28,7 @@ export type Schema = EntityShape & {
|
||||||
loss: Price;
|
loss: Price;
|
||||||
payId: ForeignKey<"pay">;
|
payId: ForeignKey<"pay">;
|
||||||
meta?: Object | null;
|
meta?: Object | null;
|
||||||
|
externalMeta?: Object | null;
|
||||||
externalId?: String<128> | null;
|
externalId?: String<128> | null;
|
||||||
price: Price;
|
price: Price;
|
||||||
creatorId: ForeignKey<"user">;
|
creatorId: ForeignKey<"user">;
|
||||||
|
|
@ -54,6 +56,7 @@ type AttrFilter = {
|
||||||
payId: Q_StringValue;
|
payId: Q_StringValue;
|
||||||
pay: Pay.Filter;
|
pay: Pay.Filter;
|
||||||
meta: Object;
|
meta: Object;
|
||||||
|
externalMeta: Object;
|
||||||
externalId: Q_StringValue;
|
externalId: Q_StringValue;
|
||||||
price: Q_NumberValue;
|
price: Q_NumberValue;
|
||||||
creatorId: Q_StringValue;
|
creatorId: Q_StringValue;
|
||||||
|
|
@ -78,6 +81,7 @@ export type Projection = {
|
||||||
payId?: number;
|
payId?: number;
|
||||||
pay?: Pay.Projection;
|
pay?: Pay.Projection;
|
||||||
meta?: number | Object;
|
meta?: number | Object;
|
||||||
|
externalMeta?: number | Object;
|
||||||
externalId?: number;
|
externalId?: number;
|
||||||
price?: number;
|
price?: number;
|
||||||
creatorId?: number;
|
creatorId?: number;
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,9 @@ export const desc = {
|
||||||
meta: {
|
meta: {
|
||||||
type: "object"
|
type: "object"
|
||||||
},
|
},
|
||||||
|
externalMeta: {
|
||||||
|
type: "object"
|
||||||
|
},
|
||||||
externalId: {
|
externalId: {
|
||||||
type: "varchar",
|
type: "varchar",
|
||||||
params: {
|
params: {
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
{ "name": "帐户", "attr": { "pay": "关联支付", "price": "价格", "loss": "损耗", "withdraw": "关联提现", "meta": "metadata", "externalId": "外部退款流水号", "iState": "状态", "creator": "创建者", "reason": "原因", "opers": "相关账户操作", "successAt": "退款成功时间" }, "action": { "succeed": "退款成功", "fail": "退款失败" }, "v": { "iState": { "refunding": "退款中", "successful": "退款成功", "failed": "退款失败" } } }
|
{ "name": "帐户", "attr": { "pay": "关联支付", "price": "价格", "loss": "损耗", "withdraw": "关联提现", "meta": "metadata", "externalMeta": "外部meta信息", "externalId": "外部退款流水号", "iState": "状态", "creator": "创建者", "reason": "原因", "opers": "相关账户操作", "successAt": "退款成功时间" }, "action": { "succeed": "退款成功", "fail": "退款失败" }, "v": { "iState": { "refunding": "退款中", "successful": "退款成功", "failed": "退款失败" } } }
|
||||||
|
|
|
||||||
|
|
@ -237,7 +237,9 @@ async function failRefunding(context, refundId) {
|
||||||
await context.operate('pay', {
|
await context.operate('pay', {
|
||||||
id: await generateNewIdAsync(),
|
id: await generateNewIdAsync(),
|
||||||
action,
|
action,
|
||||||
data: {},
|
data: {
|
||||||
|
refundable: true,
|
||||||
|
},
|
||||||
filter: {
|
filter: {
|
||||||
id: pay.id,
|
id: pay.id,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,6 @@ import { BRC } from '../types/RuntimeCxt';
|
||||||
* @param context
|
* @param context
|
||||||
* @param refunds
|
* @param refunds
|
||||||
*/
|
*/
|
||||||
export declare function updateWithdrawState(context: BRC, id: string): Promise<0 | 1>;
|
export declare function updateWithdrawState(context: BRC, id: string): Promise<1 | 0>;
|
||||||
declare const triggers: Trigger<EntityDict, 'withdraw', BRC>[];
|
declare const triggers: Trigger<EntityDict, 'withdraw', BRC>[];
|
||||||
export default triggers;
|
export default triggers;
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ export default class WechatPay extends WechatPayDebug {
|
||||||
const { id, price, pay } = refund;
|
const { id, price, pay } = refund;
|
||||||
const serverUrl = context.composeAccessPath();
|
const serverUrl = context.composeAccessPath();
|
||||||
const endpoint = this.refundNotifyUrl;
|
const endpoint = this.refundNotifyUrl;
|
||||||
const refundNotifyUrl = `${serverUrl}/endpoint/${endpoint}/${pay.id}`;
|
const refundNotifyUrl = `${serverUrl}/endpoint/${endpoint}/${id}`;
|
||||||
const result = await this.wechatPay.createRefund({
|
const result = await this.wechatPay.createRefund({
|
||||||
out_trade_no: compressTo32(pay.id),
|
out_trade_no: compressTo32(pay.id),
|
||||||
out_refund_no: compressTo32(id),
|
out_refund_no: compressTo32(id),
|
||||||
|
|
@ -73,7 +73,8 @@ export default class WechatPay extends WechatPayDebug {
|
||||||
}
|
}
|
||||||
async getRefundState(refund) {
|
async getRefundState(refund) {
|
||||||
const result = await this.wechatPay.queryRefundByOutRefundNo(compressTo32(refund.id));
|
const result = await this.wechatPay.queryRefundByOutRefundNo(compressTo32(refund.id));
|
||||||
const { status, success_time } = this.analyzeResult(result);
|
const externalMeta = this.analyzeResult(result);
|
||||||
|
const { status, success_time } = externalMeta;
|
||||||
/**
|
/**
|
||||||
* 【退款状态】 退款到银行发现用户的卡作废或者冻结了,导致原路退款银行卡失败,可前往商户平台(pay.weixin.qq.com)-交易中心,手动处理此笔退款。
|
* 【退款状态】 退款到银行发现用户的卡作废或者冻结了,导致原路退款银行卡失败,可前往商户平台(pay.weixin.qq.com)-交易中心,手动处理此笔退款。
|
||||||
可选取值:
|
可选取值:
|
||||||
|
|
@ -83,7 +84,10 @@ export default class WechatPay extends WechatPayDebug {
|
||||||
ABNORMAL: 退款异常
|
ABNORMAL: 退款异常
|
||||||
*/
|
*/
|
||||||
const iState = REFUND_STATE_MATRIX[status];
|
const iState = REFUND_STATE_MATRIX[status];
|
||||||
return [iState, success_time ? { successAt: dayJs(success_time).valueOf() } : undefined];
|
return [iState, success_time ? {
|
||||||
|
successAt: success_time ? dayJs(success_time).valueOf() : undefined,
|
||||||
|
externalMeta,
|
||||||
|
} : undefined];
|
||||||
}
|
}
|
||||||
analyzeResult(result) {
|
analyzeResult(result) {
|
||||||
const { success, data, } = result;
|
const { success, data, } = result;
|
||||||
|
|
@ -358,9 +362,10 @@ export default class WechatPay extends WechatPayDebug {
|
||||||
const iState = REFUND_STATE_MATRIX[refund_status];
|
const iState = REFUND_STATE_MATRIX[refund_status];
|
||||||
assert(iState);
|
assert(iState);
|
||||||
const extra = {
|
const extra = {
|
||||||
meta: omit(result, ['mchid',]),
|
externalMeta: omit(result, ['mchid',]),
|
||||||
};
|
};
|
||||||
if (iState === 'successful') {
|
if (iState === 'successful') {
|
||||||
|
assert(success_time);
|
||||||
extra.successAt = dayJs(success_time).valueOf();
|
extra.successAt = dayJs(success_time).valueOf();
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { fullPayProjection, refreshPayState } from '../utils/pay';
|
import { fullPayProjection, refreshPayState } from '../utils/pay';
|
||||||
import { mergeOperationResult } from 'oak-domain/lib/utils/operationResult';
|
import { mergeOperationResult } from 'oak-domain/lib/utils/operationResult';
|
||||||
const QUERY_PAYING_STATE_GAP = process.env.NODE_ENV === 'production' ? 3600 * 1000 : 60 * 1000;
|
const QUERY_PAYING_STATE_GAP = process.env.NODE_ENV === 'production' ? 600 * 1000 : 60 * 1000;
|
||||||
const watchers = [
|
const watchers = [
|
||||||
{
|
{
|
||||||
name: '对paying状态的订单,同步其真实支付状态',
|
name: '对paying状态的订单,同步其真实支付状态',
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import { getPayClazz } from '../utils/payClazz';
|
||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import { generateNewIdAsync } from 'oak-domain/lib/utils/uuid';
|
import { generateNewIdAsync } from 'oak-domain/lib/utils/uuid';
|
||||||
import { mergeOperationResult } from 'oak-domain/lib/utils/operationResult';
|
import { mergeOperationResult } from 'oak-domain/lib/utils/operationResult';
|
||||||
const QUERY_PAYING_STATE_GAP = process.env.NODE_ENV === 'production' ? 3600 * 1000 : 60 * 1000;
|
const QUERY_PAYING_STATE_GAP = process.env.NODE_ENV === 'production' ? 600 * 1000 : 60 * 1000;
|
||||||
const watchers = [
|
const watchers = [
|
||||||
{
|
{
|
||||||
name: '对refund状态的退款,同步其真实退款状态',
|
name: '对refund状态的退款,同步其真实退款状态',
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ export declare function getWithdrawCreateData(params: {
|
||||||
accountId: string;
|
accountId: string;
|
||||||
price: number;
|
price: number;
|
||||||
withdrawAccountId?: string;
|
withdrawAccountId?: string;
|
||||||
}, context: BRC): Promise<(Partial<Omit<import("../oak-app-domain/Withdraw/Schema").OpSchema, "creatorId" | "accountId">> & {
|
}, context: BRC): Promise<(Partial<Omit<import("../oak-app-domain/Withdraw/Schema").OpSchema, "accountId" | "creatorId">> & {
|
||||||
id: string;
|
id: string;
|
||||||
} & {
|
} & {
|
||||||
accountId: string;
|
accountId: string;
|
||||||
|
|
@ -12,12 +12,12 @@ export declare function getWithdrawCreateData(params: {
|
||||||
creatorId: string;
|
creatorId: string;
|
||||||
creator?: import("../oak-app-domain/User/Schema").UpdateOperation | undefined;
|
creator?: import("../oak-app-domain/User/Schema").UpdateOperation | undefined;
|
||||||
} & {
|
} & {
|
||||||
refund$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdrawId" | "withdraw">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdrawId" | "withdraw">>)[] | undefined;
|
refund$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdraw" | "withdrawId">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdraw" | "withdrawId">>)[] | undefined;
|
||||||
withdrawTransfer$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdrawId" | "withdraw">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdrawId" | "withdraw">>)[] | undefined;
|
withdrawTransfer$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdraw" | "withdrawId">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdraw" | "withdrawId">>)[] | undefined;
|
||||||
modiEntity$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/ModiEntity/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/ModiEntity/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
|
modiEntity$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/ModiEntity/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/ModiEntity/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
|
||||||
operEntity$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/OperEntity/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/OperEntity/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
|
operEntity$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/OperEntity/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/OperEntity/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
|
||||||
accountOper$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/AccountOper/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/AccountOper/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
|
accountOper$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/AccountOper/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/AccountOper/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
|
||||||
}) | (Partial<Omit<import("../oak-app-domain/Withdraw/Schema").OpSchema, "creatorId" | "accountId">> & {
|
}) | (Partial<Omit<import("../oak-app-domain/Withdraw/Schema").OpSchema, "accountId" | "creatorId">> & {
|
||||||
id: string;
|
id: string;
|
||||||
} & {
|
} & {
|
||||||
accountId: string;
|
accountId: string;
|
||||||
|
|
@ -26,12 +26,12 @@ export declare function getWithdrawCreateData(params: {
|
||||||
creator?: undefined;
|
creator?: undefined;
|
||||||
creatorId: string;
|
creatorId: string;
|
||||||
} & {
|
} & {
|
||||||
refund$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdrawId" | "withdraw">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdrawId" | "withdraw">>)[] | undefined;
|
refund$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdraw" | "withdrawId">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdraw" | "withdrawId">>)[] | undefined;
|
||||||
withdrawTransfer$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdrawId" | "withdraw">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdrawId" | "withdraw">>)[] | undefined;
|
withdrawTransfer$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdraw" | "withdrawId">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdraw" | "withdrawId">>)[] | undefined;
|
||||||
modiEntity$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/ModiEntity/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/ModiEntity/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
|
modiEntity$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/ModiEntity/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/ModiEntity/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
|
||||||
operEntity$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/OperEntity/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/OperEntity/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
|
operEntity$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/OperEntity/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/OperEntity/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
|
||||||
accountOper$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/AccountOper/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/AccountOper/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
|
accountOper$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/AccountOper/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/AccountOper/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
|
||||||
}) | (Partial<Omit<import("../oak-app-domain/Withdraw/Schema").OpSchema, "creatorId" | "accountId">> & {
|
}) | (Partial<Omit<import("../oak-app-domain/Withdraw/Schema").OpSchema, "accountId" | "creatorId">> & {
|
||||||
id: string;
|
id: string;
|
||||||
} & {
|
} & {
|
||||||
account?: undefined;
|
account?: undefined;
|
||||||
|
|
@ -40,12 +40,12 @@ export declare function getWithdrawCreateData(params: {
|
||||||
creatorId: string;
|
creatorId: string;
|
||||||
creator?: import("../oak-app-domain/User/Schema").UpdateOperation | undefined;
|
creator?: import("../oak-app-domain/User/Schema").UpdateOperation | undefined;
|
||||||
} & {
|
} & {
|
||||||
refund$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdrawId" | "withdraw">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdrawId" | "withdraw">>)[] | undefined;
|
refund$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdraw" | "withdrawId">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdraw" | "withdrawId">>)[] | undefined;
|
||||||
withdrawTransfer$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdrawId" | "withdraw">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdrawId" | "withdraw">>)[] | undefined;
|
withdrawTransfer$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdraw" | "withdrawId">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdraw" | "withdrawId">>)[] | undefined;
|
||||||
modiEntity$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/ModiEntity/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/ModiEntity/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
|
modiEntity$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/ModiEntity/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/ModiEntity/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
|
||||||
operEntity$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/OperEntity/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/OperEntity/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
|
operEntity$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/OperEntity/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/OperEntity/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
|
||||||
accountOper$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/AccountOper/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/AccountOper/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
|
accountOper$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/AccountOper/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/AccountOper/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
|
||||||
}) | (Partial<Omit<import("../oak-app-domain/Withdraw/Schema").OpSchema, "creatorId" | "accountId">> & {
|
}) | (Partial<Omit<import("../oak-app-domain/Withdraw/Schema").OpSchema, "accountId" | "creatorId">> & {
|
||||||
id: string;
|
id: string;
|
||||||
} & {
|
} & {
|
||||||
account?: undefined;
|
account?: undefined;
|
||||||
|
|
@ -54,8 +54,8 @@ export declare function getWithdrawCreateData(params: {
|
||||||
creator?: undefined;
|
creator?: undefined;
|
||||||
creatorId: string;
|
creatorId: string;
|
||||||
} & {
|
} & {
|
||||||
refund$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdrawId" | "withdraw">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdrawId" | "withdraw">>)[] | undefined;
|
refund$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdraw" | "withdrawId">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/Refund/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/Refund/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/Refund/Schema").CreateOperationData, "withdraw" | "withdrawId">>)[] | undefined;
|
||||||
withdrawTransfer$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdrawId" | "withdraw">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdrawId" | "withdraw">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdrawId" | "withdraw">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdrawId" | "withdraw">>)[] | undefined;
|
withdrawTransfer$withdraw?: import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdraw" | "withdrawId">[]> | (import("oak-domain/lib/types").Operation<string, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").UpdateOperationData, "withdraw" | "withdrawId">, Omit<import("../oak-app-domain/WithdrawTransfer/Schema").Filter, "withdraw" | "withdrawId">> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/WithdrawTransfer/Schema").CreateOperationData, "withdraw" | "withdrawId">>)[] | undefined;
|
||||||
modiEntity$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/ModiEntity/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/ModiEntity/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
|
modiEntity$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/ModiEntity/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/ModiEntity/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
|
||||||
operEntity$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/OperEntity/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/OperEntity/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
|
operEntity$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/OperEntity/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/OperEntity/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
|
||||||
accountOper$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/AccountOper/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/AccountOper/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
|
accountOper$entity?: import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/AccountOper/Schema").CreateOperationData, "entity" | "entityId">[]> | import("oak-domain/lib/types").Operation<"create", Omit<import("../oak-app-domain/AccountOper/Schema").CreateOperationData, "entity" | "entityId">>[] | undefined;
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,10 @@ const attrUpdateMatrix = {
|
||||||
},
|
},
|
||||||
successAt: {
|
successAt: {
|
||||||
actions: ['succeed'],
|
actions: ['succeed'],
|
||||||
}
|
},
|
||||||
|
externalMeta: {
|
||||||
|
actions: ['succeed', 'fail'],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
withdraw: {
|
withdraw: {
|
||||||
dealLoss: {
|
dealLoss: {
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ export interface Schema extends EntityShape {
|
||||||
loss: Price;
|
loss: Price;
|
||||||
pay: Pay;
|
pay: Pay;
|
||||||
meta?: Object;
|
meta?: Object;
|
||||||
|
externalMeta?: Object;
|
||||||
externalId?: String<128>;
|
externalId?: String<128>;
|
||||||
price: Price;
|
price: Price;
|
||||||
creator: User;
|
creator: User;
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ exports.entityDesc = {
|
||||||
loss: '损耗',
|
loss: '损耗',
|
||||||
withdraw: '关联提现',
|
withdraw: '关联提现',
|
||||||
meta: 'metadata',
|
meta: 'metadata',
|
||||||
|
externalMeta: '外部meta信息',
|
||||||
externalId: '外部退款流水号',
|
externalId: '外部退款流水号',
|
||||||
iState: '状态',
|
iState: '状态',
|
||||||
creator: '创建者',
|
creator: '创建者',
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ export type OpSchema = EntityShape & {
|
||||||
loss: Price;
|
loss: Price;
|
||||||
payId: ForeignKey<"pay">;
|
payId: ForeignKey<"pay">;
|
||||||
meta?: Object | null;
|
meta?: Object | null;
|
||||||
|
externalMeta?: Object | null;
|
||||||
externalId?: String<128> | null;
|
externalId?: String<128> | null;
|
||||||
price: Price;
|
price: Price;
|
||||||
creatorId: ForeignKey<"user">;
|
creatorId: ForeignKey<"user">;
|
||||||
|
|
@ -27,6 +28,7 @@ export type Schema = EntityShape & {
|
||||||
loss: Price;
|
loss: Price;
|
||||||
payId: ForeignKey<"pay">;
|
payId: ForeignKey<"pay">;
|
||||||
meta?: Object | null;
|
meta?: Object | null;
|
||||||
|
externalMeta?: Object | null;
|
||||||
externalId?: String<128> | null;
|
externalId?: String<128> | null;
|
||||||
price: Price;
|
price: Price;
|
||||||
creatorId: ForeignKey<"user">;
|
creatorId: ForeignKey<"user">;
|
||||||
|
|
@ -54,6 +56,7 @@ type AttrFilter = {
|
||||||
payId: Q_StringValue;
|
payId: Q_StringValue;
|
||||||
pay: Pay.Filter;
|
pay: Pay.Filter;
|
||||||
meta: Object;
|
meta: Object;
|
||||||
|
externalMeta: Object;
|
||||||
externalId: Q_StringValue;
|
externalId: Q_StringValue;
|
||||||
price: Q_NumberValue;
|
price: Q_NumberValue;
|
||||||
creatorId: Q_StringValue;
|
creatorId: Q_StringValue;
|
||||||
|
|
@ -78,6 +81,7 @@ export type Projection = {
|
||||||
payId?: number;
|
payId?: number;
|
||||||
pay?: Pay.Projection;
|
pay?: Pay.Projection;
|
||||||
meta?: number | Object;
|
meta?: number | Object;
|
||||||
|
externalMeta?: number | Object;
|
||||||
externalId?: number;
|
externalId?: number;
|
||||||
price?: number;
|
price?: number;
|
||||||
creatorId?: number;
|
creatorId?: number;
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,9 @@ exports.desc = {
|
||||||
meta: {
|
meta: {
|
||||||
type: "object"
|
type: "object"
|
||||||
},
|
},
|
||||||
|
externalMeta: {
|
||||||
|
type: "object"
|
||||||
|
},
|
||||||
externalId: {
|
externalId: {
|
||||||
type: "varchar",
|
type: "varchar",
|
||||||
params: {
|
params: {
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
{ "name": "帐户", "attr": { "pay": "关联支付", "price": "价格", "loss": "损耗", "withdraw": "关联提现", "meta": "metadata", "externalId": "外部退款流水号", "iState": "状态", "creator": "创建者", "reason": "原因", "opers": "相关账户操作", "successAt": "退款成功时间" }, "action": { "succeed": "退款成功", "fail": "退款失败" }, "v": { "iState": { "refunding": "退款中", "successful": "退款成功", "failed": "退款失败" } } }
|
{ "name": "帐户", "attr": { "pay": "关联支付", "price": "价格", "loss": "损耗", "withdraw": "关联提现", "meta": "metadata", "externalMeta": "外部meta信息", "externalId": "外部退款流水号", "iState": "状态", "creator": "创建者", "reason": "原因", "opers": "相关账户操作", "successAt": "退款成功时间" }, "action": { "succeed": "退款成功", "fail": "退款失败" }, "v": { "iState": { "refunding": "退款中", "successful": "退款成功", "failed": "退款失败" } } }
|
||||||
|
|
|
||||||
|
|
@ -240,7 +240,9 @@ async function failRefunding(context, refundId) {
|
||||||
await context.operate('pay', {
|
await context.operate('pay', {
|
||||||
id: await (0, uuid_1.generateNewIdAsync)(),
|
id: await (0, uuid_1.generateNewIdAsync)(),
|
||||||
action,
|
action,
|
||||||
data: {},
|
data: {
|
||||||
|
refundable: true,
|
||||||
|
},
|
||||||
filter: {
|
filter: {
|
||||||
id: pay.id,
|
id: pay.id,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ class WechatPay extends WechatPay_debug_1.default {
|
||||||
const { id, price, pay } = refund;
|
const { id, price, pay } = refund;
|
||||||
const serverUrl = context.composeAccessPath();
|
const serverUrl = context.composeAccessPath();
|
||||||
const endpoint = this.refundNotifyUrl;
|
const endpoint = this.refundNotifyUrl;
|
||||||
const refundNotifyUrl = `${serverUrl}/endpoint/${endpoint}/${pay.id}`;
|
const refundNotifyUrl = `${serverUrl}/endpoint/${endpoint}/${id}`;
|
||||||
const result = await this.wechatPay.createRefund({
|
const result = await this.wechatPay.createRefund({
|
||||||
out_trade_no: (0, uuid_1.compressTo32)(pay.id),
|
out_trade_no: (0, uuid_1.compressTo32)(pay.id),
|
||||||
out_refund_no: (0, uuid_1.compressTo32)(id),
|
out_refund_no: (0, uuid_1.compressTo32)(id),
|
||||||
|
|
@ -76,7 +76,8 @@ class WechatPay extends WechatPay_debug_1.default {
|
||||||
}
|
}
|
||||||
async getRefundState(refund) {
|
async getRefundState(refund) {
|
||||||
const result = await this.wechatPay.queryRefundByOutRefundNo((0, uuid_1.compressTo32)(refund.id));
|
const result = await this.wechatPay.queryRefundByOutRefundNo((0, uuid_1.compressTo32)(refund.id));
|
||||||
const { status, success_time } = this.analyzeResult(result);
|
const externalMeta = this.analyzeResult(result);
|
||||||
|
const { status, success_time } = externalMeta;
|
||||||
/**
|
/**
|
||||||
* 【退款状态】 退款到银行发现用户的卡作废或者冻结了,导致原路退款银行卡失败,可前往商户平台(pay.weixin.qq.com)-交易中心,手动处理此笔退款。
|
* 【退款状态】 退款到银行发现用户的卡作废或者冻结了,导致原路退款银行卡失败,可前往商户平台(pay.weixin.qq.com)-交易中心,手动处理此笔退款。
|
||||||
可选取值:
|
可选取值:
|
||||||
|
|
@ -86,7 +87,10 @@ class WechatPay extends WechatPay_debug_1.default {
|
||||||
ABNORMAL: 退款异常
|
ABNORMAL: 退款异常
|
||||||
*/
|
*/
|
||||||
const iState = REFUND_STATE_MATRIX[status];
|
const iState = REFUND_STATE_MATRIX[status];
|
||||||
return [iState, success_time ? { successAt: (0, dayjs_1.default)(success_time).valueOf() } : undefined];
|
return [iState, success_time ? {
|
||||||
|
successAt: success_time ? (0, dayjs_1.default)(success_time).valueOf() : undefined,
|
||||||
|
externalMeta,
|
||||||
|
} : undefined];
|
||||||
}
|
}
|
||||||
analyzeResult(result) {
|
analyzeResult(result) {
|
||||||
const { success, data, } = result;
|
const { success, data, } = result;
|
||||||
|
|
@ -361,9 +365,10 @@ class WechatPay extends WechatPay_debug_1.default {
|
||||||
const iState = REFUND_STATE_MATRIX[refund_status];
|
const iState = REFUND_STATE_MATRIX[refund_status];
|
||||||
(0, assert_1.default)(iState);
|
(0, assert_1.default)(iState);
|
||||||
const extra = {
|
const extra = {
|
||||||
meta: (0, lodash_1.omit)(result, ['mchid',]),
|
externalMeta: (0, lodash_1.omit)(result, ['mchid',]),
|
||||||
};
|
};
|
||||||
if (iState === 'successful') {
|
if (iState === 'successful') {
|
||||||
|
(0, assert_1.default)(success_time);
|
||||||
extra.successAt = (0, dayjs_1.default)(success_time).valueOf();
|
extra.successAt = (0, dayjs_1.default)(success_time).valueOf();
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const pay_1 = require("../utils/pay");
|
const pay_1 = require("../utils/pay");
|
||||||
const operationResult_1 = require("oak-domain/lib/utils/operationResult");
|
const operationResult_1 = require("oak-domain/lib/utils/operationResult");
|
||||||
const QUERY_PAYING_STATE_GAP = process.env.NODE_ENV === 'production' ? 3600 * 1000 : 60 * 1000;
|
const QUERY_PAYING_STATE_GAP = process.env.NODE_ENV === 'production' ? 600 * 1000 : 60 * 1000;
|
||||||
const watchers = [
|
const watchers = [
|
||||||
{
|
{
|
||||||
name: '对paying状态的订单,同步其真实支付状态',
|
name: '对paying状态的订单,同步其真实支付状态',
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ const payClazz_1 = require("../utils/payClazz");
|
||||||
const assert_1 = tslib_1.__importDefault(require("assert"));
|
const assert_1 = tslib_1.__importDefault(require("assert"));
|
||||||
const uuid_1 = require("oak-domain/lib/utils/uuid");
|
const uuid_1 = require("oak-domain/lib/utils/uuid");
|
||||||
const operationResult_1 = require("oak-domain/lib/utils/operationResult");
|
const operationResult_1 = require("oak-domain/lib/utils/operationResult");
|
||||||
const QUERY_PAYING_STATE_GAP = process.env.NODE_ENV === 'production' ? 3600 * 1000 : 60 * 1000;
|
const QUERY_PAYING_STATE_GAP = process.env.NODE_ENV === 'production' ? 600 * 1000 : 60 * 1000;
|
||||||
const watchers = [
|
const watchers = [
|
||||||
{
|
{
|
||||||
name: '对refund状态的退款,同步其真实退款状态',
|
name: '对refund状态的退款,同步其真实退款状态',
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "oak-pay-business",
|
"name": "oak-pay-business",
|
||||||
"version": "2.2.8",
|
"version": "2.2.9",
|
||||||
"description": "",
|
"description": "",
|
||||||
"files": [
|
"files": [
|
||||||
"lib/**/*",
|
"lib/**/*",
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,7 @@ export default function Render(props: WebComponentProps<EntityDict, 'pay', false
|
||||||
onAction={(row, action) => {
|
onAction={(row, action) => {
|
||||||
const { entity } = row.pay;
|
const { entity } = row.pay;
|
||||||
assert(entity !== 'account');
|
assert(entity !== 'account');
|
||||||
if (entity !== 'offlineAccount' || !amIRoot) {
|
if (entity !== 'offlineAccount' && !amIRoot) {
|
||||||
setMessage({
|
setMessage({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
title: t('cantOperateOnline'),
|
title: t('cantOperateOnline'),
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,10 @@ const attrUpdateMatrix: AttrUpdateMatrix<EntityDict> = {
|
||||||
},
|
},
|
||||||
successAt: {
|
successAt: {
|
||||||
actions: ['succeed'],
|
actions: ['succeed'],
|
||||||
}
|
},
|
||||||
|
externalMeta: {
|
||||||
|
actions: ['succeed', 'fail'],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
withdraw: {
|
withdraw: {
|
||||||
dealLoss: {
|
dealLoss: {
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ export interface Schema extends EntityShape {
|
||||||
loss: Price;
|
loss: Price;
|
||||||
pay: Pay;
|
pay: Pay;
|
||||||
meta?: Object,
|
meta?: Object,
|
||||||
|
externalMeta?: Object,
|
||||||
externalId?: String<128>;
|
externalId?: String<128>;
|
||||||
price: Price;
|
price: Price;
|
||||||
creator: User;
|
creator: User;
|
||||||
|
|
@ -50,6 +51,7 @@ export const entityDesc: EntityDesc<Schema, Action, '', {
|
||||||
loss: '损耗',
|
loss: '损耗',
|
||||||
withdraw: '关联提现',
|
withdraw: '关联提现',
|
||||||
meta: 'metadata',
|
meta: 'metadata',
|
||||||
|
externalMeta: '外部meta信息',
|
||||||
externalId: '外部退款流水号',
|
externalId: '外部退款流水号',
|
||||||
iState: '状态',
|
iState: '状态',
|
||||||
creator: '创建者',
|
creator: '创建者',
|
||||||
|
|
|
||||||
|
|
@ -263,6 +263,7 @@ async function failRefunding(context: BRC, refundId: string) {
|
||||||
id: await generateNewIdAsync(),
|
id: await generateNewIdAsync(),
|
||||||
action,
|
action,
|
||||||
data: {
|
data: {
|
||||||
|
refundable: true,
|
||||||
},
|
},
|
||||||
filter: {
|
filter: {
|
||||||
id: pay!.id!,
|
id: pay!.id!,
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ export default class WechatPay extends WechatPayDebug implements PayClazz {
|
||||||
const { id, price, pay } = refund;
|
const { id, price, pay } = refund;
|
||||||
const serverUrl = context.composeAccessPath();
|
const serverUrl = context.composeAccessPath();
|
||||||
const endpoint = this.refundNotifyUrl;
|
const endpoint = this.refundNotifyUrl;
|
||||||
const refundNotifyUrl = `${serverUrl}/endpoint/${endpoint}/${pay.id}`;
|
const refundNotifyUrl = `${serverUrl}/endpoint/${endpoint}/${id}`;
|
||||||
const result = await this.wechatPay.createRefund({
|
const result = await this.wechatPay.createRefund({
|
||||||
out_trade_no: compressTo32(pay.id),
|
out_trade_no: compressTo32(pay.id),
|
||||||
out_refund_no: compressTo32(id),
|
out_refund_no: compressTo32(id),
|
||||||
|
|
@ -91,7 +91,8 @@ export default class WechatPay extends WechatPayDebug implements PayClazz {
|
||||||
async getRefundState(refund: OpRefund): Promise<[string | null | undefined, RefundUpdateData | undefined]> {
|
async getRefundState(refund: OpRefund): Promise<[string | null | undefined, RefundUpdateData | undefined]> {
|
||||||
const result = await this.wechatPay.queryRefundByOutRefundNo(compressTo32(refund.id!));
|
const result = await this.wechatPay.queryRefundByOutRefundNo(compressTo32(refund.id!));
|
||||||
|
|
||||||
const { status, success_time } = this.analyzeResult(result);
|
const externalMeta = this.analyzeResult(result);
|
||||||
|
const { status, success_time } = externalMeta;
|
||||||
/**
|
/**
|
||||||
* 【退款状态】 退款到银行发现用户的卡作废或者冻结了,导致原路退款银行卡失败,可前往商户平台(pay.weixin.qq.com)-交易中心,手动处理此笔退款。
|
* 【退款状态】 退款到银行发现用户的卡作废或者冻结了,导致原路退款银行卡失败,可前往商户平台(pay.weixin.qq.com)-交易中心,手动处理此笔退款。
|
||||||
可选取值:
|
可选取值:
|
||||||
|
|
@ -102,7 +103,10 @@ export default class WechatPay extends WechatPayDebug implements PayClazz {
|
||||||
*/
|
*/
|
||||||
const iState = REFUND_STATE_MATRIX[status];
|
const iState = REFUND_STATE_MATRIX[status];
|
||||||
|
|
||||||
return [iState, success_time ? { successAt: dayJs(success_time).valueOf() } : undefined];
|
return [iState, success_time ? {
|
||||||
|
successAt: success_time ? dayJs(success_time).valueOf() : undefined,
|
||||||
|
externalMeta,
|
||||||
|
} : undefined];
|
||||||
}
|
}
|
||||||
|
|
||||||
private analyzeResult<R extends any>(result: ApiResult<R>) {
|
private analyzeResult<R extends any>(result: ApiResult<R>) {
|
||||||
|
|
@ -435,10 +439,11 @@ export default class WechatPay extends WechatPayDebug implements PayClazz {
|
||||||
assert(iState);
|
assert(iState);
|
||||||
|
|
||||||
const extra: RefundUpdateData = {
|
const extra: RefundUpdateData = {
|
||||||
meta: omit(result, ['mchid', ]),
|
externalMeta: omit(result, ['mchid', ]),
|
||||||
};
|
};
|
||||||
|
|
||||||
if (iState === 'successful') {
|
if (iState === 'successful') {
|
||||||
|
assert(success_time);
|
||||||
extra.successAt = dayJs(success_time).valueOf();
|
extra.successAt = dayJs(success_time).valueOf();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import { fullPayProjection, refreshPayState } from '../utils/pay';
|
||||||
import { OperationResult } from 'oak-domain/lib/types';
|
import { OperationResult } from 'oak-domain/lib/types';
|
||||||
import { mergeOperationResult } from 'oak-domain/lib/utils/operationResult';
|
import { mergeOperationResult } from 'oak-domain/lib/utils/operationResult';
|
||||||
|
|
||||||
const QUERY_PAYING_STATE_GAP = process.env.NODE_ENV === 'production' ? 3600 * 1000 : 60 * 1000;
|
const QUERY_PAYING_STATE_GAP = process.env.NODE_ENV === 'production' ? 600 * 1000 : 60 * 1000;
|
||||||
|
|
||||||
const watchers: Watcher<EntityDict, 'pay', BRC>[] = [
|
const watchers: Watcher<EntityDict, 'pay', BRC>[] = [
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ import { generateNewIdAsync } from 'oak-domain/lib/utils/uuid';
|
||||||
import { OperationResult } from 'oak-domain/lib/types';
|
import { OperationResult } from 'oak-domain/lib/types';
|
||||||
import { mergeOperationResult } from 'oak-domain/lib/utils/operationResult';
|
import { mergeOperationResult } from 'oak-domain/lib/utils/operationResult';
|
||||||
|
|
||||||
const QUERY_PAYING_STATE_GAP = process.env.NODE_ENV === 'production' ? 3600 * 1000 : 60 * 1000;
|
const QUERY_PAYING_STATE_GAP = process.env.NODE_ENV === 'production' ? 600 * 1000 : 60 * 1000;
|
||||||
|
|
||||||
const watchers: Watcher<EntityDict, 'refund', BRC>[] = [
|
const watchers: Watcher<EntityDict, 'refund', BRC>[] = [
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue