移入店铺配置,保留原账号与历史账务口径
This commit is contained in:
1 parent
8d68111479
commit
90bdc75150
22 files changed
+535
-62
No files matched your search
@@ -3,13 +3,17 @@
|
||||
(function(root){
|
||||
const isAccount=account=>['助理信用卡','助理1信用卡','麦麦信用卡','助理2信用卡'].includes(account);
|
||||
const ratePermille=6;
|
||||
const normalizeAccount=account=>isAccount(account)?'麦麦信用卡':account;
|
||||
const note=(rate=ratePermille)=>`信用卡手续费(${rate}‰)`;
|
||||
const isFee=item=>item?.system==='credit_card'||String(item?.key||'').startsWith('card_fee:');
|
||||
function amount(cents){
|
||||
if(!Number.isSafeInteger(cents)||cents<0||cents>100000000000)throw new Error('客户付款金额无效');
|
||||
return Math.floor((cents*ratePermille+500)/1000);
|
||||
function rate(value=ratePermille){
|
||||
if(!Number.isSafeInteger(value)||value<0||value>1000)throw new Error('信用卡手续费率须为0~1000的整数‰');
|
||||
return value;
|
||||
}
|
||||
const api={isAccount,isFee,amount,ratePermille,normalizeAccount,note};
|
||||
const normalizeAccount=account=>isAccount(account)?'麦麦信用卡':account;
|
||||
const note=(value=ratePermille)=>`信用卡手续费(${rate(value)}‰)`;
|
||||
const isFee=item=>item?.system==='credit_card'||String(item?.key||'').startsWith('card_fee:');
|
||||
function amount(cents,value=ratePermille){
|
||||
if(!Number.isSafeInteger(cents)||cents<0||cents>100000000000)throw new Error('客户付款金额无效');
|
||||
return Number((BigInt(cents)*BigInt(rate(value))+500n)/1000n);
|
||||
}
|
||||
const api={isAccount,isFee,amount,rate,ratePermille,normalizeAccount,note};
|
||||
if(typeof module==='object'&&module.exports)module.exports=api;else root.CreditCardFees=api;
|
||||
})(typeof globalThis==='object'?globalThis:this);
|
||||
Reference in new issue
Block a user