//
|
// WAPayProxy.h
|
// WASdkIntfUI
|
//
|
// Created by GHW-T-01 on 16/3/1.
|
// Copyright © 2016年 GHW-T-01. All rights reserved.
|
//
|
|
#import <Foundation/Foundation.h>
|
#import <WASdkIntf/WAIPay.h>
|
#import <WASdkIntf/WASubscriptionStatus.h>
|
@class WAIapProduct,WAIapResult,WAChannelProduct;
|
|
/*!
|
@discussion 查询商品库存协议
|
- - -
|
*/
|
@protocol WAInventoryDelegate <NSObject>
|
@required
|
/*!
|
@abstract 查询成功
|
@param Inventory 是一个数组,保存着WAIapProduct类型的实例
|
*/
|
-(void)queryInventoryDidCompleteWithResult:(NSArray<WAIapProduct *>*)Inventory;
|
/*!
|
@abstract 查询失败
|
@param error 错误
|
*/
|
-(void)queryInventoryDidFailWithError:(NSError*)error;
|
@end
|
/*!
|
@discussion 支付协议
|
- - -
|
*/
|
@protocol WAPaymentDelegate <NSObject>
|
/*!
|
@abstract 支付成功
|
@param iapResult 支付结果
|
@param platform 支付平台
|
*/
|
-(void)paymentDidCompleteWithResult:(WAIapResult*)iapResult andPlatform:(NSString*)platform;
|
/*!
|
@abstract 支付失败
|
@param error 错误
|
@param platform 支付平台
|
*/
|
-(void)paymentDidFailWithError:(NSError*)error andPlatform:(NSString*)platform;
|
@end
|
|
/*!
|
@discussion WAPayProxy 是支付模块的代理类。
|
- - -
|
*/
|
@interface WAPayProxy : NSObject
|
/*!
|
@abstract 应用内支付初始化
|
*/
|
+(void)init4Iap;
|
/*!
|
@abstract 查询商品列表调用方法
|
@param delegate 委托
|
*/
|
+(void)queryInventoryWithDelegate:(id<WAInventoryDelegate>)delegate;
|
|
/*!
|
@abstract 查询渠道商品调用方法
|
@param callBackBlock 回调
|
*/
|
+ (void)queryChannelProduct:(NSString *)channel
|
callBackBlock:(void(^)(NSArray <WAChannelProduct *>*channelProductsArray,NSError *error))callBackBlock;
|
|
|
/*!
|
@abstract 支付某个商品
|
@param productId 商品id
|
@param extInfo 扩展信息
|
@param delegate 委托
|
*/
|
+(void)payWithProductId:(NSString*)productId extInfo:(NSString*)extInfo delegate:(id<WAPaymentDelegate>)delegate;
|
|
/*!
|
@abstract 支付某个订阅商品(订阅总开关 isOpenSubscription 未开启、或商品非自动续订订阅商品时会回调失败)
|
@param subProductId 订阅商品id(WingSDK商品id)
|
@param extInfo 扩展信息
|
@param delegate 委托
|
*/
|
+(void)paySub:(NSString*)subProductId extInfo:(NSString*)extInfo delegate:(id<WAPaymentDelegate>)delegate;
|
/*!
|
@abstract 查询是否支持支付
|
@return bool 是否支持支付
|
*/
|
+(BOOL)isPayServiceAvailable;
|
|
+(void)payLog:(NSString *)logInfo;
|
|
+ (void)restore;
|
|
/// 恢复购买(收据刷新),完成后回调;成功 error 为 nil,失败为具体错误,主线程回调。开关与 restore 一致
|
+ (void)restoreWithCompletion:(void(^)(NSError * _Nullable error))completion;
|
|
/// 是否展示恢复购买入口:订阅总开关 isOpenSubscription 开启且后台配置 isOpenSubscriptionRestore 为 1 时展示。
|
+ (BOOL)isOpenRestore;
|
|
/*!
|
@abstract 查询当前用户订阅商品的最新状态(订阅总开关 isOpenSubscription 未开启时会回调失败)。
|
@param subProductId WingSDK 订阅商品 ID;传 nil 或空串时查询全部订阅。
|
@param callBackBlock 成功时返回订阅列表(无订阅时为空数组),失败时返回 error。
|
*/
|
+ (void)getSubStatus:(nullable NSString *)subProductId
|
callBackBlock:(void(^)(NSArray<WASubscriptionStatus *> *_Nullable statusList, NSError *_Nullable error))callBackBlock;
|
|
/*!
|
@abstract 判断指定订阅商品是否拥有推介促销价(免费试用/首期折扣)资格(订阅总开关 isOpenSubscription 未开启时会回调失败)。
|
@param subProductId WingSDK 订阅商品 ID。
|
@param completion 拥有资格返回 hasAccess 为 YES,否则为 NO;失败时返回 error。
|
@discussion 当前实现为客户端商品配置判断:商品配置了推介促销价即视为拥有资格,不判断用户历史订阅记录。
|
*/
|
+ (void)hasSubOfferAccess:(nullable NSString *)subProductId
|
completion:(void (^)(BOOL hasAccess, NSError *_Nullable error))completion;
|
|
/// 订阅总开关是否开启:isOpenSubscription 为 1(全部打开)或 3(仅 iOS 开启)时开启。
|
+ (BOOL)isOpenSubscription;
|
|
/// 打开 App Store 订阅管理页。
|
+ (void)openSubscriptionManager:(void(^)(NSError *_Nullable error))callBackBlock;
|
|
/// 展示 App Store 兑换码兑换界面。回调仅表示界面是否成功调起,不表示兑换结果。
|
+ (void)presentCodeRedemptionSheet:(void(^)(NSError *_Nullable error))callback;
|
|
@end
|