示例#1
0
    /// <summary>
    /// 创建支付订单
    /// </summary>
    protected virtual void CreateOrder(ProductVo product)
    {
        _product = product;

        Debug.LogError("CreateOrder==>" + product.ToString());

        CreateOrderReq req = new CreateOrderReq
        {
            Channel       = PayAgent.PayChannel,
            Origin        = PayAgent.PayChannel,
            CommodityId   = product.CommodityId,
            Type          = product.ProductType,
            Version       = "100",
            Environment   = 0, //TODO 0沙箱,1正式
            PayType       = (int)PayAgent.PayType.GooglePlay,
            SdkVersion    = "100",
            Tag           = AppConfig.Instance.payKey,
            TriggerGiftId = new TriggerGiftIdPb()
            {
                Id = _product.ExtInt
            }
        };

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

        LoadingOverlay.Instance.Show();
        NetWorkManager.Instance.Send <CreateOrderRes>(CMD.RECHARGEC_CREATEORDER, buffer, OnGetOrderSuccess,
                                                      OnGetOrderError);
    }
示例#2
0
    private void ShowProduct(ProductVo vo)
    {
        Debug.LogError("商品信息:" + vo.ToString());

        IconSelectWindow win = PopupManager.ShowWindow <IconSelectWindow>(Constants.IconSelectWindowPath);

        win.SetData("", IconType.Alipay, IconType.WeChatFriend);
        win.clickCallback = (m) =>
        {
            win.Close();
        };
    }
示例#3
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);
    }