onepf / opfiab Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
Hello,
I have a problem with test inApps. I use sku "android.test.purchased"
BaseBillingProvider.handleRequest({
"type": "PURCHASE",
"sku": "android.test.purchased"
});
BillingEventDispatcher.onResponse({
"type": "PURCHASE",
"status": "SUCCESS",
"provider_info": {
"name": "Google",
"package_name": "com.google.play",
"installer": "com.android.vending"
},
"purchase": {
"sku": "android.test.purchased",
"type": "ENTITLEMENT",
"provider_info": {
"name": "Google",
"package_name": "com.google.play",
"installer": "com.android.vending"
},
"original_json": {
"packageName": "***",
"orderId": "transactionId.android.test.purchased",
"productId": "android.test.purchased",
"developerPayload": "",
"purchaseTime": 0,
"purchaseState": 0,
"purchaseToken": "inapp:***:android.test.purchased"
},
"token": "inapp:***:android.test.purchased",
"purchaseTime": 0,
"canceled": false
},
"verification_result": "ERROR"
});
From logs i get "Either data or signature is empty."
private static BillingProvider newGoogleProvider() {
final GoogleMapSkuResolver skuResolver = new GoogleMapSkuResolver();
skuResolver.add("android.test.purchased", SkuType.ENTITLEMENT);
return new GoogleBillingProvider.Builder(context)
.setPurchaseVerifier(new SimpleGooglePurchaseVerifier(getPublicLicenseKey()))
.setSkuResolver(skuResolver)
.build();
}
public static Configuration getRelevantConfiguration(final Context context) {
final Configuration.Builder builder = new Configuration.Builder();
builder.setBillingListener(new StoreManagerListener(context));
builder.addBillingProvider(newGoogleProvider());
return builder.build();
}
There is a check in dev library version, that requires purchase json to have orderId field, if library is not in debug mode.
https://github.com/onepf/OPFIab/blob/dev/opfiab-providers/google/src/main/java/org/onepf/opfiab/google/GoogleBillingProvider.java#L164
However, in-app purchases can be tested from PlayStore Beta distribution channel, which will contain app in release build type, obviously. And google sends empty orderId for test purhases.
In that manner, test purchase can never complete in app, downloaded from Beta channel.
I think this check should be removed from library and how about you, devs?
Amazon allows multiple child SKUs for single parent subscription SKU. This child SKUs represent different duration options.
Current implementation doesn't distinguish such SKUs, which makes it difficult to load proper SKU details.
AmazonBilling provider uses Service\BroadcastReceiver flow to handle requests. Current implementation is a little bit unreliable and somewhat confusing - there's no way to distinguish one purchase response from another.
Best way to workaround it is probably make billing request handling a blocking operation. However Amazon doesn't guarantee callback after posted request - there should be some failsafe so library won't get stuck waiting for callback that will never arrive.
Solution likely requires quite a bit of decompiled code reading.
Hello,
The current version of FragmentIabHelperImpl does not work with native fragments (and PreferenceFragment) prior api level 17. This is because the method getChildFragmentManager() isnt available there. This makes it not possible to use this Helper in PreferenceFragment, which also lacks an official supportversion.
As a workarround I implemented the Activity version and forwarded calls to my settings fragment.
The reason why I opened this issue is because I think this should be pointed out somewhere in the wiki or javadoc. Right now, you have to read the source or find it out the hard way (by exception :p )
Regards,
danijoo
Current name OPFIab.setup()
is confusing. This method should be renamed to better represents its function - picking BillingProvider.
Also this method should probably be called automatically from OPFIab.init()
. However it should be possible to disable this behaviour in Configuration
.
Library can't rely on static memory when handling billing request, moreover billing response is not even guaranteed by successfully handled billing request. Because of this BillingResponse only contains information returned by BillingProvider.
For more convenient API BillingResponse should contain all relevant information from corresponding BillingRequest, foremost SKU(s).
how the user can select the payment gateway in iap window
Current implementation calls unregister
right after activity onPause()
call since it's the only one guaranteed by framework. This might not be the best approach especially with minSdkVersion
set to 15.
Best place for this calls is probably in onStart()
/onStop()
Current implementation might not work properly with multiprocess applications. Easiest way to work around it is probably to allow only main process to make init()
call.
I'm getting this exception for yandexBillingProvider (looks like something is wrong related to AIDL).
Did I do someting wrong in my code ?
(I'm using the latest 0.4 artefacts from mavenCentral and I looked at trivialDrive to implement the skumaps..)
Caused by: java.lang.IllegalStateException: Couldn't extract Stub implementation from AIDL class.
at org.onepf.opfiab.billing.AidlBillingHelper.(AidlBillingHelper.java:101)
at org.onepf.opfiab.openstore.OpenStoreBillingHelper$OpenAppstoreHelper.(OpenStoreBillingHelper.java:211)
at org.onepf.opfiab.openstore.OpenStoreBillingHelper.(OpenStoreBillingHelper.java:56)
at org.onepf.opfiab.openstore.OpenStoreBillingProvider.(OpenStoreBillingProvider.java:84)
at org.onepf.opfiab.openstore.OpenStoreBillingProvider$Builder.build(OpenStoreBillingProvider.java:397)
at org.lakedaemon.android.InAppBuy.yandexBillingProvider(InAppBuy.kt:60)
at org.lakedaemon.android.InAppBuy.billingConfiguration(InAppBuy.kt:100)
at org.lakedaemon.dictionary.DictionaryApp.onCreate(DictionaryApp.kt:83)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1013)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4775)
at android.app.ActivityThread.access$1600(ActivityThread.java:171)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1369)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5679)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107)
at dalvik.system.NativeStart.main(Native Method)
Subj.
A can't build my app which has minSdkVersion=14. There is any reason for minSdk 15 ?
I'm not sure if this is the right forum for discussing this, but I would like to propose completely removing the dependency on EventBus.
While EB is a nice library for some use cases, I disagree with the forced dependency for the following reasons:
The library works properly with Google Play but not with the Amazon Store App.
I have downloaded the latest Amazon App and tested with my app and also the Trivial Drive.
These are the logs and results:
06-04 13:13:05.774: D/d(2307): In App Purchasing SDK - Sandbox Mode: PurchasingListener registered: org.onepf.opfiab.amazon.AmazonBillingHelper@b3486198
06-04 13:13:05.774: D/d(2307): In App Purchasing SDK - Sandbox Mode: PurchasingListener Context: org.myklos.inote.SettingsView@b33ef490
06-04 13:13:05.814: D/OPF(2307): --> SetupManager.newResponse(org.onepf.opfiab.model.event.SetupStartedEvent@b339aec0);
06-04 13:13:05.814: D/OPF(2307): --> GoogleBillingHelper.isBillingSupported();
06-04 13:13:05.814: D/OPF(2307): Can't bind to service: class com.android.vending.billing.IInAppBillingService$Stub
06-04 13:13:05.844: D/OPF(2307): Check if billing supported: null
06-04 13:13:05.844: D/OPF(2307): Package installer: null
06-04 13:13:06.094: D/OPF(2307): --> BillingEventDispatcher.onSetupResponse({
06-04 13:13:06.094: D/OPF(2307): "authorized": false,
06-04 13:13:06.094: D/OPF(2307): "status": "FAILED",
06-04 13:13:06.094: D/OPF(2307): "provider": null
06-04 13:13:06.094: D/OPF(2307): });
06-04 13:13:55.095: D/org.myklos.inote.LicenseClass(2307): Purchase
06-04 13:13:55.115: D/OPF(2307): --> BillingEventDispatcher.onResponse({
06-04 13:13:55.115: D/OPF(2307): "purchase": null,
06-04 13:13:55.115: D/OPF(2307): "provider_info": null,
06-04 13:13:55.115: D/OPF(2307): "verification_result": null,
06-04 13:13:55.115: D/OPF(2307): "type": "PURCHASE",
06-04 13:13:55.115: D/OPF(2307): "status": "NO_BILLING_PROVIDER"
06-04 13:13:55.115: D/OPF(2307): });
06-04 13:13:55.115: D/org.myklos.inote.LicenseClass(2307): PURCHASE NO_BILLING_PROVIDER
It seems the library does not detect the Amazon App installed.
The initialization of the library is as follows:
// Init configuration
Configuration configuration = new Configuration.Builder()
.addBillingProvider(newGoogleProvider())
.addBillingProvider(newAmazonProvider())
.setBillingListener(myListener)
.build();
OPFLog.setEnabled(true, true);
OPFIab.init(mActivity.getApplication(), configuration);
iabHelper = OPFIab.getAdvancedHelper();
iabHelper.register();
OPFIab.setup();
where the newAmazonProvider method is:
private BillingProvider newAmazonProvider() {
final MapSkuResolver skuResolver = new MapSkuResolver();
skuResolver.add(ITEM_SKU, AMAZON_ITEM_SKU);
return new AmazonBillingProvider.Builder(mContext)
.setSkuResolver(skuResolver)
.build();
}
Please, let me know what else you need from me.
Thank you,
Jakub
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.