mirror of
https://github.com/defold/extension-iap
synced 2025-09-28 09:32:19 +02:00
Compare commits
1 Commits
3.2.0
...
issue-33-r
Author | SHA1 | Date | |
---|---|---|---|
|
53ae8a308e |
76
.github/workflows/bob.yml
vendored
76
.github/workflows/bob.yml
vendored
@@ -1,76 +0,0 @@
|
|||||||
name: Build with bob
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
pull_request_target:
|
|
||||||
schedule:
|
|
||||||
# nightly at 05:00 on the 1st and 15th
|
|
||||||
- cron: 0 5 1,15 * *
|
|
||||||
|
|
||||||
env:
|
|
||||||
VERSION_FILENAME: 'info.json'
|
|
||||||
BUILD_SERVER: 'https://build.defold.com'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build_with_bob:
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
platform: [armv7-android, x86_64-linux, x86_64-win32, x86-win32, js-web]
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
name: Build
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- uses: actions/setup-java@v1
|
|
||||||
with:
|
|
||||||
java-version: '11.0.2'
|
|
||||||
|
|
||||||
- name: Get Defold version
|
|
||||||
run: |
|
|
||||||
TMPVAR=`curl -s http://d.defold.com/stable/${{env.VERSION_FILENAME}} | jq -r '.sha1'`
|
|
||||||
echo "DEFOLD_VERSION=${TMPVAR}" >> $GITHUB_ENV
|
|
||||||
echo "Found version ${TMPVAR}"
|
|
||||||
|
|
||||||
- name: Download bob.jar
|
|
||||||
run: |
|
|
||||||
wget -q http://d.defold.com/archive/stable/${{env.DEFOLD_VERSION}}/bob/bob.jar
|
|
||||||
java -jar bob.jar --version
|
|
||||||
|
|
||||||
- name: Resolve libraries
|
|
||||||
run: java -jar bob.jar resolve --email a@b.com --auth 123456
|
|
||||||
- name: Build
|
|
||||||
run: java -jar bob.jar --platform=${{ matrix.platform }} build --archive --build-server=${{env.BUILD_SERVER}}
|
|
||||||
- name: Bundle
|
|
||||||
run: java -jar bob.jar --platform=${{ matrix.platform }} bundle
|
|
||||||
|
|
||||||
# macOS is not technically needed for building, but we want to test bundling as well, since we're also testing the manifest merging
|
|
||||||
build_with_bob_macos:
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
platform: [armv7-darwin, x86_64-darwin]
|
|
||||||
runs-on: macOS-latest
|
|
||||||
|
|
||||||
name: Build
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- uses: actions/setup-java@v1
|
|
||||||
with:
|
|
||||||
java-version: '11.0.2'
|
|
||||||
|
|
||||||
- name: Get Defold version
|
|
||||||
run: |
|
|
||||||
TMPVAR=`curl -s http://d.defold.com/stable/${{env.VERSION_FILENAME}} | jq -r '.sha1'`
|
|
||||||
echo "DEFOLD_VERSION=${TMPVAR}" >> $GITHUB_ENV
|
|
||||||
echo "Found version ${TMPVAR}"
|
|
||||||
|
|
||||||
- name: Download bob.jar
|
|
||||||
run: |
|
|
||||||
wget -q http://d.defold.com/archive/stable/${{env.DEFOLD_VERSION}}/bob/bob.jar
|
|
||||||
java -jar bob.jar --version
|
|
||||||
|
|
||||||
- name: Resolve libraries
|
|
||||||
run: java -jar bob.jar resolve --email a@b.com --auth 123456
|
|
||||||
- name: Build
|
|
||||||
run: java -jar bob.jar --platform=${{ matrix.platform }} build --archive --build-server=${{env.BUILD_SERVER}}
|
|
||||||
- name: Bundle
|
|
||||||
run: java -jar bob.jar --platform=${{ matrix.platform }} bundle
|
|
@@ -1,5 +1,3 @@
|
|||||||
[](https://github.com/defold/extension-iap/actions)
|
|
||||||
|
|
||||||
# In-app purchase extension for Defold
|
# In-app purchase extension for Defold
|
||||||
|
|
||||||
Defold [native extension](https://www.defold.com/manuals/extensions/) which provides access to In-app purchase functionality on iOS, Android (Google Play and Amazon) and Facebook Canvas platforms.
|
Defold [native extension](https://www.defold.com/manuals/extensions/) which provides access to In-app purchase functionality on iOS, Android (Google Play and Amazon) and Facebook Canvas platforms.
|
||||||
|
@@ -226,10 +226,6 @@
|
|||||||
type: string
|
type: string
|
||||||
desc: Apple only[icon:apple]. The original transaction. This field is only set when `state` is `TRANS_STATE_RESTORED`.
|
desc: Apple only[icon:apple]. The original transaction. This field is only set when `state` is `TRANS_STATE_RESTORED`.
|
||||||
|
|
||||||
- name: original_json
|
|
||||||
type: string
|
|
||||||
desc: Android only[icon:android]. The purchase order details in JSON format.
|
|
||||||
|
|
||||||
- name: signature
|
- name: signature
|
||||||
type: string
|
type: string
|
||||||
desc: Google Play only[icon:googleplay]. A string containing the signature of the purchase data that was signed with the private key of the developer.
|
desc: Google Play only[icon:googleplay]. A string containing the signature of the purchase data that was signed with the private key of the developer.
|
||||||
|
Binary file not shown.
@@ -4,9 +4,9 @@
|
|||||||
<uses-sdk android:minSdkVersion="{{android.minimum_sdk_version}}" android:targetSdkVersion="{{android.target_sdk_version}}" />
|
<uses-sdk android:minSdkVersion="{{android.minimum_sdk_version}}" android:targetSdkVersion="{{android.target_sdk_version}}" />
|
||||||
<application>
|
<application>
|
||||||
<!-- For Amazon IAP -->
|
<!-- For Amazon IAP -->
|
||||||
<receiver android:name = "com.amazon.device.iap.ResponseReceiver" android:permission = "com.amazon.inapp.purchasing.Permission.NOTIFY" >
|
<receiver android:name="com.amazon.device.iap.ResponseReceiver" >
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name = "com.amazon.inapp.purchasing.NOTIFY" />
|
<action android:name="com.amazon.inapp.purchasing.NOTIFY" android:permission="com.amazon.inapp.purchasing.Permission.NOTIFY" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
</application>
|
</application>
|
||||||
|
@@ -30,10 +30,12 @@ struct IAP
|
|||||||
m_autoFinishTransactions = true;
|
m_autoFinishTransactions = true;
|
||||||
m_ProviderId = PROVIDER_ID_GOOGLE;
|
m_ProviderId = PROVIDER_ID_GOOGLE;
|
||||||
}
|
}
|
||||||
|
int m_InitCount;
|
||||||
bool m_autoFinishTransactions;
|
bool m_autoFinishTransactions;
|
||||||
int m_ProviderId;
|
int m_ProviderId;
|
||||||
|
|
||||||
dmScript::LuaCallbackInfo* m_Listener;
|
dmScript::LuaCallbackInfo* m_Listener;
|
||||||
|
dmScript::LuaCallbackInfo* m_RestoreListener;
|
||||||
|
|
||||||
jobject m_IAP;
|
jobject m_IAP;
|
||||||
jobject m_IAPJNI;
|
jobject m_IAPJNI;
|
||||||
@@ -190,14 +192,23 @@ static int IAP_Restore(lua_State* L)
|
|||||||
{
|
{
|
||||||
// TODO: Missing callback here for completion/error
|
// TODO: Missing callback here for completion/error
|
||||||
// See iap_ios.mm
|
// See iap_ios.mm
|
||||||
|
DM_LUA_STACKCHECK(L, 1);
|
||||||
|
|
||||||
|
if (iap->m_RestoreListener)
|
||||||
|
{
|
||||||
|
dmScript::DestroyCallback(iap->m_RestoreListener);
|
||||||
|
iap->m_RestoreListener = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lua_isfunction(L, 1))
|
||||||
|
{
|
||||||
|
iap->m_RestoreListener = dmScript::CreateCallback(L, 1);
|
||||||
|
}
|
||||||
|
|
||||||
int top = lua_gettop(L);
|
|
||||||
JNIEnv* env = Attach();
|
JNIEnv* env = Attach();
|
||||||
env->CallVoidMethod(g_IAP.m_IAP, g_IAP.m_Restore, g_IAP.m_IAPJNI);
|
env->CallVoidMethod(g_IAP.m_IAP, g_IAP.m_Restore, g_IAP.m_IAPJNI);
|
||||||
Detach();
|
Detach();
|
||||||
|
|
||||||
assert(top == lua_gettop(L));
|
|
||||||
|
|
||||||
lua_pushboolean(L, 1);
|
lua_pushboolean(L, 1);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -398,6 +409,9 @@ static void HandlePurchaseResult(const IAPCommand* cmd)
|
|||||||
|
|
||||||
static dmExtension::Result InitializeIAP(dmExtension::Params* params)
|
static dmExtension::Result InitializeIAP(dmExtension::Params* params)
|
||||||
{
|
{
|
||||||
|
// TODO: Life-cycle managaemnt is *budget*. No notion of "static initalization"
|
||||||
|
// Extend extension functionality with per system initalization?
|
||||||
|
if (g_IAP.m_InitCount == 0) {
|
||||||
IAP_Queue_Create(&g_IAP.m_CommandQueue);
|
IAP_Queue_Create(&g_IAP.m_CommandQueue);
|
||||||
|
|
||||||
g_IAP.m_autoFinishTransactions = dmConfigFile::GetInt(params->m_ConfigFile, "iap.auto_finish_transactions", 1) == 1;
|
g_IAP.m_autoFinishTransactions = dmConfigFile::GetInt(params->m_ConfigFile, "iap.auto_finish_transactions", 1) == 1;
|
||||||
@@ -446,6 +460,8 @@ static dmExtension::Result InitializeIAP(dmExtension::Params* params)
|
|||||||
g_IAP.m_IAPJNI = env->NewGlobalRef(env->NewObject(iap_jni_class, jni_constructor));
|
g_IAP.m_IAPJNI = env->NewGlobalRef(env->NewObject(iap_jni_class, jni_constructor));
|
||||||
|
|
||||||
Detach();
|
Detach();
|
||||||
|
}
|
||||||
|
g_IAP.m_InitCount++;
|
||||||
|
|
||||||
lua_State*L = params->m_L;
|
lua_State*L = params->m_L;
|
||||||
int top = lua_gettop(L);
|
int top = lua_gettop(L);
|
||||||
@@ -488,18 +504,26 @@ static dmExtension::Result UpdateIAP(dmExtension::Params* params)
|
|||||||
static dmExtension::Result FinalizeIAP(dmExtension::Params* params)
|
static dmExtension::Result FinalizeIAP(dmExtension::Params* params)
|
||||||
{
|
{
|
||||||
IAP_Queue_Destroy(&g_IAP.m_CommandQueue);
|
IAP_Queue_Destroy(&g_IAP.m_CommandQueue);
|
||||||
|
--g_IAP.m_InitCount;
|
||||||
|
|
||||||
if (params->m_L == dmScript::GetCallbackLuaContext(g_IAP.m_Listener)) {
|
if (params->m_L == dmScript::GetCallbackLuaContext(g_IAP.m_Listener)) {
|
||||||
dmScript::DestroyCallback(g_IAP.m_Listener);
|
dmScript::DestroyCallback(g_IAP.m_Listener);
|
||||||
g_IAP.m_Listener = 0;
|
g_IAP.m_Listener = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (iap->m_RestoreListener)
|
||||||
|
{
|
||||||
|
dmScript::DestroyCallback(iap->m_RestoreListener);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (g_IAP.m_InitCount == 0) {
|
||||||
JNIEnv* env = Attach();
|
JNIEnv* env = Attach();
|
||||||
env->CallVoidMethod(g_IAP.m_IAP, g_IAP.m_Stop);
|
env->CallVoidMethod(g_IAP.m_IAP, g_IAP.m_Stop);
|
||||||
env->DeleteGlobalRef(g_IAP.m_IAP);
|
env->DeleteGlobalRef(g_IAP.m_IAP);
|
||||||
env->DeleteGlobalRef(g_IAP.m_IAPJNI);
|
env->DeleteGlobalRef(g_IAP.m_IAPJNI);
|
||||||
Detach();
|
Detach();
|
||||||
g_IAP.m_IAP = NULL;
|
g_IAP.m_IAP = NULL;
|
||||||
|
}
|
||||||
return dmExtension::RESULT_OK;
|
return dmExtension::RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -24,10 +24,11 @@ struct IAP
|
|||||||
memset(this, 0, sizeof(*this));
|
memset(this, 0, sizeof(*this));
|
||||||
m_AutoFinishTransactions = true;
|
m_AutoFinishTransactions = true;
|
||||||
}
|
}
|
||||||
int m_Version;
|
int m_InitCount;
|
||||||
bool m_AutoFinishTransactions;
|
bool m_AutoFinishTransactions;
|
||||||
NSMutableDictionary* m_PendingTransactions;
|
NSMutableDictionary* m_PendingTransactions;
|
||||||
dmScript::LuaCallbackInfo* m_Listener;
|
dmScript::LuaCallbackInfo* m_Listener;
|
||||||
|
dmScript::LuaCallbackInfo* m_RestoreListener;
|
||||||
IAPCommandQueue m_CommandQueue;
|
IAPCommandQueue m_CommandQueue;
|
||||||
IAPCommandQueue m_ObservableQueue;
|
IAPCommandQueue m_ObservableQueue;
|
||||||
SKPaymentTransactionObserver* m_Observer;
|
SKPaymentTransactionObserver* m_Observer;
|
||||||
@@ -103,17 +104,11 @@ static void IAP_FreeTransaction(IAPTransaction* transaction)
|
|||||||
@interface SKProductsRequestDelegate : NSObject<SKProductsRequestDelegate>
|
@interface SKProductsRequestDelegate : NSObject<SKProductsRequestDelegate>
|
||||||
@property dmScript::LuaCallbackInfo* m_Callback;
|
@property dmScript::LuaCallbackInfo* m_Callback;
|
||||||
@property (assign) SKProductsRequest* m_Request;
|
@property (assign) SKProductsRequest* m_Request;
|
||||||
@property int m_Version;
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation SKProductsRequestDelegate
|
@implementation SKProductsRequestDelegate
|
||||||
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response{
|
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response{
|
||||||
|
|
||||||
if (self.m_Version != g_IAP.m_Version) {
|
|
||||||
dmLogWarning("Received products but the extension has been restarted")
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!dmScript::IsCallbackValid(self.m_Callback)) {
|
if (!dmScript::IsCallbackValid(self.m_Callback)) {
|
||||||
dmLogError("No callback set");
|
dmLogError("No callback set");
|
||||||
return;
|
return;
|
||||||
@@ -168,7 +163,7 @@ static void HandleProductResult(IAPCommand* cmd)
|
|||||||
|
|
||||||
IAPResponse* response = (IAPResponse*)cmd->m_Data;
|
IAPResponse* response = (IAPResponse*)cmd->m_Data;
|
||||||
|
|
||||||
lua_State* L = dmScript::GetCallbackLuaContext(cmd->m_Callback);
|
lua_State* L = dmScript::GetCallbackLuaContext(g_IAP.m_Listener);
|
||||||
int top = lua_gettop(L);
|
int top = lua_gettop(L);
|
||||||
|
|
||||||
if (!dmScript::SetupCallback(cmd->m_Callback))
|
if (!dmScript::SetupCallback(cmd->m_Callback))
|
||||||
@@ -415,7 +410,6 @@ static int IAP_List(lua_State* L)
|
|||||||
|
|
||||||
delegate.m_Callback = dmScript::CreateCallback(L, 2);
|
delegate.m_Callback = dmScript::CreateCallback(L, 2);
|
||||||
delegate.m_Request = products_request;
|
delegate.m_Request = products_request;
|
||||||
delegate.m_Version = g_IAP.m_Version;
|
|
||||||
products_request.delegate = delegate;
|
products_request.delegate = delegate;
|
||||||
[products_request start];
|
[products_request start];
|
||||||
|
|
||||||
@@ -536,9 +530,13 @@ static const luaL_reg IAP_methods[] =
|
|||||||
|
|
||||||
static dmExtension::Result InitializeIAP(dmExtension::Params* params)
|
static dmExtension::Result InitializeIAP(dmExtension::Params* params)
|
||||||
{
|
{
|
||||||
|
// TODO: Life-cycle managaemnt is *budget*. No notion of "static initalization"
|
||||||
|
// Extend extension functionality with per system initalization?
|
||||||
|
if (g_IAP.m_InitCount == 0) {
|
||||||
g_IAP.m_AutoFinishTransactions = dmConfigFile::GetInt(params->m_ConfigFile, "iap.auto_finish_transactions", 1) == 1;
|
g_IAP.m_AutoFinishTransactions = dmConfigFile::GetInt(params->m_ConfigFile, "iap.auto_finish_transactions", 1) == 1;
|
||||||
g_IAP.m_PendingTransactions = [[NSMutableDictionary alloc]initWithCapacity:2];
|
g_IAP.m_PendingTransactions = [[NSMutableDictionary alloc]initWithCapacity:2];
|
||||||
g_IAP.m_Version++;
|
}
|
||||||
|
g_IAP.m_InitCount++;
|
||||||
|
|
||||||
IAP_Queue_Create(&g_IAP.m_CommandQueue);
|
IAP_Queue_Create(&g_IAP.m_CommandQueue);
|
||||||
IAP_Queue_Create(&g_IAP.m_ObservableQueue);
|
IAP_Queue_Create(&g_IAP.m_ObservableQueue);
|
||||||
@@ -593,9 +591,21 @@ static dmExtension::Result UpdateIAP(dmExtension::Params* params)
|
|||||||
|
|
||||||
static dmExtension::Result FinalizeIAP(dmExtension::Params* params)
|
static dmExtension::Result FinalizeIAP(dmExtension::Params* params)
|
||||||
{
|
{
|
||||||
|
--g_IAP.m_InitCount;
|
||||||
|
|
||||||
|
// TODO: Should we support one listener per lua-state?
|
||||||
|
// Or just use a single lua-state...?
|
||||||
|
if (params->m_L == dmScript::GetCallbackLuaContext(g_IAP.m_Listener)) {
|
||||||
dmScript::DestroyCallback(g_IAP.m_Listener);
|
dmScript::DestroyCallback(g_IAP.m_Listener);
|
||||||
g_IAP.m_Listener = 0;
|
g_IAP.m_Listener = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (iap->m_RestoreListener)
|
||||||
|
{
|
||||||
|
dmScript::DestroyCallback(iap->m_RestoreListener);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (g_IAP.m_InitCount == 0) {
|
||||||
if (g_IAP.m_PendingTransactions) {
|
if (g_IAP.m_PendingTransactions) {
|
||||||
[g_IAP.m_PendingTransactions release];
|
[g_IAP.m_PendingTransactions release];
|
||||||
g_IAP.m_PendingTransactions = 0;
|
g_IAP.m_PendingTransactions = 0;
|
||||||
@@ -606,6 +616,7 @@ static dmExtension::Result FinalizeIAP(dmExtension::Params* params)
|
|||||||
[g_IAP.m_Observer release];
|
[g_IAP.m_Observer release];
|
||||||
g_IAP.m_Observer = 0;
|
g_IAP.m_Observer = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
IAP_Queue_Destroy(&g_IAP.m_CommandQueue);
|
IAP_Queue_Destroy(&g_IAP.m_CommandQueue);
|
||||||
IAP_Queue_Destroy(&g_IAP.m_ObservableQueue);
|
IAP_Queue_Destroy(&g_IAP.m_ObservableQueue);
|
||||||
|
@@ -121,14 +121,13 @@ void IAP_Queue_Push(IAPCommandQueue* queue, IAPCommand* cmd)
|
|||||||
void IAP_Queue_Flush(IAPCommandQueue* queue, IAPCommandFn fn, void* ctx)
|
void IAP_Queue_Flush(IAPCommandQueue* queue, IAPCommandFn fn, void* ctx)
|
||||||
{
|
{
|
||||||
assert(fn != 0);
|
assert(fn != 0);
|
||||||
|
|
||||||
DM_MUTEX_SCOPED_LOCK(queue->m_Mutex);
|
|
||||||
|
|
||||||
if (queue->m_Commands.Empty())
|
if (queue->m_Commands.Empty())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DM_MUTEX_SCOPED_LOCK(queue->m_Mutex);
|
||||||
|
|
||||||
for(uint32_t i = 0; i != queue->m_Commands.Size(); ++i)
|
for(uint32_t i = 0; i != queue->m_Commands.Size(); ++i)
|
||||||
{
|
{
|
||||||
fn(&queue->m_Commands[i], ctx);
|
fn(&queue->m_Commands[i], ctx);
|
||||||
|
@@ -11,7 +11,6 @@ import java.util.concurrent.BlockingQueue;
|
|||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.json.JSONArray;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@@ -174,13 +173,9 @@ public class IapAmazon implements PurchasingListener {
|
|||||||
if (productDataResponse.getRequestStatus() != ProductDataResponse.RequestStatus.SUCCESSFUL) {
|
if (productDataResponse.getRequestStatus() != ProductDataResponse.RequestStatus.SUCCESSFUL) {
|
||||||
listener.onProductsResult(IapJNI.BILLING_RESPONSE_RESULT_ERROR, null, commadPtr);
|
listener.onProductsResult(IapJNI.BILLING_RESPONSE_RESULT_ERROR, null, commadPtr);
|
||||||
} else {
|
} else {
|
||||||
for (final String s : productDataResponse.getUnavailableSkus()) {
|
|
||||||
Log.v(TAG, "Unavailable SKU: " + s);
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, Product> products = productDataResponse.getProductData();
|
Map<String, Product> products = productDataResponse.getProductData();
|
||||||
try {
|
try {
|
||||||
JSONArray data = new JSONArray();
|
JSONObject data = new JSONObject();
|
||||||
for (Map.Entry<String, Product> entry : products.entrySet()) {
|
for (Map.Entry<String, Product> entry : products.entrySet()) {
|
||||||
String key = entry.getKey();
|
String key = entry.getKey();
|
||||||
Product product = entry.getValue();
|
Product product = entry.getValue();
|
||||||
@@ -194,7 +189,7 @@ public class IapAmazon implements PurchasingListener {
|
|||||||
// Based on return values from getPrice: https://developer.amazon.com/public/binaries/content/assets/javadoc/in-app-purchasing-api/com/amazon/inapp/purchasing/item.html
|
// Based on return values from getPrice: https://developer.amazon.com/public/binaries/content/assets/javadoc/in-app-purchasing-api/com/amazon/inapp/purchasing/item.html
|
||||||
item.put("price", priceString.replaceAll("[^0-9.,]", ""));
|
item.put("price", priceString.replaceAll("[^0-9.,]", ""));
|
||||||
}
|
}
|
||||||
data.put(item);
|
data.put(key, item);
|
||||||
}
|
}
|
||||||
listener.onProductsResult(IapJNI.BILLING_RESPONSE_RESULT_OK, data.toString(), commadPtr);
|
listener.onProductsResult(IapJNI.BILLING_RESPONSE_RESULT_OK, data.toString(), commadPtr);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
|
@@ -102,7 +102,6 @@ public class IapGooglePlay implements PurchasesUpdatedListener {
|
|||||||
p.put("date", toISO8601(new Date(purchase.getPurchaseTime())));
|
p.put("date", toISO8601(new Date(purchase.getPurchaseTime())));
|
||||||
p.put("receipt", purchase.getPurchaseToken());
|
p.put("receipt", purchase.getPurchaseToken());
|
||||||
p.put("signature", purchase.getSignature());
|
p.put("signature", purchase.getSignature());
|
||||||
p.put("original_json", purchase.getOriginalJson());
|
|
||||||
}
|
}
|
||||||
catch (JSONException e) {
|
catch (JSONException e) {
|
||||||
Log.wtf(TAG, "Failed to convert purchase", e);
|
Log.wtf(TAG, "Failed to convert purchase", e);
|
||||||
|
Reference in New Issue
Block a user