update:enjoy-pay 接入

This commit is contained in:
2026-06-03 17:33:34 +08:00
parent ea03c8023f
commit 3da65b8cbd
17 changed files with 704 additions and 61 deletions

View File

@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.arkgame.ft.ep"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<application android:extractNativeLibs="true" android:name="com.unity3d.player.TYApp" android:usesCleartextTraffic="true">
<activity android:name="com.unity3d.player.TYUnityActivity"
android:theme="@style/UnityThemeSelector">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" android:host="fishingtraveliae.onelink.me" android:pathPrefix="/jT1Q"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:host="mainactivity" android:scheme="zzft" />
</intent-filter>
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
<meta-data android:name="google_analytics_default_allow_analytics_storage" android:value="true" />
<meta-data android:name="google_analytics_default_allow_ad_storage" android:value="true" />
<meta-data android:name="google_analytics_default_allow_ad_user_data" android:value="true" />
<meta-data android:name="google_analytics_default_allow_ad_personalization_signals" android:value="true" />
</activity>
<meta-data android:name="CHANNEL" android:value="EnjoyPay" />
</application>
<queries>
<provider android:authorities="com.facebook.katana.provider.PlatformProvider" />
<provider android:authorities="com.facebook.orca.provider.PlatformProvider" />
<intent>
<action android:name="android.intent.action.MAIN"/>
</intent>
</queries>
</manifest>

View File

@@ -0,0 +1,13 @@
package com.unity3d.player;
public class ChannelEntry {
public static final String CHANNEL = "EnjoyPay";
public static SDKManager.IChannelSDKAdapter createSDKAdapter() {
return null;
}
public static String normalizeSkuList(String msg) {
return msg;
}
}

View File

@@ -0,0 +1,26 @@
package com.unity3d.player;
public class ConfigManager {
// Common SDK parameters
public static int SDK_APPID = 20587;
public static String SDK_GAMEID = "20587";
public static String SDK_PROJECTID = "20587";
public static String SDK_CLOUDID = "128";
public static String SDK_CLIENTID = "Android_5.00_tyGuest,facebook.googleplay.0-hall20587.googleplay.FishingMasterRussia";
public static String SDK_LOGIN_SERVER_URL = "https://128-hwsfsdk-sdk-online01.qijihdhk.com";
// FCM (anti-addiction system)
public static String FCM_NAMESPACE = "128";
public static String FCM_IAM_HOST = "tcp://fcmtcp.tuyoo.com:3563";
public static String FCM_ANTISERVERURL = "https://fcmapi.tuyoo.com";
// Unity Facade callback names
public static final String UNITY_FACADE_NAME = "TYSdkFacade";
public static final String LOGIN_CALLBACK_FUNCTION_NAME = "LoginResult";
public static final String LINKACCOUT_CALLBACK_FUNCTION_NAME = "LinkAccoutResult";
public static final String CHANGELINK_CALLBACK_FUNCTION_NAME = "ChangeLinkAccountResult";
public static final String CHECKLINK_CALLBACK_FUNCTION_NAME = "CheckLinkResult";
public static final String PAY_CALLBACK_FUNCTION_NAME = "PayResult";
public static final String PAY_TYPE_CALLBACK_FUNCTION_NAME = "SKUListResult";
public static final String FCM_NOTICE_FUNCTION_NAME = "FCMCallback";
public static final String FCM_REALNAME_CALLBACK_FUNCTION_NAME = "RealNameCallback";
public static final String INIT_CALLBACK_FUNCTION_NAME = "InitResult";
}

View File

@@ -0,0 +1,29 @@
{
"project_info": {
"project_number": "404468630883",
"project_id": "fishing-travel-ep-1ab1e",
"storage_bucket": "fishing-travel-ep-1ab1e.firebasestorage.app"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:404468630883:android:de3cb115158a5e4cdfff56",
"android_client_info": {
"package_name": "com.arkgame.ft.ep"
}
},
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyAL8YVO4U6A9WRiQ581Et0o-BmtMf3k7Hg"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": []
}
}
}
],
"configuration_version": "1"
}

View File

