feat: 增加flutter_keychain来缓存订单号
This commit is contained in:
@@ -2,12 +2,14 @@
|
||||
abstract class Api {
|
||||
/// 游客登录查看是否已经注册
|
||||
static const String kr_isRegister = "/v1/auth/check";
|
||||
|
||||
/// 判断邮箱和当前设备是否已存在订阅
|
||||
static const String kr_checkSubscription = "/v1/public/user/subscribe_status";
|
||||
|
||||
/// 注册
|
||||
// static const String kr_register = "/v1/auth/register";
|
||||
static const String kr_register = "/v1/public/user/bind_email_with_verification";
|
||||
static const String kr_register =
|
||||
"/v1/public/user/bind_email_with_verification";
|
||||
|
||||
/// 验证验证码
|
||||
static const String kr_checkVerificationCode = "/v1/auth/check-code";
|
||||
@@ -56,12 +58,10 @@ abstract class Api {
|
||||
static const String kr_getPackageList = "/v1/public/subscribe/list";
|
||||
|
||||
/// 获取用户已订阅套餐(用于判断是否购买过)
|
||||
static const String kr_getAlreadySubscribe =
|
||||
"/v1/public/user/subscribe";
|
||||
static const String kr_getAlreadySubscribe = "/v1/public/user/subscribe";
|
||||
|
||||
/// 获取用户可用订阅(与已订阅接口相同,OmnOem 项目中没有区分)
|
||||
static const String kr_userAvailableSubscribe =
|
||||
"/v1/public/user/subscribe";
|
||||
static const String kr_userAvailableSubscribe = "/v1/public/user/subscribe";
|
||||
|
||||
/// 续费
|
||||
static const String kr_renewal = "/v1/public/order/renewal";
|
||||
@@ -111,12 +111,13 @@ abstract class Api {
|
||||
/// 获取可用支付方式(公开接口)
|
||||
static const String kr_getPublicPaymentMethods = "/v1/public/payment/methods";
|
||||
|
||||
static const String kr_attachAppleIapTransaction = "/v1/public/iap/apple/transactions/attach_by_id";
|
||||
static const String kr_attachAppleIapTransaction =
|
||||
"/v1/public/iap/apple/transactions/attach_by_id";
|
||||
static const String kr_restoreAppleIap = "/v1/public/iap/apple/restore";
|
||||
|
||||
/// 获取用户信息(用于获取邀请码等)
|
||||
static const String kr_getUserInfo = "/v1/public/user/info";
|
||||
|
||||
/// 保存邀请码
|
||||
static const String hi_invite_code = "/v1/public/user/bind_invite_code";
|
||||
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ class KRSubscribeApi {
|
||||
data['order_no'] = orderNo;
|
||||
|
||||
BaseResponse<KROrderStatus> baseResponse =
|
||||
await HttpUtil.getInstance().request<KROrderStatus>(
|
||||
await HttpUtil.getInstance().request<KROrderStatus>(
|
||||
Api.kr_queryOrderStatus,
|
||||
data,
|
||||
method: HttpMethod.GET,
|
||||
@@ -271,7 +271,8 @@ class KRSubscribeApi {
|
||||
}
|
||||
|
||||
/// 获取支付地址,跳转到付款地址(新版本:支持多种支付类型)
|
||||
Future<Either<HttpError, KRCheckoutResponse>> kr_checkout(String orderId) async {
|
||||
Future<Either<HttpError, KRCheckoutResponse>> kr_checkout(
|
||||
String orderId) async {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['orderNo'] = orderId;
|
||||
data['returnUrl'] = AppConfig.getInstance().baseUrl;
|
||||
@@ -330,7 +331,8 @@ class KRSubscribeApi {
|
||||
return right(baseResponse.model);
|
||||
}
|
||||
|
||||
Future<Either<HttpError, bool>> kr_attachAppleIapTransaction(String transactionId, String orderNo) async {
|
||||
Future<Either<HttpError, bool>> kr_attachAppleIapTransaction(
|
||||
String transactionId, String orderNo) async {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['transaction_id'] = transactionId;
|
||||
data['order_no'] = orderNo;
|
||||
@@ -340,10 +342,32 @@ class KRSubscribeApi {
|
||||
Api.kr_attachAppleIapTransaction,
|
||||
data,
|
||||
method: HttpMethod.POST,
|
||||
isShowLoading: true,
|
||||
isShowLoading: false,
|
||||
);
|
||||
if (!baseResponse.isSuccess) {
|
||||
return left(HttpError(msg: baseResponse.retMsg, code: baseResponse.retCode));
|
||||
return left(
|
||||
HttpError(msg: baseResponse.retMsg, code: baseResponse.retCode));
|
||||
}
|
||||
|
||||
return right(baseResponse.model.kr_bl);
|
||||
}
|
||||
|
||||
Future<Either<HttpError, bool>> kr_restoreAppleIapTransaction(
|
||||
String transactionId, String orderNo) async {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['transaction_id'] = [transactionId];
|
||||
data['order_no'] = orderNo;
|
||||
|
||||
BaseResponse<KRStatus> baseResponse =
|
||||
await HttpUtil.getInstance().request<KRStatus>(
|
||||
Api.kr_restoreAppleIap,
|
||||
data,
|
||||
method: HttpMethod.POST,
|
||||
isShowLoading: false,
|
||||
);
|
||||
if (!baseResponse.isSuccess) {
|
||||
return left(
|
||||
HttpError(msg: baseResponse.retMsg, code: baseResponse.retCode));
|
||||
}
|
||||
|
||||
return right(baseResponse.model.kr_bl);
|
||||
|
||||
Reference in New Issue
Block a user