Giter Club home page Giter Club logo

mangopay2-nodejs-sdk's Introduction

Mangopay Node.js SDK Build Status

MangopaySDK is a Node.js client library to work with Mangopay REST API.

Installation

Install the module via npm

npm install mangopay2-nodejs-sdk --save

Usage inside your app

var mangopay = require('mangopay2-nodejs-sdk');

var api = new mangopay({
    clientId: 'your_client_id',
    clientApiKey: 'your_client_api_key',
    // Set the right production API url. If testing, omit the property since it defaults to sandbox URL
    baseUrl: 'https://api.mangopay.com'
});

api.Users.create(...)

Supported options

Option Default value Description
clientId null API Client Id
clientApiKey null API Client Api Key
baseUrl "https://api.sandbox.mangopay.com" API Base URL. The default value points to sandbox. Production is 'https://api.mangopay.com'
debugMode false Active debugging
logClass function() {console.log(arguments)} Log function to be used for debug
connectionTimeout 30000 Set the connection timeout limit (in milliseconds)
responseTimeout 80000 Set the response timeout limit (in milliseconds)
apiVersion 'v2.01' API Version
errorHandler function(options, err) {console.error(options, err)} Set a custom error handler

Documentation

Github Full Node.js SDK Documentation is located in /docs folder. You can also access API References on our website.

License

MangopaySDK is distributed under MIT license, see the LICENSE file.

Contacts

Report bugs or suggest features using issue tracker on GitHub.

Account creation

You can get yourself a free sandbox account or sign up for a production account by registering on the Mangopay site (note that validation of your production account involves several steps, so think about doing it in advance of when you actually want to go live).

Creating a user

Using a hash of properties:

    mangopay.Users.create({
        "FirstName": "Victor",
        "LastName": "Hugo",
        "Address": "1 rue des Misérables, Paris",
        "Birthday": 1300186358,
        "Nationality": "FR",
        "CountryOfResidence": "FR",
        "Occupation": "Writer",
        "IncomeRange": "6",
        "ProofOfIdentity": null,
        "ProofOfAddress": null,
        "PersonType": "NATURAL",
        "Email": "[email protected]",
        "Tag": "custom tag",
    }, function(model) {
        // User created - using callback
    }).then(function(model){
        // User created - using promise
    });

Using Mangopay SDK pre-defined models:

    var myUser = new api.models.UserLegal({
        Name: 'MangoPay',
        Email: '[email protected]',
        LegalPersonType: 'BUSINESS',
        LegalRepresentativeFirstName: 'Mango',
        LegalRepresentativeLastName: 'Pay',
        LegalRepresentativeEmail: '[email protected]',
        HeadquartersAddress: new api.models.Address({
            AddressLine1: "4101 Reservoir Rd NW",
            AddressLine2: "",
            City: "Washington",
            Region: "District of Columbia",
            PostalCode: "20007",
            Country: "US"
        }),
        LegalRepresentativeBirthday: 1300186358,
        LegalRepresentativeNationality: 'FR',
        LegalRepresentativeCountryOfResidence: 'FR',
        CompanyNumber: 123456789,
        Tag: 'custom tag'
    });

    api.Users.create(myUser).then(function(){
        // Output the created user data to console
        console.log(myUser.Name + ' user created at ' + myUser.CreationDate);
    });

Promise vs Callback

Mangopay Node.js SDK supports both callback and promise approach. Here is how they can be implemented :

    api.Service.method(... , function(data, response, err){
        // Callback method
    })

    api.Service.method(...).then(function(data) {
        // Promise function called
    }, function(error) {
        //exception
    })

Pagination / Filtering

