// tslint:disable:no-console import * as mongoose from 'mongoose'; import * as redis from 'redis'; import { chevre } from '../../../../lib/index'; import { call } from '../../../../lib/chevre/service/task/orderProgramMembership'; const project = { id: String(process.env.PROJECT_ID) }; async function main() { await mongoose.connect(process.env.MONGOLAB_URI, { autoIndex: false }); const redisClient = redis.createClient({ host: process.env.REDIS_HOST, port: Number(process.env.REDIS_PORT), password: process.env.REDIS_KEY }); const result = await call( { agent: { typeOf: chevre.factory.personType.Person, id: 'b2bc2b6d-aea2-41fc-9f6e-e4ec89c11d2e', identifier: [ { name: 'tokenIssuer', value: String(process.env.ISS) }, { name: 'iss', value: String(process.env.ISS) } ] }, object: { seller: { id: '5d0abf30ac3fb200198ebb2c' }, typeOf: chevre.factory.offerType.Offer, itemOffered: { typeOf: chevre.factory.permit.PermitType.Permit, name: '[development]会員ポイントプログラム', issuedThrough: { id: '5afff104d51e59232c7b481b', typeOf: chevre.factory.product.ProductType.MembershipService } }, id: '7k9f3ht34', identifier: 'AnnualPlan' }, project: { typeOf: chevre.factory.organizationType.Project, id: project.id }, typeOf: chevre.factory.actionType.OrderAction } )({ connection: mongoose.connection, redisClient }); console.log(result); } main() .then(console.log) .catch(console.error);