AppEasy Core SDK  1.5.0
Cross platform mobile and desktop app and game development SDK - The easy way to make apps
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines
CzPlatformMarket.h
Go to the documentation of this file.
00001 // 
00002 //
00003 // AppEasy SDK - Cross Platform Multi-purpose Game and App Engine
00004 //
00005 // Developed by Matthew Hopwood of Pocketeers Limited - www.pocketeers.co.uk
00006 //
00007 // For updates, tutorials and more details check out www.appeasymobile.com
00008 //
00009 // This code is provided free of charge and without any warranty whatsoever. You must ensure that this whole notice is present in all files and derivatives, so the reader knows its origin.
00010 // If you use this SDK in your product then please ensure that you credit AppEasy's usage appropriately. Please see www.appeasymobile.com for licensing details and support
00011 //
00012 //
00013 
00014 #if !defined(_CCZ_PLATFORM_MARKET_H_)
00015 #define _CCZ_PLATFORM_MARKET_H_
00016 
00017 #include "IzPlatformMarket.h"
00018 
00019 #include "s3eIOSAppStoreBilling.h"
00020 #include "s3eAndroidMarketBilling.h"
00021 
00022 //
00023 //
00024 //
00025 //
00026 // CzPlatformMarketiOS - Handles in-app purchasing for iOS
00027 //
00028 //
00029 // 
00030 //
00031 class CzPlatformMarketiOS : public IzPlatformMarket
00032 {
00033     // Properties
00034 protected:
00035     s3ePaymentRequest*      getPaymentRequest();
00036     void                    setTransactionReceipt(void *receipt_data, uint receipt_size);
00037     s3eTransactionReceipt*  getTransactionReceipt();
00038     void                    setProductInformation(s3eProductInformation* info);
00039     s3eProductInformation*  getProductInformation();
00040     void                    setPaymentTransaction(s3ePaymentTransaction* trans);
00041     s3ePaymentTransaction*  getPaymentTransaction();
00042     bool                    isBillingEnabled();
00043     // Properties end
00044 
00045 protected:
00046     s3ePaymentRequest       PaymentRequest;
00047     s3eTransactionReceipt   TransactionReceipt;
00048     s3eProductInformation*  ProductInformation;
00049     s3ePaymentTransaction*  PaymentTransaction;
00050 
00051 public:
00052 
00053     int                     Init(void* id);
00054     void                    Release();
00055     void                    Update();
00056     bool                    QueryProduct(const char* product_id);
00057     bool                    PurchaseProduct(const char* product_id);
00058     bool                    RestoreProducts();
00059 
00060     void                    StopProductinfo();
00061     void                    GetReceipt();
00062 
00063     // Internal
00064     static void             TransactionUpdateCallback(s3ePaymentTransaction* transaction, void* userData);
00065     static void             ProductInfoCallback(s3eProductInformation* productInfo, void* userData);
00066     void                    ReleaseReceipt();
00067     void                    ReleasePayment();
00068     void                    ReleaseProductInfo();
00069 
00070 };
00071 
00072 //
00073 //
00074 //
00075 //
00076 // CzPlatformMarketAndroid - Handles in-app purchasing fro Android
00077 //
00078 //
00079 // 
00080 //
00081 class CzPlatformMarketAndroid : public IzPlatformMarket
00082 {
00083     // Properties
00084 protected:
00085     CzString                PublicKey;
00086     CzString                RefundedID;
00087 public:
00088     void                    setPublicKey(const char* key)   { PublicKey = key; }
00089     void                    setRefundedID(const char* id)   { RefundedID = id; }
00090     CzString&               getRefundedID()                 { return RefundedID; }
00091     bool                    isBillingEnabled();
00092     // Properties end
00093 
00094 protected:
00095 
00096 public:
00097 
00098     int                     Init(void* id);
00099     void                    Release();
00100     void                    Update();
00101     bool                    QueryProduct(const char* product_id);       // Does nothing
00102     bool                    PurchaseProduct(const char* product_id);
00103     bool                    RestoreProducts();
00104 
00105     void                    NotifyRefund();
00106 
00107 
00108     // Internal
00109     static int32            AsyncResponse(void* system, void* user);
00110     static int32            OrderInformationChanged(void* system, void* user);
00111 
00112 };
00113 
00114 //
00115 //
00116 //
00117 //
00118 // CzPlatformMarketTest - A test class that simply allows testing of in-app purchase without performing any actual purchasing
00119 //
00120 //
00121 // 
00122 //
00123 class CzPlatformMarketTest : public IzPlatformMarket
00124 {
00125     // Properties
00126 protected:
00127     bool                    isBillingEnabled();
00128     // Properties end
00129 
00130 protected:
00131     CzTimer                 PurchaseTimer;
00132 
00133 public:
00134 
00135     int                     Init(void* id);
00136     void                    Release();
00137     void                    Update();
00138     bool                    QueryProduct(const char* product_id);
00139     bool                    PurchaseProduct(const char* product_id);
00140     bool                    RestoreProducts();
00141 
00142     void                    ForceError(eMarketStatus status);
00143 };
00144 
00145 
00146 
00147 #endif  // _CCZ_PLATFORM_MARKET_H_