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";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Unified SDKManager for all channels (GooglePlay / Flexion / RuStore).
|
||||
* Unified SDKManager for all channels (GooglePlay / Flexion / RuStore / EnjoyPay).
|
||||
* C# passes the channel string via InitSDK(activity, channel); Java dispatches
|
||||
* internally via switch. All login/link/GA/share logic is shared.
|
||||
* Channel-specific behaviour is limited to: Init, Pay, thirdExtend, Review.
|
||||
@@ -461,6 +461,13 @@ public class SDKManager {
|
||||
public static void UnityKnowNew(String productId, String productPrice, String productName,
|
||||
String productCount, String prodorderId, String appInfo,
|
||||
String ptype) {
|
||||
SDKLog.i("[SDKManager.UnityKnowNew] channel=" + channel
|
||||
+ ", ptype=" + ptype
|
||||
+ ", productId=" + productId
|
||||
+ ", productPrice=" + productPrice
|
||||
+ ", productName=" + productName
|
||||
+ ", productCount=" + productCount
|
||||
+ ", orderId=" + prodorderId);
|
||||
if (sdkAdapter instanceof IPaymentAdapter) {
|
||||
((IPaymentAdapter) sdkAdapter).pay(UnityPlayer.currentActivity, productId, productPrice, productName, productCount, prodorderId, appInfo);
|
||||
return;
|
||||
@@ -478,6 +485,7 @@ public class SDKManager {
|
||||
payData.payReq = mPayReq;
|
||||
PayType payType = new PayType();
|
||||
payType.paytype = ptype;
|
||||
SDKLog.i("[SDKManager.UnityKnowNew] payNew payType.paytype=" + payType.paytype);
|
||||
SDKAPI.getIns().payNew(payData, payType, mPay);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ namespace tysdk
|
||||
{
|
||||
"Rustore" => "rustore.global.app",
|
||||
"Flexion" => "flexion.global.app",
|
||||
"EnjoyPay" => "enjoypay.global.h5.web",
|
||||
_ => "googleiab.global.app"
|
||||
};
|
||||
|
||||
|
||||
@@ -59,6 +59,7 @@ namespace tysdk
|
||||
#elif UNITY_ANDROID
|
||||
|
||||
var pType = ChannelConfig.PayType;
|
||||
Debug.Log($"[TYSdkFacade::Pay] Channel={ChannelConfig.Channel}, PayType={pType}, prodId={prodId}, price={prodPrice}, orderId={orderId}");
|
||||
var task = TYSDKCallbackManager.Instance.RegisterCallback<PaymentInfo>(TimeSpan.FromSeconds(90));
|
||||
try
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user