update:enjoy-pay 接入
This commit is contained in:
@@ -5,7 +5,7 @@ using UnityEngine;
|
||||
|
||||
public class ChannelBuildTool
|
||||
{
|
||||
public static readonly string[] SupportedChannels = { "GooglePlay", "Rustore", "Flexion" };
|
||||
public static readonly string[] SupportedChannels = { "GooglePlay", "Rustore", "Flexion", "EnjoyPay" };
|
||||
|
||||
private const string DefaultChannel = "GooglePlay";
|
||||
private const string DefaultAndroidBundleIdentifier = "com.arkgame.ft";
|
||||
@@ -101,6 +101,7 @@ public class ChannelBuildTool
|
||||
var bundleId = channel switch
|
||||
{
|
||||
"Flexion" => "com.arkgame.ft.flexion",
|
||||
"EnjoyPay" => "com.arkgame.ft.ep",
|
||||
_ => "com.arkgame.ft"
|
||||
};
|
||||
PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.Android, bundleId);
|
||||
@@ -176,6 +177,9 @@ public class ChannelBuildTool
|
||||
[MenuItem("Tools/Switch Channel/Flexion")]
|
||||
public static void Switch_Flexion() => SwitchChannel("Flexion");
|
||||
|
||||
[MenuItem("Tools/Switch Channel/EnjoyPay")]
|
||||
public static void Switch_EnjoyPay() => SwitchChannel("EnjoyPay");
|
||||
|
||||
// ==================== Menu: Build ====================
|
||||
|
||||
[MenuItem("Tools/Build Android (Channel)/GooglePlay")]
|
||||
@@ -195,4 +199,10 @@ public class ChannelBuildTool
|
||||
|
||||
[MenuItem("Tools/Build Android (Channel)/Flexion Debug")]
|
||||
public static void Build_Flexion_Debug() => BuildAndroidForChannel("Flexion", true);
|
||||
|
||||
[MenuItem("Tools/Build Android (Channel)/EnjoyPay")]
|
||||
public static void Build_EnjoyPay() => BuildAndroidForChannel("EnjoyPay", false);
|
||||
|
||||
[MenuItem("Tools/Build Android (Channel)/EnjoyPay Debug")]
|
||||
public static void Build_EnjoyPay_Debug() => BuildAndroidForChannel("EnjoyPay", true);
|
||||
}
|
||||
|
||||
@@ -82,10 +82,10 @@ public class SDKTest : MonoBehaviour
|
||||
//====================== Test Server ===========================
|
||||
//===============================================================================
|
||||
//
|
||||
_InitBtn.onClick.AddListener(Init);
|
||||
TYSdkFacade.OnInitComplete += (success, msg) =>
|
||||
{
|
||||
_messageTxt.text = success ? $"Init OK: {msg}" : $"Init Failed: {msg}";
|
||||
_InitBtn.onClick.AddListener(Init);
|
||||
TYSdkFacade.OnInitComplete += (success, msg) =>
|
||||
{
|
||||
_messageTxt.text = success ? $"Init OK: {msg}" : $"Init Failed: {msg}";
|
||||
};
|
||||
_loginGuestBtn.onClick.AddListener(() => OnLogin(EAccoutType.hwGuest));
|
||||
_loginGoogleBtn.onClick.AddListener(() => OnLogin(EAccoutType.hwGoogle));
|
||||
@@ -223,6 +223,18 @@ public class SDKTest : MonoBehaviour
|
||||
type = "inapp"
|
||||
};
|
||||
}
|
||||
else if (ChannelConfig.Channel.Equals("EnjoyPay"))
|
||||
{
|
||||
sku = new SKUDetail
|
||||
{
|
||||
productId = "comarkgameftpack0199",
|
||||
ourProductId = "comarkgameftpack0199",
|
||||
price = "1.99",
|
||||
price_amount_micros = "1990000",
|
||||
title = "EnjoyPay Test Pack",
|
||||
type = "inapp"
|
||||
};
|
||||
}
|
||||
if (sku == null){
|
||||
_messageTxt.text = "no product";
|
||||
return;
|
||||
@@ -240,18 +252,18 @@ public class SDKTest : MonoBehaviour
|
||||
// purchaseInfo["customData"] ="{\"BuyType\":{\"type\":1,\"ID\":100502,\"key\":null,\"endDay\":0,\"extraPurcheData\":null,\"IsHide\":false},\"IAPID\":302,\"ItemData\":[{\"id\":1005,\"curCount\":22728,\"count\":260}],\"ShowType\":8,\"CONTENT_ID\":\"com.arkgame.ft.pack0499\",\"PRICE\":4.99,\"CURRENCY\":\"USD\",\"ProdPrice\":4.99,\"extraPurcheData\":{\"purchase_count\":9,\"trade_name\":\"商店-钻石直充4.99\",\"trade_type\":\"商店-钻石直充\",\"usd_price\":4.99,\"iap_id\":302,\"drop_id\":1005,\"trade_group\":\"商店\",\"item_1005\":260},\"orderId\":null,\"time\":\"5/20/2026 3:59:07 AM\"}";
|
||||
purchaseInfo["userId"] = TYSdkFacade.TYAccountInfo.strUserId;
|
||||
|
||||
PaymentInfo payResult = await TYSdkFacade.Instance.Pay(sku, 1, sku.ProdPrice, purchaseInfo);
|
||||
_messageTxt.text = "\n" + $"Success : {payResult.isSuccess}";
|
||||
_messageTxt.text += "\n" + $"message : {payResult.msg}";
|
||||
_messageTxt.text += "\n" + $"orderId : {payResult.orderId}";
|
||||
_messageTxt.text += "\n" + $"storeOrderId : {payResult.storeOrderId}";
|
||||
var consumeToken = payResult.Receipt?.PurchaseToken ?? payResult.purchaseToken;
|
||||
_messageTxt.text += "\n" + $"hasToken : {!string.IsNullOrEmpty(consumeToken)}";
|
||||
if (!string.IsNullOrEmpty(consumeToken))
|
||||
{
|
||||
Debug.Log($"[SDKTest] Consume purchase token after pay result token={consumeToken}");
|
||||
UnityBridgeFunc.ConsumePurchase(consumeToken);
|
||||
_messageTxt.text += "\nconsume requested";
|
||||
PaymentInfo payResult = await TYSdkFacade.Instance.Pay(sku, 1, sku.ProdPrice, purchaseInfo);
|
||||
_messageTxt.text = "\n" + $"Success : {payResult.isSuccess}";
|
||||
_messageTxt.text += "\n" + $"message : {payResult.msg}";
|
||||
_messageTxt.text += "\n" + $"orderId : {payResult.orderId}";
|
||||
_messageTxt.text += "\n" + $"storeOrderId : {payResult.storeOrderId}";
|
||||
var consumeToken = payResult.Receipt?.PurchaseToken ?? payResult.purchaseToken;
|
||||
_messageTxt.text += "\n" + $"hasToken : {!string.IsNullOrEmpty(consumeToken)}";
|
||||
if (!string.IsNullOrEmpty(consumeToken))
|
||||
{
|
||||
Debug.Log($"[SDKTest] Consume purchase token after pay result token={consumeToken}");
|
||||
UnityBridgeFunc.ConsumePurchase(consumeToken);
|
||||
_messageTxt.text += "\nconsume requested";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user