Merge branch 'main' of 47.107.44.202:xionglijia/18xchat
This commit is contained in:
@@ -30,6 +30,7 @@ export enum InnerMsgCode {
|
||||
BalanceChange, // 余额发生变化
|
||||
VipExpireChange, // vip失效时间戳发生变化
|
||||
ChatTotalCountChange, // 总聊天次数发生变化
|
||||
PayOrderCreateSucc, // 支付订单创建成功
|
||||
|
||||
Navigation_PanelSwitch, // 导航面板切换事件
|
||||
}
|
||||
|
||||
@@ -33,9 +33,15 @@ 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(), // 订单创建时间
|
||||
createdAt: Date.now(), // 订单创建时间,毫秒
|
||||
};
|
||||
this._orders.set(orderId, vo);
|
||||
console.log("保存订单数据:", this._orders);
|
||||
@@ -77,6 +83,69 @@ export class OrderData extends BaseData {
|
||||
return ids;
|
||||
}
|
||||
|
||||
/** 根据订单 id 获取支付url */
|
||||
public getPayUrlById(id: string): string {
|
||||
let oneData = this.getOrderDataById(id);
|
||||
if (!oneData) return "";
|
||||
return oneData.payUrl;
|
||||
}
|
||||
|
||||
/** 根据订单 id 获取支付类型 */
|
||||
public getPayTypeById(id: string): number {
|
||||
let oneData = this.getOrderDataById(id);
|
||||
if (!oneData) return 0;
|
||||
return oneData.payType;
|
||||
}
|
||||
|
||||
/** 根据订单 id 获取网络类型 */
|
||||
public getNetworkById(id: string): number {
|
||||
let oneData = this.getOrderDataById(id);
|
||||
if (!oneData) return 0;
|
||||
return oneData.network;
|
||||
}
|
||||
|
||||
/** 根据订单 id 获取充值钱包地址 */
|
||||
public getWalletById(id: string): string {
|
||||
let oneData = this.getOrderDataById(id);
|
||||
if (!oneData) return "";
|
||||
return oneData.wallet;
|
||||
}
|
||||
|
||||
/** 根据订单 id 获取充值金额 */
|
||||
public getAmountById(id: string): string {
|
||||
let oneData = this.getOrderDataById(id);
|
||||
if (!oneData) return "";
|
||||
return oneData.amount;
|
||||
}
|
||||
|
||||
/** 根据订单 id 获取过期时间,单位: 秒 */
|
||||
public getExpireById(id: string): number {
|
||||
let oneData = this.getOrderDataById(id);
|
||||
if (!oneData) return 0;
|
||||
return oneData.expire;
|
||||
}
|
||||
|
||||
/** 根据订单 id 获取过期时间戳,秒 */
|
||||
public getExpireUnixById(id: string): string {
|
||||
let oneData = this.getOrderDataById(id);
|
||||
if (!oneData) return "";
|
||||
return oneData.expireUnix;
|
||||
}
|
||||
|
||||
/** 根据订单 id 获取订单失败时的原因码 */
|
||||
public getRetCodeById(id: string): number {
|
||||
let oneData = this.getOrderDataById(id);
|
||||
if (!oneData) return 0;
|
||||
return oneData.retCode;
|
||||
}
|
||||
|
||||
/** 根据订单 id 获取订单创建时间,毫秒 */
|
||||
public getCreatedAtById(id: string): number {
|
||||
let oneData = this.getOrderDataById(id);
|
||||
if (!oneData) return 0;
|
||||
return oneData.createdAt;
|
||||
}
|
||||
|
||||
/** --------------------------------------------------------- 缓存逻辑 --------------------------------------------------------- */
|
||||
|
||||
private ensureMap(): Map<string, OrderVO> {
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* 现金支付流程
|
||||
*
|
||||
*/
|
||||
import { PaymentOpenerFactory } from "./PaymentOpener";
|
||||
import PaymentPoller from "./PaymentPoller";
|
||||
import type { PaymentFlow } from "./PaymentFlow";
|
||||
import type proto from "db://assets/Scripts/proto/proto.pb.js";
|
||||
import { type OpenStrategy } from "./PaymentOpener";
|
||||
import { DataManager, DataId } from "db://assets/Scripts/chat18x/data/DataManager";
|
||||
import { OrderData } from "db://assets/Scripts/chat18x/data/OrderData";
|
||||
|
||||
export class CashInrFlow implements PaymentFlow {
|
||||
constructor(private waitAppResume: (open: OpenStrategy) => Promise<void>) {}
|
||||
|
||||
async run(orderId: string, payUrl: string, open: OpenStrategy): Promise<proto.cs.ICSQueryOrderRes | null> {
|
||||
// 打开支付页
|
||||
await PaymentOpenerFactory.create(open).open(payUrl);
|
||||
// 等待回到前台(系统浏览器策略下)
|
||||
// - 如果是 inapp/minigame,可在 WebView/回跳时立即开始轮询;
|
||||
// - 这里给一个通用的“等待前台”方法(可用 Cocos 的 onShow/onHide 自行接入)
|
||||
await this.waitAppResume(open);
|
||||
// 开始轮询
|
||||
const data = await this.pollOrder(orderId);
|
||||
// 刷新订单数据
|
||||
const orderData = DataManager.I.getDataById<OrderData>(DataId.Order);
|
||||
orderData.applyQueryOrder(orderId, data);
|
||||
// 返回结果
|
||||
return data;
|
||||
}
|
||||
|
||||
async resume(orderId: string, _payUrl: string): Promise<proto.cs.ICSQueryOrderRes | null> {
|
||||
// 直接恢复轮询
|
||||
return this.pollOrder(orderId);
|
||||
}
|
||||
|
||||
private async pollOrder(orderId: string) {
|
||||
const poller = new PaymentPoller();
|
||||
return poller.poll(orderId, {
|
||||
maxDurationMs: 2 * 60 * 1000,
|
||||
startIntervalMs: 2000,
|
||||
maxIntervalMs: 10000,
|
||||
jitter: true,
|
||||
}, (d) => console.log());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.24",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "806a1ac4-3dd3-4744-b846-c6915c171a32",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* 支付流程的相关接口
|
||||
*
|
||||
*/
|
||||
import type proto from "db://assets/Scripts/proto/proto.pb.js";
|
||||
import { type OpenStrategy } from "./PaymentOpener";
|
||||
|
||||
export interface PaymentFlow {
|
||||
/** 开始支付流程 */
|
||||
run(orderId: string, payUrl: string, open: OpenStrategy): Promise<proto.cs.ICSQueryOrderRes | null>;
|
||||
|
||||
/** 恢复未完成订单 */
|
||||
resume(orderId: string, payUrl: string): Promise<proto.cs.ICSQueryOrderRes | null>;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.24",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "61bfae9e-5202-4dce-8ce6-1d31ca7e5593",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
@@ -41,9 +41,9 @@ export class PaymentPoller {
|
||||
this.currentPollCount++;
|
||||
// 查询
|
||||
let reqData = {orderId: orderId};
|
||||
console.log("第 ", this.currentPollCount, " 次轮询订单的请求数据:", reqData);
|
||||
console.log("订单:", orderId, " ,第 ", this.currentPollCount, " 次轮询订单的请求数据:", reqData);
|
||||
const r = await PaymentApi.I.queryOrder(reqData);
|
||||
console.log("第 ", this.currentPollCount, " 次轮询订单的响应数据:", r);
|
||||
console.log("订单:", orderId, " ,第 ", this.currentPollCount, " 次轮询订单的响应数据:", r);
|
||||
if (r.code === proto.cs.EnmRetCode.SUCCESS && r.data) {
|
||||
// 回调
|
||||
onTick?.(r.data);
|
||||
|
||||
@@ -6,18 +6,33 @@ import { EventTarget, game, Game } from "cc";
|
||||
import { PaymentApi } from "./PaymentApi";
|
||||
import { PaymentOpenerFactory, type OpenStrategy } from "./PaymentOpener";
|
||||
import PaymentPoller from "./PaymentPoller";
|
||||
import { PaymentFlow } from "./PaymentFlow";
|
||||
import { CashInrFlow } from "./CashInrFlow";
|
||||
import { WebUsdFlow } from "./WebUsdFlow";
|
||||
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;
|
||||
static get I() { return this._I ?? (this._I = new PaymentService()); }
|
||||
private constructor() {}
|
||||
/** 策略表 */
|
||||
private flowMap: Record<number, PaymentFlow> = {};
|
||||
|
||||
private constructor() {
|
||||
this.flowMap = {};
|
||||
let num1 = proto.cs.EnmPayType.EPT_Cash_INR;
|
||||
this.flowMap[num1] = new CashInrFlow(this.waitAppResumeIfNeeded.bind(this));
|
||||
let num2 = proto.cs.EnmPayType.EPT_WEB3_USD;
|
||||
this.flowMap[num2] = new WebUsdFlow(5000);
|
||||
}
|
||||
|
||||
/** 发起支付:创建订单→打开URL→回到App后开始轮询 */
|
||||
async startPayment(req: proto.cs.ICSCreateOrderReq, open: OpenStrategy = "system"): Promise<proto.cs.ICSQueryOrderRes> {
|
||||
// 下单
|
||||
console.log("创建订单的请求数据:", req);
|
||||
const create = await PaymentApi.I.createOrder(req);
|
||||
console.log("创建订单的响应数据:", create);
|
||||
if (create.code !== proto.cs.EnmRetCode.SUCCESS || !create.data) {
|
||||
@@ -29,27 +44,12 @@ export class PaymentService {
|
||||
const orderData = DataManager.I.getDataById<OrderData>(DataId.Order);
|
||||
orderData.saveOrderData(create.data);
|
||||
|
||||
// 打开支付页
|
||||
await PaymentOpenerFactory.create(open).open(payUrl);
|
||||
// 发出事件,支付订单创建成功
|
||||
Utils.sendInnerMsg(InnerMsgCode.PayOrderCreateSucc, { orderId: orderId, payType: req.payType });
|
||||
|
||||
// 等待回到前台(系统浏览器策略下)
|
||||
// - 如果是 inapp/minigame,可在 WebView/回跳时立即开始轮询;
|
||||
// - 这里给一个通用的“等待前台”方法(可用 Cocos 的 onShow/onHide 自行接入)
|
||||
await this.waitAppResumeIfNeeded(open);
|
||||
|
||||
// 轮询
|
||||
const poller = new PaymentPoller();
|
||||
const data = await poller.poll(orderId, {
|
||||
maxDurationMs: 2 * 60 * 1000,
|
||||
startIntervalMs: 2000,
|
||||
maxIntervalMs: 10000,
|
||||
jitter: true,
|
||||
}, (d) => console.log());
|
||||
|
||||
// 刷新订单数据
|
||||
orderData.applyQueryOrder(orderId, data);
|
||||
// 返回结果
|
||||
return data;
|
||||
// 分发流程
|
||||
const flow = this.flowMap[req.payType];
|
||||
return flow?.run(orderId, payUrl, open) ?? null;
|
||||
}
|
||||
|
||||
/** App 回到前台后恢复未完成订单的轮询(在 onShow 时调用) */
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* web3 USD 支付流程
|
||||
*
|
||||
*/
|
||||
import PaymentPoller from "./PaymentPoller";
|
||||
import type { PaymentFlow } from "./PaymentFlow";
|
||||
import type proto from "db://assets/Scripts/proto/proto.pb.js";
|
||||
import { type OpenStrategy } from "./PaymentOpener";
|
||||
import { DataManager, DataId } from "db://assets/Scripts/chat18x/data/DataManager";
|
||||
import { OrderData } from "db://assets/Scripts/chat18x/data/OrderData";
|
||||
|
||||
export class WebUsdFlow implements PaymentFlow {
|
||||
constructor(private delayMs: number = 5000) {}
|
||||
|
||||
async run(orderId: string, _payUrl: string, _open: OpenStrategy): Promise<proto.cs.ICSQueryOrderRes | null> {
|
||||
// 延时
|
||||
await this.delay(this.delayMs);
|
||||
// 开始轮询
|
||||
const data = await this.pollOrder(orderId);
|
||||
// 刷新订单数据
|
||||
const orderData = DataManager.I.getDataById<OrderData>(DataId.Order);
|
||||
orderData.applyQueryOrder(orderId, data);
|
||||
// 返回结果
|
||||
return data;
|
||||
}
|
||||
|
||||
async resume(orderId: string, _payUrl: string): Promise<proto.cs.ICSQueryOrderRes | null> {
|
||||
// 直接轮询(也可以选择先 delay 一下再 poll,看业务需求)
|
||||
return this.pollOrder(orderId);
|
||||
}
|
||||
|
||||
private async pollOrder(orderId: string) {
|
||||
const poller = new PaymentPoller();
|
||||
return poller.poll(orderId, {
|
||||
maxDurationMs: 2 * 60 * 1000,
|
||||
startIntervalMs: 2000,
|
||||
maxIntervalMs: 10000,
|
||||
jitter: true,
|
||||
}, (d) => console.log());
|
||||
}
|
||||
|
||||
private delay(ms: number) {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.24",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "87ddca36-23cb-411d-bbe9-3bd948ec5490",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -128,7 +128,7 @@ export class PurchasePanel extends li_BaseView {
|
||||
const isRechargeId = shopData.isRechargeId(id);
|
||||
if (isRechargeId) {
|
||||
// 需要外部支付进行购买
|
||||
this.startPayment(id);
|
||||
this.startPayment(id, proto.cs.EnmPayType.EPT_Cash_INR, proto.cs.EnmNetworkType.ENT_TRON);
|
||||
} else {
|
||||
//是u币充值,打开页面
|
||||
NavigationManager.Instance.openSubPanel("Web3PopPanel", this.node);
|
||||
@@ -187,10 +187,12 @@ export class PurchasePanel extends li_BaseView {
|
||||
}
|
||||
|
||||
// 创建订单
|
||||
async startPayment(goodId: number) {
|
||||
async startPayment(goodId: number, payType: number, network: number) {
|
||||
// 请求数据
|
||||
const reqData = {
|
||||
goodId,
|
||||
payType,
|
||||
network,
|
||||
};
|
||||
let res = await PaymentService.I.startPayment(reqData);
|
||||
console.log("支付完成的响应数据:", res);
|
||||
|
||||
Vendored
+71
-1
@@ -1660,11 +1660,31 @@ toJSON(): { [k: string]: any };
|
||||
static getTypeUrl(typeUrlPrefix?: string): string;
|
||||
}
|
||||
|
||||
/** EnmPayType enum. */
|
||||
enum EnmPayType {
|
||||
EPT_Cash_INR = 0,
|
||||
EPT_WEB3_USD = 1
|
||||
}
|
||||
|
||||
/** EnmNetworkType enum. */
|
||||
enum EnmNetworkType {
|
||||
ENT_TRON = 0,
|
||||
ENT_TON = 1,
|
||||
ENT_ETH = 2,
|
||||
ENT_BEP = 3
|
||||
}
|
||||
|
||||
/** Properties of a CSCreateOrderReq. */
|
||||
interface ICSCreateOrderReq {
|
||||
|
||||
/** CSCreateOrderReq goodId */
|
||||
goodId?: (number|null);
|
||||
|
||||
/** CSCreateOrderReq payType */
|
||||
payType?: (number|null);
|
||||
|
||||
/** CSCreateOrderReq network */
|
||||
network?: (number|null);
|
||||
}
|
||||
|
||||
/** Represents a CSCreateOrderReq. */
|
||||
@@ -1679,6 +1699,12 @@ static getTypeUrl(typeUrlPrefix?: string): string;
|
||||
/** CSCreateOrderReq goodId. */
|
||||
goodId: number;
|
||||
|
||||
/** CSCreateOrderReq payType. */
|
||||
payType: number;
|
||||
|
||||
/** CSCreateOrderReq network. */
|
||||
network: number;
|
||||
|
||||
/**
|
||||
* Creates a new CSCreateOrderReq instance using the specified properties.
|
||||
* @param [properties] Properties to set
|
||||
@@ -1765,6 +1791,24 @@ static getTypeUrl(typeUrlPrefix?: string): string;
|
||||
|
||||
/** CSCreateOrderRes orderId */
|
||||
orderId?: (string|null);
|
||||
|
||||
/** CSCreateOrderRes network */
|
||||
network?: (number|null);
|
||||
|
||||
/** CSCreateOrderRes wallet */
|
||||
wallet?: (string|null);
|
||||
|
||||
/** CSCreateOrderRes amount */
|
||||
amount?: (string|null);
|
||||
|
||||
/** CSCreateOrderRes Expire */
|
||||
Expire?: (number|null);
|
||||
|
||||
/** CSCreateOrderRes ExpireUnix */
|
||||
ExpireUnix?: (number|Long|null);
|
||||
|
||||
/** CSCreateOrderRes payType */
|
||||
payType?: (number|null);
|
||||
}
|
||||
|
||||
/** Represents a CSCreateOrderRes. */
|
||||
@@ -1782,6 +1826,24 @@ payUrl: string;
|
||||
/** CSCreateOrderRes orderId. */
|
||||
orderId: string;
|
||||
|
||||
/** CSCreateOrderRes network. */
|
||||
network: number;
|
||||
|
||||
/** CSCreateOrderRes wallet. */
|
||||
wallet: string;
|
||||
|
||||
/** CSCreateOrderRes amount. */
|
||||
amount: string;
|
||||
|
||||
/** CSCreateOrderRes Expire. */
|
||||
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
|
||||
@@ -4129,6 +4191,9 @@ static getTypeUrl(typeUrlPrefix?: string): string;
|
||||
|
||||
/** PurchaseConfig price */
|
||||
price?: (number|null);
|
||||
|
||||
/** PurchaseConfig usd */
|
||||
usd?: (number|null);
|
||||
}
|
||||
|
||||
/** Represents a PurchaseConfig. */
|
||||
@@ -4152,6 +4217,9 @@ count: number;
|
||||
/** PurchaseConfig price. */
|
||||
price: number;
|
||||
|
||||
/** PurchaseConfig usd. */
|
||||
usd: number;
|
||||
|
||||
/**
|
||||
* Creates a new PurchaseConfig instance using the specified properties.
|
||||
* @param [properties] Properties to set
|
||||
@@ -5818,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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3868,6 +3868,38 @@ $root.cs = (function() {
|
||||
return CSBuyGoodRes;
|
||||
})();
|
||||
|
||||
/**
|
||||
* EnmPayType enum.
|
||||
* @name cs.EnmPayType
|
||||
* @enum {number}
|
||||
* @property {number} EPT_Cash_INR=0 EPT_Cash_INR value
|
||||
* @property {number} EPT_WEB3_USD=1 EPT_WEB3_USD value
|
||||
*/
|
||||
cs.EnmPayType = (function() {
|
||||
var valuesById = {}, values = Object.create(valuesById);
|
||||
values[valuesById[0] = "EPT_Cash_INR"] = 0;
|
||||
values[valuesById[1] = "EPT_WEB3_USD"] = 1;
|
||||
return values;
|
||||
})();
|
||||
|
||||
/**
|
||||
* EnmNetworkType enum.
|
||||
* @name cs.EnmNetworkType
|
||||
* @enum {number}
|
||||
* @property {number} ENT_TRON=0 ENT_TRON value
|
||||
* @property {number} ENT_TON=1 ENT_TON value
|
||||
* @property {number} ENT_ETH=2 ENT_ETH value
|
||||
* @property {number} ENT_BEP=3 ENT_BEP value
|
||||
*/
|
||||
cs.EnmNetworkType = (function() {
|
||||
var valuesById = {}, values = Object.create(valuesById);
|
||||
values[valuesById[0] = "ENT_TRON"] = 0;
|
||||
values[valuesById[1] = "ENT_TON"] = 1;
|
||||
values[valuesById[2] = "ENT_ETH"] = 2;
|
||||
values[valuesById[3] = "ENT_BEP"] = 3;
|
||||
return values;
|
||||
})();
|
||||
|
||||
cs.CSCreateOrderReq = (function() {
|
||||
|
||||
/**
|
||||
@@ -3875,6 +3907,8 @@ $root.cs = (function() {
|
||||
* @memberof cs
|
||||
* @interface ICSCreateOrderReq
|
||||
* @property {number|null} [goodId] CSCreateOrderReq goodId
|
||||
* @property {number|null} [payType] CSCreateOrderReq payType
|
||||
* @property {number|null} [network] CSCreateOrderReq network
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -3900,6 +3934,22 @@ $root.cs = (function() {
|
||||
*/
|
||||
CSCreateOrderReq.prototype.goodId = 0;
|
||||
|
||||
/**
|
||||
* CSCreateOrderReq payType.
|
||||
* @member {number} payType
|
||||
* @memberof cs.CSCreateOrderReq
|
||||
* @instance
|
||||
*/
|
||||
CSCreateOrderReq.prototype.payType = 0;
|
||||
|
||||
/**
|
||||
* CSCreateOrderReq network.
|
||||
* @member {number} network
|
||||
* @memberof cs.CSCreateOrderReq
|
||||
* @instance
|
||||
*/
|
||||
CSCreateOrderReq.prototype.network = 0;
|
||||
|
||||
/**
|
||||
* Creates a new CSCreateOrderReq instance using the specified properties.
|
||||
* @function create
|
||||
@@ -3926,6 +3976,10 @@ $root.cs = (function() {
|
||||
writer = $Writer.create();
|
||||
if (message.goodId != null && Object.hasOwnProperty.call(message, "goodId"))
|
||||
writer.uint32(/* id 1, wireType 0 =*/8).int32(message.goodId);
|
||||
if (message.payType != null && Object.hasOwnProperty.call(message, "payType"))
|
||||
writer.uint32(/* id 2, wireType 0 =*/16).int32(message.payType);
|
||||
if (message.network != null && Object.hasOwnProperty.call(message, "network"))
|
||||
writer.uint32(/* id 3, wireType 0 =*/24).int32(message.network);
|
||||
return writer;
|
||||
};
|
||||
|
||||
@@ -3966,6 +4020,14 @@ $root.cs = (function() {
|
||||
message.goodId = reader.int32();
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
message.payType = reader.int32();
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
message.network = reader.int32();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
@@ -4004,6 +4066,12 @@ $root.cs = (function() {
|
||||
if (message.goodId != null && message.hasOwnProperty("goodId"))
|
||||
if (!$util.isInteger(message.goodId))
|
||||
return "goodId: integer expected";
|
||||
if (message.payType != null && message.hasOwnProperty("payType"))
|
||||
if (!$util.isInteger(message.payType))
|
||||
return "payType: integer expected";
|
||||
if (message.network != null && message.hasOwnProperty("network"))
|
||||
if (!$util.isInteger(message.network))
|
||||
return "network: integer expected";
|
||||
return null;
|
||||
};
|
||||
|
||||
@@ -4021,6 +4089,10 @@ $root.cs = (function() {
|
||||
var message = new $root.cs.CSCreateOrderReq();
|
||||
if (object.goodId != null)
|
||||
message.goodId = object.goodId | 0;
|
||||
if (object.payType != null)
|
||||
message.payType = object.payType | 0;
|
||||
if (object.network != null)
|
||||
message.network = object.network | 0;
|
||||
return message;
|
||||
};
|
||||
|
||||
@@ -4037,10 +4109,17 @@ $root.cs = (function() {
|
||||
if (!options)
|
||||
options = {};
|
||||
var object = {};
|
||||
if (options.defaults)
|
||||
if (options.defaults) {
|
||||
object.goodId = 0;
|
||||
object.payType = 0;
|
||||
object.network = 0;
|
||||
}
|
||||
if (message.goodId != null && message.hasOwnProperty("goodId"))
|
||||
object.goodId = message.goodId;
|
||||
if (message.payType != null && message.hasOwnProperty("payType"))
|
||||
object.payType = message.payType;
|
||||
if (message.network != null && message.hasOwnProperty("network"))
|
||||
object.network = message.network;
|
||||
return object;
|
||||
};
|
||||
|
||||
@@ -4081,6 +4160,12 @@ $root.cs = (function() {
|
||||
* @interface ICSCreateOrderRes
|
||||
* @property {string|null} [payUrl] CSCreateOrderRes payUrl
|
||||
* @property {string|null} [orderId] CSCreateOrderRes orderId
|
||||
* @property {number|null} [network] CSCreateOrderRes network
|
||||
* @property {string|null} [wallet] CSCreateOrderRes wallet
|
||||
* @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
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -4114,6 +4199,54 @@ $root.cs = (function() {
|
||||
*/
|
||||
CSCreateOrderRes.prototype.orderId = "";
|
||||
|
||||
/**
|
||||
* CSCreateOrderRes network.
|
||||
* @member {number} network
|
||||
* @memberof cs.CSCreateOrderRes
|
||||
* @instance
|
||||
*/
|
||||
CSCreateOrderRes.prototype.network = 0;
|
||||
|
||||
/**
|
||||
* CSCreateOrderRes wallet.
|
||||
* @member {string} wallet
|
||||
* @memberof cs.CSCreateOrderRes
|
||||
* @instance
|
||||
*/
|
||||
CSCreateOrderRes.prototype.wallet = "";
|
||||
|
||||
/**
|
||||
* CSCreateOrderRes amount.
|
||||
* @member {string} amount
|
||||
* @memberof cs.CSCreateOrderRes
|
||||
* @instance
|
||||
*/
|
||||
CSCreateOrderRes.prototype.amount = "";
|
||||
|
||||
/**
|
||||
* CSCreateOrderRes Expire.
|
||||
* @member {number} Expire
|
||||
* @memberof cs.CSCreateOrderRes
|
||||
* @instance
|
||||
*/
|
||||
CSCreateOrderRes.prototype.Expire = 0;
|
||||
|
||||
/**
|
||||
* CSCreateOrderRes ExpireUnix.
|
||||
* @member {number|Long} ExpireUnix
|
||||
* @memberof cs.CSCreateOrderRes
|
||||
* @instance
|
||||
*/
|
||||
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
|
||||
@@ -4142,6 +4275,18 @@ $root.cs = (function() {
|
||||
writer.uint32(/* id 1, wireType 2 =*/10).string(message.payUrl);
|
||||
if (message.orderId != null && Object.hasOwnProperty.call(message, "orderId"))
|
||||
writer.uint32(/* id 2, wireType 2 =*/18).string(message.orderId);
|
||||
if (message.network != null && Object.hasOwnProperty.call(message, "network"))
|
||||
writer.uint32(/* id 3, wireType 0 =*/24).int32(message.network);
|
||||
if (message.wallet != null && Object.hasOwnProperty.call(message, "wallet"))
|
||||
writer.uint32(/* id 4, wireType 2 =*/34).string(message.wallet);
|
||||
if (message.amount != null && Object.hasOwnProperty.call(message, "amount"))
|
||||
writer.uint32(/* id 5, wireType 2 =*/42).string(message.amount);
|
||||
if (message.Expire != null && Object.hasOwnProperty.call(message, "Expire"))
|
||||
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;
|
||||
};
|
||||
|
||||
@@ -4186,6 +4331,30 @@ $root.cs = (function() {
|
||||
message.orderId = reader.string();
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
message.network = reader.int32();
|
||||
break;
|
||||
}
|
||||
case 4: {
|
||||
message.wallet = reader.string();
|
||||
break;
|
||||
}
|
||||
case 5: {
|
||||
message.amount = reader.string();
|
||||
break;
|
||||
}
|
||||
case 6: {
|
||||
message.Expire = reader.int32();
|
||||
break;
|
||||
}
|
||||
case 7: {
|
||||
message.ExpireUnix = reader.int64();
|
||||
break;
|
||||
}
|
||||
case 8: {
|
||||
message.payType = reader.int32();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
@@ -4227,6 +4396,24 @@ $root.cs = (function() {
|
||||
if (message.orderId != null && message.hasOwnProperty("orderId"))
|
||||
if (!$util.isString(message.orderId))
|
||||
return "orderId: string expected";
|
||||
if (message.network != null && message.hasOwnProperty("network"))
|
||||
if (!$util.isInteger(message.network))
|
||||
return "network: integer expected";
|
||||
if (message.wallet != null && message.hasOwnProperty("wallet"))
|
||||
if (!$util.isString(message.wallet))
|
||||
return "wallet: string expected";
|
||||
if (message.amount != null && message.hasOwnProperty("amount"))
|
||||
if (!$util.isString(message.amount))
|
||||
return "amount: string expected";
|
||||
if (message.Expire != null && message.hasOwnProperty("Expire"))
|
||||
if (!$util.isInteger(message.Expire))
|
||||
return "Expire: integer expected";
|
||||
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;
|
||||
};
|
||||
|
||||
@@ -4246,6 +4433,25 @@ $root.cs = (function() {
|
||||
message.payUrl = String(object.payUrl);
|
||||
if (object.orderId != null)
|
||||
message.orderId = String(object.orderId);
|
||||
if (object.network != null)
|
||||
message.network = object.network | 0;
|
||||
if (object.wallet != null)
|
||||
message.wallet = String(object.wallet);
|
||||
if (object.amount != null)
|
||||
message.amount = String(object.amount);
|
||||
if (object.Expire != null)
|
||||
message.Expire = object.Expire | 0;
|
||||
if (object.ExpireUnix != null)
|
||||
if ($util.Long)
|
||||
(message.ExpireUnix = $util.Long.fromValue(object.ExpireUnix)).unsigned = false;
|
||||
else if (typeof object.ExpireUnix === "string")
|
||||
message.ExpireUnix = parseInt(object.ExpireUnix, 10);
|
||||
else if (typeof object.ExpireUnix === "number")
|
||||
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;
|
||||
};
|
||||
|
||||
@@ -4265,11 +4471,36 @@ $root.cs = (function() {
|
||||
if (options.defaults) {
|
||||
object.payUrl = "";
|
||||
object.orderId = "";
|
||||
object.network = 0;
|
||||
object.wallet = "";
|
||||
object.amount = "";
|
||||
object.Expire = 0;
|
||||
if ($util.Long) {
|
||||
var long = new $util.Long(0, 0, false);
|
||||
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;
|
||||
if (message.orderId != null && message.hasOwnProperty("orderId"))
|
||||
object.orderId = message.orderId;
|
||||
if (message.network != null && message.hasOwnProperty("network"))
|
||||
object.network = message.network;
|
||||
if (message.wallet != null && message.hasOwnProperty("wallet"))
|
||||
object.wallet = message.wallet;
|
||||
if (message.amount != null && message.hasOwnProperty("amount"))
|
||||
object.amount = message.amount;
|
||||
if (message.Expire != null && message.hasOwnProperty("Expire"))
|
||||
object.Expire = message.Expire;
|
||||
if (message.ExpireUnix != null && message.hasOwnProperty("ExpireUnix"))
|
||||
if (typeof message.ExpireUnix === "number")
|
||||
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;
|
||||
};
|
||||
|
||||
@@ -9823,6 +10054,7 @@ $root.cs = (function() {
|
||||
* @property {string|null} [name] PurchaseConfig name
|
||||
* @property {number|null} [count] PurchaseConfig count
|
||||
* @property {number|null} [price] PurchaseConfig price
|
||||
* @property {number|null} [usd] PurchaseConfig usd
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -9872,6 +10104,14 @@ $root.cs = (function() {
|
||||
*/
|
||||
PurchaseConfig.prototype.price = 0;
|
||||
|
||||
/**
|
||||
* PurchaseConfig usd.
|
||||
* @member {number} usd
|
||||
* @memberof cs.PurchaseConfig
|
||||
* @instance
|
||||
*/
|
||||
PurchaseConfig.prototype.usd = 0;
|
||||
|
||||
/**
|
||||
* Creates a new PurchaseConfig instance using the specified properties.
|
||||
* @function create
|
||||
@@ -9904,6 +10144,8 @@ $root.cs = (function() {
|
||||
writer.uint32(/* id 3, wireType 0 =*/24).int32(message.count);
|
||||
if (message.price != null && Object.hasOwnProperty.call(message, "price"))
|
||||
writer.uint32(/* id 4, wireType 0 =*/32).int32(message.price);
|
||||
if (message.usd != null && Object.hasOwnProperty.call(message, "usd"))
|
||||
writer.uint32(/* id 5, wireType 0 =*/40).int32(message.usd);
|
||||
return writer;
|
||||
};
|
||||
|
||||
@@ -9956,6 +10198,10 @@ $root.cs = (function() {
|
||||
message.price = reader.int32();
|
||||
break;
|
||||
}
|
||||
case 5: {
|
||||
message.usd = reader.int32();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
@@ -10003,6 +10249,9 @@ $root.cs = (function() {
|
||||
if (message.price != null && message.hasOwnProperty("price"))
|
||||
if (!$util.isInteger(message.price))
|
||||
return "price: integer expected";
|
||||
if (message.usd != null && message.hasOwnProperty("usd"))
|
||||
if (!$util.isInteger(message.usd))
|
||||
return "usd: integer expected";
|
||||
return null;
|
||||
};
|
||||
|
||||
@@ -10026,6 +10275,8 @@ $root.cs = (function() {
|
||||
message.count = object.count | 0;
|
||||
if (object.price != null)
|
||||
message.price = object.price | 0;
|
||||
if (object.usd != null)
|
||||
message.usd = object.usd | 0;
|
||||
return message;
|
||||
};
|
||||
|
||||
@@ -10047,6 +10298,7 @@ $root.cs = (function() {
|
||||
object.name = "";
|
||||
object.count = 0;
|
||||
object.price = 0;
|
||||
object.usd = 0;
|
||||
}
|
||||
if (message.id != null && message.hasOwnProperty("id"))
|
||||
object.id = message.id;
|
||||
@@ -10056,6 +10308,8 @@ $root.cs = (function() {
|
||||
object.count = message.count;
|
||||
if (message.price != null && message.hasOwnProperty("price"))
|
||||
object.price = message.price;
|
||||
if (message.usd != null && message.hasOwnProperty("usd"))
|
||||
object.usd = message.usd;
|
||||
return object;
|
||||
};
|
||||
|
||||
@@ -13857,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);
|
||||
@@ -13878,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;
|
||||
})();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user