@@ -0,0 +1,11 @@
org.gradle.jvmargs=-Xmx**JVM_HEAP_SIZE**M
org.gradle.parallel=true
unityStreamingAssets=**STREAMING_ASSETS**
# Android Resolver Properties Start
android.useAndroidX=true
android.enableJetifier=true
# Android Resolver Properties End
android.suppressUnsupportedCompileSdk=35
**ADDITIONAL_PROPERTIES**

View File

@@ -0,0 +1,65 @@
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
dependencies {
implementation project(':unityLibrary')
implementation(platform("com.google.firebase:firebase-bom:33.6.0"))
implementation("com.google.firebase:firebase-analytics")
}
android {
namespace "**NAMESPACE**"
ndkPath "**NDKPATH**"
compileSdkVersion **APIVERSION**
buildToolsVersion '**BUILDTOOLS**'
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
defaultConfig {
minSdkVersion **MINSDKVERSION**
targetSdkVersion **TARGETSDKVERSION**
applicationId '**APPLICATIONID**'
ndk {
abiFilters **ABIFILTERS**
}
versionCode **VERSIONCODE**
versionName '**VERSIONNAME**'
}
aaptOptions {
noCompress = **BUILTIN_NOCOMPRESS** + unityStreamingAssets.tokenize(', ')
ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:!CVS:!thumbs.db:!picasa.ini:!*~"
}**SIGN**
lintOptions {
abortOnError false
}
buildTypes {
debug {
minifyEnabled **MINIFY_DEBUG**
proguardFiles getDefaultProguardFile('proguard-android.txt')**SIGNCONFIG**
jniDebuggable true
}
release {
minifyEnabled **MINIFY_RELEASE**
proguardFiles getDefaultProguardFile('proguard-android.txt')**SIGNCONFIG**
}
}**PACKAGING_OPTIONS****PLAY_ASSET_PACKS****SPLITS**
**BUILT_APK_LOCATION**
bundle {
language {
enableSplit = false
}
density {
enableSplit = false
}
abi {
enableSplit = true
}
}
}**SPLITS_VERSION_CODE****LAUNCHER_SOURCE_BUILD_SETUP**

View File

