Exemple #1
0
    protected void OnPaySuccess(string data)
    {
        Debug.LogWarning("===SDK===OnPaySuccess=======" + data);

        CheckOrderReqs reqList = new CheckOrderReqs();

        CheckOrderReq req = new CheckOrderReq()
        {
            Channel       = PayAgent.GetPaySdk(payType),
            Origin        = PayChannel,
            Environment   = 0,
            Params        = "",
            OrderId       = data,
            PayType       = (int)payType,
            Tag           = AppConfig.Instance.payKey,
            SdkVersion    = PayVersion.GetPayVersion(payType),
            Version       = PayVersion.GetPaySdkVersion(payType),
            TriggerGiftId = new TriggerGiftIdPb()
            {
                Id = _product.ExtInt
            }
        };

        req.ExtInfo = GalaSDKBaseFunction.SdkFetchTokenWithType("");

        reqList.CheckOrderReqs_.Add(req);
        payChecker.AddToCheckList(req.OrderId);

        Debug.LogWarning("===SDK===OnPaySuccess==>" + ObjectDumper.Dump(reqList));

        byte[] bytes = NetWorkManager.GetByteData(reqList);

        NetWorkManager.Instance.Send <CheckOrderRess>(CMD.RECHARGEC_CHECKORDER, bytes, OnCheckOrdersSuccess,
                                                      OnCheckOrdersFail);
    }
Exemple #2
0
    /// <summary>
    /// 创建支付订单
    /// </summary>
    protected virtual void CreateOrder(ProductVo product)
    {
        LoadingOverlay.Instance.Show();

        _product = product;
        string param = GalaSDKBaseFunction.PayCreateOrderParameter();

        Debug.LogError("CreateOrder==>" + product.ToString() + "\n param:" + param);

        JSONObject extJson = new JSONObject();

        extJson.AddField("productName", _product.Name);
        extJson.AddField("productDesc", _product.Name);

        if (!param.IsNullOrEmpty() && !param.Equals("false"))
        {
            JSONObject paramJson = new JSONObject(param);
            if (paramJson != null && paramJson.keys != null)
            {
                for (int i = 0; i < paramJson.keys.Count; i++)
                {
                    string key = paramJson.keys[i];
                    extJson.AddField(key, paramJson[key].str);
                }
            }
        }

        CreateOrderReq req = new CreateOrderReq
        {
            Channel       = PayAgent.GetPaySdk(payType),
            Origin        = PayChannel,
            CommodityId   = product.CommodityId,
            Type          = product.ProductType,
            Version       = PayVersion.GetPayVersion(payType),
            SdkVersion    = PayVersion.GetPaySdkVersion(payType),
            Environment   = 0, //TODO 0沙箱,1正式
            PayType       = (int)payType,
            Tag           = AppConfig.Instance.payKey,
            IsClose       = int.Parse(AppConfig.Instance.SwitchControl.CheckAdultPay),
            TriggerGiftId = new TriggerGiftIdPb()
            {
                Id = _product.ExtInt
            },
            Extra = extJson.ToString()
        };

        byte[] buffer = NetWorkManager.GetByteData(req);

        LoadingOverlay.Instance.Show();
        NetWorkManager.Instance.Send <CreateOrderRes>(CMD.RECHARGEC_CREATEORDER, buffer, OnGetOrderSuccess, OnGetOrderError);
    }
Exemple #3
0
    private void CheckPayList()
    {
        CheckOrderReqs checkOrderReqs = new CheckOrderReqs();

        foreach (KeyValuePair <string, OrderData> orderData in _orderDict)
        {
            Debug.LogWarning("检查订单=" + orderData.Value.orderId);

            PayAgent.PayType payType = orderData.Value.payType;
            CheckOrderReq    req     = new CheckOrderReq()
            {
                Channel       = PayAgent.GetPaySdk(payType),
                Origin        = PayAgent.PayChannel,
                Environment   = 0,
                Params        = "",
                OrderId       = orderData.Value.orderId,
                PayType       = (int)payType,
                Tag           = AppConfig.Instance.payKey,
                SdkVersion    = PayVersion.GetPayVersion(payType),
                Version       = PayVersion.GetPaySdkVersion(payType),
                TriggerGiftId = new TriggerGiftIdPb()
                {
                    Id = orderData.Value.productVo.ExtInt
                }
            };

            if (orderData.Value.payType == PayAgent.PayType.WechatPay)
            {
                req.Channel = "WX";
            }
            else if (orderData.Value.payType == PayAgent.PayType.AliPay)
            {
                req.Channel = "ALIPAY";
            }

            checkOrderReqs.CheckOrderReqs_.Add(req);
        }

        byte[] buff = NetWorkManager.GetByteData(checkOrderReqs);
        NetWorkManager.Instance.Send <CheckOrderRess>(CMD.RECHARGEC_CHECKORDER, buff, OnCheckPayListSuccess, OnCheckPayListFail);
    }