using ProtoCSStruct; using Sog; using Sog.Crypto; namespace HttpProxyPay { public class GooglePaySvc { public static void OnCltPayGoogleSuccReq(uint remoteAppID, ref SSPayGoogleSuccessReq req) { bool ret = CheckGooglePay(req.PurchaseData.ToString(), req.Signature.ToString()); if (ret == false) { TraceLog.Error("GooglePaySvc.OnCltPayGoogleSuccReq uid {0} purchase data check failed"); SSPayGoogleSuccessRes res = new SSPayGoogleSuccessRes {Ret = -1, Uid = req.Uid}; HttpProxyPayServerUtils.GetPacketSender().SendToServerByID(remoteAppID, (int)SSGameMsgID.PayGoogleSuccessRes, ref res, req.Uid); return; } // todo 最好根据google最新接口去google服务器校验一下订单信息 } public static bool CheckGooglePay(string purchaseData, string signature) { string publicKeyBase64 = HttpProxyPayServerUtils.GetServerConfig().googlePayPublicKey; return GooglePaySecurity.CheckSignatureCS(purchaseData, signature, publicKeyBase64); } } }