@@ -0,0 +1,112 @@
apply plugin: 'com.android.library'
**APPLY_PLUGINS**
// Android Resolver Exclusions Start
android {
packagingOptions {
exclude ('/lib/armeabi/*' + '*')
exclude ('/lib/mips/*' + '*')
exclude ('/lib/mips64/*' + '*')
exclude ('/lib/x86/*' + '*')
exclude ('/lib/x86_64/*' + '*')
}
}
// Android Resolver Exclusions End
android {
namespace "com.unity3d.player"
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
api "com.android.support:support-v4:28.0.0"
api "com.android.support:appcompat-v7:28.0.0"
api "com.google.code.gson:gson:2.8.6"
api "com.squareup.okio:okio:1.15.0"
api "com.squareup.okhttp3:okhttp:3.12.13"
api "com.squareup.retrofit2:retrofit:2.3.0"
api "com.squareup.retrofit2:converter-gson:2.2.0"
api "com.squareup.retrofit2:adapter-rxjava:2.1.0"
api "io.reactivex:rxandroid:1.2.1"
api "io.reactivex:rxjava:1.1.9"
// Google Play In-App Review
implementation 'com.google.android.play:review:2.0.1'
implementation 'net.aihelp:android-aihelp-aar:5.3.+'
implementation 'com.google.android.gms:play-services-auth:20.2.0'
implementation('com.android.billingclient:billing:7.0.0')
implementation 'com.google.android.gms:play-services-basement:18.2.0'
implementation 'androidx.fragment:fragment:1.3.6'
implementation "org.jetbrains.kotlin:kotlin-reflect:1.3.41"
implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.3.41'
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.41'
implementation 'org.jetbrains.kotlin:kotlin-android-extensions-runtime:1.3.41'
implementation 'androidx.core:core:1.8.0'
implementation 'com.miui.referrer:homereferrer:1.0.0.6'
implementation platform('com.google.firebase:firebase-bom:34.6.0')
implementation 'com.google.firebase:firebase-analytics'
implementation('com.facebook.android:facebook-android-sdk:16.2.0')
implementation 'com.google.android.play:asset-delivery:2.2.2'
implementation "androidx.credentials:credentials:1.3.0"
implementation "androidx.credentials:credentials-play-services-auth:1.3.0"
implementation "com.google.android.libraries.identity.googleid:googleid:1.1.1"
// EnjoyPay SDK dependency goes here after the official Maven/AAR coordinates are confirmed.
// Android Resolver Dependencies Start
implementation 'com.android.installreferrer:installreferrer:2.1' // Assets/AppsFlyer/Editor/AppsFlyerDependencies.xml:7
implementation 'com.applovin.mediation:facebook-adapter:[6.18.0.1]' // Assets/MaxSdk/Mediation/Facebook/Editor/Dependencies.xml:8
implementation 'com.applovin.mediation:fyber-adapter:8.4.2.0' // Assets/MaxSdk/Mediation/Fyber/Editor/Dependencies.xml:4
implementation 'com.applovin.mediation:google-adapter:[23.6.0.1]' // Assets/MaxSdk/Mediation/Google/Editor/Dependencies.xml:5
implementation 'com.applovin.mediation:ironsource-adapter:8.6.1.0.0' // Assets/MaxSdk/Mediation/IronSource/Editor/Dependencies.xml:8
implementation 'com.applovin.mediation:unityads-adapter:4.12.3.0' // Assets/MaxSdk/Mediation/UnityAds/Editor/Dependencies.xml:4
implementation 'com.applovin.mediation:vungle-adapter:7.4.2.2' // Assets/MaxSdk/Mediation/Vungle/Editor/Dependencies.xml:4
implementation 'com.applovin:applovin-sdk:13.5.1' // Assets/MaxSdk/AppLovin/Editor/Dependencies.xml:4
implementation 'com.appsflyer:af-android-sdk:6.17.3' // Assets/AppsFlyer/Editor/AppsFlyerDependencies.xml:5
implementation 'com.appsflyer:purchase-connector:2.2.0' // Assets/AppsFlyer/Editor/AppsFlyerDependencies.xml:8
implementation 'com.appsflyer:unity-wrapper:6.17.7' // Assets/AppsFlyer/Editor/Dependencies.xml:6
implementation 'com.google.android.ump:user-messaging-platform:2.1.0' // Assets/MaxSdk/AppLovin/Editor/Dependencies.xml:5
// Android Resolver Dependencies End
**DEPS**}
android {
ndkPath "**NDKPATH**"
compileSdkVersion **APIVERSION**
buildToolsVersion '**BUILDTOOLS**'
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
defaultConfig {
minSdkVersion **MINSDKVERSION**
targetSdkVersion **TARGETSDKVERSION**
ndk {
abiFilters **ABIFILTERS**
}
versionCode **VERSIONCODE**
versionName '**VERSIONNAME**'
consumerProguardFiles 'proguard-unity.txt'**USER_PROGUARD**
}
lintOptions {
abortOnError false
}
aaptOptions {
noCompress = **BUILTIN_NOCOMPRESS** + unityStreamingAssets.tokenize(', ')
ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:!CVS:!thumbs.db:!picasa.ini:!*~"
}**PACKAGING_OPTIONS**
}
**IL_CPP_BUILD_SETUP**
**SOURCE_BUILD_SETUP**
**EXTERNAL_SOURCES**

View File

@@ -0,0 +1,35 @@
pluginManagement {
repositories {
**ARTIFACTORYREPOSITORY**
gradlePluginPortal()
google()
mavenCentral()
}
}
include ':launcher', ':unityLibrary'
**INCLUDES**
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
repositories {
**ARTIFACTORYREPOSITORY**
google()
mavenCentral()
// Android Resolver Repos Start
def unityProjectPath = $/file:///**DIR_UNITYPROJECT**/$.replace("\\", "/")
maven {
url "https://android-sdk.is.com/" // Assets/MaxSdk/Mediation/IronSource/Dependencies.xml:8
}
mavenLocal()
// Android Resolver Repos End
flatDir {
dirs "${project(':unityLibrary').projectDir}/libs"
}
maven {
url "http://sdkck.tuyoo.com/artifactory/tuyoo-component/"
allowInsecureProtocol = true
}
}
}

View File

