Permalink
Browse files

Initial commit.

  • Loading branch information...
0 parents commit d5a2bcf716f1378b29d196f71208d214e41a67e2 @millenomi committed Feb 2, 2010
@@ -0,0 +1,4 @@
+.DS_Store
+/build
+*.mode2v3
+*.pbxuser
@@ -0,0 +1,34 @@
+//
+// ILSimSKPayment.h
+// SimStoreKit
+//
+// Created by ∞ on 02/02/10.
+// Copyright 2010 __MyCompanyName__. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+@class ILSimSKProduct;
+
+@interface ILSimSKPayment : NSObject <NSCopying, NSMutableCopying> {
+ NSString* productIdentifier;
+ NSInteger quantity;
+ NSData* requestData;
+}
+
++ paymentWithProduct:(ILSimSKProduct*) product;
++ paymentWithProductIdentifier:(NSString*) identifier;
+
+@property(nonatomic, copy, readonly) NSString* productIdentifier;
+@property(nonatomic, readonly) NSInteger quantity;
+@property(nonatomic, copy, readonly) NSData* requestData;
+
+@end
+
+@interface ILSimSKMutablePayment : ILSimSKPayment {}
+
+@property(nonatomic, copy) NSString* productIdentifier;
+@property(nonatomic) NSInteger quantity;
+@property(nonatomic, copy) NSData* requestData;
+
+@end
@@ -0,0 +1,99 @@
+//
+// ILSimSKPayment.m
+// SimStoreKit
+//
+// Created by ∞ on 02/02/10.
+// Copyright 2010 __MyCompanyName__. All rights reserved.
+//
+
+#import "ILSimSKPayment.h"
+#import "ILSimSKProduct.h"
+
+@interface ILSimSKPayment ()
+
+- (id) initWithProductIdentifier:(NSString*) pid;
+
+@property(nonatomic, copy, setter=private_setProductIdentifier:) NSString* productIdentifier;
+@property(nonatomic, setter=private_setQuantity:) NSInteger quantity;
+@property(nonatomic, copy, setter=private_setRequestData:) NSData* requestData;
+
+- (id) copyWithZone:(NSZone *)zone class:(Class) c;
+
+@end
+
+
+
+@implementation ILSimSKPayment
+
+- (id) initWithProductIdentifier:(NSString*) pid;
+{
+ if (self = [super init])
+ productIdentifier = [pid copy];
+
+ return self;
+}
+
+- (void) dealloc
+{
+ [productIdentifier release];
+ [requestData release];
+ [super dealloc];
+}
+
+- (id) copyWithZone:(NSZone *)zone class:(Class) c;
+{
+ ILSimSKPayment* p = [[c allocWithZone:zone] init];
+ p.productIdentifier = productIdentifier;
+ p.quantity = quantity;
+ p.requestData = requestData;
+ return p;
+}
+
+- (id) copyWithZone:(NSZone *)zone;
+{
+ return [self copyWithZone:zone class:[ILSimSKPayment class]];
+}
+
+- (id) mutableCopyWithZone:(NSZone *)zone;
+{
+ return [self copyWithZone:zone class:[ILSimSKMutablePayment class]];
+}
+
++ paymentWithProduct:(ILSimSKProduct*) product;
+{
+ return [[[self alloc] initWithProductIdentifier:product.productIdentifier] autorelease];
+}
+
++ paymentWithProductIdentifier:(NSString*) identifier;
+{
+ return [[[self alloc] initWithProductIdentifier:identifier] autorelease];
+}
+
+@synthesize productIdentifier;
+@synthesize quantity;
+@synthesize requestData;
+
+@end
+
+
+@implementation ILSimSKMutablePayment
+
+@dynamic quantity;
+- (void) setQuantity:(NSInteger) q;
+{
+ [self private_setQuantity:q];
+}
+
+@dynamic productIdentifier;
+- (void) setProductIdentifier:(NSString *) p;
+{
+ [self private_setProductIdentifier:p];
+}
+
+@dynamic requestData;
+- (void) setRequestData:(NSData *) d;
+{
+ [self private_setRequestData:d];
+}
+
+@end
@@ -0,0 +1,50 @@
+//
+// ILSimSKPaymentQueue.h
+// SimStoreKit
+//
+// Created by ∞ on 02/02/10.
+// Copyright 2010 __MyCompanyName__. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import "ILSimSKPayment.h"
+#import "ILSimSKPaymentTransaction.h"
+
+@protocol ILSimSKPaymentTransactionObserver;
+
+
+@interface ILSimSKPaymentQueue : NSObject {
+ NSMutableSet* observers;
+ NSMutableArray* transactions;
+
+ ILSimSKPaymentTransaction* currentTransaction;
+}
+
++ (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;
+
+@end
+
+
+@protocol ILSimSKPaymentTransactionObserver <NSObject>
+
+- (void) paymentQueue:(ILSimSKPaymentQueue*) queue updatedTransactions:(NSArray*) transactions;
+
+- (void) paymentQueue:(ILSimSKPaymentQueue*) queue removedTransactions:(NSArray*) transactions;
+
+- (void) paymentQueue:(ILSimSKPaymentQueue*) queue restoreCompletedTransactionsFailedWithError:(NSError*) e;
+
+- (void) paymentQueueRestoreCompletedTransactionsFinished:(ILSimSKPaymentQueue*) queue;
+
+@end
Oops, something went wrong.

0 comments on commit d5a2bcf

Please sign in to comment.