This commit is contained in:
2025-12-16 14:14:49 +08:00
parent 1651258eec
commit f10ddd9a31
3 changed files with 43 additions and 42 deletions

View File

@@ -46,6 +46,29 @@ NSNotificationName const KBIAPDidCompletePurchaseNotification = @"KBIAPDidComple
}];
}
- (void)verifySignedPayload:(NSString *)payload
completion:(void (^)(BOOL success, NSString * _Nullable message, NSInteger statusCode))completion {
if (![payload isKindOfClass:NSString.class] || payload.length == 0) {
if (completion) {
completion(NO, KBLocalized(@"Payload missing"), KBBizCodeReceiptError);
}
return;
}
NSDictionary *params = @{ @"signedPayload": payload ?: @"" };
__weak typeof(self) weakSelf = self;
[self.payVM applePayReqWithParams:params needShow:NO completion:^(NSInteger sta, NSString * _Nullable msg) {
dispatch_async(dispatch_get_main_queue(), ^{
__strong typeof(weakSelf) self = weakSelf;
(void)self;
BOOL success = (sta == KBBizCodeSuccess);
NSString *tip = msg ?: (success ? KBLocalized(@"Success") : KBLocalized(@"Payment failed"));
if (completion) {
completion(success, tip, sta);
}
});
}];
}
#pragma mark - FGIAPVerifyTransaction
- (void)pushSuccessTradeReultToServer:(NSString *)receipt