@@ -1,43 +0,0 @@
#!/bin/bash
# Usage: ./switch-channel.sh <channel>
# channel: googleplay | flexion | rustore
#
# 切换渠道后重新用 Unity 打 Android 包即可打出对应渠道的 APK。
# 脚本会同步AAR、Gradle 配置、AndroidManifest、Java 文件ConfigManager、ChannelHelpers 等)
CHANNEL=${1:-googleplay}
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
CHANNEL_DIR="$SCRIPT_DIR/$CHANNEL"
PROJ_DIR="$SCRIPT_DIR/../../sdk-intergration"
TYSDK_PLUGINS="$PROJ_DIR/Packages/tysdk/Plugins/Android"
ASSETS_PLUGINS="$PROJ_DIR/Assets/Plugins/Android"
# 校验渠道目录
if [ ! -d "$CHANNEL_DIR" ]; then
echo "ERROR: Unknown channel '$CHANNEL'. Available: googleplay, flexion, rustore"
exit 1
fi
echo "=== Switching to channel: $CHANNEL ==="
# 1. Sync channel AAR to tysdk package (only tuyoosdk, gasdk stays permanently)
echo "[AAR] Syncing tuyoosdk to $TYSDK_PLUGINS"
find "$TYSDK_PLUGINS" -maxdepth 1 -name "tuyoosdk_*.aar" -delete
cp "$CHANNEL_DIR/Plugins/Android/"*.aar "$TYSDK_PLUGINS/" 2>/dev/null
# 2. Sync Gradle + Manifest to Assets/Plugins/Android
echo "[Config] Syncing gradle/manifest to $ASSETS_PLUGINS"
for f in "$CHANNEL_DIR"/*.gradle "$CHANNEL_DIR"/*.properties "$CHANNEL_DIR"/AndroidManifest.xml; do
[ -f "$f" ] && cp "$f" "$ASSETS_PLUGINS/"
done
# 3. Sync Java files to tysdk package
echo "[Java] Syncing ConfigManager + ChannelHelpers to $TYSDK_PLUGINS"
for f in "$CHANNEL_DIR"/*.java; do
[ -f "$f" ] && cp "$f" "$TYSDK_PLUGINS/"
done
echo "=== Done. Channel: $CHANNEL ==="
echo ""
echo "Next: Open Unity and build Android APK."

View File

@@ -0,0 +1,144 @@
# EnjoyPay 本次接入改动记录
## 本次目标
为 Android 测试工程增加 EnjoyPay 渠道切换与打包配置,使 Unity 菜单可以切换到 EnjoyPay 并使用俄罗斯包参数进行打包测试。
## 参数来源
- wiki MCP 文档:
- `https://wiki.bamboogames.top/doc/5oqa5pyv5rkf6yca-dF8FesCMt3`
- `https://wiki.bamboogames.top/doc/sdk-PiMyYd30k5`
- PDF 参数文档:
- `D:/.devup/【128-FishingTravel】【Google俄罗斯】接入支持.pdf`
- Firebase 配置:
- `D:/.devup/google-services (1).json`
- `D:/.devup/google-services (2).json`
两份 `google-services` 文件经 `fc` 对比完全一致,已使用其中一份作为 EnjoyPay 渠道配置。
## 已确认参数
- 渠道名:`EnjoyPay`
- Android 包名:`com.arkgame.ft.ep`
- 客户端支付类型:`enjoypay.global.h5.web`
- clientId`Android_5.00_tyGuest,facebook.googleplay.0-hall20587.googleplay.FishingMasterRussia`
- Firebase project id`fishing-travel-ep-1ab1e`
- Firebase package name`com.arkgame.ft.ep`
## 代码改动
### 1. 增加 EnjoyPay 切渠道入口
文件:
- `sdk-intergration/Assets/Editor/ChannelBuildTool.cs`
改动:
- `SupportedChannels` 增加 `EnjoyPay`
- 增加菜单 `Tools/Switch Channel/EnjoyPay`
- 增加菜单 `Tools/Build Android (Channel)/EnjoyPay`
- 增加菜单 `Tools/Build Android (Channel)/EnjoyPay Debug`
- `SwitchChannel("EnjoyPay")` 设置 Android bundle id 为 `com.arkgame.ft.ep`
### 2. 增加 EnjoyPay 支付类型映射
文件:
- `sdk-intergration/Packages/tysdk/Runtime/ChannelConfig.cs`
改动:
```csharp
"EnjoyPay" => "enjoypay.global.h5.web",
```
说明:
- 客户端传给 SDK 的 `paytype` 使用 `enjoypay.global.h5.web`
- PDF 中的 `enj` 是后台支付方式配置类型,不作为客户端 `paytype`
### 3. 增加 EnjoyPay 渠道配置目录
目录:
- `ExtraPluginCfgs/Android/enjoypay`
包含:
- `AndroidManifest.xml`
- `ChannelEntry.java`
- `ConfigManager.java`
- `launcherTemplate.gradle`
- `mainTemplate.gradle`
- `settingsTemplate.gradle`
- `gradleTemplate.properties`
- `Files/google-services.json`
- `Plugins/Android/tuyoosdk_1.0.0.aar`
关键配置:
- `AndroidManifest.xml`
- package`com.arkgame.ft.ep`
- `CHANNEL = EnjoyPay`
- `ChannelEntry.java`
- `CHANNEL = "EnjoyPay"`
- 不创建专用 adapter继续走默认 Tuyoo SDK 流程。
- `ConfigManager.java`
- `SDK_CLIENTID = "Android_5.00_tyGuest,facebook.googleplay.0-hall20587.googleplay.FishingMasterRussia"`
- `Files/google-services.json`
- 来自 `D:/.devup/google-services (1).json`
- package name`com.arkgame.ft.ep`
### 4. Firebase / Gradle 配置核对
Unity Gradle 模板对应关系:
- 项目级 Gradle
- `sdk-intergration/Assets/Plugins/Android/baseProjectTemplate.gradle`
- 当前已有 `com.google.gms.google-services` 插件版本声明。
- 应用模块 Gradle
- `ExtraPluginCfgs/Android/enjoypay/launcherTemplate.gradle`
- 当前已应用 `com.google.gms.google-services` 插件。
- UnityLibrary 模块 Gradle
- `ExtraPluginCfgs/Android/enjoypay/mainTemplate.gradle`
- 当前包含 Firebase Analytics 依赖。
## 未改动 / 延后项
- 当前测试工程不新增 EnjoyPay 商品列表逻辑。
- 正式项目接入时,再从正式项目本地 json table / 商品表构造 SKU。
- 当前不新增 EnjoyPay 专用 Billing adapter。
- 当前不复用 Flexion / RuStore 的 pending、consume、receipt 验签逻辑。
- 后台支付方式无需本次配置。
## 打包前检查
在 Unity 执行 `Tools/Switch Channel/EnjoyPay` 后,检查:
1. `sdk-intergration/Packages/tysdk/Plugins/Android/ChannelEntry.java`
- `CHANNEL = "EnjoyPay"`
2. `sdk-intergration/Packages/tysdk/Plugins/Android/ConfigManager.java`
- `SDK_CLIENTID` 为俄罗斯包 clientId。
3. `sdk-intergration/Assets/Plugins/Android/AndroidManifest.xml`
- package 为 `com.arkgame.ft.ep`
- `CHANNEL = EnjoyPay`
4. `sdk-intergration/Packages/tysdk/Files/google-services.json`
- package name 为 `com.arkgame.ft.ep`
5. `sdk-intergration/Packages/tysdk/Plugins/Android/tuyoosdk_1.0.0.aar`
- 应同步为 EnjoyPay 目录中的新版 AAR。
## 打包步骤
1. 打开 Unity 工程:`sdk-intergration`
2. 执行菜单:`Tools/Switch Channel/EnjoyPay`
3. 执行菜单:`Tools/Build Android (Channel)/EnjoyPay Debug`
4. 安装生成的 APK。
5. 验证初始化、登录、支付拉起和 SDK 回调。
## 已知注意点
- `google-services.json` 的 package name 是 `com.arkgame.ft.ep`,所以 EnjoyPay 包名必须与其一致。
- 已删除历史脚本 `ExtraPluginCfgs/Android/switch-channel.sh`,正式入口是 Unity 菜单中的 `ChannelBuildTool.SwitchChannel`
- 当前仓库内 `SDKTest.cs` 存在行尾状态提示;忽略行尾后无业务差异。

View File

@@ -0,0 +1,172 @@
# EnjoyPay Android 接入开发步骤
## 资料来源
- 主要依据:通过 `wiki` MCP 读取的文档
- `https://wiki.bamboogames.top/doc/5oqa5pyv5rkf6yca-dF8FesCMt3`
- `https://wiki.bamboogames.top/doc/sdk-PiMyYd30k5`
- 辅助参考:`D:/.devup/【Enjoypay三方支付】接入指引.pdf`
- 参数来源:`D:/.devup/【128-FishingTravel】【Google俄罗斯】接入支持.pdf`
## 参数读取规则
- EnjoyPay / Google 俄罗斯包相关参数统一从 `【128-FishingTravel】【Google俄罗斯】接入支持.pdf` 读取。
- 当前代码侧只写入打包和 SDK 初始化必需、且文档中已经明确给出的参数。
- PDF 中覆盖的参数范围包括:
- 基础信息包名、clientId、服务器地址等。
- EnjoyPayEnjoyPay 应用 AppId、商户号、AppSecret、计费点配置、发货通知地址、退款通知地址等。
- AppsFlyer`af_appid``devkey`
- Firebase`google-services.json`、Gradle / Firebase 依赖说明。
- AIHelpApp key、domain、Android platform 配置。
- 设备指纹businessId、secretId、secretKey。
- 广告变现:按平台申请对应参数。
## 已确认结论
- 渠道名:`EnjoyPay`
- Android 包名:`com.arkgame.ft.ep`
- 俄罗斯包 clientId`Android_5.00_tyGuest,facebook.googleplay.0-hall20587.googleplay.FishingMasterRussia`
- 客户端支付类型:`enjoypay.global.h5.web`
- 支付入口:复用现有 Tuyoo SDK `SDKAPI.payNew` 支付链路。
- SDK 依赖:需要替换为支持 EnjoyPay 的新版 Tuyoo AAR。
- 商品列表:当前测试工程不处理;接入正式项目时再从正式项目本地 json table / 表格数据构造 SKU。
- 服务端发货:复用现有 OrderFunc / `WaitForSvrOrder` / `ConfirmOrder` 流程。
- 不新增独立 EnjoyPay Billing adapter。
- 不复用 Flexion / RuStore 的 pending、consume、receipt 验签逻辑。
- 后台支付方式无需本次配置。
## 开发步骤
### 1. 在 ChannelBuildTool 中增加 EnjoyPay 渠道
文件:
- `sdk-intergration/Assets/Editor/ChannelBuildTool.cs`
改动:
- `SupportedChannels` 增加 `EnjoyPay`
- 增加菜单 `Tools/Switch Channel/EnjoyPay`
- 增加菜单 `Tools/Build Android (Channel)/EnjoyPay`
- 增加菜单 `Tools/Build Android (Channel)/EnjoyPay Debug`
- `SwitchChannel` 中为 `EnjoyPay` 设置 bundle id`com.arkgame.ft.ep`
- 已删除历史脚本 `ExtraPluginCfgs/Android/switch-channel.sh`;真实入口是 `ChannelBuildTool.SwitchChannel`
### 2. 增加 EnjoyPay 渠道配置目录
目录:
- `ExtraPluginCfgs/Android/enjoypay`
需要包含:
- `ChannelEntry.java`
- `ConfigManager.java`
- `AndroidManifest.xml`
- `mainTemplate.gradle`
- `launcherTemplate.gradle`
- `settingsTemplate.gradle`
- `gradleTemplate.properties`
- `Plugins/Android/<新版 Tuyoo AAR>`
- 可选:`Files/google-services.json`,仅在 EnjoyPay / Appsflyer / Firebase 需要独立配置时添加。
关键配置:
- `ChannelEntry.CHANNEL = "EnjoyPay"`
- Manifest package`com.arkgame.ft.ep`
- Manifest 渠道标识:`CHANNEL = EnjoyPay`
- `ConfigManager.SDK_CLIENTID` 使用参数文档中的俄罗斯包 clientId`Android_5.00_tyGuest,facebook.googleplay.0-hall20587.googleplay.FishingMasterRussia`
### 3. 配置 Unity 侧支付类型
文件:
- `sdk-intergration/Packages/tysdk/Runtime/ChannelConfig.cs`
增加映射:
```csharp
"EnjoyPay" => "enjoypay.global.h5.web",
```
说明:
- `enj` 是 SDK 后台“支付方式配置”使用的类型。
- `enj` 不是客户端传给 `SDKAPI.payNew``paytype`
### 4. Java 支付链路保持默认实现
文件:
- `sdk-intergration/Packages/tysdk/Plugins/Android/SDKManager.java`
预期行为:
- EnjoyPay 不新增专用 `IPaymentAdapter`
- `UnityKnowNew(...)` 走现有默认支付链路:
```java
SDKAPI.getIns().payNew(payData, payType, mPay);
```
其中 `payType.paytype` 由 Unity 传入,值为 `enjoypay.global.h5.web`
### 5. 商品列表接入延后到正式项目
当前测试工程:
- 不新增 EnjoyPay 商品列表逻辑。
- 不改 `SDKTest` 的商品列表测试流程。
正式项目接入时:
- EnjoyPay 不调用渠道商品列表查询接口。
- 客户端从正式项目本地 table / json 构造 SKU 列表。
- `productId``ourProductId` 使用同一个商品具体 ID。
- 如果 `TbIAPItemList.ProductId1` 就是 EnjoyPay 支付所需的商品具体 ID则直接使用 `ProductId1` 构造 SKU并复用现有 `SKUDetail.ProdID -> TYSdkFacade.Pay -> SDKAPI.payNew` 链路。
### 6. 替换新版 Tuyoo AAR
预期行为:
- 将支持 EnjoyPay 的新版 Tuyoo AAR 放入:
```text
ExtraPluginCfgs/Android/enjoypay/Plugins/Android/
```
- `ChannelBuildTool.SwitchChannel("EnjoyPay")` 会同步到:
```text
sdk-intergration/Packages/tysdk/Plugins/Android/
```
### 7. 后台与配置系统工作
这些工作在代码外完成:
- 配置 EnjoyPay AppId、商户号、AppSecret。
- 配置 EnjoyPay 计费点。
- 配置途游商品 ID 与 EnjoyPay 计费点 ID 映射。
- 确认 Appsflyer 是否需要与 RuStore 分开统计,以及是否需要独立 Appsflyer 配置。
## 验证清单
1. 在 Unity 执行 `Tools/Switch Channel/EnjoyPay`
2. 确认 `sdk-intergration/Packages/tysdk/Plugins/Android/ChannelEntry.java``CHANNEL = "EnjoyPay"`
3. 确认 Android bundle id 为 `com.arkgame.ft.ep`
4. 确认 `ChannelConfig.PayType` 在 EnjoyPay 渠道下返回 `enjoypay.global.h5.web`
5. 确认 `SDKManager.UnityKnowNew` 使用默认 `SDKAPI.payNew` 链路。
6. 确认 EnjoyPay 未启用 Flexion / RuStore 的 pending、consume、receipt 逻辑。
7. 构建 `Tools/Build Android (Channel)/EnjoyPay Debug`
8. 测试支付拉起与 SDK 回调。
9. 确认 OrderFunc 匹配和发货流程复用现有逻辑。
## 待确认项
- 新版 Tuyoo AAR 的具体文件名和版本。
- EnjoyPay / Google 俄罗斯包是否需要独立 `google-services.json`,以参数 PDF 中最新文件为准。
- 外链支付回跳是否需要新增 Android `scheme / host / path / intent-filter`
- 正式项目接入时的本地商品表字段映射。
- 是否必须展示 RUB 价格;如果需要,确认 RUB 金额来自哪张表、哪个字段。
- 参数 PDF 与 `google-services.json` 中的包名均为 `com.arkgame.ft.ep`;当前代码按 `com.arkgame.ft.ep` 执行。

View File

@@ -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);
}

View File

@@ -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;

View File

@@ -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);
}

View File

@@ -8,6 +8,7 @@ namespace tysdk
{
"Rustore" => "rustore.global.app",
"Flexion" => "flexion.global.app",
"EnjoyPay" => "enjoypay.global.h5.web",
_ => "googleiab.global.app"
};

View File

@@ -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
{