/
ILSimSKPaymentQueue.h
98 lines (67 loc) · 2.72 KB
/
ILSimSKPaymentQueue.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
//
// ILSimSKPaymentQueue.h
// SimStoreKit
//
// Created by ∞ on 02/02/10.
// Copyright 2010 __MyCompanyName__. All rights reserved.
//
#import "ILSimStoreKit.h"
#if kILSimAllowSimulatedStoreKit
#import <Foundation/Foundation.h>
#import "ILSimSKPayment.h"
#import "ILSimSKPaymentTransaction.h"
@protocol ILSimTransactionSimulator;
// ENVIRONMENT VARIABLES THAT CHANGE THIS CLASS'S BEHAVIOR:
// if -boolValue == NO, the user cannot make payments.
// Defaults to YES if missing.
#define kILSimSKCanMakePaymentsEnvironmentVariable @"ILSimSKCanMakePayments"
// the path to a plist file containing simulated store product info info.
// format:
// dict {
// any number of @"<product code>" => dict {
// @"Title" => @"<product title>";
// @"Description" => @"<guess>";
// @"Tier" => int(<a price tier, eg 1 for $0.99. 0 (free) is not a valid tier in IAP>);
// @"ProductType" => int(<0 means nonconsumable, 1 consumable, 2 subscription>);
// }
// }
#define kILSimSKProductsPlistEnvironmentVariable @"ILSimSKProductsPlist"
// the storefront to use.
// Use a currency symbol for the storefront -- f. ex. "USD" is the USA storefront, "EUR" an Euro-using storefront etc.
// Default is USD.
#define kILSimSKStorefrontCodeEnvironmentVariable @"ILSimSKStorefrontCode"
extern NSString* const kILSimSKErrorDomain;
enum {
// doubles from SKErrorDomain
kILSimSKErrorUnknown,
kILSimSKErrorClientInvalid,
kILSimSKErrorPaymentCancelled,
kILSimSKErrorPaymentInvalid,
kILSimSKErrorPaymentNotAllowed,
};
@protocol ILSimSKPaymentTransactionObserver;
@interface ILSimSKPaymentQueue : NSObject {
NSMutableSet* observers;
NSMutableArray* transactions;
ILSimSKPaymentTransaction* currentTransaction;
id <ILSimTransactionSimulator> transactionSimulator;
}
+ (BOOL) canMakePayments;
+ (ILSimSKPaymentQueue*) defaultQueue;
- (void) addPayment:(ILSimSKPayment*) p;
- (void) addTransactionObserver:(id <ILSimSKPaymentTransactionObserver>) o;
- (void) removeTransactionObserver:(id <ILSimSKPaymentTransactionObserver>) o;
- (void) finishTransaction:(ILSimSKPaymentTransaction*) t;
- (void) restoreCompletedTransactions;
@property(nonatomic, readonly) NSArray* transactions;
@property(nonatomic, assign) id <ILSimTransactionSimulator> transactionSimulator;
@end
@protocol ILSimSKPaymentTransactionObserver <NSObject>
@required
- (void) paymentQueue:(ILSimSKPaymentQueue*) queue updatedTransactions:(NSArray*) transactions;
@optional
- (void) paymentQueue:(ILSimSKPaymentQueue*) queue removedTransactions:(NSArray*) transactions;
- (void) paymentQueue:(ILSimSKPaymentQueue*) queue restoreCompletedTransactionsFailedWithError:(NSError*) e;
- (void) paymentQueueRestoreCompletedTransactionsFinished:(ILSimSKPaymentQueue*) queue;
@end
#endif // #if kILSimAllowSimulatedStoreKit