Skip to content
This repository was archived by the owner on Mar 15, 2018. It is now read-only.

Restore product from receipt (bug 981235) - #16

Merged
kumar303 merged 1 commit into
mozilla:masterfrom
kumar303:receipt-proof
Jun 17, 2014
Merged

Restore product from receipt (bug 981235)#16
kumar303 merged 1 commit into
mozilla:masterfrom
kumar303:receipt-proof

Conversation

@kumar303

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread README.rst Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any documentation on what the info object is? Is it just an object with a productId?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It just has productId for now but I would like to document the info object. I should add that to the docs.

@mstriemer

Copy link
Copy Markdown

r+wc

Still not crazy about node-style callbacks though. It might be nice for oninit to be passed an array of receipts but that could be handled later.

Weird suggestion for the possibly future promises: use forEach for onrestore. I don't think that's a convention in JS but we should make it one.

fxpay.init().forEach(function (receipt) {
    // Do stuff.
}).done(function (receipts) {
    // Got all of them!
}).fail(function (error) {
    // Oops.
});

@kumar303

Copy link
Copy Markdown
Contributor Author

I think moving to promises might be worthwhile.

As for passing a restoration callback an array of products (or receipts), I thought about this and I don't think it's practical. I think you'd want one callback per product so that you can enable/disable each one independently of the others. Also, the forEach...fail suggests that one failure would abort all other receipt checks, including valid ones. I still lean toward one callback per product.

@kumar303

Copy link
Copy Markdown
Contributor Author

The thing I like about node style callbacks is you don't have to define a separate error callback. It seems more concise. Also, it forces the caller to at least think about errors.

@mstriemer

Copy link
Copy Markdown

r+

kumar303 added a commit that referenced this pull request Jun 17, 2014
Restore product from receipt (bug 981235)
@kumar303
kumar303 merged commit df34fe4 into mozilla:master Jun 17, 2014
@kumar303
kumar303 deleted the receipt-proof branch June 17, 2014 21:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants