//
//  KDIAPManager.h
//  KDChat
//
//  Created by JYJ on 2019/6/14.
//  Copyright © 2019 dcjf. All rights reserved.
//

#import <Foundation/Foundation.h>


#define ProductID_IAPp12  @"12yuanqian"
#define ProductID_IAPp50 @"50yuan"
#define ProductID_IAPp15  @"15day"
#define ProductID_IAPp30  @"30day"
#define ProductID_IAPp90  @"90day"
#define ProductID_IAPp365  @"365day"

NS_ASSUME_NONNULL_BEGIN


typedef NS_ENUM(NSUInteger,IAPResultType) {
    IAPResultSuccess = 0,       // 购买成功
    IAPResultFailed = 1,        // 购买失败
    IAPResultCancle = 2,        // 取消购买
    IAPResultVerFailed = 3,     // 订单校验失败
    IAPResultVerSuccess = 4,    // 订单校验成功
    IAPResultNotArrow = 5,      // 不允许内购
    IAPResultIDError = 6,       // 项目ID错误
};



typedef void(^IAPCompletionHandle)(IAPResultType type, NSData *data);

@interface KDIAPManager : NSObject

+ (instancetype)shareIAPManager;

/** 检测客户端与服务器漏单情况处理*/
+ (void)checkOrderStatus;

/**
 开启内购
 
 @param productID 内购项目的产品ID
 @param handle 内购的结果回调
 */
- (void)startIAPWithOrderId:(NSString *)orderId productID:(NSString *)productID completeHandle: (IAPCompletionHandle)handle;

@end

NS_ASSUME_NONNULL_END