refactor: 支付链路规范化 — 统一命名/层次/传参

- ISDKHelper.pay() 增加 productPrice 参数,与 UnityKnowNew 签名对齐
- FlexionSDKHelper: prodPrice/prodCount 从参数直接写入 developerPayload
- playerId → userId 统一命名 (SDKTest/Java payload)
- pfId → pfid 统一小写 (服务端 JSON key)
- PaymentInfo 序列化替代 StringBuilder 手拼 JSON
- FlexionPaymentVerifier.Consume 走 UnityBridgeFunc.ConsumePurchase 桥接层
- UnityBridgeFunc 新增 ConsumePurchase 通用方法,移除渠道特定方法
- SDKManager.ConsumeFlexionPurchase → ConsumePurchase 通用化

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-11 15:24:39 +08:00
parent 8de35fa97d
commit f9b5413a81
6 changed files with 30 additions and 35 deletions

View File

@@ -88,8 +88,9 @@ public class FlexionSDKHelper implements SDKManager.ISDKHelper {
}
@Override
public void pay(Activity activity, String productId, String productName,
String productCount, String prodorderId, String appInfo) {
public void pay(Activity activity, String productId, String productPrice,
String productName, String productCount, String prodorderId,
String appInfo) {
Log.i(TAG, "[PAY-FLOW] pay called: productId=" + productId + " billingReady=" + billingConnected);
if (billingService == null || !billingConnected) {
Log.e(TAG, "[PAY-FLOW] billing not ready");
@@ -101,11 +102,14 @@ public class FlexionSDKHelper implements SDKManager.ISDKHelper {
byte[] decoded = Base64.getDecoder().decode(appInfo);
JSONObject json = new JSONObject(new String(decoded, "UTF-8"));
JSONObject payload = new JSONObject();
payload.put("playerId", json.optString("playerId", ""));
payload.put("userId", json.optString("userId", ""));
payload.put("pfid", json.optString("pfid", ""));
payload.put("customData", json.optString("customData", ""));
payload.put("prodPrice", productPrice);
payload.put("prodCount", productCount);
developerPayload = payload.toString();
} catch (Exception e) {
Log.w(TAG, "Failed to extract playerId/customData from appInfo: " + e.getMessage());
Log.w(TAG, "Failed to extract payload fields from appInfo: " + e.getMessage());
}
String finalPayload = developerPayload;
activity.runOnUiThread(() -> {