34 lines
870 B
C
34 lines
870 B
C
|
|
//
|
|||
|
|
// PayVM.h
|
|||
|
|
// 支付相关 VM:封装 Apple IAP 验签请求
|
|||
|
|
//
|
|||
|
|
|
|||
|
|
#import <Foundation/Foundation.h>
|
|||
|
|
|
|||
|
|
NS_ASSUME_NONNULL_BEGIN
|
|||
|
|
|
|||
|
|
/// 统一的支付回调:sta 为状态码(0 成功,非 0 失败),msg 为后端返回的消息
|
|||
|
|
typedef void(^KBPayCompletion)(NSInteger sta, NSString * _Nullable msg);
|
|||
|
|
|
|||
|
|
/// 统一状态码(与原 Swift 代码的 succCode / errorCode 语义一致)
|
|||
|
|
#ifndef KB_PAY_SUCC_CODE
|
|||
|
|
#define KB_PAY_SUCC_CODE 0
|
|||
|
|
#endif
|
|||
|
|
#ifndef KB_PAY_ERROR_CODE
|
|||
|
|
#define KB_PAY_ERROR_CODE 1
|
|||
|
|
#endif
|
|||
|
|
|
|||
|
|
@interface PayVM : NSObject
|
|||
|
|
|
|||
|
|
/// Apple 内购验签
|
|||
|
|
/// params 形如:@{ @"payment": @{ @"receipt": receipt, @"type": @(type) } }
|
|||
|
|
/// needShow:是否显示加载 HUD
|
|||
|
|
- (void)applePayReqWithParams:(NSDictionary *)params
|
|||
|
|
needShow:(BOOL)needShow
|
|||
|
|
completion:(KBPayCompletion)completion;
|
|||
|
|
|
|||
|
|
@end
|
|||
|
|
|
|||
|
|
NS_ASSUME_NONNULL_END
|
|||
|
|
|