npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mollie-reseller-es6

v0.5.0

Published

Mollie Reseller ES6 API

Downloads

7

Readme

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
    ]