oak-pay-business 2.0.1 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/checkers/order.js +5 -1
- package/es/components/account/detail/index.d.ts +1 -0
- package/es/components/account/detail/index.js +4 -0
- package/es/components/account/detail/index.xml +6 -1
- package/es/components/account/detail/web.d.ts +1 -0
- package/es/components/account/detail/web.js +4 -2
- package/es/components/account/detail/web.pc.d.ts +1 -0
- package/es/components/account/detail/web.pc.js +1 -1
- package/es/components/accountOper/list/index.d.ts +3 -2
- package/es/components/accountOper/list/index.js +41 -1
- package/es/components/accountOper/list/mobile.module.less +7 -0
- package/es/components/accountOper/list/web.d.ts +11 -3
- package/es/components/accountOper/list/web.js +27 -3
- package/es/components/accountOper/list/web.pc.d.ts +10 -3
- package/es/components/accountOper/list/web.pc.js +7 -1
- package/es/components/accountOper/pure/List.pc.js +1 -1
- package/es/components/pay/detail/web.d.ts +2 -2
- package/es/components/pay/detail/web.js +7 -4
- package/es/components/pay/detail/web.pc.d.ts +2 -2
- package/es/components/pay/detail/web.pc.js +7 -4
- package/es/components/pay/list/web.pc.d.ts +1 -1
- package/es/components/pay/list/web.pc.js +4 -4
- package/es/context/BackendRuntimeContext.d.ts +1 -1
- package/es/context/BackendRuntimeContext.js +1 -1
- package/es/context/FrontendRuntimeContext.d.ts +1 -1
- package/es/context/FrontendRuntimeContext.js +1 -1
- package/es/data/actionAuth.js +1 -1
- package/es/entities/AccountOper.d.ts +3 -0
- package/es/entities/AccountOper.js +4 -1
- package/es/features/Pay.js +19 -1
- package/es/features/index.d.ts +1 -1
- package/es/index.d.ts +0 -3
- package/es/index.js +0 -2
- package/es/oak-app-domain/AccountOper/Schema.d.ts +18 -0
- package/es/oak-app-domain/AccountOper/Storage.js +12 -0
- package/es/oak-app-domain/AccountOper/locales/zh_CN.json +1 -1
- package/es/oak-app-domain/Refund/locales/zh_CN.json +1 -1
- package/es/oak-app-domain/WithdrawTransfer/locales/zh_CN.json +1 -1
- package/es/triggers/accountOper.js +12 -9
- package/es/utils/pay.d.ts +0 -10
- package/es/utils/pay.js +0 -26
- package/lib/checkers/order.js +5 -1
- package/lib/context/BackendRuntimeContext.d.ts +1 -1
- package/lib/context/BackendRuntimeContext.js +2 -2
- package/lib/context/FrontendRuntimeContext.d.ts +1 -1
- package/lib/context/FrontendRuntimeContext.js +2 -2
- package/lib/data/actionAuth.js +1 -1
- package/lib/entities/AccountOper.d.ts +3 -0
- package/lib/entities/AccountOper.js +4 -1
- package/lib/features/Pay.js +20 -2
- package/lib/features/index.d.ts +1 -1
- package/lib/index.d.ts +0 -3
- package/lib/index.js +0 -5
- package/lib/oak-app-domain/AccountOper/Schema.d.ts +18 -0
- package/lib/oak-app-domain/AccountOper/Storage.js +12 -0
- package/lib/oak-app-domain/AccountOper/locales/zh_CN.json +1 -1
- package/lib/oak-app-domain/Refund/locales/zh_CN.json +1 -1
- package/lib/oak-app-domain/WithdrawTransfer/locales/zh_CN.json +1 -1
- package/lib/triggers/accountOper.js +12 -9
- package/lib/utils/pay.d.ts +0 -10
- package/lib/utils/pay.js +1 -28
- package/package.json +4 -4
- package/src/entities/AccountOper.ts +7 -1
- package/es/aspects/account.d.ts +0 -5
- package/es/aspects/account.js +0 -4
- package/es/aspects/sample.d.ts +0 -2
- package/es/aspects/sample.js +0 -3
- package/es/components/offlineAccount/index.d.ts +0 -3
- package/es/components/offlineAccount/index.js +0 -17
- package/es/components/offlineAccount/index.json +0 -1
- package/es/components/offlineAccount/locales/zh-CN.json +0 -3
- package/es/components/offlineAccount/web.pc.d.ts +0 -6
- package/es/components/offlineAccount/web.pc.js +0 -27
- package/es/components/pay/channelPicker/index.d.ts +0 -23
- package/es/components/pay/channelPicker/index.js +0 -47
- package/es/components/pay/channelPicker/index.json +0 -8
- package/es/components/pay/channelPicker/index.less +0 -31
- package/es/components/pay/channelPicker/index.xml +0 -36
- package/es/components/pay/channelPicker/locales/zh-CN.json +0 -6
- package/es/components/pay/channelPicker/web.d.ts +0 -14
- package/es/components/pay/channelPicker/web.js +0 -49
- package/es/components/pay/channelPicker/web.mobile.module.less +0 -8
- package/es/components/pay/channelPicker/web.pc.d.ts +0 -12
- package/es/components/pay/channelPicker/web.pc.js +0 -54
- package/es/components/pay/channelPicker/web.pc.module.less +0 -7
- package/es/config/connector.d.ts +0 -5
- package/es/config/connector.js +0 -5
- package/es/context/DependentContext.d.ts +0 -1
- package/es/context/DependentContext.js +0 -1
- package/es/entities/Application.d.ts +0 -5
- package/es/entities/Application.js +0 -38
- package/es/exceptionHandler.d.ts +0 -8
- package/es/exceptionHandler.js +0 -47
- package/es/features/Console.d.ts +0 -12
- package/es/features/Console.js +0 -15
- package/es/features/Menu.d.ts +0 -20
- package/es/features/Menu.js +0 -62
- package/es/features/Sample.d.ts +0 -15
- package/es/features/Sample.js +0 -14
- package/es/triggers/acount.d.ts +0 -5
- package/es/triggers/acount.js +0 -20
- package/lib/aspects/account.d.ts +0 -5
- package/lib/aspects/account.js +0 -8
- package/lib/context/DependentContext.d.ts +0 -1
- package/lib/context/DependentContext.js +0 -6
package/es/utils/pay.js
CHANGED
|
@@ -83,29 +83,3 @@ export async function payNotify(context, body, payId, headers) {
|
|
|
83
83
|
}
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
86
|
-
/**
|
|
87
|
-
* 计算充值的损耗比例
|
|
88
|
-
* attention: 这个函数目前是在前端调用的
|
|
89
|
-
* @param context
|
|
90
|
-
* @param channel
|
|
91
|
-
* @param application
|
|
92
|
-
*/
|
|
93
|
-
export function getDepositLoss(price, application) {
|
|
94
|
-
const { system } = application;
|
|
95
|
-
const { payConfig } = system;
|
|
96
|
-
const depositLoss = payConfig?.depositLoss;
|
|
97
|
-
if (depositLoss) {
|
|
98
|
-
const { ratio, highest, lowest } = depositLoss;
|
|
99
|
-
let loss = ratio && Math.round(price * ratio / 100) || 0;
|
|
100
|
-
if (highest && loss > highest) {
|
|
101
|
-
return [highest, 'common::deposit.lossReason.highest', { value: (highest / 100).toFixed(2) }];
|
|
102
|
-
}
|
|
103
|
-
if (lowest && loss < lowest) {
|
|
104
|
-
return [lowest, 'common::deposit.lossReason.lowest', { value: (lowest / 100).toFixed(2) }];
|
|
105
|
-
}
|
|
106
|
-
if (loss > 0) {
|
|
107
|
-
return [loss, 'common::deposit.lossReason.ratio', { value: ratio }];
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
return [0, '', undefined];
|
|
111
|
-
}
|
package/lib/checkers/order.js
CHANGED
|
@@ -16,7 +16,11 @@ const checkers = [
|
|
|
16
16
|
data.paid = 0;
|
|
17
17
|
data.refunded = 0;
|
|
18
18
|
data.settled = false;
|
|
19
|
-
data.systemId
|
|
19
|
+
if (!data.systemId) {
|
|
20
|
+
const contextSystemId = context.getApplication()?.systemId;
|
|
21
|
+
(0, assert_1.default)(contextSystemId);
|
|
22
|
+
data.systemId = contextSystemId;
|
|
23
|
+
}
|
|
20
24
|
}
|
|
21
25
|
},
|
|
22
26
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EntityDict } from '../oak-app-domain';
|
|
2
2
|
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/types/Entity';
|
|
3
3
|
import { RuntimeContext } from './RuntimeContext';
|
|
4
|
-
import { BackendRuntimeContext as DependentBackendRuntimeContext } from '
|
|
4
|
+
import { BackendRuntimeContext as DependentBackendRuntimeContext } from 'oak-general-business/lib/context/BackendRuntimeContext';
|
|
5
5
|
export declare class BackendRuntimeContext<ED extends EntityDict & BaseEntityDict> extends DependentBackendRuntimeContext<ED> implements RuntimeContext {
|
|
6
6
|
protected applicationProjection: {
|
|
7
7
|
[k: string]: any;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BackendRuntimeContext = void 0;
|
|
4
|
-
const
|
|
4
|
+
const BackendRuntimeContext_1 = require("oak-general-business/lib/context/BackendRuntimeContext");
|
|
5
5
|
const application_1 = require("../utils/application");
|
|
6
|
-
class BackendRuntimeContext extends
|
|
6
|
+
class BackendRuntimeContext extends BackendRuntimeContext_1.BackendRuntimeContext {
|
|
7
7
|
applicationProjection = application_1.mergedProjection;
|
|
8
8
|
async toString() {
|
|
9
9
|
const data = await this.getSerializedData();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EntityDict } from '../oak-app-domain';
|
|
2
2
|
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/types/Entity';
|
|
3
|
-
import { FrontendRuntimeContext as DependentFrontendRuntimeContext, SerializedData } from '
|
|
3
|
+
import { FrontendRuntimeContext as DependentFrontendRuntimeContext, SerializedData } from 'oak-general-business/es/context/FrontendRuntimeContext';
|
|
4
4
|
import { RuntimeContext } from './RuntimeContext';
|
|
5
5
|
export { SerializedData, };
|
|
6
6
|
export declare class FrontendRuntimeContext<ED extends EntityDict & BaseEntityDict> extends DependentFrontendRuntimeContext<ED> implements RuntimeContext {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FrontendRuntimeContext = void 0;
|
|
4
|
-
const
|
|
5
|
-
class FrontendRuntimeContext extends
|
|
4
|
+
const FrontendRuntimeContext_1 = require("oak-general-business/es/context/FrontendRuntimeContext");
|
|
5
|
+
class FrontendRuntimeContext extends FrontendRuntimeContext_1.FrontendRuntimeContext {
|
|
6
6
|
async toString() {
|
|
7
7
|
const data = await this.getSerializedData();
|
|
8
8
|
return JSON.stringify(data);
|
package/lib/data/actionAuth.js
CHANGED
|
@@ -12,6 +12,9 @@ exports.entityDesc = {
|
|
|
12
12
|
totalPlus: '余额变化',
|
|
13
13
|
availPlus: '可用余额变化',
|
|
14
14
|
refundablePlus: '可退款余额变化',
|
|
15
|
+
total: "操作后余额",
|
|
16
|
+
avail: '操作后可用余额',
|
|
17
|
+
refundable: '操作后可退款余额',
|
|
15
18
|
entity: '关联对象',
|
|
16
19
|
entityId: '关联对象Id',
|
|
17
20
|
},
|
|
@@ -22,7 +25,7 @@ exports.entityDesc = {
|
|
|
22
25
|
consume: '消费',
|
|
23
26
|
loan: '抵押',
|
|
24
27
|
repay: '偿还',
|
|
25
|
-
withdrawBack: '
|
|
28
|
+
withdrawBack: '提现未遂',
|
|
26
29
|
earn: '赚取',
|
|
27
30
|
encash: '兑现',
|
|
28
31
|
tax: '渠道费',
|
package/lib/features/Pay.js
CHANGED
|
@@ -1,8 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const oak_frontend_base_1 = require("oak-frontend-base");
|
|
4
|
-
const pay_1 = require("../utils/pay");
|
|
5
4
|
const wpProductFrontend_1 = require("../utils/wpProductFrontend");
|
|
5
|
+
function getDepositLoss(price, application) {
|
|
6
|
+
const { system } = application;
|
|
7
|
+
const { payConfig } = system;
|
|
8
|
+
const depositLoss = payConfig?.depositLoss;
|
|
9
|
+
if (depositLoss) {
|
|
10
|
+
const { ratio, highest, lowest } = depositLoss;
|
|
11
|
+
let loss = ratio && Math.round(price * ratio / 100) || 0;
|
|
12
|
+
if (highest && loss > highest) {
|
|
13
|
+
return [highest, 'common::deposit.lossReason.highest', { value: (highest / 100).toFixed(2) }];
|
|
14
|
+
}
|
|
15
|
+
if (lowest && loss < lowest) {
|
|
16
|
+
return [lowest, 'common::deposit.lossReason.lowest', { value: (lowest / 100).toFixed(2) }];
|
|
17
|
+
}
|
|
18
|
+
if (loss > 0) {
|
|
19
|
+
return [loss, 'common::deposit.lossReason.ratio', { value: ratio }];
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return [0, '', undefined];
|
|
23
|
+
}
|
|
6
24
|
class Pay extends oak_frontend_base_1.Feature {
|
|
7
25
|
application;
|
|
8
26
|
locales;
|
|
@@ -52,7 +70,7 @@ class Pay extends oak_frontend_base_1.Feature {
|
|
|
52
70
|
}
|
|
53
71
|
calcDepositLoss(price, channel) {
|
|
54
72
|
const { entity, entityId } = channel;
|
|
55
|
-
return
|
|
73
|
+
return getDepositLoss(price, this.application.getApplication());
|
|
56
74
|
}
|
|
57
75
|
getDepositRatio(channel) {
|
|
58
76
|
throw new Error('method not implemented');
|
package/lib/features/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { EntityDict } from '../oak-app-domain';
|
|
|
2
2
|
import { AccessConfiguration } from 'oak-domain/lib/types/Configuration';
|
|
3
3
|
import { BasicFeatures } from 'oak-frontend-base';
|
|
4
4
|
import { FeatureDict as Ogb0FeatureDict } from "oak-general-business";
|
|
5
|
-
import Cos from 'oak-general-business/es/types/Cos';
|
|
5
|
+
import { Cos } from 'oak-general-business/es/types/Cos';
|
|
6
6
|
import Pay from './Pay';
|
|
7
7
|
export declare function create<ED extends EntityDict>(features: BasicFeatures<ED> & Ogb0FeatureDict<ED>): {
|
|
8
8
|
pay: Pay;
|
package/lib/index.d.ts
CHANGED
|
@@ -2,6 +2,3 @@ export type { FeatureDict } from './features';
|
|
|
2
2
|
export type { AspectDict } from './aspects/AspectDict';
|
|
3
3
|
export * from './types/Exception';
|
|
4
4
|
export * from './types/RuntimeCxt';
|
|
5
|
-
export { BackendRuntimeContext } from './context/BackendRuntimeContext';
|
|
6
|
-
export { FrontendRuntimeContext, SerializedData, } from './context/FrontendRuntimeContext';
|
|
7
|
-
export { RuntimeContext } from './context/RuntimeContext';
|
package/lib/index.js
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FrontendRuntimeContext = exports.BackendRuntimeContext = void 0;
|
|
4
3
|
const tslib_1 = require("tslib");
|
|
5
4
|
tslib_1.__exportStar(require("./types/Exception"), exports);
|
|
6
5
|
tslib_1.__exportStar(require("./types/RuntimeCxt"), exports);
|
|
7
|
-
var BackendRuntimeContext_1 = require("./context/BackendRuntimeContext");
|
|
8
|
-
Object.defineProperty(exports, "BackendRuntimeContext", { enumerable: true, get: function () { return BackendRuntimeContext_1.BackendRuntimeContext; } });
|
|
9
|
-
var FrontendRuntimeContext_1 = require("./context/FrontendRuntimeContext");
|
|
10
|
-
Object.defineProperty(exports, "FrontendRuntimeContext", { enumerable: true, get: function () { return FrontendRuntimeContext_1.FrontendRuntimeContext; } });
|
|
@@ -18,6 +18,9 @@ export type OpSchema = EntityShape & {
|
|
|
18
18
|
totalPlus: Price;
|
|
19
19
|
availPlus: Price;
|
|
20
20
|
refundablePlus?: Price | null;
|
|
21
|
+
total: Price;
|
|
22
|
+
avail: Price;
|
|
23
|
+
refundable: Price;
|
|
21
24
|
entity: "deposit" | "order" | "pay" | "refund" | "withdraw" | "withdrawTransfer" | string;
|
|
22
25
|
entityId: String<64>;
|
|
23
26
|
};
|
|
@@ -28,6 +31,9 @@ export type Schema = EntityShape & {
|
|
|
28
31
|
totalPlus: Price;
|
|
29
32
|
availPlus: Price;
|
|
30
33
|
refundablePlus?: Price | null;
|
|
34
|
+
total: Price;
|
|
35
|
+
avail: Price;
|
|
36
|
+
refundable: Price;
|
|
31
37
|
entity: "deposit" | "order" | "pay" | "refund" | "withdraw" | "withdrawTransfer" | string;
|
|
32
38
|
entityId: String<64>;
|
|
33
39
|
account: Account.Schema;
|
|
@@ -51,6 +57,9 @@ type AttrFilter = {
|
|
|
51
57
|
totalPlus: Q_NumberValue;
|
|
52
58
|
availPlus: Q_NumberValue;
|
|
53
59
|
refundablePlus: Q_NumberValue;
|
|
60
|
+
total: Q_NumberValue;
|
|
61
|
+
avail: Q_NumberValue;
|
|
62
|
+
refundable: Q_NumberValue;
|
|
54
63
|
entity: Q_EnumValue<"deposit" | "order" | "pay" | "refund" | "withdraw" | "withdrawTransfer" | string>;
|
|
55
64
|
entityId: Q_StringValue;
|
|
56
65
|
deposit: Deposit.Filter;
|
|
@@ -74,6 +83,9 @@ export type Projection = {
|
|
|
74
83
|
totalPlus?: number;
|
|
75
84
|
availPlus?: number;
|
|
76
85
|
refundablePlus?: number;
|
|
86
|
+
total?: number;
|
|
87
|
+
avail?: number;
|
|
88
|
+
refundable?: number;
|
|
77
89
|
entity?: number;
|
|
78
90
|
entityId?: number;
|
|
79
91
|
deposit?: Deposit.Projection;
|
|
@@ -127,6 +139,12 @@ export type SortAttr = {
|
|
|
127
139
|
availPlus: number;
|
|
128
140
|
} | {
|
|
129
141
|
refundablePlus: number;
|
|
142
|
+
} | {
|
|
143
|
+
total: number;
|
|
144
|
+
} | {
|
|
145
|
+
avail: number;
|
|
146
|
+
} | {
|
|
147
|
+
refundable: number;
|
|
130
148
|
} | {
|
|
131
149
|
entity: number;
|
|
132
150
|
} | {
|
|
@@ -25,6 +25,18 @@ exports.desc = {
|
|
|
25
25
|
refundablePlus: {
|
|
26
26
|
type: "money"
|
|
27
27
|
},
|
|
28
|
+
total: {
|
|
29
|
+
notNull: true,
|
|
30
|
+
type: "money"
|
|
31
|
+
},
|
|
32
|
+
avail: {
|
|
33
|
+
notNull: true,
|
|
34
|
+
type: "money"
|
|
35
|
+
},
|
|
36
|
+
refundable: {
|
|
37
|
+
notNull: true,
|
|
38
|
+
type: "money"
|
|
39
|
+
},
|
|
28
40
|
entity: {
|
|
29
41
|
notNull: true,
|
|
30
42
|
type: "varchar",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{ "name": "帐号操作", "attr": { "account": "帐号", "type": "类型", "totalPlus": "余额变化", "availPlus": "可用余额变化", "refundablePlus": "可退款余额变化", "entity": "关联对象", "entityId": "关联对象Id" }, "v": { "type": { "deposit": "充值", "withdraw": "提现", "consume": "消费", "loan": "抵押", "repay": "偿还", "withdrawBack": "提现失败", "earn": "赚取", "encash": "兑现", "tax": "渠道费", "taxRefund": "渠道费用退还", "cutoffRefundable": "削减可自由退额度", "refund": "退款", "refundFailure": "退款失败" } } }
|
|
1
|
+
{ "name": "帐号操作", "attr": { "account": "帐号", "type": "类型", "totalPlus": "余额变化", "availPlus": "可用余额变化", "refundablePlus": "可退款余额变化", "total": "操作后余额", "avail": "操作后可用余额", "refundable": "操作后可退款余额", "entity": "关联对象", "entityId": "关联对象Id" }, "v": { "type": { "deposit": "充值", "withdraw": "提现", "consume": "消费", "loan": "抵押", "repay": "偿还", "withdrawBack": "提现失败", "earn": "赚取", "encash": "兑现", "tax": "渠道费", "taxRefund": "渠道费用退还", "cutoffRefundable": "削减可自由退额度", "refund": "退款", "refundFailure": "退款失败" } } }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{ "name": "帐户", "attr": { "pay": "关联支付", "price": "价格", "loss": "损耗", "withdraw": "关联提现", "meta": "metadata", "externalId": "
|
|
1
|
+
{ "name": "帐户", "attr": { "pay": "关联支付", "price": "价格", "loss": "损耗", "withdraw": "关联提现", "meta": "metadata", "externalId": "外部退款流水号", "iState": "状态", "creator": "创建者", "reason": "原因", "opers": "相关账户操作" }, "action": { "succeed": "退款成功", "fail": "退款失败" }, "v": { "iState": { "refunding": "退款中", "successful": "退款成功", "failed": "退款失败" } } }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{ "name": "提现转账", "attr": { "withdraw": "提现申请", "withdrawAccount": "提现账户", "price": "金额", "loss": "手续费", "operator": "操作者", "creator": "创建者", "iState": "状态", "externalId": "
|
|
1
|
+
{ "name": "提现转账", "attr": { "withdraw": "提现申请", "withdrawAccount": "提现账户", "price": "金额", "loss": "手续费", "operator": "操作者", "creator": "创建者", "iState": "状态", "externalId": "外部转账流水号", "meta": "metadata", "reason": "原因", "sysOpers": "账户操作" }, "v": { "iState": { "transferring": "待转账", "failed": "已失败", "successful": "已成功" } }, "action": { "succeed": "转账成功", "fail": "转账失败" } }
|
|
@@ -10,7 +10,7 @@ const triggers = [
|
|
|
10
10
|
name: '当生成accountOper时,修改account中的值,并向订阅者推送',
|
|
11
11
|
entity: 'accountOper',
|
|
12
12
|
action: 'create',
|
|
13
|
-
when: '
|
|
13
|
+
when: 'before',
|
|
14
14
|
fn: async ({ operation }, context, option) => {
|
|
15
15
|
const { id, data } = operation;
|
|
16
16
|
(0, assert_1.default)(!(data instanceof Array));
|
|
@@ -36,18 +36,21 @@ const triggers = [
|
|
|
36
36
|
throw new types_1.OakInputIllegalException('accountOper', ['availPlus'], 'withdraw::refundableOverflow');
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
|
|
39
|
+
const total2 = total + totalPlus;
|
|
40
|
+
const avail2 = avail + availPlus;
|
|
41
|
+
const refundable2 = refundable + (refundablePlus || 0);
|
|
42
|
+
data.total = total2;
|
|
43
|
+
data.avail = avail2;
|
|
44
|
+
data.refundable = refundable2;
|
|
45
|
+
data.account = {
|
|
40
46
|
id: await (0, uuid_1.generateNewIdAsync)(),
|
|
41
47
|
action: type,
|
|
42
48
|
data: {
|
|
43
|
-
total:
|
|
44
|
-
avail:
|
|
45
|
-
refundable:
|
|
49
|
+
total: total2,
|
|
50
|
+
avail: avail2,
|
|
51
|
+
refundable: refundable2,
|
|
46
52
|
},
|
|
47
|
-
|
|
48
|
-
id: accountId,
|
|
49
|
-
}
|
|
50
|
-
}, option);
|
|
53
|
+
};
|
|
51
54
|
context.saveOperationToEvent(id, `${constants_1.DATA_SUBSCRIBER_KEYS.accountNumberChanged}-${accountId}`);
|
|
52
55
|
return 1;
|
|
53
56
|
},
|
package/lib/utils/pay.d.ts
CHANGED
|
@@ -5,13 +5,3 @@ import BackendRuntimeContext from '../context/BackendRuntimeContext';
|
|
|
5
5
|
import { IncomingHttpHeaders } from 'http';
|
|
6
6
|
export declare const fullPayProjection: EntityDict['pay']['Selection']['data'];
|
|
7
7
|
export declare function payNotify<ED extends EntityDict & BaseEntityDict>(context: BackendRuntimeContext<ED>, body: any, payId: string, headers: IncomingHttpHeaders): Promise<void>;
|
|
8
|
-
type CalcLoss = <ED extends EntityDict & BaseEntityDict>(entityId: string, application: ED['application']['Schema'], price: number) => [number, string, any];
|
|
9
|
-
/**
|
|
10
|
-
* 计算充值的损耗比例
|
|
11
|
-
* attention: 这个函数目前是在前端调用的
|
|
12
|
-
* @param context
|
|
13
|
-
* @param channel
|
|
14
|
-
* @param application
|
|
15
|
-
*/
|
|
16
|
-
export declare function getDepositLoss<ED extends EntityDict & BaseEntityDict>(price: number, application: ED['application']['Schema']): ReturnType<CalcLoss>;
|
|
17
|
-
export {};
|
package/lib/utils/pay.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.payNotify = exports.fullPayProjection = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const payClazz_1 = require("./payClazz");
|
|
6
6
|
const assert_1 = tslib_1.__importDefault(require("assert"));
|
|
@@ -88,30 +88,3 @@ async function payNotify(context, body, payId, headers) {
|
|
|
88
88
|
return;
|
|
89
89
|
}
|
|
90
90
|
exports.payNotify = payNotify;
|
|
91
|
-
/**
|
|
92
|
-
* 计算充值的损耗比例
|
|
93
|
-
* attention: 这个函数目前是在前端调用的
|
|
94
|
-
* @param context
|
|
95
|
-
* @param channel
|
|
96
|
-
* @param application
|
|
97
|
-
*/
|
|
98
|
-
function getDepositLoss(price, application) {
|
|
99
|
-
const { system } = application;
|
|
100
|
-
const { payConfig } = system;
|
|
101
|
-
const depositLoss = payConfig?.depositLoss;
|
|
102
|
-
if (depositLoss) {
|
|
103
|
-
const { ratio, highest, lowest } = depositLoss;
|
|
104
|
-
let loss = ratio && Math.round(price * ratio / 100) || 0;
|
|
105
|
-
if (highest && loss > highest) {
|
|
106
|
-
return [highest, 'common::deposit.lossReason.highest', { value: (highest / 100).toFixed(2) }];
|
|
107
|
-
}
|
|
108
|
-
if (lowest && loss < lowest) {
|
|
109
|
-
return [lowest, 'common::deposit.lossReason.lowest', { value: (lowest / 100).toFixed(2) }];
|
|
110
|
-
}
|
|
111
|
-
if (loss > 0) {
|
|
112
|
-
return [loss, 'common::deposit.lossReason.ratio', { value: ratio }];
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
return [0, '', undefined];
|
|
116
|
-
}
|
|
117
|
-
exports.getDepositLoss = getDepositLoss;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oak-pay-business",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"files": [
|
|
6
6
|
"lib/**/*",
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
"js-base64": "^3.7.2",
|
|
51
51
|
"lodash": "^4.17.21",
|
|
52
52
|
"nprogress": "^0.2.0",
|
|
53
|
-
"oak-domain": "~5.0.
|
|
54
|
-
"oak-frontend-base": "~5.1
|
|
55
|
-
"oak-general-business": "~5.
|
|
53
|
+
"oak-domain": "~5.0.11",
|
|
54
|
+
"oak-frontend-base": "~5.2.1",
|
|
55
|
+
"oak-general-business": "~5.2.3",
|
|
56
56
|
"react": "~18.2.0",
|
|
57
57
|
"react-dom": "~18.2.0",
|
|
58
58
|
"react-image-gallery": "^1.2.11",
|
|
@@ -18,6 +18,9 @@ export interface Schema extends EntityShape {
|
|
|
18
18
|
totalPlus: Price;
|
|
19
19
|
availPlus: Price;
|
|
20
20
|
refundablePlus?: Price;
|
|
21
|
+
total: Price;
|
|
22
|
+
avail: Price;
|
|
23
|
+
refundable: Price;
|
|
21
24
|
entity: String<32>;
|
|
22
25
|
entityId: String<64>;
|
|
23
26
|
};
|
|
@@ -34,6 +37,9 @@ export const entityDesc: EntityDesc<Schema, '', '', {
|
|
|
34
37
|
totalPlus: '余额变化',
|
|
35
38
|
availPlus: '可用余额变化',
|
|
36
39
|
refundablePlus: '可退款余额变化',
|
|
40
|
+
total: "操作后余额",
|
|
41
|
+
avail: '操作后可用余额',
|
|
42
|
+
refundable: '操作后可退款余额',
|
|
37
43
|
entity: '关联对象',
|
|
38
44
|
entityId: '关联对象Id',
|
|
39
45
|
},
|
|
@@ -44,7 +50,7 @@ export const entityDesc: EntityDesc<Schema, '', '', {
|
|
|
44
50
|
consume: '消费',
|
|
45
51
|
loan: '抵押',
|
|
46
52
|
repay: '偿还',
|
|
47
|
-
withdrawBack: '
|
|
53
|
+
withdrawBack: '提现未遂',
|
|
48
54
|
earn: '赚取',
|
|
49
55
|
encash: '兑现',
|
|
50
56
|
tax: '渠道费',
|
package/es/aspects/account.d.ts
DELETED
package/es/aspects/account.js
DELETED
package/es/aspects/sample.d.ts
DELETED
package/es/aspects/sample.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
/// <reference types="wechat-miniprogram" />
|
|
2
|
-
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../oak-app-domain").EntityDict, "offlineAccount", false, WechatMiniprogram.Component.DataOption>) => React.ReactElement;
|
|
3
|
-
export default _default;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export default OakComponent({
|
|
2
|
-
entity: 'offlineAccount',
|
|
3
|
-
projection: {
|
|
4
|
-
id: 1,
|
|
5
|
-
type: 1,
|
|
6
|
-
channel: 1,
|
|
7
|
-
name: 1,
|
|
8
|
-
desc: 1,
|
|
9
|
-
systemId: 1,
|
|
10
|
-
},
|
|
11
|
-
isList: false,
|
|
12
|
-
formData({ data }) {
|
|
13
|
-
return {
|
|
14
|
-
offlineAccount: data,
|
|
15
|
-
};
|
|
16
|
-
},
|
|
17
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { EntityDict } from "../../oak-app-domain";
|
|
2
|
-
import { RowWithActions, WebComponentProps } from "oak-frontend-base";
|
|
3
|
-
import React from 'react';
|
|
4
|
-
export default function render(props: WebComponentProps<EntityDict, 'offlineAccount', false, {
|
|
5
|
-
offlineAccount: RowWithActions<EntityDict, 'offlineAccount'>;
|
|
6
|
-
}>): React.JSX.Element | undefined;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Alert, Form, Switch, InputNumber } from 'antd';
|
|
3
|
-
export default function render(props) {
|
|
4
|
-
const { offlineAccount } = props.data;
|
|
5
|
-
const { t } = props.methods;
|
|
6
|
-
if (offlineAccount) {
|
|
7
|
-
return (<Form labelCol={{ span: 6 }} wrapperCol={{ span: 12 }} layout="horizontal" style={{ minWidth: 600 }}>
|
|
8
|
-
<Alert type='info' message={t('tips')}/>
|
|
9
|
-
<Form.Item label={t('label.depositLoss')} help={t('placeholder.depositLoss')}>
|
|
10
|
-
<Switch value={config.depositLoss} onChange={(value) => {
|
|
11
|
-
config.depositLoss = value;
|
|
12
|
-
if (value === false) {
|
|
13
|
-
config.depositLossRatio = undefined;
|
|
14
|
-
}
|
|
15
|
-
update(config);
|
|
16
|
-
}}/>
|
|
17
|
-
</Form.Item>
|
|
18
|
-
{config.depositLoss &&
|
|
19
|
-
<Form.Item label={t('label.depositLossRatio')} help={t('placeholder.depositLossRatio')}>
|
|
20
|
-
<InputNumber value={config.depositLossRatio} max={5} min={0.01} addonAfter={"%"} step={0.01} precision={2} onChange={(value) => {
|
|
21
|
-
config.depositLossRatio = value;
|
|
22
|
-
update(config);
|
|
23
|
-
}}/>
|
|
24
|
-
</Form.Item>}
|
|
25
|
-
</Form>);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { PayConfig } from "../../../types/PayConfig";
|
|
3
|
-
/**
|
|
4
|
-
* 支持自定义支付通道的选择器注入
|
|
5
|
-
* 未来遇到真正需求时再实现,by Xc 20240426
|
|
6
|
-
*/
|
|
7
|
-
export type ExtraPicker = {
|
|
8
|
-
label: string;
|
|
9
|
-
name: string;
|
|
10
|
-
icon: React.ForwardRefExoticComponent<any>;
|
|
11
|
-
component?: React.ForwardRefExoticComponent<{
|
|
12
|
-
onSetMeta?: (meta: object) => void;
|
|
13
|
-
}>;
|
|
14
|
-
};
|
|
15
|
-
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<import("../../../oak-app-domain").EntityDict, keyof import("../../../oak-app-domain").EntityDict, boolean, {
|
|
16
|
-
payConfig: PayConfig;
|
|
17
|
-
channel: string;
|
|
18
|
-
meta: object;
|
|
19
|
-
extraChannelPickers: ExtraPicker[];
|
|
20
|
-
onPick: (channel: string) => void;
|
|
21
|
-
onSetMeta: (meta?: object) => void;
|
|
22
|
-
}>) => React.ReactElement;
|
|
23
|
-
export default _default;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { PAY_CHANNEL_OFFLINE_NAME } from "../../../types/PayConfig";
|
|
2
|
-
import assert from 'assert';
|
|
3
|
-
export default OakComponent({
|
|
4
|
-
properties: {
|
|
5
|
-
payConfig: [],
|
|
6
|
-
channel: '',
|
|
7
|
-
meta: {},
|
|
8
|
-
extraChannelPickers: [],
|
|
9
|
-
onPick: (channel) => undefined,
|
|
10
|
-
onSetMeta: (meta) => undefined,
|
|
11
|
-
},
|
|
12
|
-
formData() {
|
|
13
|
-
const { payConfig } = this.props;
|
|
14
|
-
assert(payConfig);
|
|
15
|
-
const offlineConfig = payConfig.find(ele => ele.channel === PAY_CHANNEL_OFFLINE_NAME);
|
|
16
|
-
return {
|
|
17
|
-
offlineConfig,
|
|
18
|
-
payChannels: payConfig.map(ele => ele.channel),
|
|
19
|
-
};
|
|
20
|
-
},
|
|
21
|
-
methods: {
|
|
22
|
-
onPickChannel(channel) {
|
|
23
|
-
this.props.onPick(channel);
|
|
24
|
-
if (channel === PAY_CHANNEL_OFFLINE_NAME && this.state.offlineConfig?.options?.length) {
|
|
25
|
-
this.props.onSetMeta({
|
|
26
|
-
option: this.state.offlineConfig.options[0],
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
this.props.onSetMeta({});
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
onPickChannelMp(touch) {
|
|
34
|
-
const { detail } = touch;
|
|
35
|
-
const { currentKey } = detail;
|
|
36
|
-
this.onPickChannel(currentKey);
|
|
37
|
-
},
|
|
38
|
-
onSelectOfflineOptionMp(touch) {
|
|
39
|
-
const { option } = touch.currentTarget.dataset;
|
|
40
|
-
const { meta, onSetMeta } = this.props;
|
|
41
|
-
onSetMeta({
|
|
42
|
-
...meta,
|
|
43
|
-
option,
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
});
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"usingComponents": {
|
|
3
|
-
"l-input": "@oak-frontend-base/miniprogram_npm/lin-ui/input/index",
|
|
4
|
-
"l-radio": "@oak-frontend-base/miniprogram_npm/lin-ui/radio/index",
|
|
5
|
-
"l-radio-group": "@oak-frontend-base/miniprogram_npm/lin-ui/radio-group/index",
|
|
6
|
-
"l-tag": "@oak-frontend-base/miniprogram_npm/lin-ui/tag/index"
|
|
7
|
-
}
|
|
8
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
.form-item {
|
|
2
|
-
position: relative;
|
|
3
|
-
font-size: 28rpx;
|
|
4
|
-
color: #333;
|
|
5
|
-
padding-right: 25rpx;
|
|
6
|
-
margin-left: 12rpx;
|
|
7
|
-
box-sizing: border-box;
|
|
8
|
-
|
|
9
|
-
.radio {
|
|
10
|
-
height: 80rpx;
|
|
11
|
-
display: flex;
|
|
12
|
-
flex-direction: row;
|
|
13
|
-
align-items: center;
|
|
14
|
-
|
|
15
|
-
.offline-option {
|
|
16
|
-
margin-left: 12rpx;
|
|
17
|
-
display: flex;
|
|
18
|
-
flex-direction: row;
|
|
19
|
-
flex-wrap: wrap;
|
|
20
|
-
|
|
21
|
-
l-tag {
|
|
22
|
-
margin-left: 6rpx;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.selected {
|
|
26
|
-
background:#333 !important;
|
|
27
|
-
color:#fff !important;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|