11 Commits
3.0.2 ... 3.2.0

Author SHA1 Message Date
Björn Ritzl
e6e2f2de63 Update iap.script_api 2021-09-09 13:26:08 +02:00
Björn Ritzl
3468b52658 Merge pull request #41 from BigButtonCo/master
Add original_json to transaction for validating purchases on android
2021-09-09 13:23:13 +02:00
Mathias Westerdahl
bda785ef08 Merge pull request #44 from defold/buffer-threading-fix
Fixed threading issue of checking if command buffer is empty
2021-09-07 14:34:35 +02:00
JCash
b3b79006d7 Fixed threading issue of checking if command buffer is empty 2021-08-02 10:10:00 +02:00
Björn Ritzl
8b2c7b0bca Removed old Amazon SDK version 2021-07-22 19:58:18 +02:00
Björn Ritzl
78d1c80c19 Merge pull request #42 from SalavatR/master
Brought stores to a common view,  Amazon iap_lib update
2021-07-22 14:32:30 +02:00
Salavat
beb89d507f Brought stores to a common view
Amazon iap_lib update
2021-07-20 02:32:13 +06:00
BigButtonCo
1a6d2f01e5 Merge branch 'defold:master' into master 2021-06-03 20:05:02 +02:00
Björn Ritzl
1fe29ad24a Autobuilder 2021-05-28 11:25:20 +02:00
BigButtonCo
276437b981 Update IapGooglePlay.java 2021-04-12 19:26:56 +02:00
BigButtonCo
246fcd3179 Added original_json 2021-04-12 19:22:33 +02:00
8 changed files with 95 additions and 6 deletions

76
.github/workflows/bob.yml vendored Normal file
View File

@@ -0,0 +1,76 @@
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

View File

@@ -1,3 +1,5 @@
[![Actions Status Alpha](https://github.com/defold/extension-iap/actions/workflows/bob.yml/badge.svg)](https://github.com/defold/extension-iap/actions)
# 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.

View File

@@ -226,6 +226,10 @@
type: string
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
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.

View File

@@ -4,9 +4,9 @@
<uses-sdk android:minSdkVersion="{{android.minimum_sdk_version}}" android:targetSdkVersion="{{android.target_sdk_version}}" />
<application>
<!-- For Amazon IAP -->
<receiver android:name="com.amazon.device.iap.ResponseReceiver" >
<receiver android:name = "com.amazon.device.iap.ResponseReceiver" android:permission = "com.amazon.inapp.purchasing.Permission.NOTIFY" >
<intent-filter>
<action android:name="com.amazon.inapp.purchasing.NOTIFY" android:permission="com.amazon.inapp.purchasing.Permission.NOTIFY" />
<action android:name = "com.amazon.inapp.purchasing.NOTIFY" />
</intent-filter>
</receiver>
</application>

View File

@@ -121,13 +121,14 @@ void IAP_Queue_Push(IAPCommandQueue* queue, IAPCommand* cmd)
void IAP_Queue_Flush(IAPCommandQueue* queue, IAPCommandFn fn, void* ctx)
{
assert(fn != 0);
DM_MUTEX_SCOPED_LOCK(queue->m_Mutex);
if (queue->m_Commands.Empty())
{
return;
}
DM_MUTEX_SCOPED_LOCK(queue->m_Mutex);
for(uint32_t i = 0; i != queue->m_Commands.Size(); ++i)
{
fn(&queue->m_Commands[i], ctx);

View File

@@ -11,6 +11,7 @@ import java.util.concurrent.BlockingQueue;
import org.json.JSONException;
import org.json.JSONObject;
import org.json.JSONArray;
import android.app.Activity;
import android.os.Bundle;
@@ -173,9 +174,13 @@ public class IapAmazon implements PurchasingListener {
if (productDataResponse.getRequestStatus() != ProductDataResponse.RequestStatus.SUCCESSFUL) {
listener.onProductsResult(IapJNI.BILLING_RESPONSE_RESULT_ERROR, null, commadPtr);
} else {
for (final String s : productDataResponse.getUnavailableSkus()) {
Log.v(TAG, "Unavailable SKU: " + s);
}
Map<String, Product> products = productDataResponse.getProductData();
try {
JSONObject data = new JSONObject();
JSONArray data = new JSONArray();
for (Map.Entry<String, Product> entry : products.entrySet()) {
String key = entry.getKey();
Product product = entry.getValue();
@@ -189,7 +194,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
item.put("price", priceString.replaceAll("[^0-9.,]", ""));
}
data.put(key, item);
data.put(item);
}
listener.onProductsResult(IapJNI.BILLING_RESPONSE_RESULT_OK, data.toString(), commadPtr);
} catch (JSONException e) {

View File

@@ -102,6 +102,7 @@ public class IapGooglePlay implements PurchasesUpdatedListener {
p.put("date", toISO8601(new Date(purchase.getPurchaseTime())));
p.put("receipt", purchase.getPurchaseToken());
p.put("signature", purchase.getSignature());
p.put("original_json", purchase.getOriginalJson());
}
catch (JSONException e) {
Log.wtf(TAG, "Failed to convert purchase", e);