Files
keyboard/keyBoard/Class/Pay/VM/PayVM.h
2025-12-12 14:54:45 +08:00

40 lines
1.3 KiB
Objective-C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// PayVM.h
// 支付相关 VM封装 Apple IAP 验签请求
//
#import <Foundation/Foundation.h>
@class KBPayProductModel;
NS_ASSUME_NONNULL_BEGIN
/// 统一的支付回调sta 为状态码0 成功,非 0 失败msg 为后端返回的消息
typedef void(^KBPayCompletion)(NSInteger sta, NSString * _Nullable msg);
/// In-App 商品列表回调(返回 data 数组)
typedef void(^KBPayProductsCompletion)(NSInteger sta,
NSString * _Nullable msg,
NSArray<KBPayProductModel *> * _Nullable products);
@interface PayVM : NSObject
/// Apple 内购验签
/// params 形如:@{ @"payment": @{ @"receipt": receipt, @"type": @(type) } }
/// needShow是否显示加载 HUD
- (void)applePayReqWithParams:(NSDictionary *)params
needShow:(BOOL)needShow
completion:(KBPayCompletion)completion;
/// 查询 type=in-app-purchase 的商品列表
- (void)fetchInAppProductsNeedShow:(BOOL)needShow
completion:(KBPayProductsCompletion)completion;
/// 查询订阅商品列表
- (void)fetchSubscriptionProductsNeedShow:(BOOL)needShow
completion:(KBPayProductsCompletion)completion;
@end
NS_ASSUME_NONNULL_END