This commit is contained in:
2025-12-12 16:09:14 +08:00
parent 2b08dd44ee
commit 437f796a08
6 changed files with 12 additions and 7 deletions

View File

@@ -73,6 +73,9 @@ typedef NS_ENUM(NSInteger, KBBizCode) {
/// 操作失败OPERATION_ERROR(50001, "操作失败")
KBBizCodeOperationError = 50001,
/// 特定收据无效
KBBizCodeReceiptError = 50016,
};
NS_ASSUME_NONNULL_BEGIN

View File

@@ -65,7 +65,7 @@
<EnvironmentVariable
key = "OS_ACTIVITY_MODE"
value = "disable"
isEnabled = "NO">
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>
</LaunchAction>

View File

@@ -458,7 +458,7 @@ autoShowBusinessError:YES
NSLocalizedDescriptionKey : msg,
@"code" : @(bizCode)
}];
// if (completion) completion(dict, response, bizErr);
if (completion) completion(dict, response, bizErr);
return;
}
// code

View File

@@ -36,7 +36,6 @@
#else
type = 1;
#endif
// , @"type": @(type)
NSDictionary *params = @{ @"receipt": receipt ?: @""};
__weak typeof(self) weakSelf = self;
@@ -47,7 +46,9 @@
[[SKPaymentQueue defaultQueue] finishTransaction:transaction];
[KBHUD showSuccess:@"Success"];
if (handler) handler(KBLocalized(@"Success"), nil);
} else {
}else if(sta == KBBizCodeReceiptError){
[[SKPaymentQueue defaultQueue] finishTransaction:transaction];
}else {
[KBHUD showError:@"Failed"];
if (handler) handler(KBLocalized(@"Failed"), nil);
}

View File

@@ -16,11 +16,11 @@
completion:(KBPayCompletion)completion {
if (needShow) { [KBHUD show]; }
[[KBNetworkManager shared] POST:API_VALIDATE_RECEIPT jsonBody:params headers:nil completion:^(NSDictionary * _Nullable json, NSURLResponse * _Nullable response, NSError * _Nullable error) {
[[KBNetworkManager shared] POST:API_VALIDATE_RECEIPT jsonBody:params headers:nil autoShowBusinessError:false completion:^(NSDictionary * _Nullable json, NSURLResponse * _Nullable response, NSError * _Nullable error) {
if (needShow) { [KBHUD dismiss]; }
if (error) {
// if (completion) completion(ERROR_CODE, error.localizedDescription ?: KBLocalized(@"Network error"));
if (completion) completion(ERROR_CODE, error.localizedDescription ?: KBLocalized(@"Network error"));
return;
}

View File

@@ -54,7 +54,8 @@
#if DEBUG
#define KBLOG(fmt, ...) do { \
NSString *kb_msg__ = [NSString stringWithFormat:(fmt), ##__VA_ARGS__]; \
NSLog(@"\n==============================[KB DEBUG]==============================\n[Function] %s\n[Line] %d\n%@\n=====================================================================\n", __PRETTY_FUNCTION__, __LINE__, kb_msg__); \
NSString *kb_full_msg__ = [NSString stringWithFormat:@"\n==============================[KB DEBUG]==============================\n[Function] %s\n[Line] %d\n%@\n=====================================================================\n", __PRETTY_FUNCTION__, __LINE__, kb_msg__]; \
fprintf(stderr, "%s", kb_full_msg__.UTF8String); \
} while(0)
#else
#define KBLOG(...)