In order to paginate or filter results, we can use options.parameters to specify these options:

    api.Transactions.getAll({
        parameters: {
            // Pagination
            per_page: 2,
            page: 2,

            // Filters
            BeforeDate: 1414000367,
            AfterDate: 1414000367,
            Nature: REGULAR,
            Status: FAILED,
            Type: TRANSFER
        }
    }

Reading server response headers

For reading the server response headers we can use options.resolveWithFullResponse: true

    api.Users.getAll(null, {
      parameters: {
        per_page: 1
      },
      resolveWithFullResponse: true
    }).then(function(response){
      // Read pages count
      console.log(response.headers['x-number-of-pages']);

      // Read response body
      console.log(response.body);
    });

Sample usage of Mangopay SDK installed with npm in a Node.js project

Don't forget to check examples folder !

Contributing

npm start                       // installs dependencies and global mocha for testing and jsdox for documentation
npm test                        // runs the mocha tests
npm run-script documentation    // update documentation using jsdox, make sure to have it installed globally

Unit Tests

Mocha tests are placed under /test/ folder. To run the tests, make sure you have all dependencies installed. Check Contributing section for details.

mangopay2-nodejs-sdk's People

Contributors

ayhid avatar catacraciun avatar cosmin-margarit avatar effe-ickx avatar fetrarij avatar freddypoly avatar fredericdelordm avatar gabriellupu avatar hobailey avatar hostyn avatar hubyrod avatar ifiokjr avatar iulian03 avatar jeromebotineau avatar jgautheron avatar jordhanmadec avatar kevin68 avatar mangomaxoasis avatar mesteve avatar mickaelpois avatar mihaimoiseanu avatar msolovastru-ro avatar murarumihai avatar shengdaliu avatar silvianagh avatar solojr avatar stefanghivi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mangopay2-nodejs-sdk's Issues

Create payout : Cannot read property 'bind' of undefined

Hello,

I'm trying to use the function PayOuts.create but i keep getting the error :

Create Payout needs MeanOfPaymentDetails or PaymentType undefined
TypeError: Cannot read property 'bind' of undefined

This is the payout object i'm trying to run :

{  
  DebitedWalletId: 27394454,
  MeanOfPaymentDetails: {
    BankAccountId: 27445735,
    BankWireRef: 'invoice 7282'
  },
  PaymentType: 'BANK_WIRE',
  AuthorId: 27394110,
  CreditedUserId: 27394110,
  DebitedFunds: {
    Currency: 'EUR',
    Amount: 8500
  },
  Fees: {
    Currency: 'EUR',
    Amount: 0
  },
  Tag: 'custom meta'
}

Am I missing something ?

PayIn needs a PaymentType

Hi,I am trying to make transaction using customer cardId already added to Mango Pay.
My code -
` let data={

    "AuthorId" : "24704378",
    "CreditedUserId" :"24704378",
    "DebitedFunds" : {"Currency":"EUR","Amount":5000},
    "CreditedWalletId":"24704381",
    "CardId":"24704387",
    "SecureMode":"DEFAULT",
    "SecureModeReturnURL":"http://localhost"
}`

MANGO_PAY_API.PayIns.create(data).then(function(data){ console.log(data); },function(err){ console.log("errr") console.log(err); })

Error is coming - "PayIn needs a PaymentType"

Please help in this issue

Getting Response with promise ?

Hi,

For multi-pages request I want to have access on header params.
I was using promise but I think there is someting wrong with this line

resolve(data, response); on api.js

Does Promise can handle multiple resolve value ?
also I don't see any test using response value.

for now I can use callback and I cannot resolve this without breaking existing code, maybe with an additional parmeter.
{ parameters: { returnResponse : true} } will produce => resolve({data, response});

Thanks,

Mica

The 3DSecure authentification has failed

Hi,

In Sandbox, each of these cards (3569990000000132, 3569990000000157) causes the 3D Secure authentification to fail with the following message. Did I miss something? It seemed to be working a few days ago.
{
Id: '24446943',
CreationDate: 1492612438,
AuthorId: '22457551',
DebitedFunds: { Currency: 'EUR', Amount: 10678 },
AuthorizationDate: null,
Status: 'FAILED',
PaymentStatus: 'CANCELED',
ExpirationDate: null,
PayInId: null,
ResultCode: '101301',
ResultMessage: 'Secure mode: The 3DSecure authentication has failed',
SecureMode: 'DEFAULT',
CardId: '24001605',
SecureModeReturnURL: 'https://www.koalap.com/3DSecure?preAuthorizationId=24446943',
SecureModeRedirectURL: null,
SecureModeNeeded: true,
PaymentType: 'CARD',
ExecutionType: 'DIRECT',
StatementDescriptor: null }

apiMethods wrong variables

There is an issue in the apiMethods.js file for the routes :

  • mandates_get_for_user
  • mandates_get_for_bank_account

The id parameter is not written as expected : its is {$id}, and should be ${id}

EAI_AGAIN error

Hello,

Different API calls (get user cards, get user bank accounts, register card) sometimes give the following error:

Error: getaddrinfo EAI_AGAIN api.sandbox.mangopay.com:443 at Object.exports._errnoException (util.js:874:11) at errnoException (dns.js:31:15) at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:77:26)

