iFun Engine API  1.0.0-b2601
Great Technology for Great Games
 All Classes Files Functions Variables Typedefs Macros
billing.h
Go to the documentation of this file.
1 // Copyright (C) 2013-2018 iFunFactory Inc. All Rights Reserved.
2 //
3 // This work is confidential and proprietary to iFunFactory Inc. and
4 // must not be used, disclosed, copied, or distributed without the prior
5 // consent of iFunFactory Inc.
6 
9 #ifndef INCLUDE_FUNAPI_SERVICE_BILLING_H_
10 #define INCLUDE_FUNAPI_SERVICE_BILLING_H_
11 
12 #include <funapi/player_account.h>
13 #include <funapi/types.h>
14 
15 #include <vector>
16 
17 
18 namespace fun {
19 
20 typedef string Receipt;
21 
22 
23 Receipt MakeGooglePlayReceipt(const string &package_name,
24  const string &product_id,
25  const string &purchase_token);
26 Receipt MakeAppleAppStoreReceipt(const string &receipt_data,
27  const string &product_id,
28  int64_t quantity);
29 Receipt MakeOneStoreReceipt(const string &txid,
30  const string &appid,
31  const string &signdata,
32  const std::vector<string> &products,
33  bool use_one_store_test_server);
34 DEPRECATED(Receipt MakeTStoreReceipt(const string &txid,
35  const string &appid,
36  const string &signdata,
37  const std::vector<string> &products,
38  bool use_tstore_test_server));
40  ReceiptValidationRequest(const string &service_provider,
41  const string &id,
42  const Receipt &receipt);
43 
44  PlayerAccount player_account;
45  Receipt receipt;
46 };
47 
48 
49 enum ReceiptValidationResponse {
50  kSuccess = 0,
51  kFailAlreadyProvisioned = 1000,
52  kFailWrongReceipt = 1001,
53  kFailWrongServiceProvider = 1002,
54  kFailNotAuthenticatedServiceProvider = 1003,
55  kFailCancelledReceipt = 1004,
56  kFailAuthenticationRequired = 1005,
57  kBillingSystemError = 2000
58 };
59 
60 
61 typedef function<void(const ReceiptValidationRequest &request,
62  const ReceiptValidationResponse &response,
63  const bool &error)> BillingResponseHandler;
64 
65 
66 void ValidateReceipt(const ReceiptValidationRequest &request,
67  const BillingResponseHandler &handler);
68 bool ValidateReceiptSync(const ReceiptValidationRequest &request,
69  ReceiptValidationResponse *response);
70 
71 } // namespace fun
72 
73 #endif // INCLUDE_FUNAPI_SERVICE_BILLING_H_
Definition: billing.h:39
Account Id.
Definition: player_account.h:20