Coder Social home page Coder Social logo

Comments (12)

j3k0 avatar j3k0 commented on July 4, 2024

I see why you would need that, and no it's not already possible.

The thing is that I would like to keep the API simple for people with simple needs (i.e. most people).

For it to be suitable for all advanced needs, I guess we will end up exposing the whole Obj-C API to JS, which btw I think would be great. Advanced users could then do whatever they need by taping directly into this low-level API. The simplified API would just be a layer above that.

As this would require almost a full rewrite of the plugin, it won't be for today (except if someone sponsors this dev).

from cordova-plugin-purchase.

maxmoore14 avatar maxmoore14 commented on July 4, 2024

I completely understand your desire to keep it simple, but in this particular case, I think all you would need is a flag in the init function (like the debug flag). Call it the autoFinish flag or something. And you can have it default to true so that it doesn't affect existing users. Leave everything exactly the same, but separate out the finish call.

if autoFinish = true
    --> finish
else
    --> do nothing (the user can manually call finish)

Right?

from cordova-plugin-purchase.

j3k0 avatar j3k0 commented on July 4, 2024

Sure the API can be tweaked for this particular thing. Well, internally it wont be as simple as you think, as the finishTransaction: method will need the objc transaction object as a parameter, so we need to maintain internally the list of unfinished transaction objects (probably in a id => object dictionary), to retrieve it later when the user calls finish. Then we probably have to add another method to cleanup/cancel unfinished transactions (those that won't be finished).

So of course I can hack this, but then I will have to hack something else for a different need. Little by little the code will begin to look kind messy, with special case 1, special case 2, etc. That's why I'm considering solving everyone's issues once and for all, by simply exposing the full objc API in JS.

Anyway, I will probably go for the tweak first, as this would add the functionality you need and I cannot spend too much time on this.

from cordova-plugin-purchase.

maxmoore14 avatar maxmoore14 commented on July 4, 2024

Thanks very much! Would be a huge help for sure.

from cordova-plugin-purchase.

j3k0 avatar j3k0 commented on July 4, 2024

Commit 40b2230 changes a behaviour when autoFinish is set to false. Failed transactions are now automatically finished. Would there be any reason not to?

from cordova-plugin-purchase.

maxmoore14 avatar maxmoore14 commented on July 4, 2024

@j3k0 No, I agree with you, can't see any reason not to. Cause a failed transaction is essentially dead anyway. No need to have the javascript finish it manually.

from cordova-plugin-purchase.

tommymei avatar tommymei commented on July 4, 2024

Was this feature confirmed to be working, I am running into an issue where I am calling noAutoFinish but the transaction is still being committed before I call finish.

I want to confirm this is working to rule out this layer as being the problem.

Thanks, love the plugin btw, got me up and running in no time.

Forgot to mention that I am using version 3.4.1

from cordova-plugin-purchase.

j3k0 avatar j3k0 commented on July 4, 2024

Hi tommy, noAutoFinish should work as expected. Any logs or code to share so I can dig in your problem?

from cordova-plugin-purchase.

tommymei avatar tommymei commented on July 4, 2024

Thanks, I will collect more info and get back to you.

from cordova-plugin-purchase.

tommymei avatar tommymei commented on July 4, 2024

I debugged it and looks like the feature is not working. The purchase starts and I see this in the logs.

2014-11-07 12:20:22.832 Play2Prep[2815:60b] InAppPurchase[objc]: Payment transaction updated (com.play2prep.play2prep.monthly.subscription):
2014-11-07 12:20:22.834 Play2Prep[2815:60b] InAppPurchase[objc]: State: PaymentTransactionStatePurchased

but the code at the end of method "paymentQueue" calls the unfinished (else) block as expected.

if (g_autoFinishEnabled) {
[[SKPaymentQueue defaultQueue] finishTransaction:transaction];
[self transactionFinished:transaction];
}
else {
[unfinishedTransactions setObject:transaction forKey:transactionIdentifier];
}

but without the "transactionFinished" method being called, the transaction goes through. I am testing this with an itunes connect test user. I tested this on iOS 7.1 and 8.0.

Any additional thoughts?

from cordova-plugin-purchase.

tommymei avatar tommymei commented on July 4, 2024

Disregard, the sandbox purchase confirmation popup was misleading and confused me. I went into manage subscription and did not see it there. The transaction feature is working.

from cordova-plugin-purchase.

j3k0 avatar j3k0 commented on July 4, 2024

Alright! Thank you for the follow up. Do you see anything that could have been added in the doc to make this clearer?

from cordova-plugin-purchase.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.