I am using the sandbox for now and the SDK v1.2.0.

Thank you

Sub models aren't effective

As discussed, the main models are made of free JSON effecively, rather than using sub-models etc as per our other SDKs (eg using PaymentDetails or ExecutionDetails which aren't actually API fields, but group various API fields required for each case)

Problem importing sdk in React-Native

Trying to import the SDK from a React-Native project via npm, though it seems to fail reading directories/files.

capture d ecran 2017-05-11 a 12 42 41

Is the nodejs mangopay sdk compatible with React-Native?

Troubles creating direct payin

Hello, I'm doing an integration with mangopay (using the sadbox) and I'm having troubles with the payin.

I'm using the example card (cardNumber = '4970100000000154', cardExpirationDate = '1019', cardCvx = '123')

I have this:

let params = {
    AuthorId: userId,
    CreditedWalletId: walletId,
    DebitedFunds: {
      Currency: currency,
      Amount: ammount
    },
    Fees: {
      Currency: currency,
      Amount: ammount
    },
    SecureModeReturnURL: 'http://test.com',
    CardId: cardId
}

api.PayIns.create(params)
    .then(payIn => resolve(payIn))
    .catch(err => reject(err))

The problem is that when I do de call, the method create doesn't return nothing.
I'm doing something wrong?

Improve createBankAccount without Type error

Hello, can i have help plz ?
I can create a user, create a wallet, but i can't create a bank account.
This function does nothing. No warnings... my callback is never called.

var api = new mangopay({...});
api.Users.create({...}, function(user) {
api.Users.createBankAccount(user.Id, {
"OwnerAddress": 'XXX',
"OwnerName": 'XXX',
"IBAN": 'FR7630004000031234567890143',
"BIC": 'BNPAFRPP'
}, function(data){
console.log('BankAccount', data);
});
});

Your authorization do not allow you to access to this information

Hello,

When I make an API call (user creation, payin whatever) I sometimes get the following error:

{ Message: 'Your authorization do not allow you to access to this information',
Type: 'not_authorized',
Id: '3b54f507-6805-49c4-beef-5e92da838c66#1476384039',
Date: 1476384040,
errors: null }

Your authorization do not allow you to access to this information { Message: 'Your authorization do not allow you to access to this information',
Type: 'not_authorized',
 Id: '3b54f507-6805-49c4-beef-5e92da838c66#1476384039',
 Date: 1476384040,
errors: null }

On my local environment I had the error every once in a while but when the app is deployed it's way more frequent. Please note that I am using the sandbox for now.

Error not caught using promises

Hello,

Using "mangopay2-nodejs-sdk": "^1.3.2", it seems that when using promises errors are not caught in the catch block:

mangoPayApi.CardRegistrations.create({
    "UserId": '12345678',
    "Currency": "EUR",
    "CardType": "CB_VISA_MASTERCARD"
  }).then((aCardRegistration) => {
    console.log('Promise OK');
    // console.log(aCardRegistration);
  }).catch((e) => {
    console.log('Promise failed');
    console.log(e);
  });

Since the UserId does not exists, the promise will fail. However, the output is:

W20170109-23:03:21.534(1)? (STDERR) The ressource does not exist { Message: 'The ressource does not exist',
W20170109-23:03:21.535(1)? (STDERR)   Type: 'ressource_not_found',
W20170109-23:03:21.535(1)? (STDERR)   Id: 'a04adf4a-6569-44ad-aafd-1f6e23424ca7#1483999401',
W20170109-23:03:21.535(1)? (STDERR)   Date: 1483999402,
W20170109-23:03:21.536(1)? (STDERR)   errors: { RessourceNotFound: 'Cannot found the ressource User with the id=12345678 ' } }
*20170109-23:03:21.538(1)? Promise OK <===
I20170109-23:03:21.538(1)? { Message: 'The ressource does not exist',
I20170109-23:03:21.539(1)?   Type: 'ressource_not_found',
I20170109-23:03:21.540(1)?   Id: 'a04adf4a-6569-44ad-aafd-1f6e23424ca7#1483999401',
I20170109-23:03:21.541(1)?   Date: 1483999402,
I20170109-23:03:21.543(1)?   errors: { RessourceNotFound: 'Cannot found the ressource User with the id=12345678 ' } }

It looks like that, not only the catch part is not executed, but the then part is despite the error... Not sure if I am doing something wrong or there's an issue.

Thanks for your support.

Error while adding card

Hi,
When I am adding card of customer after creating customer,I am getting this error -

Error: getaddrinfo ENOTFOUND api.sandbox.mangopay.com api.sandbox.mangopay.com:443

error: 'invalid_client'

Hello, I was wondering what this error meant ? I get it on every api call
I thought it was my mangopay api configured wrongly but it can't be as I verified my clientID and password and they are correct (I can sign in with those)

PayInPaymentDetailsCard not specific enough

PayInPaymentDetailsCard is used for both direct and web execution when infact the fields arent the same. For web it should be CardType and for direct it should be CardId

no error triggered but no result

hello,

when i set this config it works.
clientId: 'firstIdXXX',
clientPassword: 'passphraseXXX',

and when i set this (prod), it doesn't work, and it doesn't fail => no return at all.
clientId: 'prodIdXXX',
clientPassword: 'prodPassphraseXXX',
baseUrl: 'https://api.mangopay.com/'

can you ehelp me ?

this is my sample code :

var mangopay = require('mangopay2-nodejs-sdk');

var api = new mangopay({
clientId: 'xxxx',
clientPassword: 'xxxxx',
});

api.Users.getNatural('11510910021zx', function(result) {
// no return
console.log('result1', result);
})
.catch(function(data) {
// no failure
console.error('err', data.Message);
});

how to add user card?

Hey,
I am using mangoPay node sdk for the first time.I have created sandbox box account.Create card registration object but when I am adding my card ...it is giving some error.

This is my code
const mangopay = require('mangopay2-nodejs-sdk');
`const MANGO_PAY={
clientId : PAYMENT_CONFIG.clientId,
clientPassword : PAYMENT_CONFIG.clientPassword,
baseUrl : PAYMENT_CONFIG.baseUrl
};

let MANGO_PAY_API = new mangopay(MANGO_PAY); let cardRegistration = {
"Tag" : "USER",
"UserId" : customerData.mangoPayId,
"Currency": CONFIG.APPCONFIG.CURRENCY,
"CardType" : CONFIG.APPCONFIG.CARD_TYPES.VISA
};

        MANGO_PAY_API.CardRegistrations.create(cardRegistration).then(function(res){

            let cardRegistrationData={
                "data": res.PreregistrationData,
                "accessKeyRef": res.AccessKey,
                "returnURL": "localhost",
                "cardNumber": "4970100000000154",
                "cardExpirationDate": "1020",
                "cardCvx": "123"
            };

            // Set the headers
            var headers = {
                'Content-Type': 'application/x-www-form-urlencoded'
            }

            // Configure the request
            var options = {
                url: res.CardRegistrationURL,
                headers: headers,
                form: cardRegistrationData
            }

            console.log(cardRegistrationData)
            console.log(headers)
            console.log(options);

            // 3. POST request to CardRegistrationURL
            MANGO_PAY_API.method('post', function (data, response) {
                console.log("DATA = %j", data);
                console.log("RESPONSE = %j", JSON.stringify(response));
            }, options);


            cb();
        })`

I am getting this in respose:

DATA = {"type":"Buffer","data":[101,114,114,111,114,67,111,100,101,61,48,57,49,48,49]}
RESPONSE = [Circular]

What to do with this?

When I am converting into string..it is showing error errorCode=09101

Please help in this issue.

Package naming conflict

The package name is mangopay-nodejs-sdk and not mangopay2-nodejs-sdk as specified in the readme. And therefore the example require doesnt work

Models are missing money amounts

Perhaps they're inherited from elsewhere etc, but in the payin and payout objects, I dont see the DebitedFunds or Fees fields

TypeError: this._servicesLoader is not a function

Hi,

When I try importing the Node.js sdk by doing

var mangopay = require('mangopay2-nodejs-sdk')({
    clientId: 'clientid',
    clientPassword: 'clientpassword',
    // Set the right production API url. If testing, omit the property since it defaults to sandbox URL
    //baseUrl: 'https://api.mangopay.com'
});

I get the following error :

/application/node_modules/mangopay2-nodejs-sdk/lib/api.js:60
    this._servicesLoader();
         ^

TypeError: this._servicesLoader is not a function
    at Api (/application/node_modules/mangopay2-nodejs-sdk/lib/api.js:60:10)
    at Object.<anonymous> (/application/controllers/admin/freelancers.js:7:16)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at /application/index.js:237:29
    at Array.forEach (native)
    at /application/index.js:235:49
    at Array.forEach (native)
    at Object.<anonymous> (/application/index.js:230:33)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/application/server.js:2:11)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)

