支付协议修改
This commit is contained in:
@@ -30,6 +30,7 @@ export enum InnerMsgCode {
|
||||
BalanceChange, // 余额发生变化
|
||||
VipExpireChange, // vip失效时间戳发生变化
|
||||
ChatTotalCountChange, // 总聊天次数发生变化
|
||||
PayOrderCreateSucc, // 支付订单创建成功
|
||||
|
||||
Navigation_PanelSwitch, // 导航面板切换事件
|
||||
}
|
||||
|
||||
@@ -33,6 +33,12 @@ export class OrderData extends BaseData {
|
||||
const vo: OrderVO = {
|
||||
orderId, // 订单 id
|
||||
payUrl: res.payUrl || "", // 支付url
|
||||
payType: res.payType, // 支付类型
|
||||
network: res.network || 0, // 网络类型
|
||||
wallet: res.wallet || "", // 充值钱包地址
|
||||
amount: res.amount || "", // 充值金额
|
||||
expire: res.Expire || 0, // 过期时间,单位: 秒
|
||||
expireUnix: res.ExpireUnix || "", // 过期时间戳
|
||||
status: "CREATED" as OrderStatus, // 订单状态
|
||||
retCode: 0, // 失败时的原因码
|
||||
createdAt: Date.now(), // 订单创建时间
|
||||
|
||||
@@ -9,6 +9,8 @@ import PaymentPoller from "./PaymentPoller";
|
||||
import proto from 'db://assets/Scripts/proto/proto.pb.js';
|
||||
import { DataManager, DataId } from "db://assets/Scripts/chat18x/data/DataManager";
|
||||
import { OrderData } from "db://assets/Scripts/chat18x/data/OrderData";
|
||||
import Utils from "../../Main/Common/Utils";
|
||||
import { InnerMsgCode } from "../../Main/Config/InnerMsgCode";
|
||||
|
||||
export class PaymentService {
|
||||
private static _I: PaymentService | null = null;
|
||||
@@ -29,6 +31,9 @@ export class PaymentService {
|
||||
const orderData = DataManager.I.getDataById<OrderData>(DataId.Order);
|
||||
orderData.saveOrderData(create.data);
|
||||
|
||||
// 发出事件,支付订单创建成功
|
||||
Utils.sendInnerMsg(InnerMsgCode.PayOrderCreateSucc, { orderId: orderId });
|
||||
|
||||
// 打开支付页
|
||||
await PaymentOpenerFactory.create(open).open(payUrl);
|
||||
|
||||
|
||||
@@ -16,6 +16,12 @@ export type OrderStatus =
|
||||
export interface OrderVO {
|
||||
orderId: string;
|
||||
payUrl: string;
|
||||
payType: number;
|
||||
network: number;
|
||||
wallet: string;
|
||||
amount: string;
|
||||
expire: number;
|
||||
expireUnix: string;
|
||||
status: OrderStatus;
|
||||
retCode: number; // 失败时的原因码
|
||||
createdAt: number;
|
||||
|
||||
Vendored
+9
-1
@@ -1806,6 +1806,9 @@ static getTypeUrl(typeUrlPrefix?: string): string;
|
||||
|
||||
/** CSCreateOrderRes ExpireUnix */
|
||||
ExpireUnix?: (number|Long|null);
|
||||
|
||||
/** CSCreateOrderRes payType */
|
||||
payType?: (number|null);
|
||||
}
|
||||
|
||||
/** Represents a CSCreateOrderRes. */
|
||||
@@ -1838,6 +1841,9 @@ Expire: number;
|
||||
/** CSCreateOrderRes ExpireUnix. */
|
||||
ExpireUnix: (number|Long);
|
||||
|
||||
/** CSCreateOrderRes payType. */
|
||||
payType: number;
|
||||
|
||||
/**
|
||||
* Creates a new CSCreateOrderRes instance using the specified properties.
|
||||
* @param [properties] Properties to set
|
||||
@@ -5880,7 +5886,9 @@ static getTypeUrl(typeUrlPrefix?: string): string;
|
||||
RMGOrder_MaxQuery = 5013,
|
||||
RMGOrder_NotFound = 5014,
|
||||
TokenExpire = 5015,
|
||||
TokenInvalid = 5016
|
||||
TokenInvalid = 5016,
|
||||
Web3Order_NotFound = 5017,
|
||||
Web3Order_Timeout = 5018
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4165,6 +4165,7 @@ $root.cs = (function() {
|
||||
* @property {string|null} [amount] CSCreateOrderRes amount
|
||||
* @property {number|null} [Expire] CSCreateOrderRes Expire
|
||||
* @property {number|Long|null} [ExpireUnix] CSCreateOrderRes ExpireUnix
|
||||
* @property {number|null} [payType] CSCreateOrderRes payType
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -4238,6 +4239,14 @@ $root.cs = (function() {
|
||||
*/
|
||||
CSCreateOrderRes.prototype.ExpireUnix = $util.Long ? $util.Long.fromBits(0,0,false) : 0;
|
||||
|
||||
/**
|
||||
* CSCreateOrderRes payType.
|
||||
* @member {number} payType
|
||||
* @memberof cs.CSCreateOrderRes
|
||||
* @instance
|
||||
*/
|
||||
CSCreateOrderRes.prototype.payType = 0;
|
||||
|
||||
/**
|
||||
* Creates a new CSCreateOrderRes instance using the specified properties.
|
||||
* @function create
|
||||
@@ -4276,6 +4285,8 @@ $root.cs = (function() {
|
||||
writer.uint32(/* id 6, wireType 0 =*/48).int32(message.Expire);
|
||||
if (message.ExpireUnix != null && Object.hasOwnProperty.call(message, "ExpireUnix"))
|
||||
writer.uint32(/* id 7, wireType 0 =*/56).int64(message.ExpireUnix);
|
||||
if (message.payType != null && Object.hasOwnProperty.call(message, "payType"))
|
||||
writer.uint32(/* id 8, wireType 0 =*/64).int32(message.payType);
|
||||
return writer;
|
||||
};
|
||||
|
||||
@@ -4340,6 +4351,10 @@ $root.cs = (function() {
|
||||
message.ExpireUnix = reader.int64();
|
||||
break;
|
||||
}
|
||||
case 8: {
|
||||
message.payType = reader.int32();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
@@ -4396,6 +4411,9 @@ $root.cs = (function() {
|
||||
if (message.ExpireUnix != null && message.hasOwnProperty("ExpireUnix"))
|
||||
if (!$util.isInteger(message.ExpireUnix) && !(message.ExpireUnix && $util.isInteger(message.ExpireUnix.low) && $util.isInteger(message.ExpireUnix.high)))
|
||||
return "ExpireUnix: integer|Long expected";
|
||||
if (message.payType != null && message.hasOwnProperty("payType"))
|
||||
if (!$util.isInteger(message.payType))
|
||||
return "payType: integer expected";
|
||||
return null;
|
||||
};
|
||||
|
||||
@@ -4432,6 +4450,8 @@ $root.cs = (function() {
|
||||
message.ExpireUnix = object.ExpireUnix;
|
||||
else if (typeof object.ExpireUnix === "object")
|
||||
message.ExpireUnix = new $util.LongBits(object.ExpireUnix.low >>> 0, object.ExpireUnix.high >>> 0).toNumber();
|
||||
if (object.payType != null)
|
||||
message.payType = object.payType | 0;
|
||||
return message;
|
||||
};
|
||||
|
||||
@@ -4460,6 +4480,7 @@ $root.cs = (function() {
|
||||
object.ExpireUnix = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
|
||||
} else
|
||||
object.ExpireUnix = options.longs === String ? "0" : 0;
|
||||
object.payType = 0;
|
||||
}
|
||||
if (message.payUrl != null && message.hasOwnProperty("payUrl"))
|
||||
object.payUrl = message.payUrl;
|
||||
@@ -4478,6 +4499,8 @@ $root.cs = (function() {
|
||||
object.ExpireUnix = options.longs === String ? String(message.ExpireUnix) : message.ExpireUnix;
|
||||
else
|
||||
object.ExpireUnix = options.longs === String ? $util.Long.prototype.toString.call(message.ExpireUnix) : options.longs === Number ? new $util.LongBits(message.ExpireUnix.low >>> 0, message.ExpireUnix.high >>> 0).toNumber() : message.ExpireUnix;
|
||||
if (message.payType != null && message.hasOwnProperty("payType"))
|
||||
object.payType = message.payType;
|
||||
return object;
|
||||
};
|
||||
|
||||
@@ -14088,6 +14111,8 @@ $root.cs = (function() {
|
||||
* @property {number} RMGOrder_NotFound=5014 RMGOrder_NotFound value
|
||||
* @property {number} TokenExpire=5015 TokenExpire value
|
||||
* @property {number} TokenInvalid=5016 TokenInvalid value
|
||||
* @property {number} Web3Order_NotFound=5017 Web3Order_NotFound value
|
||||
* @property {number} Web3Order_Timeout=5018 Web3Order_Timeout value
|
||||
*/
|
||||
cs.EnmRetCode = (function() {
|
||||
var valuesById = {}, values = Object.create(valuesById);
|
||||
@@ -14109,6 +14134,8 @@ $root.cs = (function() {
|
||||
values[valuesById[5014] = "RMGOrder_NotFound"] = 5014;
|
||||
values[valuesById[5015] = "TokenExpire"] = 5015;
|
||||
values[valuesById[5016] = "TokenInvalid"] = 5016;
|
||||
values[valuesById[5017] = "Web3Order_NotFound"] = 5017;
|
||||
values[valuesById[5018] = "Web3Order_Timeout"] = 5018;
|
||||
return values;
|
||||
})();
|
||||
|
||||
|
||||
+1
-1
Submodule proto_cs updated: 9558599175...05baadbb24
Reference in New Issue
Block a user