Files
habitica/website/server/libs/inAppPurchases.js
Matteo Pagliazzi cb42a31c43 Node 8 (WIP) (#9946)
* start upgrade to node 8

* upgrade travis

* improve travis

* Remove bluebird, babel (except for modules) from server (WIP) (#9947)

* remove bluebird, babel from server (except for modules)

* fixes

* fix path

* fix path

* fix export

* fix export

* fix test

* fix tests

* remove plugin for transform-object-rest-spread since it is supported in node8

* babel: correct syntax rest spread

* remove bluebird

* update migrations archive readme

* fix package-lock.json

* fix typo

* add package-loc
2018-03-15 19:59:36 +01:00

28 lines
880 B
JavaScript

import nconf from 'nconf';
import util from 'util';
import iap from 'in-app-purchase';
// Validation ERROR Codes
// const INVALID_PAYLOAD = 6778001;
// const CONNECTION_FAILED = 6778002;
// const PURCHASE_EXPIRED = 6778003;
iap.config({
// This is the path to the directory containing iap-sanbox/iap-live files
googlePublicKeyPath: nconf.get('IAP_GOOGLE_KEYDIR'),
googleAccToken: nconf.get('PLAY_API:ACCESS_TOKEN'),
googleRefToken: nconf.get('PLAY_API:REFRESH_TOKEN'),
googleClientID: nconf.get('PLAY_API:CLIENT_ID'),
googleClientSecret: nconf.get('PLAY_API:CLIENT_SECRET'),
applePassword: nconf.get('ITUNES_SHARED_SECRET'),
});
module.exports = {
setup: util.promisify(iap.setup.bind(iap)),
validate: util.promisify(iap.validate.bind(iap)),
isValidated: iap.isValidated,
getPurchaseData: iap.getPurchaseData,
GOOGLE: iap.GOOGLE,
APPLE: iap.APPLE,
};