Node version : 6.8.1
SDK version : 1.3.0

Undefined cardRegistration object

Hello everyone,

I'm currently working on a NodeJS API and on a phone application that will use MangoPay for the payment.
The problem I'm having is when I want to init a cardRegistration object to do a PayIn, the object is undefined.

Here is my code :

var Mangopay = require("mangopay2-nodejs-sdk");
var mangoPay = new Mangopay({
    clientId: "myClientId",
    clientPassword: "myClientPassword",
    // Set the right production API url. If testing, omit the property since it defaults to sandbox URL
    baseUrl: "https://api.sandbox.mangopay.com"
});

And then in a test function :

// Initialize mangoPay.cardRegistration object
mangoPay.cardRegistration.init({
    cardRegistrationURL: cardRegistrationURL,
    preregistrationData: preregistrationData,
    accessKey: accessKey,
    Id: cardRegistrationId
});

How can I implement this NodeJS sdk in my API?

Thanks in advance,

Promises not rejecting errors

Hello,

The Promises in this SDK are always calling resolve even if there is an error. This means that the errors are being ignored unless I explicitely check the result returned or use the errorHandler to log them.

Is it intentional ?

I would rather expect the Promises to reject the error so that I could just catch it in my code and stop the execution.

Documentation seems outdated

Hello,

