Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LICENSE Policy #32

Closed
roblav96 opened this issue Feb 17, 2016 · 7 comments
Closed

LICENSE Policy #32

roblav96 opened this issue Feb 17, 2016 · 7 comments

Comments

@roblav96
Copy link

I'm a bit confused as to what your license policy states.

I'm familiar with the MIT, but that's about it. Am I able to use this project in a commercial product I'm selling to verify my in app purchases?

@voltrue2
Copy link
Owner

Hello

Yes you may use this module in a commercial product. I only ask that the project being properly acknowledged.

Best

-Nobuyori

On Feb 18, 2016, 00:26 +0900, Rob Lavertynotifications@github.com, wrote:

I'm a bit confused as to what your license policy states.

I'm familiar with the MIT, but that's about it. Am I able to use this project in a commercial product I'm selling to verify my in app purchases?


Reply to this email directly orview it on GitHub(#32).

@roblav96
Copy link
Author

Ah! No problem at all! I have a specific page just for that. Do you have a logo or media you'd like for me to put?

@roblav96
Copy link
Author

Any plans to implement promises? I'm going to try bluebirds promisify

@voltrue2
Copy link
Owner

Hello Rob,

Thanks for reaching out.
I don't have a logo at the moment. If you don't mind mentioning my module and name somewhere in your project(s) would be good enough for me :-)

As for promises, I am working on that right now.
I'm a little busy with other projects right now, but I'm planning on releasing the promise version of the module in 2 months or so.

I'm always open to feedbacks and thoughts!

Best

-Nobuyori

On Feb 18, 2016, 03:17 +0900, Rob Lavertynotifications@github.com, wrote:

Any plans to implement promises? I'm going to try bluebirds promisify


Reply to this email directly orview it on GitHub(#32 (comment)).

@roblav96
Copy link
Author

This works wonders!

var iap = require( 'in-app-purchase' )
iap.Pvalidate = Promise.promisify( iap.validate )
iap.config( {
    applePassword: "", // this comes from iTunes Connect
    googlePublicKeyPath: "" // this is the path to the directory containing iap-sanbox/iap-live files
} )
iap.setup()



module.exports = function ( req, res, next ) {

    req.that = {
        data: _.pick( req.json, [ 'recipt' ] ),
        xid: req.xid
    }

    Promise.resolve().bind( req.that ).then( function () {

        if ( _.isInvalidUndefined( this.data, [ 'recipt' ] ) ) {
            throw new restify.errors.InternalServerError( 'isInvalidUndefined!' )
        }

        return iap.Pvalidate( iap.APPLE, this.data.recipt )

    } ).then( function ( response ) {

        if ( !iap.isValidated( response ) ) {
            throw new restify.errors.BadRequestError( 'Invalid purchase recipt!!!' )
        }

        this.recipt = _.last( iap.getPurchaseData( response, {
            ignoreExpired: true
        } ) )

        if ( _.isUndefined( this.recipt.expirationDate ) ) {
            throw new restify.errors.BadRequestError( 'Invalid purchase recipt!!!' )
        }

        return r.table( 'users' ).get( this.xid ).update( {
            premium: this.recipt.expirationDate
        } )

    } ).then( function () {

        return redis.hset( 'tok:' + this.xid, 'prm', this.recipt.expirationDate )

    } ).then( function () {

        res.send( {
            stamp: this.recipt.expirationDate
        } )
        return next()

    } ).catch( restify.errors.BadRequestError, function ( err ) {
        res.send( {
            err: true,
            msg: err.message
        } )
        return next()
    } ).catch( restify.errors.InternalServerError, function ( err ) {
        return next( err )
    } ).catch( function ( err ) {
        return next( new restify.errors.InternalServerError( err ) )
    } )

}

Promisify works like a charm!

@voltrue2
Copy link
Owner

Awesome!

Thanks for the snippet. I just need to find the time to do this :-)

On Feb 18, 2016, 09:04 +0900, Rob Lavertynotifications@github.com, wrote:

This works wonders!

variap=require('in-app-purchase')iap.Pvalidate=Promise.promisify(iap.validate)iap.config( { applePassword:"",// this comes from iTunes ConnectgooglePublicKeyPath:""// this is the path to the directory containing iap-sanbox/iap-live files} )iap.setup()module.exports=function(req,res,next) {req.that={ data:.pick(req.json, ['recipt'] ), xid:req.xid}Promise.resolve().bind(req.that).then(function() {if(.isInvalidUndefined(this.data, ['recipt'] ) ) {thrownewrestify.errors.InternalServerError('isInvalidUndefined!') }returniap.Pvalidate(iap.APPLE,this.data.recipt) } ).then(function(response) {if(!iap.isValidated( response ) ) {thrownewrestify.errors.BadRequestError('Invalid purchase recipt!!!') }this.recipt=.last(iap.getPurchaseData( response, { ignoreExpired:true} ) )if(.isUndefined(this.recipt.expirationDate) ) {thrownewrestify.errors.BadRequestError('Invalid purchase recipt!!!') }returnr.table('users').get(this.xid).update( { premium:this.recipt.expirationDate} ) } ).then(function() {returnredis.hset('tok:'+this.xid,'prm',this.recipt.expirationDate) } ).then(function() {res.send( { stamp:this.recipt.expirationDate} )returnnext() } ).catch(restify.errors.BadRequestError,function(err) {res.send( { err:true, msg:err.message} )returnnext() } ).catch(restify.errors.InternalServerError,function(err) {returnnext( err ) } ).catch(function(err) {returnnext(newrestify.errors.InternalServerError( err ) ) } ) }

Promisify works like a charm!


Reply to this email directly orview it on GitHub(#32 (comment)).

@roblav96
Copy link
Author

No problem man!

jackywxd pushed a commit to jackywxd/in-app-purchase that referenced this issue Dec 8, 2022
…cha-9.0.3

build(deps-dev): bump mocha from 9.0.2 to 9.0.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants