// // IAPReceiptModel.h // PDF Reader Pro // // Created by User-Tangchao on 2025/1/1. // #import NS_ASSUME_NONNULL_BEGIN @interface IAPReceiptInfoModel: NSObject @property (nonatomic, copy) NSString *product_id; @property (nonatomic, copy) NSString *purchase_date; @property (nonatomic, copy) NSString *purchase_date_ms; @property (nonatomic, copy) NSString *purchase_date_pst; @property (nonatomic, copy) NSString *expires_date; @property (nonatomic, copy) NSString *expires_date_ms; @property (nonatomic, copy) NSString *expires_date_pst; @property (nonatomic, copy) NSString *original_purchase_date; @property (nonatomic, copy) NSString *original_purchase_date_ms; @property (nonatomic, copy) NSString *original_purchase_date_pst; @property (nonatomic, copy) NSString *original_transaction_id; @property (nonatomic, copy) NSString *transaction_id; // 订阅群组标识 @property (nonatomic, copy) NSString *subscription_group_identifier; // PURCHASED 购买者本人‌ // FAMILY_SHARED‌ 家庭成员受益 [家庭共享订阅] @property (nonatomic, copy) NSString *in_app_ownership_type; //  如果收据中之前的订阅期具有is_trial_period或is_in_intro_offer_period键的“true”值,则用户没有资格在该订阅组内获得免费试用或介绍性价格。 // 享受推介优惠期间 true 处于享受推介优惠中 @property (nonatomic, assign) BOOL is_in_intro_offer_period; // 订阅试用期 true 处于免费试用期 @property (nonatomic, assign) BOOL is_trial_period; @property (nonatomic, assign) NSInteger quantity; // 促销优惠的优惠卷ID @property (nonatomic, copy) NSString *promotional_offer_id; // 网上订单行项目ID // 用于识别订阅购买的主密钥。 // 此值是一个唯一ID,用于识别跨设备的购买事件,包括订阅续订购买事件。 @property (nonatomic, copy) NSString *web_order_line_item_id; - (instancetype)initWithDict:(NSDictionary *)dict; + (instancetype)modelWithDict:(NSDictionary *)dict; @end @interface IAPPendingRenewalInfoModel: NSObject // 续订的产品 [有切换套餐时 是切换后的产品] @property (nonatomic, copy) NSString *auto_renew_product_id; // 订阅自动续订状态 1 订阅将在当前订阅期结束时续订 0 客户已关闭订阅的自动续订 @property (nonatomic, assign) NSInteger auto_renew_status; // 订阅到期的原因 1 客户取消 2 账单错误 eg 客户的支付信息无效 3 客户不同意自动续订订阅价格增加 导致订阅到期 4 在续订时产品不可购买 5 其他原因 @property (nonatomic, assign) NSInteger expiration_intent; // 订阅重试标识 1 AppStore 在尝试续订 0 已停止尝试续订 @property (nonatomic, assign) NSInteger is_in_billing_retry_period; // 切换前的产品 [有切换套餐后 会与 auto_renew_product_id 不一致] @property (nonatomic, copy) NSString *product_id; - (instancetype)initWithDict:(NSDictionary *)dict; + (instancetype)modelWithDict:(NSDictionary *)dict; @end @interface IAPInAppReceiptModel: NSObject // App ID @property (nonatomic, assign) NSInteger adam_id; // 应用程序项目ID // 如果您的服务器支持多个应用程序,您可以使用此值来区分它们。 // Mac应用程序不提供此字段。 @property (nonatomic, assign) NSInteger app_item_id; @property (nonatomic, copy) NSString *application_version; @property (nonatomic, copy) NSString *bundle_id; @property (nonatomic, assign) NSInteger download_id; @property (nonatomic, assign) NSInteger version_external_identifier; @property (nonatomic, copy) NSString *original_application_version; @property (nonatomic, copy) NSString *original_purchase_date; // 时间戳 @property (nonatomic, copy) NSString *original_purchase_date_ms; @property (nonatomic, copy) NSString *original_purchase_date_pst; @property (nonatomic, copy) NSString *receipt_creation_date; @property (nonatomic, copy) NSString *receipt_creation_date_ms; @property (nonatomic, copy) NSString *receipt_creation_date_pst; // 凭证类型 沙盒 ProductionSandbox 正式 @property (nonatomic, copy) NSString *receipt_type; @property (nonatomic, copy) NSString *request_date; @property (nonatomic, copy) NSString *request_date_ms; @property (nonatomic, copy) NSString *request_date_pst; @property (nonatomic, strong) NSArray *in_app; - (instancetype)initWithDict:(NSDictionary *)dict; + (instancetype)modelWithDict:(NSDictionary *)dict; @property (nonatomic, strong) NSArray *inAppModels; @end @interface IAPReceiptModel : NSObject // Sandbox @property (nonatomic, copy) NSString *environment; @property (nonatomic, assign) BOOL is_sandbox; @property (nonatomic, copy) NSString *latest_receipt; @property (nonatomic, strong) NSArray *latest_receipt_info; // 下个续费周期订阅的产品 @property (nonatomic, strong) NSArray *pending_renewal_info; @property (nonatomic, strong) NSDictionary *receipt; // 0 检验成果 @property (nonatomic, assign) NSInteger status; - (instancetype)initWithDict:(NSDictionary *)dict; + (instancetype)modelWithDict:(NSDictionary *)dict; @property (nonatomic, strong) IAPInAppReceiptModel *receiptModel; @property (nonatomic, strong) NSArray *latestReceiptInfoModels; @property (nonatomic, strong) NSArray *pendingRenewalInfoModels; @end @interface IAPReceiptTool: NSObject // 是否在免费试用中 + (BOOL)isFreeTrailingWithModel:(IAPReceiptModel * _Nullable)model withProductId:(NSString * _Nullable)productId; // 是否为新用户 + (BOOL)isNewUserWithModel:(IAPReceiptModel * _Nullable)model withGroupIdentifier:(NSString * _Nullable)groupIdentifier; // 是否有享受过 推介优惠 [免费试用] + (BOOL)hasFreeTrialWithModel:(IAPReceiptModel * _Nullable)model withGroupIdentifier:(NSString * _Nullable)groupIdentifier; // 是否有享受过 推介优惠 + (BOOL)hasIntroOfferWithModel:(IAPReceiptModel * _Nullable)model withGroupIdentifier:(NSString * _Nullable)groupIdentifier; // 获取订阅群组的所有票据 + (NSArray *)fetchReceiptsWithModel:(IAPReceiptModel * _Nullable)model withGroupIdentifier:(NSString * _Nullable)groupIdentifier; // 获取对应商品的最后的票据 + (IAPReceiptInfoModel * _Nullable)fetchProductLastestReceiptsWithModel:(IAPReceiptModel * _Nullable)model withProductId:(NSString * _Nullable)productId; // 获取对应商品的所有票据 + (NSArray *)fetchProductReceiptsWithModel:(IAPReceiptModel * _Nullable)model withProductId:(NSString * _Nullable)productId; // 获取所有的票据 + (NSArray *)fetchReceiptsWithModel:(IAPReceiptModel * _Nullable)model; @end /** status 21000 未使用HTTPPOST请求方式向AppStore发送请求 21001 此状态代码不再由AppStore发送 21002 该receipt-data属性中的数据格式错误或丢失 21003 收据无法认证 21004 提供的共享密码与账号的文件共享密码不匹配 21005 收据服务器当前不可用 21006 该收据有效,但订阅已过期。当次状态代码返回到你的服务器时,收据数据也会被解码并作为响应的一部分返回。仅针对自动续订的iOS6样式的交易收据返回 21007 该收据来自测试环境 但已发送到生产环境以进行验证 21008 该收据来自生产环境 但是已发送到测试环境以进行验证 21009 内部数据访问错误 稍后再试 21010 找不到或删除了该用户账号 */ NS_ASSUME_NONNULL_END