It seems that the documentation is a bit outdated:

https://docs.mangopay.com/endpoints/v2.01/bank-accounts#e41_create-an-iban-bankaccount

To create an IBAN account:

Body Parameters :
{
"Tag": "custom meta",
"OwnerAddress": {
"AddressLine1": "1 Mangopay Street",
"AddressLine2": "The Loop",
"City": "Paris",
"Region": "Ile de France",
"PostalCode": "75001",
"Country": "FR"
},
"OwnerName": "Joe Blogs",
"IBAN": "FR7630004000031234567890143",
"BIC": "BNPAFRPP"
}

The type is missing.

From the tests:

        var account = {
            OwnerName: user.FirstName + ' ' + user.LastName,
            OwnerAddress: user.Address,
            Type: 'IBAN',
            IBAN: 'FR7630004000031234567890143',
            BIC: 'BNPAFRPP'
        };

Also about PayOuts:

https://docs.mangopay.com/endpoints/v2.01/payouts#e228_create-a-payout

Body Parameters :
{
"Tag": "custom meta",
"AuthorId": "8494514",
"DebitedFunds": {
"Currency": "EUR",
"Amount": 12
},
"Fees": {
"Currency": "EUR",
"Amount": 12
},
"BankAccountId": "14213351",
"DebitedWalletId": "8519987",
"BankWireRef": "invoice 7282"
}

The payment type is missing:

"PaymentType": 'BANK_WIRE'

Angular5 & Mangopay

Hi, I'm starting with mangopay and I have a hard time finding good documentation, tutorial, example, integration of mangopay with angular 5. Can anyone help me?
Thank's in advance

Internal server error in Payin using Preauthorization

Hi I am creating a PayIn for a preauthorization, but I am getting

{ Message: 'Internal Server Error',
Type: 'other',
Id: 'e9e302b2-c544-4285-bd30-9cf95e6d9f82#1505804242',
Date: 1505804243,
errors: null }

for the below code:

let data = {
"AuthorId": userId,
"CreditedUserId": userId,
"CreditedWalletId": walletId,
"DebitedFunds": {
"Currency": "GBP",
"Amount": 1200
},
"Fees": {
"Currency": "GBP",
"Amount": 00
},
"PaymentType": "PREAUTHORIZED",
"ExecutionType": "DIRECT",
}
data.ExecutionDetails = new api.models.PayInExecutionDetailsDirect({
SecureMode: "DEFAULT",
SecureModeReturnURL: "https://localhost",
SecureModeRedirectURL: "https://localhost",
SecureModeNeeded: false
})
data.PaymentDetails = new api.models.PayInPaymentDetailsPreAuthorized({"PreauthorizationId":preauthId});
let payin = new api.models.PayIn(data);
api.PayIns.create(payin).then(function (response) {
// Promise function called
console.log('response')
console.log(response)
}, function (error) {
//exception
console.log('error in PayIns');
console.log(error);
})

Can you tell me what mistake I am making?

Bug in parsing the PayIn getPaymentKey with DirectDebit

When calling PayIns.create with params that include the following:

{"AuthorId":xx,
"CreditedUserId":"xx",
"CreditedWalletId":"x","DebitedFunds":{"Currency":"EUR","Amount
":1000},"Fees":{"Currency":"EUR","Amount":100},
"ReturnURL":"http://xxx.xx/xxx","Culture":"de","Tag":"xxx",
"SecureMode":"DEFAULT",
"SecureModeReturnURL":xxx",
"StatementDescriptor":"xx",
"ExecutionDetails": new api.models.PayInExecutionDetailsWeb();
"PaymentDetails": new api.models.PayInPaymentDetailsDirectDebitWeb({
        DirectDebitType: 'SOFORT',
    }),
}

does not work and throws an error (TypeError: Cannot read property 'bind' of undefined)

The Problem is that the parsed method is:
payins_directdebit-web-web_create

Which is a problem in: https://github.com/Mangopay/mangopay2-nodejs-sdk/blob/master/lib/services/PayIns.js#L78

That the web part is passed into the chained string from both the getPaymentKey and the getExecutionKey methods.

I would suggest, to either use only one option: PayInPaymentDetailsDirectDebit without distinguishing between web and direct on the payment details as you already have it on the execution details, or return the string without the '-web' in both cases.

Documentation - Promise / Callback

https://github.com/Mangopay/mangopay2-nodejs-sdk#promise-vs-callback

Instead of

api.Service.method(... , function(data, response, err){
    // Callback method
})

api.Service.method(...).then(function(data, response) {
    // Promise function called
}, function(error) {
    //exception
})

I think the promise function line should read,

api.Service.method(...).then(function(data) { ,

I don't see the response Object. Originally I was using async/await with destructuring and was getting some weird errors, switched to using .then / .catch and noticed response was not present. Was calling .Users.create() .

Thanks

Problem to create Kyc Page

Does someone could help me to implement CreateKycPage...

I have my user Id (req.params.a below), my document Id (req.params.b below) with status created and my file encoded on base64 (req.params.c below)...

Then I call that function on Nodejs:
`

1

Parse.Cloud.define('new_kyc_page_mpay', function (req, res)
  | {
  | var mangopay = require('mangopay2-nodejs-sdk');
  |  
  | var mango = new mangopay({
  | clientId: 'xxx',
  | clientPassword: 'xxx'
  | });
  |  
  | mango.Users.createKycPageFromFile( req.params.a, req.params.b, {
  | "File": req.params.c
  | },function(myKYCpage) {
  | // Output the created user data to console
  | res.success(myKYCpage);
  | });
  |  
  | });

`

And I get 'File does not exist'

I tried the same with CreateKycPage but I just get some empty buffer...

I don't figure out how to create a page with these two methods 'CreateKycPage' and 'CreateKycPageFromFile'... on mangopay docs, code is only in PHP... it seems that the file has to be encoded in base64 but when I see the codes on Nodejs it seems that we have to provide file path and that the library encodes that file

Well I am lost... everything was ok (user, wallet, bank accounts, kyc documents) but I am blocked with this page creation.

Thanks for any help

Default API version

The default API version should be v2.01 (but it's currently v2). Especially since the SDK uses objects for Address fields (which is the principle v2.01 feature)

How to deduct amount from customer card?

Hi ,
I have added customer and his card to his profile.
But I am not getting which API to use and deduct some amount from customer card which is added to Mango pay?

It would be great if you provide me the code example of deducting amount from card .
thanks in advance

Card Registration

Hi,
I'm having trouble using api.CardRegistrations.create(cardRegistration) :
Here are the steps :

  1. I'm adding a card with card registration data that I received. This is working well.
  2. Just then, I'm trying to add a new card, but the card registration data are exactly the same than the first one, so I'm getting an error with MangoAPay front-end kit.

Do you have any idea why this is happening ?

Card Registration

Hello,

How can we avoid registering card several times ?
Is it possible to return known card when the user try to do this ?

Thank you

Cannot retrieve created user and wallets

Hello,

In test environment, I cannot retrieve a user:

W20160703-21:40:30.254(2)? (STDERR) The ressource does not exist { Message: 'The ressource does not exist',
W20160703-21:40:30.254(2)? (STDERR) Type: 'ressource_not_found',
W20160703-21:40:30.254(2)? (STDERR) Id: 'd52476c9-3a3a-4a3b-8dd3-22fe516f2b6f#1467574830',
W20160703-21:40:30.255(2)? (STDERR) Date: 1467574831,
W20160703-21:40:30.255(2)? (STDERR) errors: { RessourceNotFound: 'Cannot found the ressource User with the id=[object Object] ' } }

aData = Promise.await(mangoPayApi.Users.get({ "userId" : '14296087' }))

I also tried with the ID as a number:
"userId" : 14296087

However, when I list all users, I can see that the user is present:

[ { PersonType: 'NATURAL',
 Email: '[email protected]',
  KYCLevel: 'LIGHT',
  Id: '14296087',
 Tag: 'custom tag',
  CreationDate: 1466983520 },

I get the exact same error when trying to retrieve wallets for a user:

**Creation logs:**
> I20160703-21:12:17.070(2)? User created 
> I20160703-21:12:17.072(2)? { Address: 
> I20160703-21:12:17.072(2)?    { AddressLine1: null,
> I20160703-21:12:17.073(2)?      AddressLine2: null,
> I20160703-21:12:17.073(2)?      City: null,
> I20160703-21:12:17.074(2)?      Region: null,
> I20160703-21:12:17.074(2)?      PostalCode: null,
> I20160703-21:12:17.074(2)?      Country: null },
> I20160703-21:12:17.075(2)?   FirstName: 'Yanis',
> I20160703-21:12:17.075(2)?   LastName: 'H',
> I20160703-21:12:17.075(2)?   Birthday: 671839200,
> I20160703-21:12:17.076(2)?   Nationality: 'FR',
> I20160703-21:12:17.076(2)?   CountryOfResidence: 'FR',
> I20160703-21:12:17.077(2)?   Occupation: null,
> I20160703-21:12:17.077(2)?   IncomeRange: null,
> I20160703-21:12:17.078(2)?   ProofOfIdentity: null,
> I20160703-21:12:17.078(2)?   ProofOfAddress: null,
> I20160703-21:12:17.078(2)?   PersonType: 'NATURAL',
> I20160703-21:12:17.079(2)?   Email: '[email protected]',
> I20160703-21:12:17.079(2)?   KYCLevel: 'LIGHT',
> I20160703-21:12:17.079(2)?   Id: '14435865',
> I20160703-21:12:17.080(2)?   Tag: 'dimf2kkvj9oJjRmW9',
> I20160703-21:12:17.080(2)?   CreationDate: 1467573133 }
> I20160703-21:12:17.081(2)? wallet created
> I20160703-21:12:17.081(2)? { Description: 'User Wallet',
> I20160703-21:12:17.082(2)?   Owners: [ '14435865' ],
> I20160703-21:12:17.082(2)?   Balance: { Currency: 'EUR', Amount: 0 },
> I20160703-21:12:17.082(2)?   Currency: 'EUR',
> I20160703-21:12:17.083(2)?   FundsType: 'DEFAULT',
> I20160703-21:12:17.083(2)?   Id: '14435866',
> I20160703-21:12:17.084(2)?   Tag: null,
> I20160703-21:12:17.085(2)?   CreationDate: 1467573134
      aWallet = Promise.await(mangoPayApi.Wallets.get({
        "walletId" : '14435866'
      }))

Am I doing something wrong?

3DSecure issue during card PreAuthorization

Hey
Using the sandbox environment I'm trying to pre-authorize the card with following code:

        let preAuthObject = new mango.models.CardPreAuthorization({
         Tag: 'TestPayment',
         ExecutionType: 'DIRECT',
         PaymentType: 'CARD',
         AuthorId: mangoPayUserUuid,
         CardId: '19882774',
         SecureMode: 'FORCE',
         SecureModeReturnURL: apiURL,
         DebitedFunds: {
           Currency: (currency ? currency : 'GBP'),
           Amount: moneyToDebit
         }
      });

      return mango.CardPreAuthorizations.create(preAuthObject);

as result I always have the same error:

{"Id":"19882794",
"Tag":"TestPayment",
"CreationDate":1484572903,
"AuthorId":"19751873",
"DebitedFunds":{"Currency":"GBP","Amount":90000},
"AuthorizationDate":null,
"Status":"FAILED",
"PaymentStatus":"CANCELED",
"ExpirationDate":null,
"PayInId":null,
"ResultCode":"101302",
"ResultMessage":"Secure mode: The card is not enrolled with 3DSecure",
"SecureMode":"FORCE",
"CardId":"19882774",
"SecureModeReturnURL":null,
"SecureModeRedirectURL":null,
"SecureModeNeeded":true,
"PaymentType":"CARD",
"ExecutionType":"DIRECT",
"StatementDescriptor":null}

What is the reason for that? I expect that it should return me
"Status":"CREATED" and non-empty SecureModeRedirectURL so I can redirect user.

As CreditCard I tried both from your list:
3569990000000132
3569990000000157
Does 3DSecure redirection works on Sandbox?

Error: Cannot find module '../model'

Hi
on ubuntu 14.04.3 LTS
when running, for example a getuser
i got the following error
Error: Cannot find module '../model'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object. (/opt/bitnami/nodejs/lib/node_modules/mangopay2-nodejs-sdk/lib/models/CardPreAuthorization.js:2:13)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)

model npm is installed...

Same script running on my mac desktop works like a charm..
any idea?
thanks

Issue in creating KYC document

Hi,

I am trying to create kyc document, but getting

{ Message: 'the body cannot be empty',
Type: 'empty_body',
Id: 'a9ea2062-6727-48ac-bff4-5a03287739a6#1505976508',
Date: 1505976509,
errors: null }

for the below code

    let kycDoc = {
                    "Type": "IDENTITY_PROOF",
                     "Status": "CREATED",
                    "UserId": users[0].userId
                }
    let doc = new api.models.KycDocument(kycDoc);
     api.Users.createKycDocument(doc).then(function (response) {
        // Promise function called
        console.log('response')
        console.log(response)
    }, function (error) {
        //exception
        console.log('mangopay service: error in creating kyc');
        console.log(error);
    })

Let me know, what I need to modify to get this code working.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.