try mollie
This commit is contained in:
parent
69a283be52
commit
644df861f0
16
README.md
16
README.md
|
@ -1,13 +1,17 @@
|
||||||
BIJ1 Compliance Facilitator App
|
BIJ1 Compliance Facilitator App
|
||||||
===============================
|
===============================
|
||||||
|
|
||||||
`npm install` installs the dependencies
|
`yarn install` installs the dependencies
|
||||||
|
|
||||||
If you also want to develop you'll want to run:
|
set the API keys for [AirTable](https://airtable.com/account) and [Mollie](https://www.mollie.com/dashboard/org_3678554/developers/api-keys):
|
||||||
`npm install --also=dev`
|
```bash
|
||||||
|
export NODE_OPTIONS=--experimental-vm-modules npx jest
|
||||||
set the [AirTable API key](https://airtable.com/account):
|
export AIRTABLE_API_KEY=<MY_KEY>
|
||||||
`export AIRTABLE_API_KEY=MY_API_KEY`
|
export MOLLIE_API_KEY_LEDEN=<MY_KEY>
|
||||||
|
export MOLLIE_API_KEY_DOEMEE=<MY_KEY>
|
||||||
|
export MOLLIE_API_KEY_SHOP=<MY_KEY>
|
||||||
|
export MOLLIE_API_KEY_DONEER=<MY_KEY>
|
||||||
|
```
|
||||||
|
|
||||||
`npm start` launches the app
|
`npm start` launches the app
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -2,6 +2,8 @@
|
||||||
"name": "bij1-compliance",
|
"name": "bij1-compliance",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"description": "BIJ1 Compliance Facilitator App",
|
"description": "BIJ1 Compliance Facilitator App",
|
||||||
|
"type": "module",
|
||||||
|
"transform": {},
|
||||||
"main": "src/app.js",
|
"main": "src/app.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node src/app.js",
|
"start": "node src/app.js",
|
||||||
|
@ -19,9 +21,12 @@
|
||||||
},
|
},
|
||||||
"homepage": "https://gitlab.com/bij1/bij1-compliance#readme",
|
"homepage": "https://gitlab.com/bij1/bij1-compliance#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@mollie/api-client": "^3.5.1",
|
||||||
"airtable": "^0.11.1",
|
"airtable": "^0.11.1",
|
||||||
"chokidar-cli": "^3.0.0",
|
"chokidar-cli": "^3.0.0",
|
||||||
"mollie": "^2.0.2"
|
"mollie": "^2.0.2",
|
||||||
|
"rxjs": "^7.3.0",
|
||||||
|
"typescript": "^4.4.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"chokidar": "^3.5.2",
|
"chokidar": "^3.5.2",
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
"use strict";
|
||||||
|
import Airtable from 'airtable';
|
||||||
|
|
||||||
|
const base = 'appXWc6Btm4KkIg8G';
|
||||||
|
const table = 'leden';
|
||||||
|
const airtable = new Airtable({});
|
||||||
|
export const tbl = airtable
|
||||||
|
.base(base)
|
||||||
|
.table(table);
|
19
src/app.js
19
src/app.js
|
@ -1,18 +1,3 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
const Airtable = require('airtable');
|
// import "./airtable.js";
|
||||||
|
// import "./mollie.js";
|
||||||
const base = 'appXWc6Btm4KkIg8G';
|
|
||||||
const table = 'leden';
|
|
||||||
const airtable = new Airtable({});
|
|
||||||
airtable
|
|
||||||
.base(base)
|
|
||||||
.table(table)
|
|
||||||
.select()
|
|
||||||
.firstPage()
|
|
||||||
// .eachPage()
|
|
||||||
// .forEach()
|
|
||||||
.then(records => {
|
|
||||||
records.forEach(record => {
|
|
||||||
console.log(record.fields);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
"use strict";
|
||||||
|
import mergeMap from "rxjs/operators";
|
||||||
|
import { of, from, concat } from "rxjs";
|
||||||
|
|
||||||
|
export const mollieKeys = {
|
||||||
|
leden: process.env.MOLLIE_API_KEY_LEDEN,
|
||||||
|
doemee: process.env.MOLLIE_API_KEY_DOEMEE,
|
||||||
|
shop: process.env.MOLLIE_API_KEY_SHOP,
|
||||||
|
doneer: process.env.MOLLIE_API_KEY_DONEER,
|
||||||
|
};
|
||||||
|
|
||||||
|
export function unrollResult(result) {
|
||||||
|
// log(result);
|
||||||
|
// const { count, nextPage, links } = result;
|
||||||
|
return concat(of(result), of(result.nextPage ? listAll(result.nextPage()) : []));
|
||||||
|
}
|
||||||
|
|
||||||
|
export function listAll(page$) {
|
||||||
|
return from(page$).pipe(
|
||||||
|
mergeMap(unrollResult)
|
||||||
|
);
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
import { tbl } from '../src/airtable.js';
|
||||||
|
|
||||||
|
test('airtable can print records', () => {
|
||||||
|
tbl
|
||||||
|
.select()
|
||||||
|
.firstPage()
|
||||||
|
// .eachPage()
|
||||||
|
// .forEach()
|
||||||
|
.then(records => {
|
||||||
|
records.forEach(record => {
|
||||||
|
console.log(record.fields);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
expect(true).toBe(true);
|
||||||
|
});
|
|
@ -1,7 +1,3 @@
|
||||||
/**
|
|
||||||
* @jest-environment jsdom
|
|
||||||
*/
|
|
||||||
|
|
||||||
test('Hello tests', () => {
|
test('Hello tests', () => {
|
||||||
expect(true).toBe(true);
|
expect(true).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
import { createMollieClient } from '@mollie/api-client';
|
||||||
|
import { mollieKeys, listAll } from '../src/mollie.js';
|
||||||
|
const log = console.log.bind(console);
|
||||||
|
|
||||||
|
test('airtable can print records', () => {
|
||||||
|
const mollieClient = createMollieClient({ apiKey: mollieKeys.leden });
|
||||||
|
const entity = mollieClient.customers;
|
||||||
|
|
||||||
|
const obs = listAll(entity.list());
|
||||||
|
|
||||||
|
log('just before subscribe');
|
||||||
|
obs.subscribe({
|
||||||
|
next(x) { log('got value ' + x); },
|
||||||
|
error(err) { console.error('something wrong occurred: ' + err); },
|
||||||
|
complete() { log('done'); }
|
||||||
|
});
|
||||||
|
log('just after subscribe');
|
||||||
|
|
||||||
|
// mollyEntity
|
||||||
|
// .list()
|
||||||
|
// .then(result => {
|
||||||
|
// console.log(result);
|
||||||
|
// // const { count, nextPage, links } = result;
|
||||||
|
// // result.forEach(item => {
|
||||||
|
// // console.log(item);
|
||||||
|
// // })
|
||||||
|
// });
|
||||||
|
|
||||||
|
// same for payments, refunds, chargebacks
|
||||||
|
expect(true).toBe(true);
|
||||||
|
});
|
Loading…
Reference in New Issue