Socket
Socket
Sign inDemoInstall

mollie-reseller-es6

Package Overview
Dependencies
101
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    mollie-reseller-es6

Mollie Reseller ES6 API


Version published
Weekly downloads
5
increased by66.67%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Mollie

Mollie Reseller API client in ES6

Mollie Reseller API client written in ES6 by an official Mollie Partner / Reseller.

Note: Till version 1.0 of this module, not all functions are implemented and / or tested check below to see a full list of implemented functions and how to use them.

Requirements

To use the this module, the following is required:

  • Node.js v6.0.0 or higher
  • You can Sign up here for free.
  • You need to accept the Mollie Reseller Agreement for this module to work

Installation

You can install this module with NPM:

npm install --save mollie-reseller-es6

Getting started

Require the library.

    const API = require('mollie-reseller-es6');

Set the basics needed

    const keys = {
        "partner_id": 1234567,
        "profile_key": "profile_key",
        "secret": "site_secret"
    }
    const reseller = new API(keys);

All (main) functions return promises, which you can either yield in a try / catch or resolve it foo.then().catch()

Tips

If you're managing multiple reseller accounts on 1 server, it's ofcourse also possible to instantiate the class multiple times.

    const account_1 = new API(keys_1);
    const account_2 = new API(keys_2);

Implemented instance functions

Account

Claim
    const username = 'customers username';
    const password = 'customers password';
    try {
        const result = yield reseller.accountClaim(username, password);
        if(result.success) {
            // Account successfully claimed
        } else {
            // Something went wrong
        }
    } catch (e) {
        // Handle error
    }
Account Valid
    const username = 'customers username';
    const password = 'customers password';
    try {
        const result = yield reseller.accountValid(username, password);
        if(result.success) {
            // Account exists
        } else {
            // Something went wrong
        }
    } catch (e) {
        // Handle error
    }

Profile

Profiles
    const username = 'customers username';
    const password = 'customers password';
    const partner_id_customer = 1234568
    try {
        const result = yield reseller.profiles({username, password});
        // or
        const result = yield reseller.profiles({partner_id_customer});
        if(result.success) {
            // Account exists and is a sub of yours
        } else {
            // Account invalid
        }
    } catch (e) {
        // Handle error
    }

Static functions

Here are some static functions that might prove useful, maybe even for other projects!

stringToEncodedURI

URIencodes a String as the way Mollie requires us to. The standard encodeURIComponent(String) functions is not enough.

    const string_to_be_encoded = '/api/reseller/v1/account-valid?partner_id=1234567&etc=more';
    const encoded_string = API.stringToEncodedURI(string_to_be_encoded);

getLegalForms

Returns an array with the legal forms Mollie accepts. Might I miss some, please do a pull request :)

    const legal_forms = API.getLegalForms();

Printing this would result in:

    [
        {
            "key": "eenmanszaak",
            "value": "Eenmanszaak (The Netherlands)"
        },
        {
            "key": "eenmanszaak-be",
            "value": "Eenmanszaak (Belgium)"
        },
        {
            "key": "eenmans-bvba-be",
            "value": "Eenmans besloten vennootschap met beperkte aansprakelijkheid"
        },
        {
            "key": "maatschap",
            "value": "Maatschap"
        },
        {
            "key": "vof",
            "value": "VOF (The Netherlands)"
        },
    // Etc etc etc
    ]

Keywords

FAQs

Last updated on 07 May 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc