build
This commit is contained in:
parent
77cc2fec3b
commit
6c7b0cbce8
|
|
@ -1,4 +1,4 @@
|
|||
import { EntityDict } from '@oak-app-domain';
|
||||
import { EntityDict } from '../oak-app-domain/index';
|
||||
import { Checker } from 'oak-domain/lib/types';
|
||||
import { RuntimeCxt } from '../types/RuntimeCxt';
|
||||
declare const checkers: Checker<EntityDict, keyof EntityDict, RuntimeCxt>[];
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ declare const List: <T extends keyof EntityDict>(props: ReactComponentProps<Enti
|
|||
rowSelection?: any;
|
||||
hideHeader?: boolean | undefined;
|
||||
disableSerialNumber?: boolean | undefined;
|
||||
size?: "small" | "middle" | "large" | undefined;
|
||||
size?: "large" | "middle" | "small" | undefined;
|
||||
scroll?: any;
|
||||
empty?: React.ReactNode;
|
||||
opWidth?: number | undefined;
|
||||
|
|
@ -43,7 +43,7 @@ declare const ListPro: <T extends keyof EntityDict>(props: {
|
|||
tablePagination?: any;
|
||||
rowSelection?: any;
|
||||
disableSerialNumber?: boolean | undefined;
|
||||
size?: "small" | "middle" | "large" | undefined;
|
||||
size?: "large" | "middle" | "small" | undefined;
|
||||
scroll?: any;
|
||||
empty?: any;
|
||||
opWidth?: number | undefined;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { PayChannel } from "@project/types/Pay";
|
||||
import { PayChannel } from "../../../types/Pay";
|
||||
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, keyof import("../../../oak-app-domain").EntityDict, boolean, {
|
||||
accountId: string;
|
||||
depositMinCent: number;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import React from 'react';
|
||||
import { WebComponentProps } from 'oak-frontend-base';
|
||||
import { EntityDict } from '../../../oak-app-domain';
|
||||
import { PayChannel, PayChannels } from '@project/types/Pay';
|
||||
import { PayChannel, PayChannels } from '../../../types/Pay';
|
||||
export default function render(props: WebComponentProps<EntityDict, 'deposit', false, {
|
||||
depositMax: number;
|
||||
price: number;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import React from 'react';
|
||||
import { WebComponentProps } from 'oak-frontend-base';
|
||||
import { EntityDict } from '../../../oak-app-domain';
|
||||
import { PayChannel, PayChannels } from '@project/types/Pay';
|
||||
import { PayChannel, PayChannels } from '../../../types/Pay';
|
||||
export default function render(props: WebComponentProps<EntityDict, 'deposit', false, {
|
||||
depositMax: number;
|
||||
price: number;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import React from 'react';
|
|||
import { WebComponentProps } from 'oak-frontend-base';
|
||||
import { EntityDict } from '../../../oak-app-domain';
|
||||
import { AccountPayConfig } from '../../../types/PayConfig';
|
||||
import { PayChannel, PayChannels } from '@project/types/Pay';
|
||||
import { PayChannel, PayChannels } from '../../../types/Pay';
|
||||
export default function Render(props: WebComponentProps<EntityDict, 'order', false, {
|
||||
accountId?: string;
|
||||
accountAvailMax: number;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import React from 'react';
|
|||
import { WebComponentProps } from 'oak-frontend-base';
|
||||
import { EntityDict } from '../../../oak-app-domain';
|
||||
import { AccountPayConfig } from '../../../types/PayConfig';
|
||||
import { PayChannel, PayChannels } from '@project/types/Pay';
|
||||
import { PayChannel, PayChannels } from '../../../types/Pay';
|
||||
export default function Render(props: WebComponentProps<EntityDict, 'order', false, {
|
||||
accountId?: string;
|
||||
accountAvailMax: number;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/// <reference types="react" />
|
||||
import { PayChannelOption } from "@project/types/Pay";
|
||||
import { PayChannelOption } from "../../../types/Pay";
|
||||
export default function Render(props: {
|
||||
data: {
|
||||
channel?: string;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/// <reference types="react" />
|
||||
import { PayChannelOption } from "@project/types/Pay";
|
||||
import { PayChannelOption } from "../../../types/Pay";
|
||||
export default function Render(props: {
|
||||
data: {
|
||||
channel?: string;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { AccountPayConfig } from '@project/types/PayConfig';
|
||||
import { AccountPayConfig } from '../../../../types/PayConfig';
|
||||
import React from 'react';
|
||||
export default function Account(props: {
|
||||
config: AccountPayConfig;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import React from 'react';
|
||||
import { OfflinePayConfig } from '@project/types/PayConfig';
|
||||
import { OfflinePayConfig } from '../../../../types/PayConfig';
|
||||
export default function Offline(props: {
|
||||
config: OfflinePayConfig;
|
||||
update: (config: Omit<OfflinePayConfig, 'channel'>) => void;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { WechatPayConfig } from '@project/types/PayConfig';
|
||||
import { WechatPayConfig } from '../../../../types/PayConfig';
|
||||
import React from 'react';
|
||||
export default function WechatPay(props: {
|
||||
config: WechatPayConfig;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import React from 'react';
|
||||
import { WebComponentProps } from 'oak-frontend-base';
|
||||
import { EntityDict } from '../../../oak-app-domain';
|
||||
import { SysAccountOperType } from '@project/types/sysAccountOper';
|
||||
import { SysAccountOperType } from '../../../types/sysAccountOper';
|
||||
type SAOType = SysAccountOperType | 'all';
|
||||
export default function Render(props: WebComponentProps<EntityDict, 'accountOper', true, {
|
||||
sysAccountOpers?: Array<{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { Importation, Exportation } from "oak-domain/lib/types/Port";
|
||||
import { EntityDict } from "@oak-app-domain";
|
||||
import { EntityDict } from "../oak-app-domain/index";
|
||||
import { BRC } from '../types/RuntimeCxt';
|
||||
export declare const importations: Importation<EntityDict, keyof EntityDict, any, BRC>[];
|
||||
export declare const exportations: Exportation<EntityDict, keyof EntityDict, any, BRC>[];
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
export { registerPayClazzEntity } from './utils/payClazz';
|
||||
export { registerPayChannelComponent } from './components/payConfig/system/web.pc';
|
||||
export { registerFrontendPayRoutine } from './components/pay/detail/index';
|
||||
export { registerApplicationProjection } from './utils/application';
|
||||
import { EntityDict } from './oak-app-domain';
|
||||
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/types/Entity';
|
||||
export declare const ExtraOnlineChannels: Array<{
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
export { registerPayClazzEntity } from './utils/payClazz';
|
||||
export { registerPayChannelComponent } from './components/payConfig/system/web.pc';
|
||||
export { registerFrontendPayRoutine } from './components/pay/detail/index';
|
||||
export { registerApplicationProjection } from './utils/application';
|
||||
export const ExtraOnlineChannels = [];
|
||||
export function registerOnlinePayEntity(entity, options) {
|
||||
const { name } = options;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { Routine } from 'oak-domain/lib/types/Timer';
|
||||
import { EntityDict } from '@oak-app-domain';
|
||||
import { EntityDict } from '../oak-app-domain/index';
|
||||
import { BRC } from '../types/RuntimeCxt';
|
||||
declare const startRoutines: Array<Routine<EntityDict, keyof EntityDict, BRC>>;
|
||||
export default startRoutines;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { Timer } from 'oak-domain/lib/types/Timer';
|
||||
import { EntityDict } from '@oak-app-domain';
|
||||
import { EntityDict } from '../oak-app-domain/index';
|
||||
import { BRC } from '../types/RuntimeCxt';
|
||||
declare const timers: Array<Timer<EntityDict, keyof EntityDict, BRC>>;
|
||||
export default timers;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { EntityDict } from '@oak-app-domain';
|
||||
import { EntityDict } from '../oak-app-domain/index';
|
||||
import { Trigger } from 'oak-domain/lib/types';
|
||||
import { BRC } from '../types/RuntimeCxt';
|
||||
declare const triggers: Trigger<EntityDict, keyof EntityDict, BRC>[];
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { OakException, OpRecord } from 'oak-domain/lib/types';
|
||||
import { EntityDict } from '@oak-app-domain';
|
||||
import { EntityDict } from '../oak-app-domain/index';
|
||||
export declare class ExternalPayUtilException<ED extends EntityDict> extends OakException<ED> {
|
||||
reason: any;
|
||||
constructor(reason: any, message?: string, _module?: string, params?: Record<string, any>);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { Watcher } from 'oak-domain/lib/types';
|
||||
import { EntityDict } from '@oak-app-domain';
|
||||
import { EntityDict } from '../oak-app-domain/index';
|
||||
import { BRC } from '../types/RuntimeCxt';
|
||||
declare const watchers: Watcher<EntityDict, keyof EntityDict, BRC>[];
|
||||
export default watchers;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { EntityDict } from '@oak-app-domain';
|
||||
import { EntityDict } from '../oak-app-domain/index';
|
||||
import { Checker } from 'oak-domain/lib/types';
|
||||
import { RuntimeCxt } from '../types/RuntimeCxt';
|
||||
declare const checkers: Checker<EntityDict, keyof EntityDict, RuntimeCxt>[];
|
||||
|
|
|
|||
|
|
@ -1,4 +0,0 @@
|
|||
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, "offlineAccount", true, {
|
||||
systemId: string;
|
||||
}>) => React.ReactElement;
|
||||
export default _default;
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = OakComponent({
|
||||
entity: 'offlineAccount',
|
||||
isList: true,
|
||||
projection: {
|
||||
id: 1,
|
||||
type: 1,
|
||||
channel: 1,
|
||||
name: 1,
|
||||
qrCode: 1,
|
||||
allowDeposit: 1,
|
||||
allowPay: 1,
|
||||
systemId: 1,
|
||||
price: 1,
|
||||
enabled: 1,
|
||||
taxLossRatio: 1,
|
||||
refundCompensateRatio: 1,
|
||||
refundGapDays: 1,
|
||||
allowWithdrawTransfer: 1,
|
||||
withdrawTransferLossRatio: 1,
|
||||
},
|
||||
properties: {
|
||||
systemId: '',
|
||||
},
|
||||
filters: [
|
||||
{
|
||||
filter() {
|
||||
const { systemId } = this.props;
|
||||
return {
|
||||
systemId,
|
||||
};
|
||||
}
|
||||
}
|
||||
],
|
||||
formData({ data, legalActions }) {
|
||||
return {
|
||||
accounts: data.map((ele) => {
|
||||
const { type } = ele;
|
||||
const color = this.features.style.getColor('offlineAccount', 'type', type);
|
||||
return {
|
||||
color,
|
||||
...ele,
|
||||
};
|
||||
}),
|
||||
canCreate: legalActions?.includes('create'),
|
||||
oakExecutable: this.tryExecute(),
|
||||
};
|
||||
},
|
||||
actions: ['create', 'update', 'remove'],
|
||||
});
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
import { EntityDict } from "../../../oak-app-domain";
|
||||
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/types/Entity';
|
||||
import { StartPayRoutine, JudgeCanPay } from "../../../types/Pay";
|
||||
export declare function registerFrontendPayRoutine<ED extends EntityDict & BaseEntityDict>(entity: keyof ED, routine: StartPayRoutine, projection: ED['pay']['Projection'], judgeCanPay: JudgeCanPay): void;
|
||||
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<EntityDict, "pay", false, {
|
||||
onClose: () => void;
|
||||
onPaid: () => void;
|
||||
onPayFailure: () => void;
|
||||
disableAutoPay: boolean;
|
||||
closeWhenFailure: boolean;
|
||||
}>) => React.ReactElement;
|
||||
export default _default;
|
||||
|
|
@ -1,327 +0,0 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.registerFrontendPayRoutine = void 0;
|
||||
const tslib_1 = require("tslib");
|
||||
const money_1 = require("oak-domain/lib/utils/money");
|
||||
const constants_1 = require("../../../config/constants");
|
||||
const assert_1 = tslib_1.__importDefault(require("assert"));
|
||||
const utils_1 = require("oak-frontend-base/es/utils/utils");
|
||||
const lodash_1 = require("oak-domain/lib/utils/lodash");
|
||||
const wpProductFrontend_1 = require("../../../utils/wpProductFrontend");
|
||||
const uuid_1 = require("oak-domain/lib/utils/uuid");
|
||||
const Exception_1 = require("../../../types/Exception");
|
||||
const PayRoutineDict = {
|
||||
wpProduct: {
|
||||
projection: {
|
||||
wpProduct: {
|
||||
id: 1,
|
||||
type: 1,
|
||||
},
|
||||
},
|
||||
routine: async (pay, features) => {
|
||||
const { iState, wpProduct, meta } = pay;
|
||||
switch (wpProduct.type) {
|
||||
case 'mp': {
|
||||
if (process.env.OAK_PLATFORM === 'wechatMp') {
|
||||
const { prepayMeta } = meta;
|
||||
if (prepayMeta) {
|
||||
try {
|
||||
const result = await wx.requestPayment(prepayMeta);
|
||||
process.env.NODE_ENV === 'development' && console.log(result);
|
||||
}
|
||||
catch (err) {
|
||||
throw new Exception_1.StartPayFailure(err.errMsg.includes('cancel')
|
||||
? features.locales.t('startPayError.userCancel')
|
||||
: features.locales.t('startPayError.unknown'));
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw new Exception_1.StartPayFailure(features.locales.t('startPayError.illegalPrepayData'));
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw new Exception_1.StartPayFailure(features.locales.t('startPayError.falseEnv', { env: 'wechatMp' }));
|
||||
}
|
||||
return;
|
||||
}
|
||||
case 'jsapi': {
|
||||
if (process.env.OAK_PLATFORM === 'web' && utils_1.isWeiXin) {
|
||||
const { prepayMeta } = meta;
|
||||
if (prepayMeta) {
|
||||
const { timeStamp, ...rest } = prepayMeta;
|
||||
// chooseWXPay文档都找不到了,网上查出来这里timestamp的s要小写,吐血了
|
||||
await features.wechatSdk.loadWxAPi('chooseWXPay', {
|
||||
timestamp: timeStamp,
|
||||
...rest,
|
||||
});
|
||||
}
|
||||
else {
|
||||
throw new Exception_1.StartPayFailure(features.locales.t('startPayError.illegalPrepayData'));
|
||||
}
|
||||
}
|
||||
}
|
||||
default: {
|
||||
(0, assert_1.default)('尚未实现');
|
||||
}
|
||||
}
|
||||
},
|
||||
judgeCanPay: wpProductFrontend_1.canStartPay,
|
||||
}
|
||||
};
|
||||
function registerFrontendPayRoutine(entity, routine, projection, judgeCanPay) {
|
||||
PayRoutineDict[entity] = {
|
||||
routine,
|
||||
projection,
|
||||
judgeCanPay,
|
||||
};
|
||||
}
|
||||
exports.registerFrontendPayRoutine = registerFrontendPayRoutine;
|
||||
exports.default = OakComponent({
|
||||
entity: 'pay',
|
||||
isList: false,
|
||||
projection: () => {
|
||||
const baseProjection = {
|
||||
id: 1,
|
||||
applicationId: 1,
|
||||
price: 1,
|
||||
meta: 1,
|
||||
iState: 1,
|
||||
paid: 1,
|
||||
refunded: 1,
|
||||
timeoutAt: 1,
|
||||
forbidRefundAt: 1,
|
||||
externalId: 1,
|
||||
orderId: 1,
|
||||
depositId: 1,
|
||||
deposit: {
|
||||
id: 1,
|
||||
accountId: 1,
|
||||
price: 1,
|
||||
loss: 1,
|
||||
},
|
||||
order: {
|
||||
id: 1,
|
||||
creatorId: 1,
|
||||
},
|
||||
entity: 1,
|
||||
entityId: 1,
|
||||
creatorId: 1,
|
||||
phantom3: 1,
|
||||
};
|
||||
for (const k in PayRoutineDict) {
|
||||
(0, lodash_1.merge)(baseProjection, PayRoutineDict[k].projection);
|
||||
}
|
||||
return baseProjection;
|
||||
},
|
||||
properties: {
|
||||
onClose: () => undefined,
|
||||
onPaid: () => undefined,
|
||||
onPayFailure: () => undefined,
|
||||
disableAutoPay: false,
|
||||
closeWhenFailure: false,
|
||||
},
|
||||
data: {
|
||||
showCloseConfirmMp: false,
|
||||
showChannelSelectMp: false,
|
||||
unsub: undefined,
|
||||
},
|
||||
formData({ data }) {
|
||||
const application = this.features.application.getApplication();
|
||||
const iState = data?.iState;
|
||||
const iStateColor = iState && this.features.style.getColor('pay', 'iState', iState);
|
||||
const startPayable = iState === 'paying' && !['account', 'offlineAccount'].includes(data.entity) && (PayRoutineDict[data.entity] && PayRoutineDict[data.entity].judgeCanPay(data, this.features));
|
||||
const payChannels = this.features.pay.getPayChannels();
|
||||
const offlines = this.features.cache.get('offlineAccount', {
|
||||
data: {
|
||||
id: 1,
|
||||
type: 1,
|
||||
channel: 1,
|
||||
name: 1,
|
||||
qrCode: 1,
|
||||
},
|
||||
filter: {
|
||||
systemId: this.features.application.getApplication().systemId,
|
||||
}
|
||||
}).map(ele => {
|
||||
const color = this.features.style.getColor('offlineAccount', 'type', ele.type);
|
||||
return {
|
||||
color,
|
||||
...ele,
|
||||
};
|
||||
});
|
||||
const offline = offlines?.find(ele => ele.id === data.entityId);
|
||||
return {
|
||||
type: data?.orderId ? 'order' : 'deposit',
|
||||
pay: data,
|
||||
application,
|
||||
iStateColor,
|
||||
closable: !!(data?.["#oakLegalActions"]?.includes('close')),
|
||||
startPayable,
|
||||
offline,
|
||||
offlines,
|
||||
notSameApp: data && data.applicationId !== application.id && data.entity !== 'offlineAccount',
|
||||
priceStr: data?.price && (0, money_1.CentToString)(data.price, 2),
|
||||
oakExecutable: this.tryExecute(),
|
||||
};
|
||||
},
|
||||
features: [{
|
||||
feature: 'application',
|
||||
callback() {
|
||||
this.refreshOfflineAccounts();
|
||||
}
|
||||
}],
|
||||
actions: ['close', 'startPaying', {
|
||||
action: 'update',
|
||||
attrs: ['entityId'],
|
||||
}],
|
||||
methods: {
|
||||
refreshOfflineAccounts() {
|
||||
const { entity } = this.state.pay || {};
|
||||
if (entity === 'offlineAccount') {
|
||||
this.features.cache.refresh('offlineAccount', {
|
||||
data: {
|
||||
id: 1,
|
||||
channel: 1,
|
||||
name: 1,
|
||||
type: 1,
|
||||
qrCode: 1,
|
||||
},
|
||||
filter: {
|
||||
systemId: this.features.application.getApplication().systemId,
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
executeMp() {
|
||||
return this.execute();
|
||||
},
|
||||
resetMp() {
|
||||
return this.clean();
|
||||
},
|
||||
closeMp() {
|
||||
this.setState({
|
||||
showCloseConfirmMp: true,
|
||||
});
|
||||
},
|
||||
cancelCloseMp() {
|
||||
this.setState({
|
||||
showCloseConfirmMp: false,
|
||||
});
|
||||
},
|
||||
async confirmCloseMp() {
|
||||
await this.execute('close');
|
||||
this.cancelCloseMp();
|
||||
const { onClose } = this.props;
|
||||
onClose && onClose();
|
||||
},
|
||||
goBack() {
|
||||
this.navigateBack();
|
||||
},
|
||||
async startPay() {
|
||||
const { onPaid, onClose, onPayFailure } = this.props;
|
||||
const { pay } = this.state;
|
||||
try {
|
||||
await PayRoutineDict[pay.entity].routine(pay, this.features);
|
||||
onPaid && onPaid();
|
||||
}
|
||||
catch (err) {
|
||||
if (this.props.closeWhenFailure) {
|
||||
await this.execute(undefined, undefined, undefined, [
|
||||
{
|
||||
entity: 'pay',
|
||||
operation: {
|
||||
id: await (0, uuid_1.generateNewIdAsync)(),
|
||||
action: 'close',
|
||||
data: {},
|
||||
filter: {
|
||||
id: this.props.oakId,
|
||||
},
|
||||
},
|
||||
}
|
||||
]);
|
||||
onClose && onClose();
|
||||
}
|
||||
else {
|
||||
onPayFailure && onPayFailure();
|
||||
}
|
||||
this.features.message.setMessage({
|
||||
type: 'warning',
|
||||
content: err.message,
|
||||
});
|
||||
}
|
||||
},
|
||||
openChannelSelectMp() {
|
||||
this.setState({
|
||||
showChannelSelectMp: true,
|
||||
});
|
||||
},
|
||||
closeChannelSelectMp() {
|
||||
this.setState({
|
||||
showChannelSelectMp: false,
|
||||
});
|
||||
},
|
||||
async updateOfflineIdMp(touch) {
|
||||
const { detail } = touch;
|
||||
const { currentKey } = detail;
|
||||
const { oakId } = this.props;
|
||||
if (currentKey) {
|
||||
await this.execute(undefined, undefined, undefined, [
|
||||
{
|
||||
entity: 'pay',
|
||||
operation: {
|
||||
id: await (0, uuid_1.generateNewIdAsync)(),
|
||||
action: 'update',
|
||||
data: {
|
||||
entity: 'offlineAccount',
|
||||
entityId: currentKey,
|
||||
},
|
||||
filter: {
|
||||
id: oakId,
|
||||
},
|
||||
}
|
||||
}
|
||||
]);
|
||||
this.setState({
|
||||
showChannelSelectMp: false,
|
||||
});
|
||||
}
|
||||
},
|
||||
updateExternalIdMp(input) {
|
||||
const { detail } = input;
|
||||
this.update({
|
||||
externalId: detail.value,
|
||||
});
|
||||
},
|
||||
clearExternalIdMp() {
|
||||
this.update({
|
||||
externalId: null,
|
||||
});
|
||||
}
|
||||
},
|
||||
lifetimes: {
|
||||
async ready() {
|
||||
const { oakId } = this.props;
|
||||
(0, assert_1.default)(typeof oakId === 'string');
|
||||
const unsub = await this.subDataEvents([`${constants_1.DATA_SUBSCRIBER_KEYS.payStateChanged}-${oakId}`]);
|
||||
this.setState({
|
||||
unsub,
|
||||
});
|
||||
},
|
||||
detached() {
|
||||
const { unsub } = this.state;
|
||||
unsub && unsub();
|
||||
}
|
||||
},
|
||||
listeners: {
|
||||
startPayable(prev, next) {
|
||||
if (next.startPayable && !this.props.disableAutoPay) {
|
||||
this.startPay();
|
||||
}
|
||||
},
|
||||
pay(prev, next) {
|
||||
if (!prev.pay && next.pay) {
|
||||
this.refreshOfflineAccounts();
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
import React from 'react';
|
||||
import { RowWithActions, WebComponentProps } from 'oak-frontend-base';
|
||||
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/types/Entity';
|
||||
import { EntityDict } from '../../../oak-app-domain';
|
||||
export declare function registerPayChannelComponent<ED extends EntityDict & BaseEntityDict, T extends keyof ED>(entity: T, component: (option: {
|
||||
oakPath: string;
|
||||
systemId: string;
|
||||
}) => React.ReactElement): void;
|
||||
export default function render(props: WebComponentProps<EntityDict, 'system', false, {
|
||||
system: RowWithActions<EntityDict, 'system'>;
|
||||
operation?: EntityDict['system']['Update'];
|
||||
serverUrl?: string;
|
||||
canUpdate?: boolean;
|
||||
oakExecutable: boolean;
|
||||
}>): import("react/jsx-runtime").JSX.Element | null;
|
||||
|
|
@ -1,122 +0,0 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.registerPayChannelComponent = void 0;
|
||||
const tslib_1 = require("tslib");
|
||||
const jsx_runtime_1 = require("react/jsx-runtime");
|
||||
const antd_1 = require("antd");
|
||||
const web_pc_module_less_1 = tslib_1.__importDefault(require("./web.pc.module.less"));
|
||||
const config_1 = tslib_1.__importDefault(require("../../offlineAccount/config"));
|
||||
const config_2 = tslib_1.__importDefault(require("../../wpAccount/config"));
|
||||
const PayChannelConfigDict = {
|
||||
'wpAccount': config_2.default,
|
||||
};
|
||||
function registerPayChannelComponent(entity, component) {
|
||||
PayChannelConfigDict[entity] = component;
|
||||
}
|
||||
exports.registerPayChannelComponent = registerPayChannelComponent;
|
||||
function PayConfig(props) {
|
||||
const { payConfig, update, t } = props;
|
||||
const withdrawLoss = payConfig?.withdrawLoss;
|
||||
const depositLoss = payConfig?.depositLoss;
|
||||
const updateDepositLoss = (data) => {
|
||||
update && update({
|
||||
depositLoss: {
|
||||
...depositLoss,
|
||||
...data,
|
||||
},
|
||||
withdrawLoss: withdrawLoss || {
|
||||
conservative: false,
|
||||
},
|
||||
});
|
||||
};
|
||||
const updateWithdrawLoss = (data) => {
|
||||
update && update({
|
||||
depositLoss: depositLoss || {},
|
||||
withdrawLoss: {
|
||||
conservative: !!(withdrawLoss?.conservative),
|
||||
...withdrawLoss,
|
||||
...data,
|
||||
},
|
||||
});
|
||||
};
|
||||
return ((0, jsx_runtime_1.jsxs)(antd_1.Flex, { gap: "middle", children: [(0, jsx_runtime_1.jsx)(antd_1.Card, { title: t('payConfig.label.depositLoss'), extra: (0, jsx_runtime_1.jsx)(antd_1.Popover, { content: t("payConfig.help.depositLoss"), children: (0, jsx_runtime_1.jsx)("span", { className: web_pc_module_less_1.default.help, children: t("help") }) }), children: (0, jsx_runtime_1.jsxs)(antd_1.Form, { labelCol: { span: 8 }, wrapperCol: { span: 18 }, layout: "horizontal", style: { width: '100%' }, children: [(0, jsx_runtime_1.jsx)(antd_1.Form.Item, { label: t('payConfig.label.ratio'), children: (0, jsx_runtime_1.jsx)(antd_1.InputNumber, { value: depositLoss?.ratio, max: 20, min: 0.01, addonAfter: "%", step: 0.01, precision: 2, disabled: !update, onChange: (value) => {
|
||||
const ratio = value;
|
||||
updateDepositLoss({
|
||||
ratio: ratio || 0
|
||||
});
|
||||
} }) }), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, { label: t('payConfig.label.highest'), children: (0, jsx_runtime_1.jsx)(antd_1.InputNumber, { value: depositLoss?.highest, min: 0, step: 1, disabled: !update, onChange: (value) => {
|
||||
const highest = value;
|
||||
updateDepositLoss({
|
||||
highest: highest || undefined
|
||||
});
|
||||
return;
|
||||
} }) }), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, { label: t('payConfig.label.lowest'), children: (0, jsx_runtime_1.jsx)(antd_1.InputNumber, { value: depositLoss?.lowest, min: 0, step: 1, disabled: !update, onChange: (value) => {
|
||||
const lowest = value;
|
||||
updateDepositLoss({
|
||||
lowest: lowest || undefined
|
||||
});
|
||||
return;
|
||||
} }) })] }) }), (0, jsx_runtime_1.jsx)(antd_1.Card, { title: t('payConfig.label.withdrawLoss'), extra: (0, jsx_runtime_1.jsx)(antd_1.Popover, { content: t('payConfig.help.withdrawLoss'), children: (0, jsx_runtime_1.jsx)("span", { className: web_pc_module_less_1.default.help, children: t("help") }) }), children: (0, jsx_runtime_1.jsxs)(antd_1.Form, { labelCol: { span: 8 }, wrapperCol: { span: 18 }, layout: "horizontal", style: { width: '100%' }, children: [(0, jsx_runtime_1.jsx)(antd_1.Form.Item, { label: t('payConfig.label.conservative'), children: (0, jsx_runtime_1.jsx)(antd_1.Switch, { disabled: !update, value: withdrawLoss?.conservative, onChange: (conservative) => {
|
||||
updateWithdrawLoss({ conservative });
|
||||
} }) }), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, { label: t('payConfig.label.ratio'), children: (0, jsx_runtime_1.jsx)(antd_1.InputNumber, { disabled: !!withdrawLoss?.conservative || !update, value: withdrawLoss?.ratio, max: 20, min: 0.01, addonAfter: "%", step: 0.01, precision: 2, onChange: (value) => {
|
||||
const ratio = value;
|
||||
updateWithdrawLoss({
|
||||
ratio: ratio || 0
|
||||
});
|
||||
} }) }), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, { label: t('payConfig.label.highest'), children: (0, jsx_runtime_1.jsx)(antd_1.InputNumber, { disabled: !!withdrawLoss?.conservative || !update, value: withdrawLoss?.highest, min: 0, step: 1, onChange: (value) => {
|
||||
const highest = value;
|
||||
updateWithdrawLoss({
|
||||
highest: highest || undefined
|
||||
});
|
||||
return;
|
||||
} }) }), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, { label: t('payConfig.label.lowest'), children: (0, jsx_runtime_1.jsx)(antd_1.InputNumber, { disabled: !!withdrawLoss?.conservative || !update, value: withdrawLoss?.lowest, min: 0, step: 1, onChange: (value) => {
|
||||
const lowest = value;
|
||||
updateWithdrawLoss({
|
||||
lowest: lowest || undefined
|
||||
});
|
||||
return;
|
||||
} }) }), (0, jsx_runtime_1.jsx)(antd_1.Form.Item, { label: t('payConfig.label.trim'), children: (0, jsx_runtime_1.jsx)(antd_1.Radio.Group, { disabled: !!withdrawLoss?.conservative || !update, options: [
|
||||
{
|
||||
label: t('payConfig.label.jiao'),
|
||||
value: 'jiao',
|
||||
},
|
||||
{
|
||||
label: t('payConfig.label.yuan'),
|
||||
value: 'yuan',
|
||||
},
|
||||
{
|
||||
label: t('payConfig.label.null'),
|
||||
value: '',
|
||||
}
|
||||
], value: withdrawLoss?.trim, onChange: ({ target }) => updateWithdrawLoss({
|
||||
trim: target.value,
|
||||
}) }) })] }) })] }));
|
||||
}
|
||||
function render(props) {
|
||||
const { system, oakFullpath, operation, oakDirty, serverUrl, oakExecutable, canUpdate } = props.data;
|
||||
const { t, update, clean, execute } = props.methods;
|
||||
if (system && oakFullpath) {
|
||||
return ((0, jsx_runtime_1.jsx)("div", { className: web_pc_module_less_1.default.container, children: (0, jsx_runtime_1.jsx)(antd_1.Tabs, { className: web_pc_module_less_1.default.tabs, tabPosition: "left", items: [
|
||||
{
|
||||
label: ((0, jsx_runtime_1.jsx)("div", { className: web_pc_module_less_1.default.systemLabel, children: t('system') })),
|
||||
key: 'system',
|
||||
children: ((0, jsx_runtime_1.jsxs)(antd_1.Flex, { vertical: true, children: [(0, jsx_runtime_1.jsx)(PayConfig, { payConfig: system.payConfig, update: canUpdate ? (payConfig) => update({ payConfig }) : undefined, t: t }), (0, jsx_runtime_1.jsxs)(antd_1.Flex, { gap: "middle", justify: 'end', children: [(0, jsx_runtime_1.jsx)(antd_1.Button, { type: "primary", disabled: oakExecutable !== true, onClick: () => execute(), children: t('common::confirm') }), (0, jsx_runtime_1.jsx)(antd_1.Button, { disabled: !oakDirty, onClick: () => clean(), children: t('common::reset') })] })] })),
|
||||
},
|
||||
{
|
||||
label: ((0, jsx_runtime_1.jsx)("div", { className: web_pc_module_less_1.default.systemLabel, children: t('offlineAccount:name') })),
|
||||
key: 'offlineAccount',
|
||||
children: ((0, jsx_runtime_1.jsx)(config_1.default, { oakPath: `${oakFullpath}.offlineAccount$system`, systemId: system.id })),
|
||||
},
|
||||
...Object.keys(PayChannelConfigDict).map((ele) => {
|
||||
const C = PayChannelConfigDict[ele];
|
||||
return {
|
||||
label: ((0, jsx_runtime_1.jsx)("div", { className: web_pc_module_less_1.default.systemLabel, children: t(`${ele}:name`) })),
|
||||
key: ele,
|
||||
children: (0, jsx_runtime_1.jsx)(C, { oakPath: `${oakFullpath}.${ele}$system`, systemId: system.id })
|
||||
};
|
||||
})
|
||||
] }) }));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
exports.default = render;
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, "wpAccount", true, {
|
||||
systemId: string;
|
||||
}>) => React.ReactElement;
|
||||
export default _default;
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = OakComponent({
|
||||
entity: 'wpAccount',
|
||||
isList: true,
|
||||
projection: {
|
||||
id: 1,
|
||||
price: 1,
|
||||
mchId: 1,
|
||||
enabled: 1,
|
||||
taxLossRatio: 1,
|
||||
refundCompensateRatio: 1,
|
||||
refundGapDays: 1,
|
||||
allowWithdrawTransfer: 1,
|
||||
withdrawTransferLossRatio: 1,
|
||||
},
|
||||
properties: {
|
||||
systemId: '',
|
||||
},
|
||||
filters: [
|
||||
{
|
||||
filter() {
|
||||
const { systemId } = this.props;
|
||||
return {
|
||||
systemId,
|
||||
};
|
||||
}
|
||||
}
|
||||
],
|
||||
formData({ data, legalActions }) {
|
||||
return {
|
||||
accounts: data,
|
||||
canCreate: legalActions?.includes('create') && !data?.find(ele => ele.enabled),
|
||||
oakExecutable: this.tryExecute(),
|
||||
};
|
||||
},
|
||||
actions: ['create', 'update', 'remove'],
|
||||
});
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
import { Importation, Exportation } from "oak-domain/lib/types/Port";
|
||||
import { EntityDict } from "@oak-app-domain";
|
||||
import { EntityDict } from "../oak-app-domain/index";
|
||||
import { BRC } from '../types/RuntimeCxt';
|
||||
export declare const importations: Importation<EntityDict, keyof EntityDict, any, BRC>[];
|
||||
export declare const exportations: Exportation<EntityDict, keyof EntityDict, any, BRC>[];
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
export { registerPayClazzEntity } from './utils/payClazz';
|
||||
export { registerPayChannelComponent } from './components/payConfig/system/web.pc';
|
||||
export { registerFrontendPayRoutine } from './components/pay/detail/index';
|
||||
export { registerApplicationProjection } from './utils/application';
|
||||
import { EntityDict } from './oak-app-domain';
|
||||
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/types/Entity';
|
||||
export declare const ExtraOnlineChannels: Array<{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,14 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.registerOnlinePayEntity = exports.ExtraOnlineChannels = void 0;
|
||||
exports.registerOnlinePayEntity = exports.ExtraOnlineChannels = exports.registerApplicationProjection = exports.registerFrontendPayRoutine = exports.registerPayChannelComponent = exports.registerPayClazzEntity = void 0;
|
||||
var payClazz_1 = require("./utils/payClazz");
|
||||
Object.defineProperty(exports, "registerPayClazzEntity", { enumerable: true, get: function () { return payClazz_1.registerPayClazzEntity; } });
|
||||
var web_pc_1 = require("./components/payConfig/system/web.pc");
|
||||
Object.defineProperty(exports, "registerPayChannelComponent", { enumerable: true, get: function () { return web_pc_1.registerPayChannelComponent; } });
|
||||
var index_1 = require("./components/pay/detail/index");
|
||||
Object.defineProperty(exports, "registerFrontendPayRoutine", { enumerable: true, get: function () { return index_1.registerFrontendPayRoutine; } });
|
||||
var application_1 = require("./utils/application");
|
||||
Object.defineProperty(exports, "registerApplicationProjection", { enumerable: true, get: function () { return application_1.registerApplicationProjection; } });
|
||||
exports.ExtraOnlineChannels = [];
|
||||
function registerOnlinePayEntity(entity, options) {
|
||||
const { name } = options;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { Routine } from 'oak-domain/lib/types/Timer';
|
||||
import { EntityDict } from '@oak-app-domain';
|
||||
import { EntityDict } from '../oak-app-domain/index';
|
||||
import { BRC } from '../types/RuntimeCxt';
|
||||
declare const startRoutines: Array<Routine<EntityDict, keyof EntityDict, BRC>>;
|
||||
export default startRoutines;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { Timer } from 'oak-domain/lib/types/Timer';
|
||||
import { EntityDict } from '@oak-app-domain';
|
||||
import { EntityDict } from '../oak-app-domain/index';
|
||||
import { BRC } from '../types/RuntimeCxt';
|
||||
declare const timers: Array<Timer<EntityDict, keyof EntityDict, BRC>>;
|
||||
export default timers;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { EntityDict } from '@oak-app-domain';
|
||||
import { EntityDict } from '../oak-app-domain/index';
|
||||
import { Trigger } from 'oak-domain/lib/types';
|
||||
import { BRC } from '../types/RuntimeCxt';
|
||||
declare const triggers: Trigger<EntityDict, keyof EntityDict, BRC>[];
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ const uuid_1 = require("oak-domain/lib/utils/uuid");
|
|||
const payClazz_1 = require("../utils/payClazz");
|
||||
const assert_1 = tslib_1.__importDefault(require("assert"));
|
||||
const withdraw_1 = require("./withdraw");
|
||||
const Exception_1 = require("@project/types/Exception");
|
||||
const Exception_1 = require("../types/Exception");
|
||||
/**
|
||||
* 开始退款的逻辑
|
||||
* @param context
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { OakException, OpRecord } from 'oak-domain/lib/types';
|
||||
import { EntityDict } from '@oak-app-domain';
|
||||
import { EntityDict } from '../oak-app-domain/index';
|
||||
export declare class ExternalPayUtilException<ED extends EntityDict> extends OakException<ED> {
|
||||
reason: any;
|
||||
constructor(reason: any, message?: string, _module?: string, params?: Record<string, any>);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { Watcher } from 'oak-domain/lib/types';
|
||||
import { EntityDict } from '@oak-app-domain';
|
||||
import { EntityDict } from '../oak-app-domain/index';
|
||||
import { BRC } from '../types/RuntimeCxt';
|
||||
declare const watchers: Watcher<EntityDict, keyof EntityDict, BRC>[];
|
||||
export default watchers;
|
||||
|
|
|
|||
Loading…
Reference in New Issue