mollie-es6
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "mollie-es6", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Mollie module ready for ES6 usage", | ||
@@ -5,0 +5,0 @@ "main": "app.js", |
# Mollie ES6 API client for Node.js # | ||
Mollie API made ready for ES6 usage. | ||
*You can see a list of implemented functions at the bottom.* | ||
*Till Version 1.0.0, this is WIP* | ||
## Requirements ## | ||
@@ -51,4 +48,5 @@ To use the Mollie API client, the following things are required: | ||
```ES6 | ||
const payment_id = 'some_id'; | ||
try { | ||
const payment = yield mollie.payments.get(payment.id); | ||
const payment = yield mollie.payments.get(payment_id); | ||
if(payment.isPaid()) { | ||
@@ -66,8 +64,62 @@ console.log('Payment is paid'); | ||
| Functionality |Implemented | | ||
|:-------------:|:-------------:| | ||
| Create | Yes | | ||
| Get | Yes | | ||
| List | Yes | | ||
#### Create #### | ||
```ES6 | ||
try { | ||
const payment = yield mollie.payments.create({ | ||
amount: 10.00, | ||
description: "My first API payment", | ||
redirectUrl: "https://webshop.com/api/payments/response" | ||
}); | ||
res.redirect(payment.getPaymentUrl()); | ||
} catch (e) { | ||
// Handle error | ||
} | ||
``` | ||
#### Get #### | ||
```ES6 | ||
const payment_id = 'some_id'; | ||
const options = { | ||
method: 'creditcard' | ||
}; | ||
try { | ||
const payment = yield mollie.payments.get(payment_id, options); | ||
if(payment.isPaid()) { | ||
console.log('Payment is paid'); | ||
} | ||
} catch (e) { | ||
// Handle error | ||
} | ||
``` | ||
#### List #### | ||
```ES6 | ||
const options = { | ||
count: 100, | ||
offset: 200 | ||
} | ||
try { | ||
const payments_list = yield mollie.payments.list(options); | ||
/* | ||
payments_list = { | ||
totalCount: Number, | ||
offset: Number, | ||
count: Number, | ||
data: [Payments], | ||
links: { | ||
first: String(url), | ||
previous: String(url), | ||
next: String(url), | ||
last: String(url) | ||
} | ||
} | ||
*/ | ||
} catch (e) { | ||
// Handle error | ||
} | ||
``` | ||
### Methods ### | ||
@@ -74,0 +126,0 @@ |
51254
147