├── .github └── workflows │ ├── node.js.yml │ └── npm-publish.yml ├── .gitignore ├── .jshintrc ├── CHANGELOG.md ├── LICENSE ├── README.md ├── docs ├── BankAccounts.md ├── BankingAliases.md ├── CardPreAuthorizations.md ├── CardRegistrations.md ├── Cards.md ├── Clients.md ├── DisputeDocuments.md ├── Disputes.md ├── Events.md ├── Hooks.md ├── Idempotency.md ├── KycDocuments.md ├── Mandates.md ├── OptionsHelper.md ├── PayIns.md ├── PayOuts.md ├── README.md ├── Refunds.md ├── Reports.md ├── Repudiations.md ├── Responses.md ├── Transfers.md ├── UboDeclarations.md ├── Users.md ├── Wallets.md └── templates │ ├── class.mustache │ ├── file.mustache │ ├── function.mustache │ ├── index.mustache │ └── overview.mustache ├── examples ├── createUsers.js ├── createWallet.js ├── failedRequest.js ├── getBankAccounts.js ├── getUserEmoney.js ├── getUsers.js └── readResponseHeaders.js ├── index.js ├── lib ├── Model.js ├── api.js ├── apiMethods.js ├── config.js ├── log.js ├── mangopay.js ├── models │ ├── Address.js │ ├── BankAccount.js │ ├── BankAccountDetails.js │ ├── BankAccountDetailsCA.js │ ├── BankAccountDetailsGB.js │ ├── BankAccountDetailsIBAN.js │ ├── BankAccountDetailsOTHER.js │ ├── BankAccountDetailsUS.js │ ├── BankAccountType.js │ ├── BankingAlias.js │ ├── BankingAliasIBAN.js │ ├── Billing.js │ ├── BinData.js │ ├── Birthplace.js │ ├── BrowserInfo.js │ ├── Card.js │ ├── CardInfo.js │ ├── CardPreAuthorization.js │ ├── CardRegistration.js │ ├── CardValidation.js │ ├── CategorizeUserLegal.js │ ├── CategorizeUserNatural.js │ ├── Check.js │ ├── CheckData.js │ ├── Client.js │ ├── ClientWallet.js │ ├── Conversion.js │ ├── ConversionRate.js │ ├── CountryAuthorization.js │ ├── DebitedBankAccount.js │ ├── DeclaredUbo.js │ ├── DeclaredUboStatus.js │ ├── Deposit.js │ ├── Dispute.js │ ├── DisputeDocument.js │ ├── DisputeDocumentPage.js │ ├── DisputeReason.js │ ├── Document.js │ ├── DocumentPageConsult.js │ ├── EMoney.js │ ├── EntityBase.js │ ├── Hook.js │ ├── IdempotencyResponse.js │ ├── IdentityVerification.js │ ├── KycDocument.js │ ├── KycDocumentStatus.js │ ├── KycDocumentType.js │ ├── KycPage.js │ ├── LegalPersonType.js │ ├── LegalRepresentative.js │ ├── Mandate.js │ ├── MandateStatus.js │ ├── Money.js │ ├── PayIn.js │ ├── PayInExecutionDetails.js │ ├── PayInExecutionDetailsBankingAlias.js │ ├── PayInExecutionDetailsDirect.js │ ├── PayInExecutionDetailsWeb.js │ ├── PayInExecutionType.js │ ├── PayInPaymentDetails.js │ ├── PayInPaymentDetailsApplePay.js │ ├── PayInPaymentDetailsBancontact.js │ ├── PayInPaymentDetailsBankWire.js │ ├── PayInPaymentDetailsBankingAlias.js │ ├── PayInPaymentDetailsBlik.js │ ├── PayInPaymentDetailsCard.js │ ├── PayInPaymentDetailsCardDirect.js │ ├── PayInPaymentDetailsCardWeb.js │ ├── PayInPaymentDetailsDirectDebitDirect.js │ ├── PayInPaymentDetailsDirectDebitWeb.js │ ├── PayInPaymentDetailsGiropay.js │ ├── PayInPaymentDetailsGooglePay.js │ ├── PayInPaymentDetailsIdeal.js │ ├── PayInPaymentDetailsKlarna.js │ ├── PayInPaymentDetailsMbway.js │ ├── PayInPaymentDetailsMultibanco.js │ ├── PayInPaymentDetailsPayByBank.js │ ├── PayInPaymentDetailsPayPal.js │ ├── PayInPaymentDetailsPayconiq.js │ ├── PayInPaymentDetailsPreAuthorized.js │ ├── PayInPaymentDetailsSatispay.js │ ├── PayInPaymentDetailsSwish.js │ ├── PayInPaymentDetailsTwint.js │ ├── PayInPaymentType.js │ ├── PayInRecurringRegistration.js │ ├── PayInTemplateURLOptions.js │ ├── PayOut.js │ ├── PayOutPaymentDetails.js │ ├── PayOutPaymentDetailsBankWire.js │ ├── PayOutPaymentType.js │ ├── PaymentData.js │ ├── PaymentMethodMetadata.js │ ├── PayoutMethods.js │ ├── PendingUserAction.js │ ├── PersonType.js │ ├── PlatformCategorization.js │ ├── PlatformType.js │ ├── Quote.js │ ├── Recipient.js │ ├── RecipientSchema.js │ ├── RecurringPayIn.js │ ├── RecurringPayInCIT.js │ ├── RecurringPayInCurrentState.js │ ├── RecurringPayInMIT.js │ ├── RecurringPayInPut.js │ ├── Refund.js │ ├── RefundReasonDetails.js │ ├── Report.js │ ├── ReportFilter.js │ ├── Repudiation.js │ ├── SecurityInfo.js │ ├── SettlementTransfer.js │ ├── Shipping.js │ ├── ShippingAddress.js │ ├── ShippingPreference.js │ ├── Transaction.js │ ├── Transfer.js │ ├── Ubo.js │ ├── UboDeclaration.js │ ├── UboDeclarationRefusedReasonType.js │ ├── UboDeclarationStatus.js │ ├── UboRefusedReasonType.js │ ├── User.js │ ├── UserCategory.js │ ├── UserDataFormatValidation.js │ ├── UserEnrollmentResult.js │ ├── UserLegal.js │ ├── UserLegalOwner.js │ ├── UserLegalPayer.js │ ├── UserLegalSca.js │ ├── UserNatural.js │ ├── UserNaturalCapacity.js │ ├── UserNaturalOwner.js │ ├── UserNaturalPayer.js │ ├── UserNaturalPut.js │ ├── UserNaturalSca.js │ ├── VirtualAccount.js │ ├── Wallet.js │ └── index.js ├── service.js ├── services │ ├── BankAccounts.js │ ├── BankingAliases.js │ ├── CardPreAuthorizations.js │ ├── CardRegistrations.js │ ├── Cards.js │ ├── Clients.js │ ├── Conversions.js │ ├── Deposits.js │ ├── DisputeDocuments.js │ ├── Disputes.js │ ├── Events.js │ ├── Hooks.js │ ├── Idempotency.js │ ├── IdentityVerifications.js │ ├── KycDocuments.js │ ├── Mandates.js │ ├── OptionsHelper.js │ ├── PayIns.js │ ├── PayOuts.js │ ├── Recipients.js │ ├── Refunds.js │ ├── Regulatory.js │ ├── Reports.js │ ├── Repudiations.js │ ├── Responses.js │ ├── Transfers.js │ ├── UboDeclarations.js │ ├── Users.js │ ├── VirtualAccounts.js │ ├── Wallets.js │ └── index.js └── utils.js ├── package.json ├── test ├── TestKycPageFile.png ├── helpers.js ├── main.js ├── mocha.opts └── services │ ├── BankAccounts.js │ ├── BankingAliases.js │ ├── CardPreAuthorizations.js │ ├── CardRegistrations.js │ ├── Cards.js │ ├── Clients.js │ ├── Conversions.js │ ├── Deposits.js │ ├── Disputes.js │ ├── EMoney.js │ ├── Events.js │ ├── Hooks.js │ ├── Idempotency.js │ ├── IdentityVerifications.js │ ├── KycDocuments.js │ ├── Mandates.js │ ├── PayIns.js │ ├── PayOuts.js │ ├── RateLimit.js │ ├── Recipients.js │ ├── Refunds.js │ ├── Regulatory.js │ ├── Reports.js │ ├── Repudiations.js │ ├── Tokens.js │ ├── Transfers.js │ ├── UboDeclarations.js │ ├── Users.js │ ├── VirtualAccounts.js │ └── Wallets.js └── typings ├── base.d.ts ├── enums.d.ts ├── index.d.ts ├── mangopay2-nodejs-sdk-tests.ts ├── models.d.ts ├── models ├── address.d.ts ├── bankAccount.d.ts ├── bankingAlias.d.ts ├── billing.d.ts ├── birthplace.d.ts ├── card.d.ts ├── cardPreauthorization.d.ts ├── cardRegistration.d.ts ├── cardValidation.d.ts ├── client.d.ts ├── conversion.d.ts ├── conversionRate.d.ts ├── countryAuthorization.d.ts ├── deposit.d.ts ├── dispute.d.ts ├── disputeDocument.d.ts ├── entityBase.d.ts ├── event.d.ts ├── hook.d.ts ├── idempotency.d.ts ├── identityVerification.d.ts ├── kycDocument.d.ts ├── mandate.d.ts ├── money.d.ts ├── payIn.d.ts ├── payOut.d.ts ├── recipient.d.ts ├── refund.d.ts ├── report.d.ts ├── repudiation.d.ts ├── securityInfo.d.ts ├── settlementTransfer.d.ts ├── shipping.d.ts ├── shippingAddress.d.ts ├── transaction.d.ts ├── transfer.d.ts ├── uboDeclaration.d.ts ├── user.d.ts ├── virtualAccount.d.ts └── wallet.d.ts ├── services ├── BankAccounts.d.ts ├── BankingAliases.d.ts ├── CardPreauthorizations.d.ts ├── CardRegistrations.d.ts ├── Cards.d.ts ├── Clients.d.ts ├── Conversions.d.ts ├── Deposits.d.ts ├── DisputeDocuments.d.ts ├── Disputes.d.ts ├── Events.d.ts ├── Hooks.d.ts ├── Idempotency.d.ts ├── IdentityVerifications.d.ts ├── KycDocuments.d.ts ├── Mandates.d.ts ├── PayIns.d.ts ├── PayOuts.d.ts ├── Recipients.d.ts ├── Refunds.d.ts ├── Regulatory.d.ts ├── Reports.d.ts ├── Repudiations.d.ts ├── Responses.d.ts ├── Transfers.d.ts ├── UboDeclarations.d.ts ├── Users.d.ts ├── VirtualAccounts.d.ts └── Wallets.d.ts ├── tsconfig.json ├── tslint.json └── types.d.ts /.github/workflows/node.js.yml: -------------------------------------------------------------------------------- 1 | # This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions 3 | 4 | name: mangopay2-nodejs-sdk-ci 5 | 6 | on: 7 | push: 8 | branches: 9 | # push on master branch 10 | - master 11 | pull_request: 12 | branches: [ master ] 13 | 14 | jobs: 15 | build: 16 | 17 | runs-on: ubuntu-latest 18 | 19 | strategy: 20 | matrix: 21 | node-version: [16.x] 22 | # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ 23 | 24 | steps: 25 | - uses: actions/checkout@v2 26 | - name: Use Node.js ${{ matrix.node-version }} 27 | uses: actions/setup-node@v2 28 | with: 29 | node-version: ${{ matrix.node-version }} 30 | - run: npm i 31 | - run: npm run build --if-present 32 | - run: npm test && npm run test:types 33 | -------------------------------------------------------------------------------- /.github/workflows/npm-publish.yml: -------------------------------------------------------------------------------- 1 | # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages 3 | 4 | name: mangopay2-nodejs-sdk-cd 5 | 6 | on: 7 | push: 8 | # Sequence of patterns matched against refs/tags 9 | tags: 10 | # It pushes any tags that contain a v. ex: v1.16.1 11 | - '*' 12 | 13 | jobs: 14 | build: 15 | runs-on: ubuntu-latest 16 | steps: 17 | - uses: actions/checkout@v2 18 | - uses: actions/setup-node@v2 19 | with: 20 | node-version: 16 21 | registry-url: https://registry.npmjs.org/ 22 | - run: npm i 23 | - run: npm run build --if-present 24 | - run: npm publish 25 | env: 26 | NODE_AUTH_TOKEN: ${{secrets.npm_token}} 27 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Dependency directory 2 | # https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git 3 | node_modules 4 | 5 | ## Directory-based project format: 6 | .idea/ 7 | 8 | .vscode/ 9 | 10 | .vs/ 11 | 12 | Folder.DotSettings.user 13 | 14 | ## Removed the package-lock as it should be auto generated 15 | package-lock.json -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "nonew": true, 3 | "curly": true, 4 | "noarg": true, 5 | "forin": true, 6 | "noempty": true, 7 | "node": true, 8 | "eqeqeq": true, 9 | "undef": true, 10 | "bitwise": true, 11 | "esversion": 6, 12 | "browser": true, 13 | "predef": ["require", "module"], 14 | "mocha": true, 15 | "expr": true 16 | } 17 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Mangopay 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /docs/BankAccounts.md: -------------------------------------------------------------------------------- 1 | # BankAccounts 2 | 3 | 4 | 5 | 6 | 7 | * * * 8 | 9 | ### BankAccounts.getTransactions(bankAccountId, callback, options) 10 | 11 | Retrieve list of transactions for a bank account 12 | 13 | **Parameters** 14 | 15 | **bankAccountId**: `number`, Bank Account Id 16 | 17 | **callback**: `function`, Callback function 18 | 19 | **options**: `Object`, Request options 20 | 21 | **Returns**: `Object`, Request promise 22 | 23 | 24 | 25 | * * * 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /docs/BankingAliases.md: -------------------------------------------------------------------------------- 1 | # BankingAliases 2 | 3 | 4 | 5 | 6 | 7 | * * * 8 | 9 | ### BankingAliases.create(bankingAlias, callback, options) 10 | 11 | Create a banking alias 12 | 13 | **Parameters** 14 | 15 | **bankingAlias**: `Object`, Banking Alias Data 16 | 17 | **callback**: `function`, Callback function 18 | 19 | **options**: `Object`, Request options 20 | 21 | **Returns**: `Object`, Request promise 22 | 23 | 24 | ### BankingAliases.get(bankingAliasId, callback, options) 25 | 26 | Get a banking alias 27 | 28 | **Parameters** 29 | 30 | **bankingAliasId**: `number`, Banking Alias Id 31 | 32 | **callback**: `function`, Callback function 33 | 34 | **options**: `Object`, Request options 35 | 36 | **Returns**: `Object`, Request promise 37 | 38 | 39 | ### BankingAliases.getAll(callback, options) 40 | 41 | Get all banking aliases 42 | 43 | **Parameters** 44 | 45 | **callback**: `function`, Callback function 46 | 47 | **options**: `Object`, Request options 48 | 49 | **Returns**: `Object`, Request promise 50 | 51 | 52 | ### BankingAliases.update(bankingAliasId, callback, options) 53 | 54 | Update banking alias 55 | 56 | **Parameters** 57 | 58 | **bankingAliasId**: `number`, Banking Alias Id 59 | 60 | **callback**: `function`, Callback function 61 | 62 | **options**: `Object`, Request options 63 | 64 | **Returns**: `Object`, Request promise 65 | 66 | 67 | ### BankingAliases.deactivate(bankingAliasId, callback, options) 68 | 69 | Deactivate banking alias 70 | 71 | **Parameters** 72 | 73 | **bankingAliasId**: `number`, Banking Alias Id 74 | 75 | **callback**: `function`, Callback function 76 | 77 | **options**: `Object`, Request options 78 | 79 | **Returns**: `Object`, Request promise 80 | 81 | 82 | ### BankingAliases.activate(bankingAliasId, callback, options) 83 | 84 | Activate banking alias 85 | 86 | **Parameters** 87 | 88 | **bankingAliasId**: `number`, Banking Alias Id 89 | 90 | **callback**: `function`, Callback function 91 | 92 | **options**: `Object`, Request options 93 | 94 | **Returns**: `Object`, Request promise 95 | 96 | 97 | 98 | * * * 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | -------------------------------------------------------------------------------- /docs/CardPreAuthorizations.md: -------------------------------------------------------------------------------- 1 | # CardPreAuthorizations 2 | 3 | [MangoPay Card Pre-Authorizations API Reference](https://docs.mangopay.com/endpoints/v2.01/preauthorizations) 4 | 5 | 6 | 7 | * * * 8 | 9 | ### CardPreAuthorizations.create(cardPreAuthorization, callback, options) 10 | 11 | Create new pre-authorization 12 | 13 | **Parameters** 14 | 15 | **cardPreAuthorization**: `Object`, CardPreAuthorization object or properties hash 16 | 17 | **callback**: `function`, Callback function 18 | 19 | **options**: `Object`, Request options 20 | 21 | **Returns**: `Object`, Promise of the request 22 | 23 | 24 | ### CardPreAuthorizations.get(cardPreAuthorizationId, callback, options) 25 | 26 | Get pre-authorization object 27 | 28 | **Parameters** 29 | 30 | **cardPreAuthorizationId**: `number`, PreAuthorization identifier 31 | 32 | **callback**: `function`, Callback function 33 | 34 | **options**: `Object`, Request options 35 | 36 | **Returns**: `Object`, Request promise 37 | 38 | 39 | ### CardPreAuthorizations.update(cardPreAuthorization, callback, options) 40 | 41 | Update pre-authorization object 42 | 43 | **Parameters** 44 | 45 | **cardPreAuthorization**: `Object`, CardPreAuthorization object of properties hash 46 | 47 | **callback**: `function`, Update pre-authorization object 48 | 49 | **options**: `Object`, Update pre-authorization object 50 | 51 | **Returns**: `Object`, Request promise 52 | 53 | 54 | 55 | * * * 56 | -------------------------------------------------------------------------------- /docs/CardRegistrations.md: -------------------------------------------------------------------------------- 1 | # CardRegistrations 2 | 3 | [MangoPay Card Registration API Reference](https://docs.mangopay.com/endpoints/v2.01/cards) 4 | 5 | 6 | 7 | * * * 8 | 9 | ### CardRegistrations.create(cardRegistration, callback, options) 10 | 11 | Create new card registration 12 | 13 | **Parameters** 14 | 15 | **cardRegistration**: `Object`, CardRegistration object or properties hash 16 | 17 | **callback**: `function`, Callback function 18 | 19 | **options**: `Object`, Request options 20 | 21 | **Returns**: `Object`, Promise of the request 22 | 23 | 24 | ### CardRegistrations.get(cardRegistrationId, callback, options) 25 | 26 | Get registration 27 | 28 | **Parameters** 29 | 30 | **cardRegistrationId**: `number`, Registration identifier 31 | 32 | **callback**: `function`, Callback function 33 | 34 | **options**: `Object`, Request options 35 | 36 | **Returns**: `Object`, Request promise 37 | 38 | 39 | ### CardRegistrations.update(cardRegistration, callback, options) 40 | 41 | Update card registration 42 | 43 | **Parameters** 44 | 45 | **cardRegistration**: `Object`, CardPreAuthorization object of properties hash 46 | 47 | **callback**: `function`, Callback function 48 | 49 | **options**: `Object`, Request options 50 | 51 | **Returns**: `Object`, Request promise 52 | 53 | 54 | 55 | * * * 56 | -------------------------------------------------------------------------------- /docs/Cards.md: -------------------------------------------------------------------------------- 1 | # Cards 2 | 3 | [MangoPay Cards API Reference](https://docs.mangopay.com/endpoints/v2.01/cards#e177_the-card-registration-object) 4 | 5 | 6 | 7 | * * * 8 | 9 | ### Cards.get(cardId, callback, options) 10 | 11 | Get card 12 | 13 | **Parameters** 14 | 15 | **cardId**: `number`, Card identifier 16 | 17 | **callback**: `function`, Callback function 18 | 19 | **options**: `Object`, Request options 20 | 21 | **Returns**: `Object`, Request promise 22 | 23 | 24 | ### Cards.getByFingerprint(fingerprint) 25 | 26 | Gets a list of cards having the same fingerprint. 27 | The fingerprint is a hash uniquely generated per 16-digit card number. 28 | 29 | **Parameters** 30 | 31 | **fingerprint**: , The fingerprint hash 32 | 33 | **Returns**: , List of Cards corresponding to provided fingerprint 34 | 35 | 36 | ### Cards.update(card, callback, options) 37 | 38 | Update card 39 | 40 | **Parameters** 41 | 42 | **card**: `Object`, Card object of properties hash 43 | 44 | **callback**: `function`, Callback function 45 | 46 | **options**: `Object`, Request options 47 | 48 | **Returns**: `Object`, Request promise 49 | 50 | 51 | ### Cards.getTransactions(cardId, callback, options) 52 | 53 | Get list of Transactions of a Card 54 | 55 | **Parameters** 56 | 57 | **cardId**: `number`, Card identifier 58 | 59 | **callback**: `function`, Callback function 60 | 61 | **options**: `object`, Request options 62 | 63 | **Returns**: `object`, Request promise 64 | 65 | 66 | ### Cards.getPreAuthorizations(cardId, callback, options) 67 | 68 | Gets list of PreAuthorizations of a Card. 69 | 70 | **Parameters** 71 | 72 | **cardId**: `number`, Card identifier 73 | 74 | **callback**: `function`, Callback function 75 | 76 | **options**: `Object`, Request options 77 | 78 | **Returns**: `Object`, Request promise 79 | 80 | 81 | 82 | * * * 83 | -------------------------------------------------------------------------------- /docs/DisputeDocuments.md: -------------------------------------------------------------------------------- 1 | # DisputeDocuments 2 | 3 | [MangoPay Dispute Documents API Reference](https://docs.mangopay.com/endpoints/v2/dispute-documents#e214_the-dispute-document-object) 4 | 5 | 6 | 7 | * * * 8 | 9 | ### DisputeDocuments.get(documentId, callback, options) 10 | 11 | Gets dispute's document 12 | 13 | **Parameters** 14 | 15 | **documentId**: `number`, Document identifier 16 | 17 | **callback**: `function`, Callback function 18 | 19 | **options**: `Object`, Request options 20 | 21 | **Returns**: `Object`, Request promise 22 | 23 | 24 | ### DisputeDocuments.getAll(callback, options) 25 | 26 | Gets dispute's documents for client 27 | 28 | **Parameters** 29 | 30 | **callback**: `function`, Callback function 31 | 32 | **options**: `Object`, Request options 33 | 34 | **Returns**: `Object`, Request promise 35 | 36 | 37 | ### DisputeDocuments.createDisputeDocumentConsult(documentId, callback, options) 38 | 39 | Creates temporary URLs where each page of a dispute document can be viewed. 40 | 41 | **Parameters** 42 | 43 | **documentId**: `string`, Document identifier 44 | 45 | **callback**: `function`, Callback function 46 | 47 | **options**: `Object`, Request options 48 | 49 | **Returns**: `Object`, Request promise 50 | 51 | 52 | 53 | * * * 54 | -------------------------------------------------------------------------------- /docs/Events.md: -------------------------------------------------------------------------------- 1 | # Events 2 | 3 | [MangoPay Events API Reference](https://docs.mangopay.com/endpoints/v2.01/events#e251_the-event-object) 4 | 5 | 6 | 7 | * * * 8 | 9 | ### Events.getAll(callback, options) 10 | 11 | Get events 12 | 13 | **Parameters** 14 | 15 | **callback**: `function`, Callback function 16 | 17 | **options**: `Object`, Request options 18 | 19 | **Returns**: `Object`, Request promise 20 | 21 | 22 | 23 | * * * 24 | -------------------------------------------------------------------------------- /docs/Hooks.md: -------------------------------------------------------------------------------- 1 | # Hooks 2 | 3 | [MangoPay Hooks API Reference](https://docs.mangopay.com/endpoints/v2.01/hooks#e246_the-hook-object) 4 | 5 | 6 | 7 | * * * 8 | 9 | ### Hooks.create(hook, callback, options) 10 | 11 | Create new hook 12 | 13 | **Parameters** 14 | 15 | **hook**: `Object`, Hook object 16 | 17 | **callback**: `function`, Callback function 18 | 19 | **options**: `Object`, Request options 20 | 21 | **Returns**: `Object`, Request promise 22 | 23 | 24 | ### Hooks.get(hookId, callback, options) 25 | 26 | Get hook 27 | 28 | **Parameters** 29 | 30 | **hookId**: `number`, Hook identifier 31 | 32 | **callback**: `function`, Callback function 33 | 34 | **options**: `Object`, Request options 35 | 36 | **Returns**: `Object`, Request promise 37 | 38 | 39 | ### Hooks.update(hook, callback, options) 40 | 41 | Save hook 42 | 43 | **Parameters** 44 | 45 | **hook**: `Object`, Hook object 46 | 47 | **callback**: `function`, Callback function 48 | 49 | **options**: `Object`, Request options 50 | 51 | **Returns**: `Object`, Request promise 52 | 53 | 54 | ### Hooks.getAll(callback, options) 55 | 56 | Get all hooks 57 | 58 | **Parameters** 59 | 60 | **callback**: `function`, Callback function 61 | 62 | **options**: `Object`, Request options 63 | 64 | **Returns**: `Object`, Request promise 65 | 66 | 67 | 68 | * * * 69 | -------------------------------------------------------------------------------- /docs/Idempotency.md: -------------------------------------------------------------------------------- 1 | * * * 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /docs/KycDocuments.md: -------------------------------------------------------------------------------- 1 | # KycDocuments 2 | 3 | [MangoPay KYC Documents API Reference](https://docs.mangopay.com/index.php/endpoints/v2.01/kyc-documents) 4 | 5 | 6 | * * * 7 | 8 | ### KycDocuments.getAll(callback, options) 9 | 10 | Get all KycDocuments 11 | 12 | **Parameters** 13 | 14 | **callback**: `function`, Callback function 15 | 16 | **options**: `Object`, Request options 17 | 18 | **Returns**: `Object`, Request promise 19 | 20 | 21 | ### KycDocuments.get(kycDocumentId, callback, options) 22 | 23 | Get KycDocument 24 | 25 | **Parameters** 26 | 27 | **kycDocumentId**: `number`, KycDocument identifier 28 | 29 | **callback**: `function`, Callback function 30 | 31 | **options**: `Object`, Request options 32 | 33 | **Returns**: `Object`, Request promise 34 | 35 | 36 | ### KycDocuments.createKycDocumentConsult(documentId, callback, options) 37 | 38 | Creates temporary URLs where each page of a KYC document can be viewed. 39 | 40 | **Parameters** 41 | 42 | **documentId**: `string`, Document identifier 43 | 44 | **callback**: `function`, Callback function 45 | 46 | **options**: `Object`, Request options 47 | 48 | **Returns**: `Object`, Request promise 49 | 50 | 51 | 52 | * * * 53 | -------------------------------------------------------------------------------- /docs/OptionsHelper.md: -------------------------------------------------------------------------------- 1 | # Global 2 | 3 | 4 | 5 | 6 | 7 | * * * 8 | 9 | ### withIdempotency(options, idempotencyKey) 10 | 11 | Adds Idempotency-Key headers to the provided 'options' parameter 12 | 13 | **Parameters** 14 | 15 | **options**: , Adds Idempotency-Key headers to the provided 'options' parameter 16 | 17 | **idempotencyKey**: , Adds Idempotency-Key headers to the provided 'options' parameter 18 | 19 | 20 | 21 | 22 | * * * 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /docs/PayIns.md: -------------------------------------------------------------------------------- 1 | # PayIns 2 | 3 | [MangoPay PayIns API Reference](https://docs.mangopay.com/endpoints/v2.01/payins) 4 | 5 | 6 | 7 | * * * 8 | 9 | ### PayIns.create(payIn, callback, options) 10 | 11 | Create new pay-in 12 | 13 | **Parameters** 14 | 15 | **payIn**: `Object`, PayIn object 16 | 17 | **callback**: `function`, Callback function 18 | 19 | **options**: `Object`, Request options 20 | 21 | **Returns**: `Object`, Request promise 22 | 23 | 24 | ### PayIns.get(payInId, callback, options) 25 | 26 | Get pay-in 27 | 28 | **Parameters** 29 | 30 | **payInId**: `number`, PayIn identifier 31 | 32 | **callback**: `function`, Callback function 33 | 34 | **options**: `Object`, Request options 35 | 36 | **Returns**: `Object`, Request promise 37 | 38 | 39 | ### PayIns.createRefund(payInId, refund, callback, options) 40 | 41 | Create refund for pay-in object 42 | 43 | **Parameters** 44 | 45 | **payInId**: `number`, PayIn identifier 46 | 47 | **refund**: `Object`, Refund data 48 | 49 | **callback**: `function`, Callback function 50 | 51 | **options**: `Object`, Request options 52 | 53 | **Returns**: `Object`, Request promise 54 | 55 | 56 | ### PayIns.getRefunds(payInId, callback, options) 57 | 58 | Gets list of Refunds for a PayIn 59 | 60 | **Parameters** 61 | 62 | **payInId**: `number`, PayIn identifier 63 | 64 | **callback**: `function`, Callback function 65 | 66 | **options**: `Object`, Request options 67 | 68 | **Returns**: `Object`, Request promise 69 | 70 | 71 | 72 | * * * 73 | -------------------------------------------------------------------------------- /docs/PayOuts.md: -------------------------------------------------------------------------------- 1 | # PayOuts 2 | 3 | [MangoPay PayOuts API Reference](https://docs.mangopay.com/endpoints/v2.01/payouts) 4 | 5 | 6 | 7 | * * * 8 | 9 | ### PayOuts.create(payOut, callback, options) 10 | 11 | Create new pay-out 12 | 13 | **Parameters** 14 | 15 | **payOut**: `Object`, PayOut object 16 | 17 | **callback**: `function`, Callback function 18 | 19 | **options**: `Object`, Request options 20 | 21 | **Returns**: `Object`, Request promise 22 | 23 | 24 | ### PayOuts.get(payOutId, callback, options) 25 | 26 | Get payout 27 | 28 | **Parameters** 29 | 30 | **payOutId**: `number`, PayOut identifiers 31 | 32 | **callback**: `function`, Callback function 33 | 34 | **options**: `Object`, Request options 35 | 36 | **Returns**: `Object`, Request promise 37 | 38 | 39 | ### PayOuts.getRefunds(payOutId, callback, options) 40 | 41 | Gets list of Refunds of a PayOut 42 | 43 | **Parameters** 44 | 45 | **payOutId**: `number`, PayOut identifier 46 | 47 | **callback**: `function`, Callback function 48 | 49 | **options**: `Object`, Request options 50 | 51 | **Returns**: `Object`, Request promise 52 | 53 | 54 | 55 | * * * 56 | -------------------------------------------------------------------------------- /docs/Refunds.md: -------------------------------------------------------------------------------- 1 | # Refunds 2 | 3 | [MangoPay Refunds API Reference](https://docs.mangopay.com/endpoints/v2.01/refunds) 4 | 5 | 6 | 7 | * * * 8 | 9 | ### Refunds.get(refundId, callback, options) 10 | 11 | Get events 12 | 13 | **Parameters** 14 | 15 | **refundId**: `number`, Refund id 16 | 17 | **callback**: `function`, Callback function 18 | 19 | **options**: `Object`, Request options 20 | 21 | **Returns**: `Object`, Request promise 22 | 23 | 24 | 25 | * * * 26 | -------------------------------------------------------------------------------- /docs/Reports.md: -------------------------------------------------------------------------------- 1 | # Reports 2 | 3 | [MangoPay Reports API Reference](https://docs.mangopay.com/endpoints/v2.01/reporting) 4 | 5 | 6 | 7 | * * * 8 | 9 | ### Reports.create(report, callback, options) 10 | 11 | Create a report 12 | 13 | **Parameters** 14 | 15 | **report**: `Object`, Report Data 16 | 17 | **callback**: `function`, Callback function 18 | 19 | **options**: `Object`, Request options 20 | 21 | **Returns**: `Object`, Request promise 22 | 23 | 24 | ### Reports.get(reportId, callback, options) 25 | 26 | Get a report 27 | 28 | **Parameters** 29 | 30 | **reportId**: `number`, Report Id 31 | 32 | **callback**: `function`, Callback function 33 | 34 | **options**: `Object`, Request options 35 | 36 | **Returns**: `Object`, Request promise 37 | 38 | 39 | ### Reports.getAll(callback, options) 40 | 41 | Get all reports 42 | 43 | **Parameters** 44 | 45 | **callback**: `function`, Callback function 46 | 47 | **options**: `Object`, Request options 48 | 49 | **Returns**: `Object`, Request promise 50 | 51 | 52 | 53 | * * * 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /docs/Repudiations.md: -------------------------------------------------------------------------------- 1 | # Repudiations 2 | 3 | [MangoPay Repudiations API Reference](https://docs.mangopay.com/endpoints/v2.01/repudiations) 4 | 5 | 6 | 7 | * * * 8 | 9 | ### Repudiations.getRefunds(repudiationId, callback, options) 10 | 11 | Gets list of Refunds of a Repudiation 12 | 13 | **Parameters** 14 | 15 | **repudiationId**: `number`, Repudiation identifier 16 | 17 | **callback**: `function`, Callback function 18 | 19 | **options**: `Object`, Request options 20 | 21 | **Returns**: `Object`, Request promise 22 | 23 | 24 | 25 | * * * 26 | -------------------------------------------------------------------------------- /docs/Responses.md: -------------------------------------------------------------------------------- 1 | # Responses 2 | 3 | 4 | 5 | 6 | 7 | * * * 8 | 9 | ### Responses.get(callback, options) 10 | 11 | Get response from previous call 12 | 13 | **Parameters** 14 | 15 | **callback**: `function`, Callback function 16 | 17 | **options**: `Object`, Request options 18 | 19 | **Returns**: `Object`, Request promise 20 | 21 | 22 | 23 | * * * 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /docs/Transfers.md: -------------------------------------------------------------------------------- 1 | # Transfers 2 | 3 | [MangoPay Transfers API Reference](https://docs.mangopay.com/endpoints/v2.01/transfers) 4 | 5 | 6 | 7 | * * * 8 | 9 | ### Transfers.create(transfer, callback, options) 10 | 11 | Create new transfer 12 | 13 | **Parameters** 14 | 15 | **transfer**: `Object`, Transfer object 16 | 17 | **callback**: `function`, Callback function 18 | 19 | **options**: `Object`, Request options 20 | 21 | **Returns**: `Object`, Request promise 22 | 23 | 24 | ### Transfers.get(transferId, callback, options) 25 | 26 | Get transfer 27 | 28 | **Parameters** 29 | 30 | **transferId**: `number`, Transfer identifier 31 | 32 | **callback**: `function`, Callback function 33 | 34 | **options**: `Object`, Request options 35 | 36 | **Returns**: `Object`, Request promise 37 | 38 | 39 | ### Transfers.createRefund(transferId, refund, callback, options) 40 | 41 | Create refund for transfer object 42 | 43 | **Parameters** 44 | 45 | **transferId**: `number`, Transfer identifier 46 | 47 | **refund**: `Object`, Refund object 48 | 49 | **callback**: `function`, Callback function 50 | 51 | **options**: `Object`, Request options 52 | 53 | **Returns**: `Object`, Request promise 54 | 55 | 56 | ### Transfers.getRefunds(transferId, callback, options) 57 | 58 | Gets list of Refunds of a Transfer 59 | 60 | **Parameters** 61 | 62 | **transferId**: `number`, Transfer identifier 63 | 64 | **callback**: `function`, Callback function 65 | 66 | **options**: `Object`, Request options 67 | 68 | **Returns**: `Object`, Request promise 69 | 70 | 71 | 72 | * * * 73 | -------------------------------------------------------------------------------- /docs/UboDeclarations.md: -------------------------------------------------------------------------------- 1 | # Global 2 | 3 | [MangoPay UBO Declaration API Reference](https://docs.mangopay.com/endpoints/v2.01/ubo-declarations) 4 | 5 | 6 | 7 | * * * 8 | 9 | ### create(userId, callback, options) 10 | 11 | Create a UBO declaration object from the API 12 | 13 | **Parameters** 14 | 15 | **userId**: `String`, user Unique identifier 16 | 17 | **callback**: `function`, Create a UBO declaration object from the API 18 | 19 | **options**: `Object`, Create a UBO declaration object from the API 20 | 21 | 22 | 23 | ### get(userId, id, callback, options) 24 | 25 | Retrieves a UBO declaration object from the API. 26 | 27 | **Parameters** 28 | 29 | **userId**: `String`, User Unique identifier 30 | 31 | **id**: `String`, Unique identifier 32 | 33 | **callback**: `function`, Retrieves a UBO declaration object from the API. 34 | 35 | **options**: `Object`, Retrieves a UBO declaration object from the API. 36 | 37 | 38 | 39 | ### getById(id, callback, options) 40 | 41 | Retrieves a UBO declaration object from the API. 42 | 43 | **Parameters** 44 | 45 | **id**: `String`, Unique identifier 46 | 47 | **callback**: `function`, Retrieves a UBO declaration object from the API. 48 | 49 | **options**: `Object`, Retrieves a UBO declaration object from the API. 50 | 51 | 52 | 53 | ### update(userId, uboDeclaration, callback, options) 54 | 55 | Updates a UBO declaration entity. 56 | 57 | **Parameters** 58 | 59 | **userId**: `String`, User Unique Identifier 60 | 61 | **uboDeclaration**: `Object`, Updated UBO declaration entity - must have ID! 62 | 63 | **callback**: `function`, Updates a UBO declaration entity. 64 | 65 | **options**: `Object`, Updates a UBO declaration entity. 66 | 67 | 68 | 69 | 70 | * * * 71 | -------------------------------------------------------------------------------- /docs/Wallets.md: -------------------------------------------------------------------------------- 1 | # Wallets 2 | 3 | [MangoPay Wallets API Reference](https://docs.mangopay.com/endpoints/v2.01/wallets) 4 | 5 | 6 | 7 | * * * 8 | 9 | ### Wallets.create(wallet, callback, options) 10 | 11 | Create new wallet 12 | 13 | **Parameters** 14 | 15 | **wallet**: `Object`, Wallet object 16 | 17 | **callback**: `function`, Callback function 18 | 19 | **options**: `Object`, Request options 20 | 21 | **Returns**: `Object`, Request promise 22 | 23 | 24 | ### Wallets.get(walletId, callback, options) 25 | 26 | Get pay-in 27 | 28 | **Parameters** 29 | 30 | **walletId**: `number`, Wallet identifier 31 | 32 | **callback**: `function`, Callback function 33 | 34 | **options**: `Object`, Request options 35 | 36 | **Returns**: `Object`, Request promise 37 | 38 | 39 | ### Wallets.update(wallet, callback, options) 40 | 41 | Update wallet 42 | 43 | **Parameters** 44 | 45 | **wallet**: `Object`, Wallet object 46 | 47 | **callback**: `function`, Callback function 48 | 49 | **options**: `Object`, Request options 50 | 51 | **Returns**: `Object`, Request promise 52 | 53 | 54 | ### Wallets.getTransactions(walletId, callback, options) 55 | 56 | Get transactions for the wallet 57 | 58 | **Parameters** 59 | 60 | **walletId**: `number`, Wallet identifier 61 | 62 | **callback**: `function`, Callback function 63 | 64 | **options**: `Object`, Request options 65 | 66 | **Returns**: `Object`, Request promise 67 | 68 | 69 | 70 | * * * 71 | -------------------------------------------------------------------------------- /docs/templates/class.mustache: -------------------------------------------------------------------------------- 1 | {{#name}} 2 | ## Class: {{name}} 3 | {{/name}} 4 | {{#description}}{{{description}}}{{/description}} 5 | 6 | {{#members}} 7 | **{{name}}**: {{#typesString}}`{{typesString}}`{{/typesString}} {{#description}}, {{{description}}}{{/description}} 8 | {{/members}} 9 | {{#methods}} 10 | {{> function}} 11 | {{/methods}} 12 | -------------------------------------------------------------------------------- /docs/templates/file.mustache: -------------------------------------------------------------------------------- 1 | {{#modules}} 2 | {{#name}} 3 | # {{name}} 4 | {{/name}} 5 | 6 | {{#description}}{{{description}}}{{/description}} 7 | 8 | {{#hasRequires}} 9 | **Requires:** 10 | 11 | {{#requires}} 12 | + {{{req}}} 13 | {{/requires}} 14 | {{/hasRequires}} 15 | 16 | {{#hasMembers}} 17 | **Members:** 18 | 19 | {{#members}} 20 | + {{{member}}} 21 | {{/members}} 22 | {{/hasMembers}} 23 | 24 | {{#examples}} 25 | **Example:** 26 | ```js 27 | {{{examples}}} 28 | ``` 29 | 30 | {{/examples}} 31 | * * * 32 | 33 | {{#functions}} 34 | {{> function}} 35 | 36 | {{/functions}} 37 | {{#classes}} 38 | {{> class}} 39 | 40 | {{/classes}} 41 | 42 | {{/modules}} 43 | * * * 44 | 45 | {{#copyright}}*{{copyright}}*{{/copyright}} 46 | 47 | {{#author}}**Author:** {{author}}{{/author}} 48 | 49 | {{#license}}**License:** {{license}} {{/license}} 50 | 51 | {{#overview}}**Overview:** {{{overview}}}{{/overview}} 52 | 53 | {{#version}}**Version:** {{version}}{{/version}} 54 | -------------------------------------------------------------------------------- /docs/templates/function.mustache: -------------------------------------------------------------------------------- 1 | ### {{#moduleName}}{{moduleName}}.{{/moduleName}}{{#className}}{{className}}.{{/className}}{{name}}({{#paramsString}}{{paramsString}}{{/paramsString}}) {{#version}}{{version}}{{/version}} 2 | 3 | {{#description}} 4 | {{{description}}} 5 | 6 | {{/description}} 7 | {{#deprecated}} 8 | Deprecated: {{{deprecated}}} 9 | 10 | {{/deprecated}} 11 | {{#hasParams}} 12 | **Parameters** 13 | 14 | {{/hasParams}} 15 | {{#params}} 16 | **{{name}}**: {{#typesString}}`{{typesString}}`{{/typesString}}{{#description}}, {{{description}}}{{/description}} 17 | 18 | {{/params}} 19 | {{#fires}} 20 | **Fires**: {{.}} 21 | 22 | {{/fires}} 23 | {{#returns}} 24 | **Returns**: {{#typesString}}`{{typesString}}`{{/typesString}}{{#description}}, {{{description}}}{{/description}} 25 | {{/returns}} 26 | 27 | {{#examples}} 28 | **Example**: 29 | ```js 30 | {{{examples}}} 31 | ``` 32 | 33 | {{/examples}} 34 | -------------------------------------------------------------------------------- /docs/templates/index.mustache: -------------------------------------------------------------------------------- 1 | # MangoPay Node.js SDK Documentation 2 | 3 | ## Services 4 | * [CardPreAuthorizations](CardPreAuthorizations.md) 5 | * [CardRegistrations](CardRegistrations.md) 6 | * [Cards](Cards.md) 7 | * [DisputeDocuments](DisputeDocuments.md) 8 | * [Disputes](Disputes.md) 9 | * [Events](Events.md) 10 | * [Hooks](Hooks.md) 11 | * [KycDocuments](KycDocuments.md) 12 | * [PayIns](PayIns.md) 13 | * [PayOuts](PayOuts.md) 14 | * [Refunds](Refunds.md) 15 | * [Responses](Responses.md) 16 | * [Transfers](Transfers.md) 17 | * [Users](Users.md) 18 | * [Wallets](Wallets.md) 19 | 20 | ## All available functions 21 | | Function | Description | Source Code | 22 | | -------- | ----------- | ----------- | 23 | {{#functions}} 24 | {{> function}} 25 | 26 | {{/functions}} -------------------------------------------------------------------------------- /docs/templates/overview.mustache: -------------------------------------------------------------------------------- 1 | |[{{moduleName}}.{{name}}]({{{file}}}) | {{description}} | [{{sourcePath}}]({{{sourcePath}}}) | -------------------------------------------------------------------------------- /examples/createWallet.js: -------------------------------------------------------------------------------- 1 | // In your app you will require('mangopay2-nodejs-sdk') 2 | var mangopay = require('../index'); 3 | 4 | // In your app you will define your own set of configurations. 5 | // Check README.md for the full list 6 | var api = new mangopay({ 7 | clientId: 'sdk-unit-tests', 8 | clientApiKey: 'cqFfFrWfCcb7UadHNxx2C9Lo6Djw8ZduLi7J9USTmu8bhxxpju' 9 | }); 10 | 11 | api.Users.create({ 12 | PersonType: "NATURAL", 13 | FirstName: "John", 14 | LastName: "Smith", 15 | Birthday: 1300186358, 16 | Nationality: "FR", 17 | CountryOfResidence: "GB", 18 | Email: "john@smith.eu", 19 | }).then(function (user) { 20 | api.Wallets.create({ 21 | Owners: [ user.Id ], 22 | Description: "create wallet - demo", 23 | Currency: "EUR", 24 | }) 25 | .then(function (res) { 26 | console.log("Wallet successfully created ", res) 27 | }); 28 | }); -------------------------------------------------------------------------------- /examples/failedRequest.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Examples of trying to read invalid data. 3 | */ 4 | var mangopay = require('../index'); 5 | 6 | var api = new mangopay({ 7 | clientId: 'sdk-unit-tests', 8 | clientApiKey: 'cqFfFrWfCcb7UadHNxx2C9Lo6Djw8ZduLi7J9USTmu8bhxxpju' 9 | }); 10 | 11 | /** 12 | * Try to request invalid user 13 | */ 14 | var INVALID_UID = '11510910021zx'; 15 | 16 | api.Users.getNatural(INVALID_UID) 17 | .catch(function(data) { 18 | // Catch the failure 19 | console.error(data.Message); 20 | }); -------------------------------------------------------------------------------- /examples/getBankAccounts.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Examples of reading users data 3 | */ 4 | var mangopay = require('../index'); 5 | 6 | var api = new mangopay({ 7 | clientId: 'sdk-unit-tests', 8 | clientApiKey: 'cqFfFrWfCcb7UadHNxx2C9Lo6Djw8ZduLi7J9USTmu8bhxxpju' 9 | }); 10 | 11 | api.Users.getBankAccounts(108379078, { 12 | parameters: { 13 | per_page: 100, 14 | page: 1, 15 | active: false 16 | } 17 | }).then(function(data){ 18 | console.log("Should be zero: " + data.length); 19 | }); 20 | 21 | api.Users.getBankAccounts(108379078, { 22 | parameters: { 23 | per_page: 100, 24 | page: 1, 25 | active: true 26 | } 27 | }).then(function(data){ 28 | console.log("Should be more than one: " + data.length); 29 | }); -------------------------------------------------------------------------------- /examples/getUserEmoney.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Examples of getting a user's emoney 3 | */ 4 | var mangopay = require('../index'); 5 | 6 | var api = new mangopay({ 7 | clientId: 'sdk-unit-tests', 8 | clientApiKey: 'cqFfFrWfCcb7UadHNxx2C9Lo6Djw8ZduLi7J9USTmu8bhxxpju' 9 | }); 10 | 11 | var USER_ID = '1151091'; 12 | var year = 2019; 13 | 14 | api.Users.getEMoney(USER_ID, year).then(function (data) { 15 | console.log(data); 16 | }); -------------------------------------------------------------------------------- /examples/getUsers.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Examples of reading users data 3 | */ 4 | var mangopay = require('../index'); 5 | 6 | var api = new mangopay({ 7 | clientId: 'sdk-unit-tests', 8 | clientApiKey: 'cqFfFrWfCcb7UadHNxx2C9Lo6Djw8ZduLi7J9USTmu8bhxxpju' 9 | }); 10 | 11 | /** 12 | * Using both callback and promise. Usually you should be using only one of them 13 | */ 14 | api.Users.getNatural('1151091', function(data, response) { 15 | console.log(data.FirstName); 16 | console.log(data.LastName); 17 | }).then(function(data){ 18 | console.log(data.FirstName); 19 | console.log(data.LastName); 20 | }); 21 | 22 | /** 23 | * Example of pagination with promise on getAll users API 24 | */ 25 | api.Users.getAll({ 26 | parameters: { 27 | per_page: 2, 28 | page: 2 29 | } 30 | }).then(function(data){ 31 | console.log(data); 32 | }); -------------------------------------------------------------------------------- /examples/readResponseHeaders.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Examples of reading users data 3 | */ 4 | var mangopay = require('../index'); 5 | 6 | var api = new mangopay({ 7 | clientId: 'sdk-unit-tests', 8 | clientApiKey: 'cqFfFrWfCcb7UadHNxx2C9Lo6Djw8ZduLi7J9USTmu8bhxxpju', 9 | debug: true 10 | }); 11 | 12 | /** 13 | * Read full server response object using a callback 14 | */ 15 | api.Users.getAll(function (response) { 16 | // Read pages count 17 | console.log(response.headers['x-number-of-pages']); 18 | 19 | // Read response body 20 | console.log(response.body); 21 | }, { 22 | parameters: { 23 | per_page: 1 24 | }, 25 | resolveWithFullResponse: true 26 | }); 27 | 28 | /** 29 | * Read full server response object using promise 30 | */ 31 | api.Users.getAll({ 32 | parameters: { 33 | per_page: 1 34 | }, 35 | resolveWithFullResponse: true 36 | }).then(function(response){ 37 | // Read pages count 38 | console.log(response.headers['x-number-of-pages']); 39 | 40 | // Read response body 41 | console.log(response.body); 42 | }); -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./lib/mangopay'); -------------------------------------------------------------------------------- /lib/Model.js: -------------------------------------------------------------------------------- 1 | var _ = require('underscore'); 2 | 3 | function Model(data) { 4 | var nonNullDefaults = _.omit(this.defaults, _.isEmpty); 5 | _.extend(this, nonNullDefaults, data); 6 | this.initialize(data); 7 | } 8 | 9 | Model.prototype = { 10 | /** 11 | * Construct 12 | */ 13 | initialize: function() { 14 | this.parse(); 15 | return; 16 | }, 17 | 18 | /** 19 | * Returns object property value 20 | * @param {string} attribute - Property value to return 21 | * @returns {*} 22 | */ 23 | getData: function(attribute) { 24 | return this[attribute]; 25 | }, 26 | 27 | /** 28 | * 29 | * @param {string|Object} attribute - attribute's value to be set or hash of properties with values 30 | * @param {string=} value - value to be set 31 | * @returns {object} 32 | */ 33 | setData: function(attribute, value) { 34 | if (typeof attribute === 'object') { 35 | _.extend(this, attribute); 36 | } else { 37 | this[attribute] = value; 38 | } 39 | 40 | return this; 41 | }, 42 | 43 | getReadOnlyProperties: function() { 44 | return []; 45 | }, 46 | 47 | getDependsObjects: function() { 48 | return []; 49 | }, 50 | 51 | parse: function() { 52 | return; 53 | } 54 | }; 55 | 56 | Model.extend = require('./utils').extend; 57 | 58 | module.exports = Model; -------------------------------------------------------------------------------- /lib/config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | /** 3 | * Client Id 4 | */ 5 | clientId: null, 6 | 7 | /** 8 | * Client api key 9 | */ 10 | clientApiKey: null, 11 | 12 | /** 13 | * Base URL to MangoPay API 14 | * Production URL changes to baseUrl: 'https://api.mangopay.com' 15 | */ 16 | baseUrl: 'https://api.sandbox.mangopay.com', 17 | 18 | /** 19 | * [INTERNAL USAGE ONLY] 20 | * Switch debug mode: log all request and response data 21 | */ 22 | debugMode: false, 23 | 24 | /** 25 | * Set the logging class if DebugMode is enabled 26 | */ 27 | logClass: require('./log'), 28 | 29 | /** 30 | * Set the connection timeout limit (in milliseconds) 31 | */ 32 | connectionTimeout: 30000, 33 | 34 | /** 35 | * Set the response timeout limit (in milliseconds) 36 | */ 37 | responseTimeout: 30000, 38 | 39 | /** 40 | * Mangopay REST API version - will be appended in the front of the endpoints 41 | */ 42 | apiVersion: 'v2.01', 43 | 44 | /** 45 | * Set to true for uk traffic 46 | */ 47 | ukHeaderFlag: false, 48 | 49 | /** 50 | * Custom error handler 51 | */ 52 | errorHandler: function(options, err) { 53 | console.error(options, err); 54 | } 55 | }; 56 | -------------------------------------------------------------------------------- /lib/log.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Manage debug logs in MangoPay SDK 3 | */ 4 | var Log = function() { 5 | console.log(arguments); 6 | }; 7 | 8 | 9 | module.exports = Log; -------------------------------------------------------------------------------- /lib/mangopay.js: -------------------------------------------------------------------------------- 1 | var _ = require('underscore'); 2 | var api = require('./api'); 3 | 4 | _.extend(api.prototype, { 5 | Log: require('./log') 6 | }); 7 | 8 | module.exports = api; -------------------------------------------------------------------------------- /lib/models/Address.js: -------------------------------------------------------------------------------- 1 | var EntityBase = require('./EntityBase'); 2 | var Address = require('./Address'); 3 | 4 | module.exports = EntityBase.extend({ 5 | defaults: { 6 | AddressLine1: null, 7 | AddressLine2: null, 8 | City: null, 9 | Region: null, 10 | PostalCode: null, 11 | Country: null 12 | }, 13 | 14 | toString: function() { 15 | var address = _.compact([ 16 | this.AddressLine1, 17 | this.AddressLine2, 18 | this.City, 19 | this.Region, 20 | this.PostalCode, 21 | this.Country 22 | ]); 23 | 24 | return address.join(', '); 25 | }, 26 | 27 | getSubObjects: function() { 28 | return { 29 | 'OwnerAddress': Address 30 | }; 31 | } 32 | }); -------------------------------------------------------------------------------- /lib/models/BankAccount.js: -------------------------------------------------------------------------------- 1 | var EntityBase = require('./EntityBase'); 2 | 3 | var BankAccount = EntityBase.extend({ 4 | defaults: { 5 | UserId: null, 6 | 7 | Type: null, 8 | 9 | OwnerName: null, 10 | 11 | OwnerAddress: null, 12 | 13 | Details: null, 14 | 15 | Active: null 16 | }, 17 | 18 | getDependsObjects: function() { 19 | return [ 20 | { 21 | dependsPropertyName: 'Type', 22 | propertyName: 'Details', 23 | propertyValueMapping: { 24 | 'IBAN': require('./BankAccountDetailsIBAN'), 25 | 'GB': require('./BankAccountDetailsGB'), 26 | 'US': require('./BankAccountDetailsUS'), 27 | 'CA': require('./BankAccountDetailsCA'), 28 | 'OTHERS': require('./BankAccountDetailsOTHER') 29 | } 30 | } 31 | ] 32 | }, 33 | 34 | /** 35 | * Get array with read-only properties 36 | * @return {Array} List of string properties 37 | */ 38 | getReadOnlyProperties: function () { 39 | var properties = EntityBase.prototype.getReadOnlyProperties(); 40 | properties.push('UserId', 'Type'); 41 | return properties; 42 | } 43 | }); 44 | 45 | module.exports = BankAccount; -------------------------------------------------------------------------------- /lib/models/BankAccountDetails.js: -------------------------------------------------------------------------------- 1 | var EntityBase = require('./EntityBase'); 2 | 3 | var BankAccountDetails = EntityBase.extend({ 4 | 5 | }); 6 | 7 | module.exports = BankAccountDetails; -------------------------------------------------------------------------------- /lib/models/BankAccountDetailsCA.js: -------------------------------------------------------------------------------- 1 | var BankAccountDetails = require('./BankAccountDetails'); 2 | 3 | var BankAccountDetailsCA = BankAccountDetails.extend({ 4 | defaults: { 5 | BankName: null, 6 | InstitutionNumber: null, 7 | BranchCode: null, 8 | AccountNumber: null 9 | } 10 | }); 11 | 12 | module.exports = BankAccountDetailsCA; -------------------------------------------------------------------------------- /lib/models/BankAccountDetailsGB.js: -------------------------------------------------------------------------------- 1 | var BankAccountDetails = require('./BankAccountDetails'); 2 | 3 | var BankAccountDetailsGB = BankAccountDetails.extend({ 4 | defaults: { 5 | AccountNumber: null, 6 | SortCode: null 7 | } 8 | }); 9 | 10 | module.exports = BankAccountDetailsGB; -------------------------------------------------------------------------------- /lib/models/BankAccountDetailsIBAN.js: -------------------------------------------------------------------------------- 1 | var BankAccountDetails = require('./BankAccountDetails'); 2 | 3 | var BankAccountDetailsIBAN = BankAccountDetails.extend({ 4 | defaults: { 5 | IBAN: null, 6 | BIC: null 7 | } 8 | }); 9 | 10 | module.exports = BankAccountDetailsIBAN; -------------------------------------------------------------------------------- /lib/models/BankAccountDetailsOTHER.js: -------------------------------------------------------------------------------- 1 | var BankAccountDetails = require('./BankAccountDetails'); 2 | 3 | var BankAccountDetailsOTHER = BankAccountDetails.extend({ 4 | defaults: { 5 | Type: null, 6 | /** 7 | * The Country associate to the BankAccount, 8 | * ISO 3166-1 alpha-2 format is expected 9 | */ 10 | Country: null, 11 | BIC: null, 12 | AccountNumber: null 13 | } 14 | }); 15 | 16 | module.exports = BankAccountDetailsOTHER; -------------------------------------------------------------------------------- /lib/models/BankAccountDetailsUS.js: -------------------------------------------------------------------------------- 1 | var BankAccountDetails = require('./BankAccountDetails'); 2 | 3 | var BankAccountDetailsOTHER = BankAccountDetails.extend({ 4 | defaults: { 5 | AccountNumber: null, 6 | ABA: null, 7 | /** 8 | * DepositAccountType { CHECKING, SAVINGS } 9 | */ 10 | DepositAccountType: null 11 | } 12 | }); 13 | 14 | module.exports = BankAccountDetailsOTHER; -------------------------------------------------------------------------------- /lib/models/BankAccountType.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | NotSpecified: 'NotSpecified', 3 | IBAN: 'IBAN', 4 | GB: 'GB', 5 | US: 'US', 6 | CA: 'CA', 7 | OTHER: 'OTHER' 8 | }; -------------------------------------------------------------------------------- /lib/models/BankingAlias.js: -------------------------------------------------------------------------------- 1 | var EntityBase = require('./EntityBase'); 2 | 3 | var BankingAlias = EntityBase.extend({ 4 | defaults: { 5 | /** 6 | * Custom data that you can add to this item 7 | */ 8 | Tag: null, 9 | 10 | /** 11 | * The User ID who was credited 12 | */ 13 | CreditedUserId: null, 14 | 15 | /** 16 | * The ID of a wallet 17 | */ 18 | WalletId: null, 19 | 20 | /** 21 | * The type of banking alias (note that only IBAN is available at present) 22 | */ 23 | Type: null, 24 | 25 | /** 26 | * The name of the owner of the bank account 27 | */ 28 | OwnerName: null, 29 | 30 | /** 31 | * Wether the banking alias is active or not 32 | */ 33 | Active: true 34 | } 35 | }); 36 | 37 | module.exports = BankingAlias; 38 | -------------------------------------------------------------------------------- /lib/models/BankingAliasIBAN.js: -------------------------------------------------------------------------------- 1 | var BankingAlias = require('./BankingAlias'); 2 | 3 | var BankingAliasIBAN = BankingAlias.extend({ 4 | defaults: { 5 | /** 6 | * The type of banking alias (note that only IBAN is available at present) 7 | */ 8 | Type: 'IBAN', 9 | 10 | /** 11 | * Custom data that you can add to this item 12 | */ 13 | IBAN: null, 14 | 15 | /** 16 | * Custom data that you can add to this item 17 | */ 18 | BIC: null, 19 | 20 | /** 21 | * The country 22 | */ 23 | Country: null 24 | } 25 | }); 26 | 27 | module.exports = BankingAliasIBAN; 28 | -------------------------------------------------------------------------------- /lib/models/Billing.js: -------------------------------------------------------------------------------- 1 | var EntityBase = require('./EntityBase'); 2 | 3 | var Billing = EntityBase.extend({ 4 | defaults: { 5 | FirstName: null, 6 | LastName: null, 7 | /** 8 | * The address 9 | */ 10 | Address: null 11 | } 12 | }); 13 | 14 | module.exports = Billing; -------------------------------------------------------------------------------- /lib/models/BinData.js: -------------------------------------------------------------------------------- 1 | var EntityBase = require('./EntityBase'); 2 | 3 | var BinData = EntityBase.extend({ 4 | defaults: { 5 | /** 6 | * The subtype of the card product. Examples include: CLASSIC, GOLD, PLATINUM, PREPAID, etc. 7 | */ 8 | Subtype: null, 9 | /** 10 | * The card brand. Examples include: AMERICAN EXPRESS, DISCOVER, JCB, MASTERCARD, VISA, etc. 11 | */ 12 | Brand: null 13 | } 14 | }); 15 | 16 | module.exports = BinData; 17 | -------------------------------------------------------------------------------- /lib/models/Birthplace.js: -------------------------------------------------------------------------------- 1 | var Model = require('./../Model'); 2 | 3 | var Birthplace = Model.extend({ 4 | defaults: { 5 | City: String, 6 | Country: String 7 | } 8 | }); 9 | 10 | module.exports = Birthplace; -------------------------------------------------------------------------------- /lib/models/BrowserInfo.js: -------------------------------------------------------------------------------- 1 | var EntityBase = require('./EntityBase'); 2 | 3 | module.exports = EntityBase.extend({ 4 | defaults: { 5 | AcceptHeader: null, 6 | JavaEnabled: null, 7 | JavascriptEnabled: null, 8 | Language: null, 9 | ColorDepth: null, 10 | ScreenHeight: null, 11 | ScreenWidth: null, 12 | TimeZoneOffset: null, 13 | UserAgent: null 14 | } 15 | }); -------------------------------------------------------------------------------- /lib/models/Card.js: -------------------------------------------------------------------------------- 1 | var EntityBase = require('./EntityBase'); 2 | 3 | module.exports = EntityBase.extend({ 4 | defaults: { 5 | ExpirationDate: null, 6 | Alias: null, 7 | CardProvider: null, 8 | UserId: null, 9 | CardType: null, 10 | Product: null, 11 | BankCode: null, 12 | Country: null, 13 | Active: null, 14 | Currency: null, 15 | Validity: null, 16 | Fingerprint: null, 17 | CardHolderName: null 18 | } 19 | }); -------------------------------------------------------------------------------- /lib/models/CardInfo.js: -------------------------------------------------------------------------------- 1 | var EntityBase = require('./EntityBase'); 2 | 3 | var CardInfo = EntityBase.extend({ 4 | defaults: { 5 | /** 6 | * The 6-digit bank identification number (BIN) of the card issuer. 7 | */ 8 | BIN: null, 9 | /** 10 | * The name of the card issuer. 11 | */ 12 | IssuingBank: null, 13 | /** 14 | * TThe country where the card was issued. 15 | */ 16 | IssuerCountryCode: null, 17 | /** 18 | * The type of card product: DEBIT, CREDIT, CHARGE CARD. 19 | */ 20 | Type: null, 21 | /** 22 | * The card brand. Examples include: AMERICAN EXPRESS, DISCOVER, JCB, MASTERCARD, VISA, etc. 23 | */ 24 | Brand: null, 25 | /** 26 | * The subtype of the card product. Examples include: CLASSIC, GOLD, PLATINUM, PREPAID, etc. 27 | */ 28 | SubType: null 29 | } 30 | }); 31 | 32 | module.exports = CardInfo; -------------------------------------------------------------------------------- /lib/models/CardRegistration.js: -------------------------------------------------------------------------------- 1 | var _ = require('underscore'); 2 | var Model = require('../Model'); 3 | 4 | var CardRegistration = Model.extend({ 5 | defaults: { 6 | UserId: null, 7 | CardType: null, 8 | AccessKey: null, 9 | PreregistrationData: null, 10 | CardRegistrationURL: null, 11 | CardId: null, 12 | RegistrationData: null, 13 | ResultCode: null, 14 | ResultMessage: null, 15 | Currency: null, 16 | Status: null, 17 | CardHolderName: null 18 | }, 19 | 20 | getReadOnlyProperties: function() { 21 | var properties = Model.prototype.getReadOnlyProperties(); 22 | properties.push('AccessKey', 'PreregistrationData', 'CardRegistrationURL', 'CardId', 'ResultCode', 23 | 'ResultMessage', 'Status'); 24 | 25 | return properties; 26 | } 27 | }); 28 | 29 | module.exports = CardRegistration; -------------------------------------------------------------------------------- /lib/models/CardValidation.js: -------------------------------------------------------------------------------- 1 | var EntityBase = require('./EntityBase'); 2 | 3 | module.exports = EntityBase.extend({ 4 | defaults: { 5 | AuthorId: null, 6 | Status: null, 7 | SecureModeReturnURL: null, 8 | SecureModeRedirectURL: null, 9 | SecureModeNeeded: null, 10 | SecureMode: null, 11 | IpAddress: null, 12 | BrowserInfo: null, 13 | Validity: null, 14 | Type: null, 15 | Applied3DSVersion: null, 16 | ResultCode: null, 17 | ResultMessage: null 18 | } 19 | }); 20 | -------------------------------------------------------------------------------- /lib/models/CategorizeUserLegal.js: -------------------------------------------------------------------------------- 1 | var Model = require('./../Model'); 2 | 3 | var CategorizeUserLegal = Model.extend({ 4 | defaults: { 5 | Id: null, 6 | UserCategory: null, 7 | TermsAndConditionsAccepted: null, 8 | LegalRepresentative: null, 9 | HeadquartersAddress: null, 10 | CompanyNumber: null 11 | } 12 | }); 13 | 14 | module.exports = CategorizeUserLegal; -------------------------------------------------------------------------------- /lib/models/CategorizeUserNatural.js: -------------------------------------------------------------------------------- 1 | var Model = require('./../Model'); 2 | 3 | var CategorizeUserNatural = Model.extend({ 4 | defaults: { 5 | Id: null, 6 | UserCategory: null, 7 | TermsAndConditionsAccepted: null, 8 | Email: null, 9 | Birthday: null, 10 | Nationality: null, 11 | CountryOfResidence: null, 12 | PhoneNumber: null, 13 | PhoneNumberCountry: null 14 | } 15 | }); 16 | 17 | module.exports = CategorizeUserNatural; -------------------------------------------------------------------------------- /lib/models/Check.js: -------------------------------------------------------------------------------- 1 | var Model = require('../Model'); 2 | 3 | module.exports = Model.extend({ 4 | defaults: { 5 | CheckId: null, 6 | Type: null, 7 | CheckStatus: null, 8 | CreationDate: null, 9 | LastUpdate: null, 10 | Data: null, 11 | Reasons: null 12 | } 13 | }); -------------------------------------------------------------------------------- /lib/models/CheckData.js: -------------------------------------------------------------------------------- 1 | var Model = require('../Model'); 2 | 3 | module.exports = Model.extend({ 4 | defaults: { 5 | Type: null, 6 | Value: null 7 | } 8 | }); -------------------------------------------------------------------------------- /lib/models/Client.js: -------------------------------------------------------------------------------- 1 | var EntityBase = require('./EntityBase'); 2 | 3 | var Client = EntityBase.extend({ 4 | defaults: { 5 | Name: null, 6 | ClientId: null, 7 | /** 8 | *The primary branding colour to use for your merchant 9 | */ 10 | PrimaryThemeColour: null, 11 | /** 12 | * The primary branding colour to use for buttons for your merchant 13 | */ 14 | PrimaryButtonColour: null, 15 | /** 16 | * The URL of the logo of your client 17 | */ 18 | Logo: null, 19 | /** 20 | * A list of email addresses to use when contacting you for technical issues/communications 21 | */ 22 | TechEmails: null, 23 | /** 24 | * A list of email addresses to use when contacting you for admin/commercial issues/communications 25 | */ 26 | AdminEmails: null, 27 | /** 28 | * A list of email addresses to use when contacting you for fraud/compliance issues/communications 29 | */ 30 | FraudEmails: null, 31 | /** 32 | * A list of email addresses to use when contacting you for billing issues/communications 33 | */ 34 | BillingEmails: null, 35 | /** 36 | * A description of what your platform does 37 | */ 38 | PlatformDescription: null, 39 | /** 40 | * Client's business categorization info 41 | */ 42 | PlatformCategorization: null, 43 | /** 44 | * The URL for your website 45 | */ 46 | PlatformURL: null, 47 | 48 | HeadquartersAddress: null, 49 | 50 | HeadquartersPhoneNumber: null, 51 | /** 52 | * The tax (or VAT) number for your company 53 | */ 54 | TaxNumber: null 55 | } 56 | }); 57 | 58 | module.exports = Client; 59 | -------------------------------------------------------------------------------- /lib/models/ClientWallet.js: -------------------------------------------------------------------------------- 1 | var EntityBase = require('./EntityBase'); 2 | var Money = require('./Money'); 3 | 4 | var ClientWallet = EntityBase.extend({ 5 | defaults : { 6 | Balance : null, 7 | Currency : null, 8 | FundsType : null 9 | }, 10 | 11 | getSubObjects: function() { 12 | return { 13 | 'Balance': Money 14 | } 15 | }, 16 | 17 | /** 18 | * Get array with read-only properties 19 | * @return {Array} List of string properties 20 | */ 21 | getReadOnlyProperties: function() { 22 | var properties = EntityBase.prototype.getReadOnlyProperties(); 23 | properties.push('Balance'); 24 | return properties; 25 | } 26 | }); 27 | 28 | module.exports = ClientWallet; -------------------------------------------------------------------------------- /lib/models/Conversion.js: -------------------------------------------------------------------------------- 1 | var EntityBase = require('./EntityBase'); 2 | 3 | module.exports = EntityBase.extend({ 4 | defaults: { 5 | AuthorId: null, 6 | DebitedWalletId: null, 7 | CreditedWalletId: null, 8 | DebitedFunds: null, 9 | CreditedFunds: null, 10 | Fees: null, 11 | ConversionRate: null, 12 | Status: null, 13 | Type: null, 14 | Nature: null, 15 | ResultCode: null, 16 | ResultMessage: null, 17 | ExecutionDate: null 18 | } 19 | }); -------------------------------------------------------------------------------- /lib/models/ConversionRate.js: -------------------------------------------------------------------------------- 1 | var Model = require('../Model'); 2 | 3 | module.exports = Model.extend({ 4 | defaults: { 5 | DebitedCurrency: null, 6 | CreditedCurrency: null, 7 | ClientRate: null, 8 | MarketRate: null 9 | } 10 | }); -------------------------------------------------------------------------------- /lib/models/CountryAuthorization.js: -------------------------------------------------------------------------------- 1 | var EntityBase = require('./EntityBase'); 2 | 3 | var CountryAuthorization = EntityBase.extend({ 4 | defaults: { 5 | CountryCode: null, 6 | CountryName: null, 7 | Authorization: null, 8 | LastUpdate: null 9 | } 10 | }); 11 | 12 | module.exports = CountryAuthorization; 13 | -------------------------------------------------------------------------------- /lib/models/DebitedBankAccount.js: -------------------------------------------------------------------------------- 1 | var Model = require('../Model'); 2 | var Money = require('./Money'); 3 | 4 | var DebitedBankAccount = Model.extend({ 5 | defaults: { 6 | OwnerName: null, 7 | AccountNumber: null, 8 | IBAN: null, 9 | BIC: null, 10 | Type: null, 11 | Country: null 12 | } 13 | }); 14 | 15 | module.exports = DebitedBankAccount; -------------------------------------------------------------------------------- /lib/models/DeclaredUbo.js: -------------------------------------------------------------------------------- 1 | var Model = require('./../Model') 2 | 3 | /** 4 | * Represents validation status of a user declared as UBO. 5 | */ 6 | var DeclaredUbo = Model.extend({ 7 | defaults: { 8 | /** 9 | * ID of the declared user 10 | */ 11 | UserId: null, 12 | /** 13 | * Validation status of this declared UBO 14 | * One of DeclaredUboStatus 15 | */ 16 | Status: null, 17 | /** 18 | * Reason why the UBO is not valid 19 | * One of UboRefusedReasonType 20 | */ 21 | RefusedReasonType: null, 22 | /** 23 | * Message explaining why the UBO is not valid 24 | */ 25 | RefusedReasonMessage: null 26 | } 27 | }); 28 | 29 | module.exports = DeclaredUbo; -------------------------------------------------------------------------------- /lib/models/DeclaredUboStatus.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Enumeration of possible statuses of a declared UBO. 3 | */ 4 | module.exports = { 5 | /** 6 | * When declaration of a UBO was created 7 | */ 8 | Created: 'CREATED', 9 | /** 10 | * When declaration of a UBO was validated 11 | */ 12 | Validated: 'VALIDATED', 13 | /** 14 | * When declaration of a UBO was refused 15 | */ 16 | Refused: 'REFUSED' 17 | }; -------------------------------------------------------------------------------- /lib/models/Deposit.js: -------------------------------------------------------------------------------- 1 | var EntityBase = require('./EntityBase'); 2 | 3 | module.exports = EntityBase.extend({ 4 | defaults: { 5 | AuthorId: null, 6 | DebitedFunds: null, 7 | Status: null, 8 | PaymentStatus: null, 9 | PayinsLinked: null, 10 | ResultCode: null, 11 | ResultMessage: null, 12 | CardId: null, 13 | SecureModeReturnURL: null, 14 | SecureModeRedirectURL: null, 15 | SecureModeNeeded: null, 16 | ExpirationDate: null, 17 | PaymentType: null, 18 | ExecutionType: null, 19 | StatementDescriptor: null, 20 | Culture: null, 21 | IpAddress: null, 22 | BrowserInfo: null, 23 | Billing: null, 24 | Shipping: null, 25 | Requested3DSVersion: null, 26 | Applied3DSVersion: null, 27 | CardInfo: null 28 | } 29 | }); 30 | -------------------------------------------------------------------------------- /lib/models/Dispute.js: -------------------------------------------------------------------------------- 1 | var _ = require('underscore'); 2 | var Model = require('../Model'); 3 | var Money = require('./Money'); 4 | var DisputeReason = require('./DisputeReason'); 5 | 6 | var Dispute = Model.extend({ 7 | defaults: { 8 | InitialTransactionId: null, 9 | InitialTransactionType: null, 10 | DisputeType: null, 11 | ContestDeadlineDate: null, 12 | ClosedDate: null, 13 | DisputeReason: null, 14 | DisputedFunds: null, 15 | ContestedFunds: null, 16 | Status: null, 17 | 18 | /** 19 | * Free text used when reopening the dispute 20 | */ 21 | StatusMessage: null, 22 | 23 | /** 24 | * The outcome of the dispute – will be null until closed, and then one of WON, LOST or VOID 25 | */ 26 | ResultCode: null, 27 | ResultMessage: null 28 | }, 29 | 30 | getSubObjects: function() { 31 | return { 32 | 'DisputeReason': DisputeReason, 33 | 'DisputedFunds': Money, 34 | 'ContestedFunds': Money 35 | } 36 | }, 37 | 38 | getReadOnlyProperties: function() { 39 | var properties = Model.prototype.getReadOnlyProperties(); 40 | properties.push('InitialTransactionId', 'InitialTransactionType', 'DisputeType', 'ContestDeadlineDate', 41 | 'DisputeReason', 'DisputedFunds', 'Status', 'StatusMessage', 'ResultCode', 'ResultMessage'); 42 | return properties; 43 | } 44 | }); 45 | 46 | module.exports = Dispute; -------------------------------------------------------------------------------- /lib/models/DisputeDocument.js: -------------------------------------------------------------------------------- 1 | var Document = require('./Document'); 2 | 3 | var DisputeDocument = Document.extend({ 4 | defaults: { 5 | DisputeId: null, 6 | Type: null 7 | } 8 | }); 9 | 10 | module.exports = DisputeDocument; -------------------------------------------------------------------------------- /lib/models/DisputeDocumentPage.js: -------------------------------------------------------------------------------- 1 | var EntityBase = require('./EntityBase'); 2 | 3 | var DisputeDocumentPage = EntityBase.extend({ 4 | defaults: { 5 | /** 6 | * Image base64 7 | */ 8 | File: null 9 | } 10 | }); 11 | 12 | module.exports = DisputeDocumentPage; -------------------------------------------------------------------------------- /lib/models/DisputeReason.js: -------------------------------------------------------------------------------- 1 | var _ = require('underscore'); 2 | var Model = require('../Model'); 3 | 4 | var DisputeReason = Model.extend({ 5 | defaults: { 6 | DisputeReasonType: null, 7 | DisputeReasonMessage: null 8 | } 9 | }); 10 | 11 | module.exports = DisputeReason; -------------------------------------------------------------------------------- /lib/models/Document.js: -------------------------------------------------------------------------------- 1 | var EntityBase = require('./EntityBase'); 2 | 3 | var Document = EntityBase.extend({ 4 | defaults: { 5 | Status: null, 6 | RefusedReasonMessage: null, 7 | RefusedReasonType: null, 8 | ProcessedDate: null 9 | } 10 | }); 11 | 12 | module.exports = Document; -------------------------------------------------------------------------------- /lib/models/DocumentPageConsult.js: -------------------------------------------------------------------------------- 1 | var Model = require('../Model'); 2 | 3 | var DocumentPageConsult = Model.extend({ 4 | defaults: { 5 | /** 6 | * URL where this document page can be viewed. 7 | */ 8 | Url: null, 9 | 10 | /** 11 | * Time in millis when the page consult will expire. 12 | */ 13 | ExpirationDate: null 14 | } 15 | }); 16 | 17 | module.exports = DocumentPageConsult; -------------------------------------------------------------------------------- /lib/models/EMoney.js: -------------------------------------------------------------------------------- 1 | var _ = require('underscore'); 2 | 3 | var Model = require('../Model'); 4 | var Money = require('./Money'); 5 | 6 | var EMoney = Model.extend({ 7 | defaults: _.extend({}, Model.prototype.defaults, { 8 | /** 9 | * Owner object owner's UserId 10 | */ 11 | UserId: null, 12 | CreditedEMoney: null, 13 | DebitedEMoney: null 14 | }), 15 | 16 | /** 17 | * Get object with key as object type and value the object class 18 | * @return {Object} Sub-objects mapping 19 | */ 20 | getSubObjects: function () { 21 | var subObjects = User.prototype.getSubObjects(); 22 | 23 | return _.extend({}, subObjects, { 24 | CreditedEMoney: Money, 25 | DebitedEMoney: Money 26 | }); 27 | } 28 | }); 29 | 30 | module.exports = EMoney; 31 | -------------------------------------------------------------------------------- /lib/models/Hook.js: -------------------------------------------------------------------------------- 1 | var EntityBase = require('./EntityBase'); 2 | 3 | module.exports = EntityBase.extend({ 4 | defaults: { 5 | /** 6 | * This is the URL where your receive notification for each EventType 7 | */ 8 | Url: null, 9 | /** 10 | * Status: ENABLED, DISABLED 11 | */ 12 | Status: null, 13 | /** 14 | * Validity: VALID, INVALID 15 | */ 16 | Validity: null, 17 | EventType: null 18 | } 19 | }); -------------------------------------------------------------------------------- /lib/models/IdempotencyResponse.js: -------------------------------------------------------------------------------- 1 | var EntityBase = require('./EntityBase'); 2 | 3 | module.exports = EntityBase.extend({ 4 | defaults: { 5 | StatusCode: null, 6 | ContentLength: null, 7 | ContentType: null, 8 | Date: null, 9 | Resource: null 10 | } 11 | }); 12 | -------------------------------------------------------------------------------- /lib/models/IdentityVerification.js: -------------------------------------------------------------------------------- 1 | var EntityBase = require('./EntityBase'); 2 | 3 | module.exports = EntityBase.extend({ 4 | defaults: { 5 | HostedUrl: null, 6 | Status: null, 7 | ReturnUrl: null, 8 | LastUpdate: null, 9 | UserId: null, 10 | Checks: null 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /lib/models/KycDocument.js: -------------------------------------------------------------------------------- 1 | var Document = require('./Document'); 2 | 3 | var KycDocument = Document.extend({ 4 | defaults: { 5 | UserId: null, 6 | Flags: null, 7 | Tag: null 8 | } 9 | }); 10 | 11 | module.exports = KycDocument; 12 | -------------------------------------------------------------------------------- /lib/models/KycDocumentStatus.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | Created: 'CREATED', 3 | ValidationAsked: 'VALIDATION_ASKED', 4 | Validated: 'VALIDATED', 5 | Refused: 'REFUSED', 6 | OutOfDate: 'OUT_OF_DATE' 7 | }; 8 | -------------------------------------------------------------------------------- /lib/models/KycDocumentType.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | IdentityProof: 'IDENTITY_PROOF', 3 | RegistrationProof: 'REGISTRATION_PROOF', 4 | ArticlesOfAssociation: 'ARTICLES_OF_ASSOCIATION', 5 | ShareholderDeclaration: 'SHAREHOLDER_DECLARATION', 6 | AddressProof: 'ADDRESS_PROOF' 7 | }; -------------------------------------------------------------------------------- /lib/models/KycPage.js: -------------------------------------------------------------------------------- 1 | var EntityBase = require('./EntityBase'); 2 | 3 | var KycPage = EntityBase.extend({ 4 | defaults: { 5 | /** 6 | * Image base64 7 | */ 8 | File: null 9 | } 10 | }); 11 | 12 | module.exports = KycPage; -------------------------------------------------------------------------------- /lib/models/LegalPersonType.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | NotSpecified: 'NotSpecified', 3 | Business: 'BUSINESS', 4 | Organization: 'ORGANIZATION', 5 | Soletrader: 'SOLETRADER', 6 | Partnership: 'PARTNERSHIP' 7 | }; 8 | -------------------------------------------------------------------------------- /lib/models/LegalRepresentative.js: -------------------------------------------------------------------------------- 1 | var EntityBase = require('./EntityBase'); 2 | 3 | var LegalRepresentative = EntityBase.extend({ 4 | defaults: { 5 | FirstName: null, 6 | LastName: null, 7 | Birthday: null, 8 | Nationality: null, 9 | CountryOfResidence: null, 10 | Email: null, 11 | PhoneNumber: null, 12 | PhoneNumberCountry: null 13 | } 14 | }); 15 | 16 | module.exports = LegalRepresentative; -------------------------------------------------------------------------------- /lib/models/Mandate.js: -------------------------------------------------------------------------------- 1 | var _ = require('underscore'); 2 | var Model = require('../Model'); 3 | 4 | var Mandate = Model.extend({ 5 | defaults: { 6 | /** 7 | * When the item was created 8 | */ 9 | CreationDate: null, 10 | /** 11 | * Custom data that you can add to this item 12 | */ 13 | Tag: null, 14 | /** 15 | * An ID of a Bank Account 16 | */ 17 | BankAccountId: null, 18 | /** 19 | * The object owner's UserId 20 | */ 21 | UserId: null, 22 | /** 23 | * The URL to redirect to after payment (whether successful or not) 24 | */ 25 | ReturnURL: null, 26 | /** 27 | * The URL to redirect to user to for them to proceed with the payment 28 | */ 29 | RedirectURL: null, 30 | /** 31 | * The URL to download the mandate 32 | */ 33 | DocumentURL: null, 34 | /** 35 | * The language to use for the mandate confirmation page - needs to be the ISO code of the language 36 | */ 37 | Culture: null, 38 | /** 39 | * The type of mandate, but will only be completed once the mandate has been submitted 40 | */ 41 | Scheme: null, 42 | /** 43 | * The status of the mandate 44 | */ 45 | Status: null, 46 | /** 47 | * The result code 48 | */ 49 | ResultCode: null, 50 | /** 51 | * A verbal explanation of the ResultCode 52 | */ 53 | ResultMessage: null, 54 | /** 55 | * The execution type for creating the mandate 56 | */ 57 | ExecutionType: 'WEB', 58 | /** 59 | * The type of Mandate, defaults to DIRECT_DEBIT 60 | */ 61 | MandateType: 'DIRECT_DEBIT', 62 | /** 63 | * The bank reference 64 | */ 65 | BankReference: null 66 | } 67 | }); 68 | 69 | module.exports = Mandate; -------------------------------------------------------------------------------- /lib/models/MandateStatus.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | Created: 'CREATED', 3 | Submitted: 'SUBMITTED', 4 | Active: 'ACTIVE', 5 | Failed: 'FAILED', 6 | Expired: 'EXPIRED' 7 | }; 8 | -------------------------------------------------------------------------------- /lib/models/Money.js: -------------------------------------------------------------------------------- 1 | var EntityBase = require('./EntityBase'); 2 | 3 | var Money = EntityBase.extend({ 4 | defaults: { 5 | /** 6 | * The currency - should be ISO 4217 format 7 | */ 8 | Currency: null, 9 | /** 10 | * The amount of money in cents, e.g. 12.60€ would be represented as 1260 11 | */ 12 | Amount: null 13 | } 14 | }); 15 | 16 | module.exports = Money; -------------------------------------------------------------------------------- /lib/models/PayIn.js: -------------------------------------------------------------------------------- 1 | var _ = require('underscore'); 2 | var Transaction = require('./Transaction'); 3 | 4 | var PayIn = Transaction.extend({ 5 | defaults: _.extend({}, Transaction.prototype.defaults, { 6 | CreditedWalletId: null, 7 | /** 8 | * PaymentType (CARD, BANK_WIRE, DIRECT_DEBIT, PREAUTHORIZED) 9 | */ 10 | PaymentType: null, 11 | /** 12 | * One of PayInPaymentDetails implementations, depending on PaymentType 13 | */ 14 | PaymentDetails: null, 15 | /** 16 | * ExecutionType (WEB, DIRECT, EXTERNAL_INSTRUCTION) 17 | */ 18 | ExecutionType: null, 19 | /** 20 | * One of PayInExecutionDetails implementations, depending on ExecutionType 21 | */ 22 | ExecutionDetails: null 23 | }), 24 | 25 | getReadOnlyProperties: function() { 26 | var properties = Transaction.prototype.getReadOnlyProperties(); 27 | properties.push('PaymentType', 'ExecutionType'); 28 | return properties; 29 | } 30 | }); 31 | 32 | module.exports = PayIn; 33 | -------------------------------------------------------------------------------- /lib/models/PayInExecutionDetails.js: -------------------------------------------------------------------------------- 1 | var EntityBase = require('./EntityBase'); 2 | 3 | var PayInExecutionDetails = EntityBase.extend({ 4 | 5 | }); 6 | 7 | module.exports = PayInExecutionDetails; -------------------------------------------------------------------------------- /lib/models/PayInExecutionDetailsBankingAlias.js: -------------------------------------------------------------------------------- 1 | var _ = require('underscore'); 2 | var PayInExecutionDetails = require('./PayInExecutionDetails'); 3 | var DebitedBankAccount = require('./DebitedBankAccount'); 4 | 5 | var PayInExecutionDetailsBankingAlias = PayInExecutionDetails.extend({ 6 | defaults: { 7 | BankingAliasId: null, 8 | WireReference: null, 9 | DebitedBankAccount: null 10 | }, 11 | 12 | getSubObjects: function() { 13 | return { 14 | 'DebitedBankAccount': DebitedBankAccount 15 | } 16 | } 17 | }); 18 | 19 | module.exports = PayInExecutionDetailsBankingAlias; -------------------------------------------------------------------------------- /lib/models/PayInExecutionDetailsDirect.js: -------------------------------------------------------------------------------- 1 | var _ = require('underscore'); 2 | var PayInExecutionDetails = require('./PayInExecutionDetails'); 3 | var Billing = require('./Billing'); 4 | var SecurityInfo = require('./SecurityInfo'); 5 | 6 | var PayInExecutionDetailsDirect = PayInExecutionDetails.extend({ 7 | defaults: { 8 | /** 9 | * SecureMode { DEFAULT, FORCE, NO_CHOICE } 10 | */ 11 | SecureMode: null, 12 | SecureModeReturnURL: null, 13 | SecureModeRedirectURL: null, 14 | SecureModeNeeded: null, 15 | Billing: null, 16 | SecurityInfo: null, 17 | Requested3DSVersion: null, 18 | Applied3DSVersion: null 19 | }, 20 | 21 | getSubObjects: function() { 22 | return { 23 | 'Billing': Billing, 24 | 'SecurityInfo': SecurityInfo 25 | } 26 | } 27 | }); 28 | 29 | module.exports = PayInExecutionDetailsDirect; -------------------------------------------------------------------------------- /lib/models/PayInExecutionDetailsWeb.js: -------------------------------------------------------------------------------- 1 | var _ = require('underscore'); 2 | var PayInExecutionDetails = require('./PayInExecutionDetails'); 3 | var PayInTemplateURLOptions = require('./PayInTemplateURLOptions'); 4 | 5 | var PayInExecutionDetailsWeb = PayInExecutionDetails.extend({ 6 | defaults: { 7 | RedirectURL: null, 8 | ReturnURL: null, 9 | TemplateURL: null, 10 | /** 11 | * The URL where you host the iFramed template. 12 | * For CB, Visa, MasterCard you need to specify PAYLINE: before your URL 13 | * with the iFramed template 14 | * ex: PAYLINE: https://www.maysite.com/payline_template/ 15 | * Used for: 16 | * - direct debit web type pay-in. 17 | * 18 | */ 19 | TemplateURLOptions: null, 20 | Culture: null, 21 | /** 22 | * Mode3DSType { DEFAULT, FORCE, NO_CHOICE } 23 | */ 24 | SecureMode: null 25 | }, 26 | 27 | getSubObjects: function() { 28 | return { 29 | 'TemplateURLOptions': PayInTemplateURLOptions 30 | } 31 | }, 32 | 33 | getReadOnlyProperties: function () { 34 | var properties = PayInExecutionDetails.prototype.getReadOnlyProperties(); 35 | properties.push('RedirectURL', 'Type'); 36 | return properties; 37 | } 38 | }); 39 | 40 | module.exports = PayInExecutionDetailsWeb; -------------------------------------------------------------------------------- /lib/models/PayInExecutionType.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | Direct: 'DIRECT', 3 | Web: 'WEB', 4 | ExternalInstruction: 'EXTERNAL_INSTRUCTION' 5 | }; -------------------------------------------------------------------------------- /lib/models/PayInPaymentDetails.js: -------------------------------------------------------------------------------- 1 | var EntityBase = require('./EntityBase'); 2 | 3 | var PayInPaymentDetails = EntityBase.extend({ 4 | 5 | }); 6 | 7 | module.exports = PayInPaymentDetails; -------------------------------------------------------------------------------- /lib/models/PayInPaymentDetailsApplePay.js: -------------------------------------------------------------------------------- 1 | var _ = require('underscore'); 2 | var PayInPaymentDetails = require('./PayInPaymentDetails'); 3 | 4 | var PayInPaymentDetailsApplePay = PayInPaymentDetails.extend({ 5 | defaults: { 6 | /** 7 | * Payment information returned by Apple Pay payment 8 | */ 9 | PaymentData: null, 10 | 11 | /** 12 | * Custom description to show on the user's bank statement. 13 | * It can be up to 10 char alpha-numeric and space. 14 | */ 15 | StatementDescriptor: null 16 | } 17 | }); 18 | 19 | module.exports = PayInPaymentDetailsApplePay; -------------------------------------------------------------------------------- /lib/models/PayInPaymentDetailsBancontact.js: -------------------------------------------------------------------------------- 1 | var PayInPaymentDetails = require('./PayInPaymentDetails'); 2 | 3 | var PayInPaymentDetailsBancontact = PayInPaymentDetails.extend({ 4 | defaults: { 5 | /** 6 | * Custom description to show on the user's bank statement. 7 | * It can be up to 10 char alpha-numeric and space. 8 | */ 9 | StatementDescriptor: null 10 | } 11 | }); 12 | 13 | module.exports = PayInPaymentDetailsBancontact; 14 | -------------------------------------------------------------------------------- /lib/models/PayInPaymentDetailsBankWire.js: -------------------------------------------------------------------------------- 1 | var _ = require('underscore'); 2 | var PayInPaymentDetails = require('./PayInPaymentDetails'); 3 | var Money = require('./Money'); 4 | var BankAccount = require('./BankAccount'); 5 | 6 | var PayInPaymentDetailsBankWire = PayInPaymentDetails.extend({ 7 | defaults: { 8 | DeclaredDebitedFunds: null, 9 | DeclaredFees: null, 10 | BankAccount: null, 11 | WireReference: null 12 | }, 13 | 14 | getSubObjects: function() { 15 | return { 16 | 'DeclaredDebitedFunds': Money, 17 | 'DeclaredFees': Money, 18 | 'BankAccount': BankAccount 19 | } 20 | } 21 | }); 22 | 23 | module.exports = PayInPaymentDetailsBankWire; -------------------------------------------------------------------------------- /lib/models/PayInPaymentDetailsBankingAlias.js: -------------------------------------------------------------------------------- 1 | var PayInPaymentDetails = require('./PayInPaymentDetails'); 2 | var DebitedBankAccount = require('./DebitedBankAccount'); 3 | 4 | var PayInPaymentDetailsBankingAlias = PayInPaymentDetails.extend({ 5 | defaults: { 6 | BankingAliasId: null, 7 | WireReference: null, 8 | DebitedBankAccount: null 9 | }, 10 | 11 | getSubObjects: function () { 12 | return { 13 | 'DebitedBankAccount': DebitedBankAccount 14 | }; 15 | } 16 | }); 17 | 18 | module.exports = PayInPaymentDetailsBankingAlias; -------------------------------------------------------------------------------- /lib/models/PayInPaymentDetailsBlik.js: -------------------------------------------------------------------------------- 1 | var _ = require('underscore'); 2 | var PayInPaymentDetails = require('./PayInPaymentDetails'); 3 | 4 | var PayInPaymentDetailsBlik = PayInPaymentDetails.extend({ 5 | defaults: { 6 | /** 7 | * Custom description to show on the user's bank statement. 8 | * It can be up to 10 char alpha-numeric and space. 9 | */ 10 | StatementDescriptor: null, 11 | Code: null, 12 | IpAddress: null, 13 | BrowserInfo: null 14 | } 15 | }); 16 | 17 | module.exports = PayInPaymentDetailsBlik; 18 | -------------------------------------------------------------------------------- /lib/models/PayInPaymentDetailsCard.js: -------------------------------------------------------------------------------- 1 | var _ = require('underscore'); 2 | var PayInPaymentDetails = require('./PayInPaymentDetails'); 3 | 4 | var PayInPaymentDetailsCard = PayInPaymentDetails.extend({ 5 | defaults: { 6 | StatementDescriptor: null 7 | } 8 | }); 9 | 10 | module.exports = PayInPaymentDetailsCard; 11 | -------------------------------------------------------------------------------- /lib/models/PayInPaymentDetailsCardDirect.js: -------------------------------------------------------------------------------- 1 | var _ = require('underscore'); 2 | var PayInPaymentDetailsCard = require('./PayInPaymentDetailsCard'); 3 | 4 | var PayInPaymentDetailsCardDirect = PayInPaymentDetailsCard.extend({ 5 | defaults: _.extend({}, PayInPaymentDetailsCard.prototype.defaults, { 6 | CardId: null, 7 | IpAddress: null, 8 | Shipping: null, 9 | BrowserInfo: null, 10 | CardInfo: null 11 | }) 12 | }); 13 | 14 | module.exports = PayInPaymentDetailsCardDirect; 15 | -------------------------------------------------------------------------------- /lib/models/PayInPaymentDetailsCardWeb.js: -------------------------------------------------------------------------------- 1 | var _ = require('underscore'); 2 | var PayInPaymentDetailsCard = require('./PayInPaymentDetailsCard'); 3 | 4 | var PayInPaymentDetailsCardWeb = PayInPaymentDetailsCard.extend({ 5 | defaults: _.extend({}, PayInPaymentDetailsCard.prototype.defaults, { 6 | /** 7 | * CardType { CB_VISA_MASTERCARD, AMEX } 8 | */ 9 | CardType: null, 10 | 11 | /* 12 | * Shipping 13 | */ 14 | Shipping: null, 15 | 16 | /** 17 | * The BIC identifier of the end-user’s bank 18 | */ 19 | Bic: null, 20 | 21 | /** 22 | * Name of the end-user’s bank 23 | */ 24 | BankName: null, 25 | }) 26 | }); 27 | 28 | module.exports = PayInPaymentDetailsCardWeb; 29 | -------------------------------------------------------------------------------- /lib/models/PayInPaymentDetailsDirectDebitDirect.js: -------------------------------------------------------------------------------- 1 | var PayInPaymentDetails = require('./PayInPaymentDetails'); 2 | 3 | var PayInPaymentDetailsDirectDebit = PayInPaymentDetails.extend({ 4 | defaults: { 5 | /** 6 | * Mandate identifier. 7 | */ 8 | MandateId: null, 9 | 10 | /** 11 | * An optional value to be specified on the user's bank statement 12 | */ 13 | StatementDescriptor: null, 14 | 15 | /** 16 | * Date of charging 17 | */ 18 | ChargeDate: null 19 | } 20 | }); 21 | 22 | module.exports = PayInPaymentDetailsDirectDebit; 23 | -------------------------------------------------------------------------------- /lib/models/PayInPaymentDetailsDirectDebitWeb.js: -------------------------------------------------------------------------------- 1 | var _ = require('underscore'); 2 | var PayInPaymentDetails = require('./PayInPaymentDetails'); 3 | 4 | var PayInPaymentDetailsDirectDebit = PayInPaymentDetails.extend({ 5 | defaults: { 6 | /** 7 | * Direct debit type {SOFORT, ELV, GIROPAY} 8 | */ 9 | DirectDebitType: null 10 | } 11 | }); 12 | 13 | module.exports = PayInPaymentDetailsDirectDebit; 14 | -------------------------------------------------------------------------------- /lib/models/PayInPaymentDetailsGiropay.js: -------------------------------------------------------------------------------- 1 | var _ = require('underscore'); 2 | var PayInPaymentDetails = require('./PayInPaymentDetails'); 3 | 4 | var PayInPaymentDetailsGiropay = PayInPaymentDetails.extend({ 5 | defaults: { 6 | 7 | /** 8 | * Custom description to show on the user's bank statement. 9 | * It can be up to 10 char alpha-numeric and space. 10 | */ 11 | StatementDescriptor: null 12 | } 13 | }); 14 | 15 | module.exports = PayInPaymentDetailsGiropay; 16 | -------------------------------------------------------------------------------- /lib/models/PayInPaymentDetailsGooglePay.js: -------------------------------------------------------------------------------- 1 | var _ = require('underscore'); 2 | var PayInPaymentDetails = require('./PayInPaymentDetails'); 3 | 4 | var PayInPaymentDetailsGooglePay = PayInPaymentDetails.extend({ 5 | defaults: { 6 | /** 7 | * Payment information returned by Google Pay payment 8 | */ 9 | PaymentData: null, 10 | 11 | /** 12 | * Custom description to show on the user's bank statement. 13 | * It can be up to 10 char alpha-numeric and space. 14 | */ 15 | StatementDescriptor: null, 16 | 17 | /** 18 | * Billing details 19 | */ 20 | Billing: null, 21 | 22 | 23 | /// V2 /// 24 | 25 | ReturnURL: null, 26 | 27 | Shipping: null, 28 | 29 | BrowserInfo: null, 30 | 31 | IpAddress: null 32 | } 33 | }); 34 | 35 | module.exports = PayInPaymentDetailsGooglePay; 36 | -------------------------------------------------------------------------------- /lib/models/PayInPaymentDetailsIdeal.js: -------------------------------------------------------------------------------- 1 | var _ = require('underscore'); 2 | var PayInPaymentDetails = require('./PayInPaymentDetails'); 3 | 4 | var PayInPaymentDetailsIdeal = PayInPaymentDetails.extend({ 5 | defaults: { 6 | 7 | /** 8 | * The BIC identifier of the end-user’s bank 9 | */ 10 | Bic: null, 11 | 12 | /** 13 | * Name of the end-user’s bank 14 | */ 15 | BankName: null, 16 | 17 | /** 18 | * Custom description to show on the user's bank statement. 19 | * It can be up to 10 char alpha-numeric and space. 20 | */ 21 | StatementDescriptor: null 22 | } 23 | }); 24 | 25 | module.exports = PayInPaymentDetailsIdeal; -------------------------------------------------------------------------------- /lib/models/PayInPaymentDetailsKlarna.js: -------------------------------------------------------------------------------- 1 | var _ = require('underscore'); 2 | var PayInPaymentDetails = require('./PayInPaymentDetails'); 3 | 4 | var PayInPaymentDetailsKlarna = PayInPaymentDetails.extend({ 5 | defaults: { 6 | LineItems: null, 7 | 8 | Shipping: null, 9 | 10 | Billing: null, 11 | 12 | PaymentMethod: null, 13 | 14 | Country: null, 15 | 16 | AdditionalData: null, 17 | 18 | Email: null, 19 | 20 | Reference: null, 21 | 22 | /** 23 | * Custom description to show on the user's bank statement. 24 | * It can be up to 10 char alpha-numeric and space. 25 | */ 26 | StatementDescriptor: null, 27 | 28 | /** 29 | * The mobile phone number of the user initiating the pay-in 30 | * Country code followed by hash symbol (#) followed by the rest of the number. Only digits and hash allowed 31 | */ 32 | Phone: null 33 | } 34 | }); 35 | 36 | module.exports = PayInPaymentDetailsKlarna; 37 | -------------------------------------------------------------------------------- /lib/models/PayInPaymentDetailsMbway.js: -------------------------------------------------------------------------------- 1 | var _ = require('underscore'); 2 | var PayInPaymentDetails = require('./PayInPaymentDetails'); 3 | 4 | var PayInPaymentDetailsMbway = PayInPaymentDetails.extend({ 5 | defaults: { 6 | /** 7 | * Custom description to show on the user's bank statement. 8 | * It can be up to 10 char alpha-numeric and space. 9 | */ 10 | StatementDescriptor: null, 11 | 12 | /** 13 | * The mobile phone number of the user initiating the pay-in 14 | * Country code followed by hash symbol (#) followed by the rest of the number. Only digits and hash allowed 15 | */ 16 | Phone: null 17 | } 18 | }); 19 | 20 | module.exports = PayInPaymentDetailsMbway; 21 | -------------------------------------------------------------------------------- /lib/models/PayInPaymentDetailsMultibanco.js: -------------------------------------------------------------------------------- 1 | var _ = require('underscore'); 2 | var PayInPaymentDetails = require('./PayInPaymentDetails'); 3 | 4 | var PayInPaymentDetailsMultibanco = PayInPaymentDetails.extend({ 5 | defaults: { 6 | /** 7 | * Custom description to show on the user's bank statement. 8 | * It can be up to 10 char alpha-numeric and space. 9 | */ 10 | StatementDescriptor: null 11 | } 12 | }); 13 | 14 | module.exports = PayInPaymentDetailsMultibanco; 15 | -------------------------------------------------------------------------------- /lib/models/PayInPaymentDetailsPayPal.js: -------------------------------------------------------------------------------- 1 | var PayInPaymentDetails = require('./PayInPaymentDetails'); 2 | 3 | var PayInPaymentDetailsPayPal = PayInPaymentDetails.extend({ 4 | defaults: { 5 | /** 6 | * Address used instead of the user's PayPal account address. 7 | */ 8 | ShippingAddress: null, 9 | 10 | /** 11 | * Email address of the buyer's account. 12 | */ 13 | PaypalBuyerAccountEmail: null, 14 | 15 | 16 | /// V2 /// 17 | 18 | /** 19 | * The URL where users are automatically redirected after the payment is validated 20 | */ 21 | ReturnURL: null, 22 | 23 | /** 24 | * The URL to which the user is redirected to complete the payment 25 | */ 26 | RedirectUrl: null, 27 | 28 | /** 29 | * Custom description of the payment shown to the consumer when making payments and on the bank statement 30 | */ 31 | StatementDescriptor: null, 32 | 33 | /** 34 | * User’s shipping address When not provided, the default address is the one register one the buyer PayPal account 35 | */ 36 | Shipping: null, 37 | 38 | /** 39 | * Information about the items bought by the customer 40 | */ 41 | LineItems: null, 42 | 43 | ShippingPreference: null, 44 | 45 | PaypalPayerID: null, 46 | 47 | BuyerCountry: null, 48 | 49 | BuyerFirstname: null, 50 | 51 | BuyerLastname: null, 52 | 53 | BuyerPhone: null, 54 | 55 | PaypalOrderID: null, 56 | 57 | CancelURL: null, 58 | 59 | Trackings: null 60 | } 61 | }); 62 | 63 | module.exports = PayInPaymentDetailsPayPal; 64 | -------------------------------------------------------------------------------- /lib/models/PayInPaymentDetailsPayconiq.js: -------------------------------------------------------------------------------- 1 | var PayInPaymentDetails = require('./PayInPaymentDetails'); 2 | var Money = require('./Money'); 3 | 4 | var PayInPaymentDetailsPayconiq = PayInPaymentDetails.extend({ 5 | defaults: { 6 | Country: null, 7 | AuthorId: null, 8 | DebitedFunds: null, 9 | Fees: null, 10 | DeepLinkURL: null, 11 | StatementDescriptor: null, 12 | QRCodeURL: null 13 | }, 14 | 15 | getSubObjects: function() { 16 | return { 17 | 'DebitedFunds': Money, 18 | 'Fees': Money 19 | }; 20 | }, 21 | }); 22 | 23 | module.exports = PayInPaymentDetailsPayconiq; 24 | -------------------------------------------------------------------------------- /lib/models/PayInPaymentDetailsPreAuthorized.js: -------------------------------------------------------------------------------- 1 | var _ = require('underscore'); 2 | var PayInPaymentDetails = require('./PayInPaymentDetails'); 3 | 4 | var PayInPaymentDetailsPreAuthorized = PayInPaymentDetails.extend({ 5 | defaults: { 6 | PreauthorizationId: null 7 | } 8 | }); 9 | 10 | module.exports = PayInPaymentDetailsPreAuthorized; -------------------------------------------------------------------------------- /lib/models/PayInPaymentDetailsSatispay.js: -------------------------------------------------------------------------------- 1 | var _ = require('underscore'); 2 | var PayInPaymentDetails = require('./PayInPaymentDetails'); 3 | 4 | var PayInPaymentDetailsSatispay = PayInPaymentDetails.extend({ 5 | defaults: { 6 | /** 7 | * Custom description to show on the user's bank statement. 8 | * It can be up to 10 char alpha-numeric and space. 9 | */ 10 | StatementDescriptor: null, 11 | 12 | /** 13 | * The end-user country of residence 14 | */ 15 | Country: null 16 | } 17 | }); 18 | 19 | module.exports = PayInPaymentDetailsSatispay; 20 | -------------------------------------------------------------------------------- /lib/models/PayInPaymentDetailsSwish.js: -------------------------------------------------------------------------------- 1 | var _ = require('underscore'); 2 | var PayInPaymentDetails = require('./PayInPaymentDetails'); 3 | 4 | var PayInPaymentDetailsSwish = PayInPaymentDetails.extend({ 5 | defaults: { 6 | 7 | /** 8 | * Custom description to show on the user's bank statement. 9 | * It can be up to 10 char alpha-numeric and space. 10 | */ 11 | StatementDescriptor: null, 12 | 13 | /** 14 | * The mobile URL to which to redirect the user to complete the payment in an app-to-app flow. 15 | */ 16 | DeepLinkURL: null, 17 | 18 | /** 19 | * The PNG file of the Swish QR code as a Base64-encoded string. 20 | */ 21 | QRCodeURL: null, 22 | 23 | /** 24 | *
Allowed values: WEB, APP
25 | *Default value: WEB
26 | *The platform environment of the post-payment flow. The PaymentFlow value combines with the ReturnURL to manage the redirection behavior after payment:
27 | *Set the value to APP to send the user to your platform’s mobile app
28 | *Set the value to WEB to send the user to a web browser
29 | *In both cases you need to provide the relevant ReturnURL, whether to your app or website.
30 | */ 31 | PaymentFlow: null 32 | } 33 | }); 34 | 35 | module.exports = PayInPaymentDetailsSwish; 36 | -------------------------------------------------------------------------------- /lib/models/PayInPaymentDetailsTwint.js: -------------------------------------------------------------------------------- 1 | var _ = require('underscore'); 2 | var PayInPaymentDetails = require('./PayInPaymentDetails'); 3 | 4 | var PayInPaymentDetailsTwint = PayInPaymentDetails.extend({ 5 | defaults: { 6 | 7 | /** 8 | * Custom description to show on the user's bank statement. 9 | * It can be up to 10 char alpha-numeric and space. 10 | */ 11 | StatementDescriptor: null 12 | } 13 | }); 14 | 15 | module.exports = PayInPaymentDetailsTwint; 16 | -------------------------------------------------------------------------------- /lib/models/PayInPaymentType.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | BankWire: 'BANK_WIRE', 3 | Card: 'CARD', 4 | DirectDebit: 'DIRECT_DEBIT', 5 | Preauthorized: 'PREAUTHORIZED', 6 | PayPal: 'PAYPAL', 7 | ApplePay: 'APPLEPAY', 8 | GooglePay: 'GOOGLE_PAY', 9 | Payconiq: 'PAYCONIQ', 10 | Mbway: 'MBWAY', 11 | Bancontact: 'BCMC', 12 | Multibanco: 'MULTIBANCO', 13 | Satispay: 'SATISPAY', 14 | Blik: 'BLIK', 15 | Klarna: 'KLARNA', 16 | Ideal: 'IDEAL', 17 | Giropay: 'GIROPAY', 18 | Swish: 'SWISH', 19 | Twint: 'TWINT' 20 | }; 21 | -------------------------------------------------------------------------------- /lib/models/PayInRecurringRegistration.js: -------------------------------------------------------------------------------- 1 | var EntityBase = require('./EntityBase'); 2 | var Money = require('./Money'); 3 | var Billing = require('./Billing'); 4 | var Shipping = require('./Shipping'); 5 | var CurrentState = require('./RecurringPayInCurrentState') 6 | 7 | var PayInRecurringRegistration = EntityBase.extend({ 8 | defaults: { 9 | /** 10 | * Array with owners identities 11 | */ 12 | AuthorId: null, 13 | CardId: null, 14 | CreditedWalletId: null, 15 | CreditedUserId: null, 16 | FirstTransactionDebitedFunds: null, 17 | FirstTransactionFees: null, 18 | Billing: null, 19 | Shipping: null, 20 | CreditedUserId: null, 21 | EndDate: null, 22 | Frequency: null, 23 | FixedNextAmount: null, 24 | FractionedPayment: null, 25 | Migration: null, 26 | NextTransactionDebitedFunds: null, 27 | NextTransactionFees: null, 28 | Status: null, 29 | TotalAmount: null, 30 | CycleNumber: null, 31 | FreeCycles: null, 32 | CurrentState: null, 33 | PaymentType: null 34 | }, 35 | 36 | /** 37 | * Get mapping of model properties and corresponding object types 38 | * @returns {Object} 39 | */ 40 | getSubObjects: function() { 41 | return { 42 | 'FirstTransactionDebitedFunds': Money, 43 | 'FirstTransactionFees': Money, 44 | 'Fees': Money, 45 | 'Billing': Billing, 46 | 'Shipping': Shipping, 47 | 'NextTransactionDebitedFunds': Money, 48 | 'NextTransactionFees': Money, 49 | 'CurrentState': CurrentState 50 | } 51 | }, 52 | 53 | /** 54 | * Get array with read-only properties 55 | * @return {Array} List of string properties 56 | */ 57 | getReadOnlyProperties: function() { 58 | var properties = EntityBase.prototype.getReadOnlyProperties(); 59 | properties.push('Status', 'TotalAmount', 'CycleNumber', 'CurrentState'); 60 | return properties; 61 | } 62 | }); 63 | 64 | module.exports = PayInRecurringRegistration; 65 | -------------------------------------------------------------------------------- /lib/models/PayInTemplateURLOptions.js: -------------------------------------------------------------------------------- 1 | var EntityBase = require('./EntityBase'); 2 | 3 | var PayInTemplateURLOptions = EntityBase.extend({ 4 | defaults: { 5 | PAYLINE: null, 6 | PAYLINEV2: null 7 | } 8 | }); 9 | 10 | module.exports = PayInTemplateURLOptions; 11 | -------------------------------------------------------------------------------- /lib/models/PayOut.js: -------------------------------------------------------------------------------- 1 | var _ = require('underscore'); 2 | var Transaction = require('./Transaction'); 3 | 4 | var PayOut = Transaction.extend({ 5 | defaults: _.extend({}, Transaction.prototype.defaults, { 6 | DebitedWalletId: null, 7 | /** 8 | * PaymentType (BANK_WIRE, MERCHANT_EXPENSE, AMAZON_GIFTCARD) 9 | */ 10 | PaymentType: null, 11 | /** 12 | * One of PayOutPaymentDetails implementations, depending on PaymentType 13 | */ 14 | MeanOfPaymentDetails: null 15 | }), 16 | 17 | getReadOnlyProperties: function() { 18 | var properties = Transaction.prototype.getReadOnlyProperties(); 19 | properties.push('PaymentType'); 20 | return properties; 21 | } 22 | }); 23 | 24 | module.exports = PayOut; -------------------------------------------------------------------------------- /lib/models/PayOutPaymentDetails.js: -------------------------------------------------------------------------------- 1 | var _ = require('underscore'); 2 | var EntityBase = require('./EntityBase'); 3 | 4 | var PayOutPaymentDetails = EntityBase.extend({ 5 | }); 6 | 7 | module.exports = PayOutPaymentDetails; -------------------------------------------------------------------------------- /lib/models/PayOutPaymentDetailsBankWire.js: -------------------------------------------------------------------------------- 1 | var _ = require('underscore'); 2 | var PayOutPaymentDetails = require('./PayOutPaymentDetails'); 3 | 4 | var PayOutPaymentDetailsBankWire = PayOutPaymentDetails.extend({ 5 | defaults: { 6 | BankAccountId: null, 7 | /** 8 | * A custom reference you wish to appear on the user’s bank statement 9 | */ 10 | BankWireRef: null, 11 | 12 | /** 13 | * Payment reference provided for the payout. 14 | */ 15 | PayoutPaymentRef: null, 16 | 17 | /** 18 | * The new parameter "PayoutModeRequested" can take the following values: "STANDARD", "INSTANT_PAYMENT", "INSTANT_PAYMENT_ONLY" 19 | */ 20 | PayoutModeRequested: null, 21 | 22 | ModeRequested: null, 23 | 24 | ModeApplied: null, 25 | 26 | Status: null, 27 | 28 | FallbackReason: null 29 | } 30 | }); 31 | 32 | module.exports = PayOutPaymentDetailsBankWire; 33 | -------------------------------------------------------------------------------- /lib/models/PayOutPaymentType.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | BankWire: 'BANK_WIRE' 3 | }; -------------------------------------------------------------------------------- /lib/models/PaymentData.js: -------------------------------------------------------------------------------- 1 | var EntityBase = require('./EntityBase'); 2 | 3 | var PaymentData = EntityBase.extend({ 4 | defaults: { 5 | /** 6 | * ID of the Apple payment transaction 7 | */ 8 | TransactionId: null, 9 | /** 10 | * Network card used for transaction 11 | */ 12 | Network: null, 13 | /** 14 | * Data block containing payment information 15 | */ 16 | TokenData: null, 17 | } 18 | }); 19 | 20 | module.exports = PaymentData; -------------------------------------------------------------------------------- /lib/models/PaymentMethodMetadata.js: -------------------------------------------------------------------------------- 1 | var EntityBase = require('./EntityBase'); 2 | 3 | var PaymentMethodMetadata = EntityBase.extend({ 4 | defaults: { 5 | /** 6 | * The type of metadata. Allowed values: BIN, GOOGLE_PAY 7 | */ 8 | Type: null, 9 | /** 10 | * The bank identification number (BIN). (Format: 6 or 8 digits) 11 | */ 12 | Bin: null, 13 | /** 14 | * The tokenized payment data provided by the third-party payment method. 15 | */ 16 | Token: null, 17 | /** 18 | * In the case of Google Pay, the format of the Token. 19 | * PAN_ONLY – The card is registered in the Google account and requires 3DS authentication. 20 | * CRYPTOGRAM_3DS – The card is enrolled in the customer’s Google Wallet and authentication is handled by the Android device. 21 | */ 22 | TokenFormat: null, 23 | /** 24 | * The country where the card was issued. Format: ISO-3166 alpha-2 two-letter country code 25 | */ 26 | IssuerCountryCode: null, 27 | /** 28 | * The name of the card issuer. 29 | */ 30 | IssuingBank: null, 31 | /** 32 | * Additional data about the card based on the BIN. In the case of co-branded card products, two objects are returned. 33 | */ 34 | BinData: null 35 | } 36 | }); 37 | 38 | module.exports = PaymentMethodMetadata; 39 | -------------------------------------------------------------------------------- /lib/models/PayoutMethods.js: -------------------------------------------------------------------------------- 1 | var EntityBase = require('./EntityBase'); 2 | 3 | module.exports = EntityBase.extend({ 4 | defaults: { 5 | AvailablePayoutMethods: null 6 | } 7 | }); 8 | -------------------------------------------------------------------------------- /lib/models/PendingUserAction.js: -------------------------------------------------------------------------------- 1 | var EntityBase = require('./EntityBase'); 2 | 3 | var PendingUserAction = EntityBase.extend({ 4 | defaults: { 5 | /** 6 | * The URL to which to redirect the user to perform strong customer authentication (SCA) via a Mangopay-hosted webpage. This value is a variable and should not be hardcoded. 7 | *8 | * Caution: Before redirecting the user on this URL, you must add the query parameter ReturnUrl with the percent-encoded URL to which you want the SCA session to return the user after authentication (whether successful or not). 9 | *
10 | * For more details, see How to redirect a user for an SCA session
11 | */
12 | RedirectUrl: null
13 | }
14 | });
15 |
16 | module.exports = PendingUserAction;
--------------------------------------------------------------------------------
/lib/models/PersonType.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | NotSpecified: 'NotSpecified',
3 | Natural: 'NATURAL',
4 | Legal: 'LEGAL'
5 | };
--------------------------------------------------------------------------------
/lib/models/PlatformCategorization.js:
--------------------------------------------------------------------------------
1 | var EntityBase = require('./EntityBase');
2 |
3 | var PlatformCategorization = EntityBase.extend({
4 | defaults: {
5 | /**
6 | * The type of business conducted by the client
7 | */
8 | BusinessType: null,
9 | /**
10 | * Sector of business
11 | */
12 | Sector: null
13 | }
14 | });
15 |
16 | module.exports = PlatformCategorization;
--------------------------------------------------------------------------------
/lib/models/PlatformType.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | NotSpecified: 'NotSpecified',
3 | MARKETPLACE: 'MARKETPLACE',
4 | P2P_PAYMENT: 'P2P_PAYMENT',
5 | CROWDFUNDING_DONATION: 'CROWDFUNDING_DONATION',
6 | CROWDFUNDING_REWARD: 'CROWDFUNDING_REWARD',
7 | CROWDFUNDING_EQUITY: 'CROWDFUNDING_EQUITY',
8 | CROWDFUNDING_LOAN: 'CROWDFUNDING_LOAN',
9 | OTHER: 'OTHER'
10 | };
11 |
--------------------------------------------------------------------------------
/lib/models/Quote.js:
--------------------------------------------------------------------------------
1 | var EntityBase = require('./EntityBase');
2 |
3 | module.exports = EntityBase.extend({
4 | defaults: {
5 | ExpirationDate: null,
6 | Status: null,
7 | DebitedFunds: null,
8 | CreditedFunds: null,
9 | ConversionRateResponse: null
10 | }
11 | });
--------------------------------------------------------------------------------
/lib/models/Recipient.js:
--------------------------------------------------------------------------------
1 | var EntityBase = require('./EntityBase');
2 |
3 | module.exports = EntityBase.extend({
4 | defaults: {
5 | Status: null,
6 | DisplayName: null,
7 | PayoutMethodType: null,
8 | RecipientType: null,
9 | Currency: null,
10 | Country: null,
11 | RecipientScope: null,
12 | UserId: null,
13 | IndividualRecipient: null,
14 | BusinessRecipient: null,
15 | LocalBankTransfer: null,
16 | InternationalBankTransfer: null,
17 | PendingUserAction: null
18 | }
19 | });
20 |
--------------------------------------------------------------------------------
/lib/models/RecipientSchema.js:
--------------------------------------------------------------------------------
1 | var EntityBase = require('./EntityBase');
2 |
3 | module.exports = EntityBase.extend({
4 | defaults: {
5 | DisplayName: null,
6 | Currency: null,
7 | Country: null,
8 | RecipientType: null,
9 | PayoutMethodType: null,
10 | RecipientScope: null,
11 | Tag: null,
12 | LocalBankTransfer: null,
13 | InternationalBankTransfer: null,
14 | IndividualRecipient: null,
15 | BusinessRecipient: null,
16 | }
17 | });
18 |
--------------------------------------------------------------------------------
/lib/models/RecurringPayIn.js:
--------------------------------------------------------------------------------
1 | var _ = require('underscore');
2 | var PayIn = require('./PayIn');
3 |
4 | var RecurringPayIn = PayIn.extend({
5 | defaults: _.extend({}, PayIn.prototype.defaults, {
6 | RecurringPayinRegistrationId: null
7 | }),
8 | });
9 |
10 | module.exports = RecurringPayIn;
11 |
--------------------------------------------------------------------------------
/lib/models/RecurringPayInCIT.js:
--------------------------------------------------------------------------------
1 | var EntityBase = require('./EntityBase');
2 | var BrowserInfo = require('./BrowserInfo');
3 | var Money = require('./Money');
4 |
5 | var RecurringPayInCIT = EntityBase.extend({
6 | defaults: {
7 | /**
8 | * Array with owners identities
9 | */
10 | RecurringPayinRegistrationId: null,
11 | BrowserInfo: null,
12 | IpAddress: null,
13 | SecureModeReturnURL: null,
14 | StatementDescriptor: null,
15 | DebitedFunds: null,
16 | Fees: null
17 | },
18 |
19 | /**
20 | * Get mapping of model properties and corresponding object types
21 | * @returns {Object}
22 | */
23 | getSubObjects: function() {
24 | return {
25 | 'BrowserInfo': BrowserInfo,
26 | 'DebitedFunds': Money,
27 | 'Fees': Money
28 | }
29 | }
30 | });
31 |
32 | module.exports = RecurringPayInCIT;
33 |
--------------------------------------------------------------------------------
/lib/models/RecurringPayInCurrentState.js:
--------------------------------------------------------------------------------
1 | var Model = require('./../Model');
2 | var Money = require('./Money')
3 |
4 | var RecurringPayInCurrentState = Model.extend({
5 | defaults: {
6 | PayinsLinked: null,
7 | CumulatedDebitedAmount: null,
8 | CumulatedFeesAmount: null,
9 | LastPayinId: null
10 | },
11 |
12 | /**
13 | * Get mapping of model properties and corresponding object types
14 | * @returns {Object}
15 | */
16 | getSubObjects: function() {
17 | return {
18 | 'CumulatedDebitedAmount': Money,
19 | 'CumulatedFeesAmount': Money
20 | }
21 | }
22 | });
23 |
24 | module.exports = RecurringPayInCurrentState;
--------------------------------------------------------------------------------
/lib/models/RecurringPayInMIT.js:
--------------------------------------------------------------------------------
1 | var EntityBase = require('./EntityBase');
2 | var Money = require('./Money');
3 |
4 | var RecurringPayInMIT = EntityBase.extend({
5 | defaults: {
6 | /**
7 | * Array with owners identities
8 | */
9 | RecurringPayinRegistrationId: null,
10 | DebitedFunds: null,
11 | Fees: null,
12 | StatementDescriptor: null
13 | },
14 |
15 | /**
16 | * Get mapping of model properties and corresponding object types
17 | * @returns {Object}
18 | */
19 | getSubObjects: function() {
20 | return {
21 | 'DebitedFunds': Money,
22 | 'Fees': Money
23 | }
24 | }
25 | });
26 |
27 | module.exports = RecurringPayInMIT;
28 |
--------------------------------------------------------------------------------
/lib/models/RecurringPayInPut.js:
--------------------------------------------------------------------------------
1 | var Model = require('./../Model');
2 | var Billing = require('./Billing');
3 | var Shipping = require('./Shipping');
4 |
5 | var RecurringPayInPut = Model.extend({
6 | defaults: {
7 | CardId: null,
8 | Billing: null,
9 | Shipping: null
10 | },
11 |
12 | /**
13 | * Get mapping of model properties and corresponding object types
14 | * @returns {Object}
15 | */
16 | getSubObjects: function() {
17 | return {
18 | 'Billing': Billing,
19 | 'Shipping': Shipping
20 | }
21 | }
22 | });
23 |
24 | module.exports = RecurringPayInPut;
--------------------------------------------------------------------------------
/lib/models/Refund.js:
--------------------------------------------------------------------------------
1 | var _ = require('underscore');
2 | var Transaction = require('./Transaction');
3 | var RefundReasonDetails = require('./RefundReasonDetails');
4 |
5 | var Refund = Transaction.extend({
6 | defaults: _.extend({}, Transaction.prototype.defaults, {
7 | InitialTransactionId: null,
8 | /**
9 | * Initial transaction Type {PAYIN, PAYOUT, TRANSFER}
10 | */
11 | InitialTransactionType: null,
12 | DebitedWalletId: null,
13 | CreditedWalletId: null,
14 | RefundReason: null,
15 | Reference: null,
16 | StatementDescriptor: null
17 | }),
18 |
19 | getSubObjects: function() {
20 | return {
21 | 'RefundReason': RefundReasonDetails
22 | };
23 | }
24 | });
25 |
26 | module.exports = Refund;
--------------------------------------------------------------------------------
/lib/models/RefundReasonDetails.js:
--------------------------------------------------------------------------------
1 | var EntityBase = require('./EntityBase');
2 |
3 | var RefundReasonDetails = EntityBase.extend({
4 | defaults: {
5 | RefundReasonMessage: null,
6 | RefundReasonType: null
7 | }
8 | });
9 |
10 | module.exports = RefundReasonDetails;
--------------------------------------------------------------------------------
/lib/models/Report.js:
--------------------------------------------------------------------------------
1 | var EntityBase = require('./EntityBase');
2 | var ReportFilter = require('./ReportFilter');
3 |
4 |
5 | var Report = EntityBase.extend({
6 | defaults: {
7 | /**
8 | *The date when the report was executed
9 | */
10 | ReportDate: null,
11 | /**
12 | * The URL to download the report
13 | */
14 | DownloadURL: null,
15 | /**
16 | * A URL that will be pinged when the report is ready to download (works in a similar way to the hooks)
17 | */
18 | CallbackURL: null,
19 | /**
20 | * The format of the report download { CSV }
21 | */
22 | DownloadFormat: null,
23 | /**
24 | * Report type {TRANSACTIONS, WALLETS}
25 | */
26 | ReportType: null,
27 | /**
28 | * The column to sort against and direction
29 | */
30 | Sort: null,
31 | /**
32 | * Whether the report should be limited to the first 10 lines (and therefore quicker to execute)
33 | */
34 | Preview: null,
35 | Filters: null,
36 | /**
37 | * A list of columns/infos to show in the report
38 | */
39 | Columns: null,
40 | /**
41 | * The result code
42 | */
43 | ResultCode: null,
44 | ResultMessage: null
45 | },
46 |
47 | getSubObjects: function () {
48 | return {
49 | 'Filters': ReportFilter
50 | }
51 | }
52 | });
53 |
54 | module.exports = Report;
55 |
--------------------------------------------------------------------------------
/lib/models/ReportFilter.js:
--------------------------------------------------------------------------------
1 | var Model = require('../Model');
2 |
3 | var ReportFilter = Model.extend({
4 | defaults: {
5 | /**
6 | * To return only resources that have CreationDate BEFORE this date
7 | */
8 | BeforeDate: null,
9 | /**
10 | * To return only resources that have CreationDate AFTER this date
11 | */
12 | AfterDate: null,
13 | /**
14 | * The type of the transaction
15 | */
16 | Type: null,
17 | /**
18 | * The status of the transaction
19 | */
20 | Status: null,
21 | /**
22 | * The nature of the transaction
23 | */
24 | Nature: null,
25 | /**
26 | * The minimum amount of DebitedFunds
27 | */
28 | MinDebitedFundsAmount: null,
29 | /**
30 | * The currency for the minimum amount of DebitedFunds
31 | */
32 | MinDebitedFundsCurrency: null,
33 | /**
34 | * The maximum amount of DebitedFunds
35 | */
36 | MaxDebitedFundsAmount: null,
37 | /**
38 | * The currency for the maximum amount of DebitedFunds
39 | */
40 | MaxDebitedFundsCurrency: null,
41 | /**
42 | * The object owner's id
43 | */
44 | AuthorId: null,
45 |
46 | WalletId: null
47 |
48 | }
49 |
50 | });
51 |
52 | module.exports = ReportFilter;
53 |
--------------------------------------------------------------------------------
/lib/models/Repudiation.js:
--------------------------------------------------------------------------------
1 | var _ = require('underscore');
2 | var Model = require('../Model');
3 | var Money = require('./Money');
4 |
5 | var Repudiation = Model.extend({
6 | defaults: {
7 | AuthorId: null,
8 | /**
9 | * The funds repudiated from the wallet
10 | */
11 | DebitedFunds: null,
12 | /**
13 | * The fees taken on the repudiation – will always be 0 at this stage
14 | */
15 | Fees: null,
16 | /**
17 | * The amount of credited funds – since there are currently no fees,
18 | * this will be equal to the DebitedFunds
19 | */
20 | CreditedFunds: null,
21 | /**
22 | * The wallet from where the repudiation was taken
23 | */
24 | DebitedWalletId: null,
25 | /**
26 | * The status of the transfer {CREATED, SUCCEEDED, FAILED}
27 | */
28 | Status: null,
29 | ResultCode: null,
30 | ResultMessage: null,
31 | ExecutionDate: null,
32 | /**
33 | * The Id of the dispute to which this repudation corresponds.
34 | * Note that this value may be null (if it was created before the Dispute
35 | * objects started to be used – October 2015)
36 | */
37 | DisputeId: null,
38 | InitialTransactionId: null,
39 | InitialTransactionType: null
40 | },
41 |
42 | getSubObjects: function() {
43 | return {
44 | 'DebitedFunds': Money,
45 | 'Fees': Money,
46 | 'CreditedFunds': Money
47 | }
48 | }
49 | });
50 |
51 | module.exports = Repudiation;
--------------------------------------------------------------------------------
/lib/models/SecurityInfo.js:
--------------------------------------------------------------------------------
1 | var EntityBase = require('./EntityBase');
2 |
3 | var SecurityInfo = EntityBase.extend({
4 | defaults: {
5 | /**
6 | * The address
7 | */
8 | AVSResult: null
9 | }
10 | });
11 |
12 | module.exports = SecurityInfo;
--------------------------------------------------------------------------------
/lib/models/SettlementTransfer.js:
--------------------------------------------------------------------------------
1 | var _ = require('underscore');
2 | var Model = require('../Model');
3 | var Money = require('./Money');
4 |
5 | var SettlementTransfer = Model.extend({
6 | defaults: {
7 | /**
8 | * The Id of the author of the original PayIn that was repudiated
9 | */
10 | AuthorId: null,
11 |
12 | /**
13 | * The funds debited from the debited wallet
14 | */
15 | DebitedFunds: null,
16 |
17 | /**
18 | * The amount you wish to charge for this settlement.
19 | * This can be equal to 0, or more than 0 to charge for the settlement
20 | * or less than 0 to refund some of the original Fees that were taken
21 | * on the original settlement (eg DebitedFunds of 1000 and
22 | * Fees of -200 will transfer 800 from the original wallet
23 | * to the credit wallet, and transfer 200 from your Fees
24 | * wallet to your Credit wallet
25 | */
26 | Fees: null
27 | },
28 |
29 | getSubObjects: function() {
30 | return {
31 | 'DebitedFunds': Money,
32 | 'Fees': Money
33 | }
34 | }
35 | });
36 |
37 | module.exports = SettlementTransfer;
38 |
--------------------------------------------------------------------------------
/lib/models/Shipping.js:
--------------------------------------------------------------------------------
1 | var EntityBase = require('./EntityBase');
2 |
3 | var Shipping = EntityBase.extend({
4 | defaults: {
5 | FirstName: null,
6 | LastName: null,
7 | /**
8 | * The address
9 | */
10 | Address: null
11 | }
12 | });
13 |
14 | module.exports = Shipping;
--------------------------------------------------------------------------------
/lib/models/ShippingAddress.js:
--------------------------------------------------------------------------------
1 | var EntityBase = require('./EntityBase');
2 | var Address = require('./Address');
3 |
4 | /**
5 | * Models shipping details
6 | */
7 | module.exports = EntityBase.extend({
8 | defaults: {
9 | /**
10 | * Name of the shipping recipient
11 | */
12 | RecipientName: null,
13 |
14 | /**
15 | * The shipping address
16 | */
17 | Address: null
18 | },
19 |
20 | getSubObjects: function () {
21 | return {
22 | 'Address': Address
23 | };
24 | }
25 | });
--------------------------------------------------------------------------------
/lib/models/ShippingPreference.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | SetProvidedAddress: 'SET_PROVIDED_ADDRESS',
3 | GetFromFile: 'GET_FROM_FILE',
4 | NoShipping: 'NO_SHIPPING'
5 | };
6 |
--------------------------------------------------------------------------------
/lib/models/Transaction.js:
--------------------------------------------------------------------------------
1 | var EntityBase = require('./EntityBase');
2 | var Money = require('./Money');
3 |
4 | var Wallet = EntityBase.extend({
5 | defaults: {
6 | /**
7 | * Array with owners identities
8 | */
9 | AuthorId: null,
10 | CreditedUserId: null,
11 | DebitedFunds: null,
12 | CreditedFunds: null,
13 | Fees: null,
14 | /**
15 | * TransactionStatus {CREATED, SUCCEEDED, FAILED}
16 | */
17 | Status: null,
18 | ResultCode: null,
19 | ResultMessage: null,
20 | ExecutionDate: null,
21 | Type: null,
22 | Nature: null,
23 | DebitedWalletId: null,
24 | CreditedWalletId: null
25 | },
26 |
27 | /**
28 | * Get mapping of model properties and corresponding object types
29 | * @returns {Object}
30 | */
31 | getSubObjects: function() {
32 | return {
33 | 'DebitedFunds': Money,
34 | 'CreditedFunds': Money,
35 | 'Fees': Money
36 | }
37 | },
38 |
39 | /**
40 | * Get array with read-only properties
41 | * @return {Array} List of string properties
42 | */
43 | getReadOnlyProperties: function() {
44 | var properties = EntityBase.prototype.getReadOnlyProperties();
45 | properties.push('Status', 'ResultCode', 'ExecutionDate');
46 | return properties;
47 | }
48 | });
49 |
50 | module.exports = Wallet;
--------------------------------------------------------------------------------
/lib/models/Transfer.js:
--------------------------------------------------------------------------------
1 | var _ = require('underscore');
2 | var Transaction = require('./Transaction');
3 |
4 | var Transfer = Transaction.extend({
5 | defaults: _.extend({}, Transaction.prototype.defaults, {
6 | DebitedWalletId: null,
7 | CreditedWalletId: null,
8 | ScaContext: null,
9 | PendingUserAction: null
10 | })
11 | });
12 |
13 | module.exports = Transfer;
--------------------------------------------------------------------------------
/lib/models/Ubo.js:
--------------------------------------------------------------------------------
1 | var EntityBase = require('./EntityBase');
2 | var Address = require('./Address');
3 | var Birthplace = require('./Birthplace');
4 |
5 | /**
6 | * UBO entity
7 | */
8 | var Ubo = EntityBase.extend({
9 | defaults: {
10 | FirstName: String,
11 | LastName: String,
12 | Address: Address,
13 | Nationality: String,
14 | Birthday: null,
15 | Birthplace: Birthplace
16 | }
17 | });
18 |
19 | module.exports = Ubo;
--------------------------------------------------------------------------------
/lib/models/UboDeclaration.js:
--------------------------------------------------------------------------------
1 | var EntityBase = require('./EntityBase');
2 |
3 | /**
4 | * UBO declaration entity.
5 | */
6 | var UboDeclaration = EntityBase.extend({
7 | defaults: {
8 | /**
9 | * cannot be modified by clients
10 | */
11 | ProcessedDate: null,
12 | /**
13 | * Declaration status (one of UboDeclarationStatus)
14 | */
15 | Status: null,
16 | /**
17 | * Array of reasons why the declaration was refused
18 | * Values as declared in UboDeclarationRefusedReasonType.
19 | */
20 | Reason: null,
21 | /**
22 | * Explanation of why the declaration was refused.
23 | */
24 | Message: null,
25 | /**
26 | * Table of ubos (declared in Ubo)
27 | */
28 | Ubos: []
29 | },
30 |
31 | /**
32 | * Get array with read-only properties
33 | * @return {Array} List of string properties
34 | */
35 | getReadOnlyProperties: function () {
36 | var properties = EntityBase.prototype.getReadOnlyProperties();
37 | properties.push('ProcessedDate', 'Status', 'Reason', 'Message');
38 | return properties;
39 | },
40 | });
41 |
42 | module.exports = UboDeclaration;
--------------------------------------------------------------------------------
/lib/models/UboDeclarationRefusedReasonType.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Enumeration of reasons why a UBO declaration could be refused.
3 | */
4 | module.exports = {
5 | /**
6 | * When at least one natural user is missing on the declaration
7 | */
8 | MissingUbo: 'MISSING_UBO',
9 |
10 | DeclarationDontMatchUboInfo: 'DECLARATION_DO_NOT_MATCH_UBO_INFORMATION',
11 |
12 | WrongUboInformation: 'WRONG_UBO_INFORMATION',
13 |
14 | UboIdentityNeeded: 'UBO_IDENTITY_NEEDED',
15 |
16 | ShareholdersDeclarationNeeded: 'SHAREHOLDERS_DECLARATION_NEEDED',
17 |
18 | OrganizationChartNeeded: 'ORGANIZATION_CHART_NEEDED',
19 |
20 | DocumentsNeeded: 'DOCUMENTS_NEEDED',
21 |
22 | SpecificCase: 'SPECIFIC_CASE'
23 | };
24 |
--------------------------------------------------------------------------------
/lib/models/UboDeclarationStatus.js:
--------------------------------------------------------------------------------
1 | /**
2 | * UBO declaration possible status enumeration.
3 | */
4 | module.exports = {
5 | /**
6 | * When the UBO declaration was created
7 | */
8 | Created: 'CREATED',
9 | /**
10 | * When validation has been requested for the UBO declaration
11 | */
12 | ValidationAsked: 'VALIDATION_ASKED',
13 | /**
14 | * When the UBO declaration was validated
15 | */
16 | Validated: 'VALIDATED',
17 | /**
18 | * When the UBO declaration was refused
19 | */
20 | Refused: 'REFUSED',
21 |
22 | /**
23 | * When the UBO declaration was incomplete
24 | */
25 | Incomplete: 'INCOMPLETE',
26 | };
--------------------------------------------------------------------------------
/lib/models/UboRefusedReasonType.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Enumerated possible reasons why declaration of a user as UBO could be refused.
3 | */
4 | module.exports = {
5 | /**
6 | * When user should not be declared as UBO
7 | */
8 | InvalidDeclaredUbo: 'INVALID_DECLARED_UBO',
9 | /**
10 | * When user declared as UBO was created with wrong
11 | * details (i.e. date of birth, country of residence)
12 | */
13 | InvalidUboDetails: 'INVALID_UBO_DETAILS'
14 | };
--------------------------------------------------------------------------------
/lib/models/User.js:
--------------------------------------------------------------------------------
1 | var _ = require('underscore');
2 | var EntityBase = require('./EntityBase');
3 |
4 | var User = EntityBase.extend({
5 | defaults: {
6 | /**
7 | * Type of user
8 | */
9 | PersonType: null,
10 |
11 | /**
12 | * Email address
13 | */
14 | Email: null,
15 |
16 | /**
17 | * KYC Level (LIGHT or REGULAR)
18 | */
19 | KYCLevel: null,
20 |
21 | /**
22 | * Whether or not the user has accepted the MANGOPAY Terms and Conditions.
23 | */
24 | TermsAndConditionsAccepted: null,
25 |
26 | TermsAndConditionsAcceptedDate: null,
27 |
28 | /**
29 | * Category of the user. May take one of the following values:
30 | * PAYER - Users who only use MANGOPAY to give money to other users
31 | * OWNER - Users who use MANGOPAY to receive funds. Please note that a user needs to be KYC validated to perform payouts
32 | */
33 | UserCategory: null,
34 |
35 | UserStatus: null
36 | },
37 |
38 | /**
39 | * Sets the person type to the model
40 | * @param {String} personType
41 | */
42 | setPersonType: function(personType) {
43 | this.PersonType = personType;
44 | },
45 |
46 | setUserCategory: function(userCategory) {
47 | this.UserCategory = userCategory;
48 | },
49 |
50 | /**
51 | * Get array with read-only properties
52 | * @return {Array} List of string properties
53 | */
54 | getReadOnlyProperties: function() {
55 | var properties = EntityBase.prototype.getReadOnlyProperties();
56 | properties.push('PersonType', 'KYCLevel');
57 | return properties;
58 | },
59 |
60 | parse: function() {
61 | var parsedValues = EntityBase.prototype.parse.call(this, arguments);
62 | return _.omit(parsedValues, 'CreationDate');
63 | }
64 | });
65 |
66 | module.exports = User;
67 |
--------------------------------------------------------------------------------
/lib/models/UserCategory.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | Payer: 'PAYER',
3 | Owner: 'OWNER'
4 | };
5 |
--------------------------------------------------------------------------------
/lib/models/UserDataFormatValidation.js:
--------------------------------------------------------------------------------
1 | var EntityBase = require('./EntityBase');
2 |
3 | module.exports = EntityBase.extend({
4 | defaults: {
5 | CompanyNumber: null
6 | }
7 | });
--------------------------------------------------------------------------------
/lib/models/UserEnrollmentResult.js:
--------------------------------------------------------------------------------
1 | var Model = require('../Model');
2 |
3 | module.exports = Model.extend({
4 | defaults: {
5 | PendingUserAction: null
6 | }
7 | });
--------------------------------------------------------------------------------
/lib/models/UserLegal.js:
--------------------------------------------------------------------------------
1 | /**
2 | * WORK IN PROGRESS
3 | */
4 | var _ = require('underscore');
5 |
6 | var PersonType = require('./PersonType');
7 |
8 | var User = require('./User');
9 | var Address = require('./Address');
10 |
11 | var UserLegal = User.extend({
12 | defaults: _.extend({}, User.prototype.defaults, {
13 | Name: null,
14 | /**
15 | * Type for legal user. Possible: ‘BUSINESS’, ’ORGANIZATION’, 'SOLETRADER'
16 | */
17 | LegalPersonType: null,
18 | HeadquartersAddress: null,
19 | LegalRepresentativeFirstName: null,
20 | LegalRepresentativeLastName: null,
21 | LegalRepresentativeAddress: null,
22 | LegalRepresentativeEmail: null,
23 | LegalRepresentativeBirthday: null,
24 | LegalRepresentativeNationality: null,
25 | LegalRepresentativeCountryOfResidence: null,
26 | CompanyNumber: null,
27 | ProofOfIdentity: null,
28 | Statute: null,
29 | ProofOfRegistration: null,
30 | ShareholderDeclaration: null
31 | }),
32 |
33 | /**
34 | * Construct
35 | */
36 | initialize: function() {
37 | User.prototype.initialize.apply(this, arguments);
38 | this.setPersonType(PersonType.Legal);
39 | },
40 |
41 | /**
42 | * Get object with key as object type and value the object class
43 | * @return {Object} Sub-objects mapping
44 | */
45 | getSubObjects: function() {
46 | var subObjects = User.prototype.getSubObjects();
47 |
48 | return _.extend({}, subObjects, {
49 | HeadquartersAddress: Address,
50 | LegalRepresentativeAddress: Address
51 | });
52 | },
53 |
54 | /**
55 | * Get array with read-only properties
56 | * @return {Array} List of string properties
57 | */
58 | getReadOnlyProperties: function() {
59 | var properties = User.prototype.getReadOnlyProperties();
60 | properties.push('Statute', 'ProofOfRegistration', 'ShareholderDeclaration');
61 | return properties;
62 | }
63 | });
64 |
65 | module.exports = UserLegal;
66 |
--------------------------------------------------------------------------------
/lib/models/UserLegalOwner.js:
--------------------------------------------------------------------------------
1 | var _ = require('underscore');
2 |
3 | var PersonType = require('./PersonType');
4 |
5 | var User = require('./User');
6 | var Address = require('./Address');
7 | var UserCategory = require("./UserCategory");
8 |
9 | var UserLegalOwner = User.extend({
10 | defaults: _.extend({}, User.prototype.defaults, {
11 | Name: null,
12 | /**
13 | * Type for legal user. Possible: ‘BUSINESS’, ’ORGANIZATION’, 'SOLETRADER', 'PARTNERSHIP
14 | */
15 | LegalPersonType: null,
16 | HeadquartersAddress: null,
17 | LegalRepresentativeFirstName: null,
18 | LegalRepresentativeLastName: null,
19 | LegalRepresentativeAddress: null,
20 | LegalRepresentativeEmail: null,
21 | LegalRepresentativeBirthday: null,
22 | LegalRepresentativeNationality: null,
23 | LegalRepresentativeCountryOfResidence: null,
24 | CompanyNumber: null,
25 | ProofOfIdentity: null,
26 | Statute: null,
27 | ProofOfRegistration: null,
28 | ShareholderDeclaration: null,
29 | UserCategory: null,
30 | TermsAndConditionsAccepted: null
31 | }),
32 |
33 | /**
34 | * Construct
35 | */
36 | initialize: function() {
37 | User.prototype.initialize.apply(this, arguments);
38 | this.setPersonType(PersonType.Legal);
39 | this.setUserCategory(UserCategory.Owner);
40 | },
41 |
42 | /**
43 | * Get object with key as object type and value the object class
44 | * @return {Object} Sub-objects mapping
45 | */
46 | getSubObjects: function() {
47 | var subObjects = User.prototype.getSubObjects();
48 |
49 | return _.extend({}, subObjects, {
50 | HeadquartersAddress: Address,
51 | LegalRepresentativeAddress: Address
52 | });
53 | },
54 |
55 | /**
56 | * Get array with read-only properties
57 | * @return {Array} List of string properties
58 | */
59 | getReadOnlyProperties: function() {
60 | var properties = User.prototype.getReadOnlyProperties();
61 | properties.push('Statute', 'ProofOfRegistration', 'ShareholderDeclaration');
62 | return properties;
63 | }
64 | });
65 |
66 | module.exports = UserLegalOwner;
67 |
--------------------------------------------------------------------------------
/lib/models/UserLegalPayer.js:
--------------------------------------------------------------------------------
1 | var _ = require('underscore');
2 |
3 | var PersonType = require('./PersonType');
4 |
5 | var User = require('./User');
6 | var Address = require('./Address');
7 | var UserCategory = require("./UserCategory");
8 |
9 | var UserLegalPayer = User.extend({
10 | defaults: _.extend({}, User.prototype.defaults, {
11 | Name: null,
12 | /**
13 | * Type for legal user. Possible: ‘BUSINESS’, ’ORGANIZATION’, 'SOLETRADER'
14 | */
15 | LegalPersonType: null,
16 | HeadquartersAddress: null,
17 | LegalRepresentativeFirstName: null,
18 | LegalRepresentativeLastName: null,
19 | LegalRepresentativeAddress: null,
20 | LegalRepresentativeEmail: null,
21 | LegalRepresentativeBirthday: null,
22 | LegalRepresentativeNationality: null,
23 | LegalRepresentativeCountryOfResidence: null,
24 | CompanyNumber: null,
25 | ProofOfIdentity: null,
26 | Statute: null,
27 | ProofOfRegistration: null,
28 | ShareholderDeclaration: null,
29 | UserCategory: null,
30 | TermsAndConditionsAccepted: null
31 | }),
32 |
33 | /**
34 | * Construct
35 | */
36 | initialize: function() {
37 | User.prototype.initialize.apply(this, arguments);
38 | this.setPersonType(PersonType.Legal);
39 | this.setUserCategory(UserCategory.Payer);
40 | },
41 |
42 | /**
43 | * Get object with key as object type and value the object class
44 | * @return {Object} Sub-objects mapping
45 | */
46 | getSubObjects: function() {
47 | var subObjects = User.prototype.getSubObjects();
48 |
49 | return _.extend({}, subObjects, {
50 | HeadquartersAddress: Address,
51 | LegalRepresentativeAddress: Address
52 | });
53 | },
54 |
55 | /**
56 | * Get array with read-only properties
57 | * @return {Array} List of string properties
58 | */
59 | getReadOnlyProperties: function() {
60 | var properties = User.prototype.getReadOnlyProperties();
61 | properties.push('Statute', 'ProofOfRegistration', 'ShareholderDeclaration');
62 | return properties;
63 | }
64 | });
65 |
66 | module.exports = UserLegalPayer;
67 |
--------------------------------------------------------------------------------
/lib/models/UserLegalSca.js:
--------------------------------------------------------------------------------
1 | var _ = require('underscore');
2 |
3 | var PersonType = require('./PersonType');
4 |
5 | var User = require('./User');
6 | var Address = require('./Address');
7 | var PendingUserAction = require('./PendingUserAction');
8 | var LegalRepresentative = require('./LegalRepresentative');
9 |
10 | var UserLegalSca = User.extend({
11 | defaults: _.extend({}, User.prototype.defaults, {
12 | Name: null,
13 | LegalPersonType: null,
14 | LegalRepresentative: null,
15 | ProofOfRegistration: null,
16 | ShareholderDeclaration: null,
17 | Statute: null,
18 | CompanyNumber: null,
19 | PendingUserAction: null,
20 | HeadquartersAddress: null,
21 | LegalRepresentativeAddress: null
22 | }),
23 |
24 | initialize: function() {
25 | User.prototype.initialize.apply(this, arguments);
26 | this.setPersonType(PersonType.Legal);
27 | },
28 |
29 | /**
30 | * Get object with key as object type and value the object class
31 | * @return {Object} Mapping of sub-objects
32 | */
33 | getSubObjects: function() {
34 | var subObjects = User.prototype.getSubObjects();
35 |
36 | return _.extend({}, subObjects, {
37 | Address: Address,
38 | HeadquarterAddress: Address,
39 | LegalRepresentativeAddress: Address,
40 | PendingUserAction: PendingUserAction,
41 | LegalRepresentative: LegalRepresentative
42 | });
43 | },
44 |
45 | /**
46 | * Get array with read-only properties
47 | * @return {Array}
48 | */
49 | getReadOnlyProperties: function() {
50 | var properties = User.prototype.getReadOnlyProperties();
51 | properties.push('Statute', 'ProofOfRegistration', 'ShareholderDeclaration');
52 | return properties;
53 | }
54 | });
55 |
56 | module.exports = UserLegalSca;
--------------------------------------------------------------------------------
/lib/models/UserNatural.js:
--------------------------------------------------------------------------------
1 | var _ = require('underscore');
2 |
3 | var PersonType = require('./PersonType');
4 |
5 | var User = require('./User');
6 | var Address = require('./Address');
7 |
8 | var UserNatural = User.extend({
9 | defaults: _.extend({}, User.prototype.defaults, {
10 | FirstName: null,
11 | LastName: null,
12 | Address: null,
13 | Birthday: null,
14 | Nationality: null,
15 | CountryOfResidence: null,
16 | Occupation: null,
17 | IncomeRange: null,
18 | ProofOfIdentity: null,
19 | ProofOfAddress: null,
20 | Capacity: null
21 | }),
22 |
23 | initialize: function() {
24 | User.prototype.initialize.apply(this, arguments);
25 | this.setPersonType(PersonType.Natural);
26 | },
27 |
28 | /**
29 | * Get object with key as object type and value the object class
30 | * @return {Object} Mapping of sub-objects
31 | */
32 | getSubObjects: function() {
33 | var subObjects = User.prototype.getSubObjects();
34 |
35 | return _.extend({}, subObjects, {
36 | Address: Address
37 | });
38 | },
39 |
40 | /**
41 | * Get array with read-only properties
42 | * @return {Array}
43 | */
44 | getReadOnlyProperties: function() {
45 | var properties = User.prototype.getReadOnlyProperties();
46 | properties.push('PersonType', 'ProofOfIdentity', 'ProofOfAddress');
47 | return properties;
48 | }
49 | });
50 |
51 | module.exports = UserNatural;
--------------------------------------------------------------------------------
/lib/models/UserNaturalCapacity.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Capacity values of a natural user within MangoPay.
3 | */
4 | module.exports = {
5 | /**
6 | * Real customer
7 | */
8 | Normal: 'NORMAL',
9 | /**
10 | * User used only for declaration purpose
11 | */
12 | Declarative: 'DECLARATIVE'
13 | };
--------------------------------------------------------------------------------
/lib/models/UserNaturalOwner.js:
--------------------------------------------------------------------------------
1 | var _ = require('underscore');
2 |
3 | var PersonType = require('./PersonType');
4 |
5 | var User = require('./User');
6 | var Address = require('./Address');
7 | var UserCategory = require("./UserCategory");
8 |
9 | var UserNaturalOwner = User.extend({
10 | defaults: _.extend({}, User.prototype.defaults, {
11 | FirstName: null,
12 | LastName: null,
13 | Address: null,
14 | Birthday: null,
15 | Nationality: null,
16 | CountryOfResidence: null,
17 | Occupation: null,
18 | IncomeRange: null,
19 | ProofOfIdentity: null,
20 | ProofOfAddress: null,
21 | Capacity: null,
22 | UserCategory: null,
23 | TermsAndConditionsAccepted: null
24 | }),
25 |
26 | initialize: function() {
27 | User.prototype.initialize.apply(this, arguments);
28 | this.setPersonType(PersonType.Natural);
29 | this.setUserCategory(UserCategory.Owner);
30 | },
31 |
32 | /**
33 | * Get object with key as object type and value the object class
34 | * @return {Object} Mapping of sub-objects
35 | */
36 | getSubObjects: function() {
37 | var subObjects = User.prototype.getSubObjects();
38 |
39 | return _.extend({}, subObjects, {
40 | Address: Address
41 | });
42 | },
43 |
44 | /**
45 | * Get array with read-only properties
46 | * @return {Array}
47 | */
48 | getReadOnlyProperties: function() {
49 | var properties = User.prototype.getReadOnlyProperties();
50 | properties.push('PersonType', 'ProofOfIdentity', 'ProofOfAddress');
51 | return properties;
52 | }
53 | });
54 |
55 | module.exports = UserNaturalOwner;
56 |
--------------------------------------------------------------------------------
/lib/models/UserNaturalPayer.js:
--------------------------------------------------------------------------------
1 | var _ = require('underscore');
2 |
3 | var PersonType = require('./PersonType');
4 |
5 | var User = require('./User');
6 | var Address = require('./Address');
7 | var UserCategory = require("./UserCategory");
8 |
9 | var UserNaturalPayer = User.extend({
10 | defaults: _.extend({}, User.prototype.defaults, {
11 | FirstName: null,
12 | LastName: null,
13 | Address: null,
14 | Birthday: null,
15 | Nationality: null,
16 | CountryOfResidence: null,
17 | Occupation: null,
18 | IncomeRange: null,
19 | ProofOfIdentity: null,
20 | ProofOfAddress: null,
21 | Capacity: null,
22 | UserCategory: null,
23 | TermsAndConditionsAccepted: null
24 | }),
25 |
26 | initialize: function() {
27 | User.prototype.initialize.apply(this, arguments);
28 | this.setPersonType(PersonType.Natural);
29 | this.setUserCategory(UserCategory.Payer);
30 | },
31 |
32 | /**
33 | * Get object with key as object type and value the object class
34 | * @return {Object} Mapping of sub-objects
35 | */
36 | getSubObjects: function() {
37 | var subObjects = User.prototype.getSubObjects();
38 |
39 | return _.extend({}, subObjects, {
40 | Address: Address
41 | });
42 | },
43 |
44 | /**
45 | * Get array with read-only properties
46 | * @return {Array}
47 | */
48 | getReadOnlyProperties: function() {
49 | var properties = User.prototype.getReadOnlyProperties();
50 | properties.push('PersonType', 'ProofOfIdentity', 'ProofOfAddress');
51 | return properties;
52 | }
53 | });
54 |
55 | module.exports = UserNaturalPayer;
56 |
--------------------------------------------------------------------------------
/lib/models/UserNaturalPut.js:
--------------------------------------------------------------------------------
1 | var _ = require('underscore');
2 |
3 | var PersonType = require('./PersonType');
4 |
5 | var User = require('./User');
6 | var Address = require('./Address');
7 |
8 | var UserNaturalPut = User.extend({
9 | defaults: _.extend({}, User.prototype.defaults, {
10 | FirstName: null,
11 | LastName: null,
12 | Address: null,
13 | Birthday: null,
14 | Nationality: null,
15 | CountryOfResidence: null,
16 | Occupation: null,
17 | IncomeRange: null,
18 | Capacity: null
19 | }),
20 |
21 | initialize: function() {
22 | User.prototype.initialize.apply(this, arguments);
23 | this.setPersonType(PersonType.Natural);
24 | },
25 |
26 | /**
27 | * Get object with key as object type and value the object class
28 | * @return {Object} Mapping of sub-objects
29 | */
30 | getSubObjects: function() {
31 | var subObjects = User.prototype.getSubObjects();
32 |
33 | return _.extend({}, subObjects, {
34 | Address: Address
35 | });
36 | },
37 |
38 | /**
39 | * Get array with read-only properties
40 | * @return {Array}
41 | */
42 | getReadOnlyProperties: function() {
43 | var properties = User.prototype.getReadOnlyProperties();
44 | properties.push('PersonType');
45 | return properties;
46 | }
47 | });
48 |
49 | module.exports = UserNaturalPut;
--------------------------------------------------------------------------------
/lib/models/UserNaturalSca.js:
--------------------------------------------------------------------------------
1 | var _ = require('underscore');
2 |
3 | var PersonType = require('./PersonType');
4 |
5 | var User = require('./User');
6 | var Address = require('./Address');
7 | var PendingUserAction = require('./PendingUserAction');
8 |
9 | var UserNaturalSca = User.extend({
10 | defaults: _.extend({}, User.prototype.defaults, {
11 | FirstName: null,
12 | LastName: null,
13 | Address: null,
14 | Birthday: null,
15 | Nationality: null,
16 | CountryOfResidence: null,
17 | Occupation: null,
18 | IncomeRange: null,
19 | ProofOfIdentity: null,
20 | ProofOfAddress: null,
21 | PhoneNumber: null,
22 | PhoneNumberCountry: null,
23 | PendingUserAction: null
24 | }),
25 |
26 | initialize: function() {
27 | User.prototype.initialize.apply(this, arguments);
28 | this.setPersonType(PersonType.Natural);
29 | },
30 |
31 | /**
32 | * Get object with key as object type and value the object class
33 | * @return {Object} Mapping of sub-objects
34 | */
35 | getSubObjects: function() {
36 | var subObjects = User.prototype.getSubObjects();
37 |
38 | return _.extend({}, subObjects, {
39 | Address: Address,
40 | PendingUserAction: PendingUserAction
41 | });
42 | },
43 |
44 | /**
45 | * Get array with read-only properties
46 | * @return {Array}
47 | */
48 | getReadOnlyProperties: function() {
49 | var properties = User.prototype.getReadOnlyProperties();
50 | properties.push('PersonType', 'ProofOfIdentity', 'ProofOfAddress', 'PendingUserAction');
51 | return properties;
52 | }
53 | });
54 |
55 | module.exports = UserNaturalSca;
--------------------------------------------------------------------------------
/lib/models/VirtualAccount.js:
--------------------------------------------------------------------------------
1 | var EntityBase = require('./EntityBase');
2 |
3 | var VirtualAccount = EntityBase.extend({
4 |
5 | defaults: {
6 | WalletId: null,
7 | CreditedUserId: null,
8 | VirtualAccountPurpose: null,
9 | Country: null,
10 | Status: null,
11 | Active: null,
12 | AccountOwner: null,
13 | LocalAccountsDetails: null,
14 | InternationalAccountDetails: null,
15 | Capabilities: null
16 | }
17 |
18 | });
19 |
20 | module.exports = VirtualAccount;
--------------------------------------------------------------------------------
/lib/models/Wallet.js:
--------------------------------------------------------------------------------
1 | var EntityBase = require('./EntityBase');
2 | var Money = require('./Money');
3 |
4 | var Wallet = EntityBase.extend({
5 | defaults: {
6 | /**
7 | * Array with owners identities
8 | */
9 | Owners: null,
10 | Description: null,
11 | Balance: null,
12 | Currency: null
13 | },
14 |
15 | getSubObjects: function() {
16 | return {
17 | 'Balance': Money
18 | }
19 | },
20 |
21 | /**
22 | * Get array with read-only properties
23 | * @return {Array} List of string properties
24 | */
25 | getReadOnlyProperties: function() {
26 | var properties = EntityBase.prototype.getReadOnlyProperties();
27 | properties.push('Balance');
28 | return properties;
29 | }
30 | });
31 |
32 | module.exports = Wallet;
--------------------------------------------------------------------------------
/lib/service.js:
--------------------------------------------------------------------------------
1 | var _ = require('underscore');
2 |
3 | function Service() {
4 | _.bindAll(this, 'initialize');
5 | this.initialize();
6 | }
7 |
8 | Service.prototype = {
9 | initialize: function() {}
10 | };
11 |
12 | Service.extend = require('./utils').extend;
13 |
14 | module.exports = Service;
--------------------------------------------------------------------------------
/lib/services/BankAccounts.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @module BankAccounts
3 | */
4 |
5 | var Service = require('../service');
6 | var Transaction = require('../models/Transaction');
7 |
8 | var BankAccounts = Service.extend({
9 |
10 | /**
11 | * Retrieve list of transactions for a bank account
12 | * @param {number} bankAccountId Bank Account Id
13 | * @param {Function} callback Callback function
14 | * @param {Object} options Request options
15 | * @return {Object} Request promise
16 | */
17 | getTransactions: function (bankAccountId, callback, options) {
18 | if (options && !options.hasOwnProperty('parameters'))
19 | Object.assign(options, {parameters: {...options}});
20 | options = this._api._getOptions(callback, options, {
21 | path: {
22 | bankAccountId: bankAccountId
23 | },
24 | dataClass: Transaction
25 | });
26 |
27 | return this._api.method('transactions_get_for_bank_account', callback, options);
28 | }
29 | });
30 |
31 | module.exports = BankAccounts;
--------------------------------------------------------------------------------
/lib/services/Events.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @module Events
3 | * @desc [MangoPay Events API Reference](https://docs.mangopay.com/endpoints/v2.01/events)
4 | */
5 |
6 | var Service = require('../service');
7 |
8 | var Events = Service.extend({
9 | /**
10 | * Get events
11 | * @param {Function} callback Callback function
12 | * @param {Object} options Request options
13 | * @return {Object} Request promise
14 | */
15 | getAll: function(callback, options) {
16 | if (options && !options.hasOwnProperty('parameters'))
17 | Object.assign(options, {parameters: {...options}});
18 | options = this._api._getOptions(callback, options);
19 |
20 | return this._api.method('events_all', callback, options);
21 | }
22 | });
23 |
24 | module.exports = Events;
25 |
--------------------------------------------------------------------------------
/lib/services/Idempotency.js:
--------------------------------------------------------------------------------
1 | var Service = require('../service');
2 | var IdempotencyResponse = require('../models/IdempotencyResponse');
3 |
4 | var Idempotency = Service.extend({
5 | get: function(idempotencyKey, callback, options) {
6 | options = this._api._getOptions(callback, options, {
7 | path: {
8 | idempotencyKey: idempotencyKey
9 | },
10 | dataClass: IdempotencyResponse
11 | });
12 |
13 | return this._api.method('idempotency_response_get', callback, options);
14 | },
15 | });
16 |
17 | module.exports = Idempotency;
18 |
--------------------------------------------------------------------------------
/lib/services/IdentityVerifications.js:
--------------------------------------------------------------------------------
1 | var Service = require('../service');
2 | var IdentityVerification = require('../models/IdentityVerification');
3 |
4 | var IdentityVerifications = Service.extend({
5 | /**
6 | * Start an identity verification session and get a link for the hosted experience
7 | */
8 | create: function(userId, identityVerification, callback, options) {
9 | options = this._api._getOptions(callback, options, {
10 | data: identityVerification,
11 | dataClass: IdentityVerification,
12 | path: {
13 | userId: userId
14 | }
15 | });
16 |
17 | return this._api.method('identity_verification_create', callback, options);
18 | },
19 |
20 | /**
21 | * See the status and basic details of an identity verification session
22 | */
23 | get: function(identityVerificationId, callback, options) {
24 | options = this._api._getOptions(callback, options, {
25 | dataClass: IdentityVerification,
26 | path: {
27 | id: identityVerificationId
28 | }
29 | });
30 |
31 | return this._api.method('identity_verification_get', callback, options);
32 | },
33 |
34 | /**
35 | * Get all IdentityVerifications for a user
36 | */
37 | getAll: function(userId, callback, options) {
38 | options = this._api._getOptions(callback, options, {
39 | path: {
40 | userId: userId
41 | }
42 | });
43 |
44 | return this._api.method('identity_verification_get_all', callback, options);
45 | }
46 | });
47 |
48 | module.exports = IdentityVerifications;
49 |
--------------------------------------------------------------------------------
/lib/services/OptionsHelper.js:
--------------------------------------------------------------------------------
1 | var Service = require('../service');
2 | var _ = require('underscore');
3 |
4 | var OptionsHelper = Service.extend({
5 |
6 | /**
7 | * Adds Idempotency-Key headers to the provided 'options' parameter
8 | * @param options
9 | * @param idempotencyKey
10 | */
11 | withIdempotency(options, idempotencyKey) {
12 | return _.extend(options, {
13 | headers: {
14 | "Idempotency-Key": idempotencyKey
15 | }
16 | });
17 | }
18 | });
19 |
20 | module.exports = OptionsHelper;
21 |
--------------------------------------------------------------------------------
/lib/services/Refunds.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @module Refunds
3 | * @desc [MangoPay Refunds API Reference](https://docs.mangopay.com/endpoints/v2.01/refunds)
4 | */
5 |
6 | var Service = require('../service');
7 | var Refund = require('../models/Refund');
8 |
9 | var Refunds = Service.extend({
10 | /**
11 | * Get events
12 | * @param {number} refundId Refund id
13 | * @param {Function} callback Callback function
14 | * @param {Object} options Request options
15 | * @return {Object} Request promise
16 | */
17 | get: function(refundId, callback, options) {
18 | options = this._api._getOptions(callback, options, {
19 | path: {
20 | id: refundId
21 | },
22 | dataClass: Refund
23 | });
24 |
25 | return this._api.method('refunds_get', callback, options);
26 | }
27 | });
28 |
29 | module.exports = Refunds;
30 |
--------------------------------------------------------------------------------
/lib/services/Regulatory.js:
--------------------------------------------------------------------------------
1 | var Service = require('../service');
2 | const CountryAuthorization = require("../models/CountryAuthorization");
3 |
4 | var Regulatory = Service.extend({
5 |
6 | /**
7 | * View the restrictions for a specific country
8 | * @param countryCode: the code of the Country
9 | */
10 | getCountryAuthorizations: function(countryCode, callback, options) {
11 | options = this._api._getOptions(callback, options, {
12 | path: {
13 | countryCode: countryCode
14 | },
15 | dataClass: CountryAuthorization
16 | });
17 |
18 | return this._api.method('countries_get_one', callback, options);
19 | },
20 |
21 | /**
22 | * View the restrictions for al countries
23 | */
24 | getAllCountriesAuthorizations: function(callback, options) {
25 | return this._api.method('countries_get_all', callback, options);
26 | }
27 | });
28 |
29 | module.exports = Regulatory;
30 |
--------------------------------------------------------------------------------
/lib/services/Reports.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @module Reports
3 | * @desc [MangoPay Reports API Reference](https://docs.mangopay.com/endpoints/v2.01/reporting)
4 | */
5 |
6 | var Service = require('../service');
7 | var Report = require('../models/Report');
8 |
9 | var Reports = Service.extend({
10 | /**
11 | * Create a report
12 | * @param {Object} report Report Data
13 | * @param {Function} callback Callback function
14 | * @param {Object} options Request options
15 | * @return {Object} Request promise
16 | */
17 | create: function(report, callback, options) {
18 | options = this._api._getOptions(callback, options, {
19 | data: report,
20 | dataClass: Report
21 | });
22 |
23 | if (!report.ReportType) {
24 | throw new Error('Please specify ReportType in the report data (ex: "TRANSACTIONS", "WALLETS")')
25 | }
26 |
27 | var reportType = report.ReportType.toLowerCase();
28 |
29 | return this._api.method('reports_' + report.ReportType.toLowerCase() + '_create', callback, options);
30 | },
31 |
32 | /**
33 | * Get a report
34 | * @param {number} reportId Report Id
35 | * @param {Function} callback Callback function
36 | * @param {Object} options Request options
37 | * @return {Object} Request promise
38 | */
39 | get: function(reportId, callback, options) {
40 | options = this._api._getOptions(callback, options, {
41 | path: {
42 | id: reportId
43 | },
44 | dataClass: Report
45 | });
46 |
47 | return this._api.method('reports_get', callback, options);
48 | },
49 |
50 | /**
51 | * Get all reports
52 | * @param {Function} callback Callback function
53 | * @param {Object} options Request options
54 | * @return {Object} Request promise
55 | */
56 | getAll: function(callback, options) {
57 | return this._api.method('reports_all', callback, options);
58 | }
59 | });
60 |
61 | module.exports = Reports;
62 |
--------------------------------------------------------------------------------
/lib/services/Repudiations.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @module Repudiations
3 | * @desc [MangoPay Repudiations API Reference](https://docs.mangopay.com/endpoints/v2.01/repudiations)
4 | */
5 |
6 | var Service = require('../service');
7 |
8 | var Refund = require('../models/Refund');
9 |
10 | var Repudiations = Service.extend({
11 |
12 | /**
13 | * Gets list of Refunds of a Repudiation
14 | * @param {number} repudiationId Repudiation identifier
15 | * @param {function} callback Callback function
16 | * @param {Object} options Request options
17 | * @return {Object} Request promise
18 | */
19 | getRefunds: function(repudiationId, callback, options) {
20 | if (options && !options.hasOwnProperty('parameters'))
21 | Object.assign(options, {parameters: {...options}});
22 | options = this._api._getOptions(callback, options, {
23 | path: {
24 | id: repudiationId
25 | },
26 | dataClass: Refund
27 | });
28 |
29 | return this._api.method("refunds_get_for_repudiation", callback, options);
30 | }
31 | });
32 |
33 | module.exports = Repudiations;
34 |
--------------------------------------------------------------------------------
/lib/services/Responses.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @module Responses
3 | */
4 |
5 | var _ = require('underscore');
6 |
7 | var Service = require('../service');
8 |
9 | var Responses = Service.extend({
10 | /**
11 | * Get response from previous call
12 | * @param {Function} callback Callback function
13 | * @param {Object} options Request options
14 | * @return {Object} Request promise
15 | */
16 | get: function(callback, options) {
17 | options = this._api._getOptions(callback, options);
18 |
19 | return this._api.method('responses_get', callback, options);
20 | }
21 | });
22 |
23 | module.exports = Responses;
--------------------------------------------------------------------------------
/lib/services/index.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | BankAccounts: require('./BankAccounts'),
3 | BankingAliases: require('./BankingAliases'),
4 | CardPreAuthorizations: require('./CardPreAuthorizations'),
5 | CardRegistrations: require('./CardRegistrations'),
6 | Cards: require('./Cards'),
7 | Clients: require('./Clients'),
8 | DisputeDocuments: require('./DisputeDocuments'),
9 | Disputes: require('./Disputes'),
10 | Events: require('./Events'),
11 | Hooks: require('./Hooks'),
12 | Idempotency: require('./Idempotency'),
13 | KycDocuments: require('./KycDocuments'),
14 | Mandates: require('./Mandates'),
15 | OptionsHelper: require('./OptionsHelper'),
16 | PayIns: require('./PayIns'),
17 | PayOuts: require('./PayOuts'),
18 | Refunds: require('./Refunds'),
19 | Reports: require('./Reports'),
20 | Repudiations: require('./Repudiations'),
21 | Responses: require('./Responses'),
22 | Transfers: require('./Transfers'),
23 | UboDeclarations: require('./UboDeclarations'),
24 | Users: require('./Users'),
25 | Wallets: require('./Wallets'),
26 | Regulatory: require('./Regulatory'),
27 | Deposits: require('./Deposits'),
28 | Conversions: require('./Conversions'),
29 | VirtualAccounts: require('./VirtualAccounts'),
30 | IdentityVerifications: require('./IdentityVerifications'),
31 | Recipients: require('./Recipients')
32 | };
33 |
--------------------------------------------------------------------------------
/lib/utils.js:
--------------------------------------------------------------------------------
1 | var _ = require('underscore');
2 |
3 | module.exports = {
4 | extend: function(protoProps, staticProps) {
5 | var parent = this;
6 | var child;
7 |
8 | // The constructor function for the new subclass is either defined by you
9 | // (the "constructor" property in your `extend` definition), or defaulted
10 | // by us to simply call the parent's constructor.
11 | if (protoProps && _.has(protoProps, 'constructor')) {
12 | child = protoProps.constructor;
13 | } else {
14 | child = function(){ return parent.apply(this, arguments); };
15 | }
16 |
17 | // Add static properties to the constructor function, if supplied.
18 | _.extend(child, parent, staticProps);
19 |
20 | // Set the prototype chain to inherit from `parent`, without calling
21 | // `parent`'s constructor function.
22 | var Surrogate = function(){ this.constructor = child; };
23 | Surrogate.prototype = parent.prototype;
24 | child.prototype = new Surrogate;
25 |
26 | // Add prototype properties (instance properties) to the subclass,
27 | // if supplied.
28 | if (protoProps) _.extend(child.prototype, protoProps);
29 |
30 | // Set a convenience property in case the parent's prototype is needed
31 | // later.
32 | child.__super__ = parent.prototype;
33 |
34 | return child;
35 | }
36 | }
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "mangopay2-nodejs-sdk",
3 | "version": "1.56.1",
4 | "types": "./typings/index.d.ts",
5 | "description": "Mangopay Node.js SDK",
6 | "repository": "https://github.com/Mangopay/mangopay2-nodejs-sdk.git",
7 | "license": "MIT",
8 | "keywords": [
9 | "mangopay",
10 | "nodejs",
11 | "sdk",
12 | "credit cards",
13 | "api"
14 | ],
15 | "engines": {
16 | "node": ">= v0.10.0"
17 | },
18 | "main": "./index.js",
19 | "dependencies": {
20 | "@types/node": "14.14.x",
21 | "axios": "1.7.5",
22 | "promise": "8.1.x",
23 | "underscore": "1.12.x"
24 | },
25 | "devDependencies": {
26 | "chai": "4.2.x",
27 | "dtslint": "4.2.1",
28 | "mocha": "9.2.0",
29 | "sinon": "9.2.x",
30 | "ts-node": "^9.1.1",
31 | "typescript": "4.1.x"
32 | },
33 | "scripts": {
34 | "start": "npm install -g mocha && npm install -g jsdox && npm install",
35 | "documentation": "jsdox -t docs/templates/ -i README -o docs lib/services",
36 | "test": "mocha 'test/**/*.js' --recursive --timeout 30000 --ui bdd",
37 | "test:types": "dtslint ./typings"
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/test/TestKycPageFile.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Mangopay/mangopay2-nodejs-sdk/8e968acbf659dd728f1543c76ea5513d2491286f/test/TestKycPageFile.png
--------------------------------------------------------------------------------
/test/main.js:
--------------------------------------------------------------------------------
1 | var Promise = require('promise');
2 | var expect = require('chai').expect;
3 | var mangopay = require('../index');
4 |
5 | var api = global.api = new mangopay({
6 | clientId: 'sdk-unit-tests',
7 | clientApiKey: 'cqFfFrWfCcb7UadHNxx2C9Lo6Djw8ZduLi7J9USTmu8bhxxpju'
8 | });
9 |
10 | module.exports = api;
--------------------------------------------------------------------------------
/test/mocha.opts:
--------------------------------------------------------------------------------
1 | --recursive
2 | --timeout 15000
3 | --ui bdd
4 |
--------------------------------------------------------------------------------
/test/services/BankAccounts.js:
--------------------------------------------------------------------------------
1 | var expect = require('chai').expect;
2 | var helpers = require('../helpers');
3 | var UserNatural = require('../../lib/models/UserNatural');
4 | var BankAccount = require('../../lib/models/BankAccount');
5 | var BankAccountDetailsIBAN = require('../../lib/models/BankAccountDetailsIBAN');
6 | var api = require('../main');
7 |
8 | describe('Bank Accounts', function () {
9 | var john = new UserNatural(helpers.data.getUserNatural());
10 | var bankAccount;
11 |
12 | before(function (done) {
13 | api.Users.create(john).then(function (data, response) {
14 | john = data;
15 |
16 | var account = new BankAccount({
17 | OwnerName: john.FirstName + ' ' + john.LastName,
18 | OwnerAddress: john.Address,
19 | Details: new BankAccountDetailsIBAN({
20 | IBAN: 'FR7630004000031234567890143',
21 | BIC: 'BNPAFRPP'
22 | })
23 | });
24 | api.Users.createBankAccount(john.Id, account).then(function (account) {
25 | bankAccount = account;
26 | done();
27 | });
28 | })
29 | });
30 |
31 | describe('Get Transactions for an Account', function () {
32 | var getTransactions;
33 |
34 | before(function (done) {
35 | api.BankAccounts.getTransactions(bankAccount.Id, function (data, response) {
36 | getTransactions = data;
37 | done();
38 | });
39 | });
40 |
41 | it('should be retrieved', function () {
42 | expect(getTransactions).not.to.be.undefined;
43 | expect(getTransactions).to.be.an('array');
44 | });
45 | });
46 | });
47 |
--------------------------------------------------------------------------------
/test/services/Cards.js:
--------------------------------------------------------------------------------
1 | var _ = require('underscore');
2 | var expect = require('chai').expect;
3 | var helpers = require('../helpers');
4 | var UserNatural = require('../../lib/models/UserNatural');
5 | var api = require('../main');
6 |
7 | describe('Cards', function () {
8 | var john = new UserNatural(helpers.data.getUserNatural());
9 | var cardId;
10 |
11 | before(function (done) {
12 | api.Users.create(john).then(function (data, response) {
13 | john = data;
14 | done();
15 | });
16 | });
17 |
18 | describe('Get PreAuthorizations', function () {
19 | var getPreAuthorizations;
20 |
21 | before(function (done) {
22 | helpers.getNewPayInCardDirect(api, john, function (data) {
23 | cardId = data.CardId;
24 | api.Cards.getPreAuthorizations(cardId, function (data, response) {
25 | getPreAuthorizations = data;
26 | done();
27 | });
28 | });
29 | });
30 |
31 | it('should be retrieved', function () {
32 | expect(getPreAuthorizations).not.to.be.undefined;
33 | expect(getPreAuthorizations).to.be.an('array');
34 | });
35 | });
36 |
37 | describe('Get Transactions for Card fingerprint', function(){
38 | var getTransactions;
39 |
40 | before(function(done){
41 | api.Cards.get(cardId, function(data, response){
42 | api.Cards.getTransactionsForFingerprint(data.Fingerprint, function(data, response){
43 | getTransactions = data;
44 | done();
45 | });
46 | });
47 | });
48 |
49 | it('should be retrieved', function(){
50 | expect(getTransactions).not.to.be.undefined;
51 | expect(getTransactions).to.be.an('array');
52 | });
53 | });
54 | });
55 |
--------------------------------------------------------------------------------
/test/services/EMoney.js:
--------------------------------------------------------------------------------
1 | var expect = require('chai').expect;
2 | var helpers = require('../helpers');
3 | var api = require('../main');
4 | var UserLegal = require('../../lib/models/UserLegal');
5 |
6 | describe('Get user emoney', function() {
7 | var john = new UserLegal(helpers.data.getUserLegal());
8 | var emoney;
9 | var year = 2019;
10 | var month = 4;
11 |
12 | before(function(done){
13 | api.Users.create(john).then(function (data, response) {
14 | john = data;
15 | done();
16 | });
17 | });
18 |
19 | describe('For year', function () {
20 |
21 | before(function (done) {
22 | api.Users.getEMoney(john.Id, year).then(function (data) {
23 | emoney = data;
24 | done();
25 | });
26 | });
27 |
28 | it('should be returned correctly', function () {
29 | expect(emoney.UserId).to.equal(john.Id);
30 | expect(emoney.CreditedEMoney.Amount).to.equal(0);
31 | expect(emoney.CreditedEMoney.Currency).to.equal('EUR');
32 | expect(emoney.DebitedEMoney.Amount).to.equal(0);
33 | expect(emoney.DebitedEMoney.Currency).to.equal('EUR');
34 | });
35 | });
36 |
37 | describe('For month', function () {
38 | before(function (done) {
39 | api.Users.getEMoney(john.Id, year, month).then(function (data) {
40 | emoney = data;
41 | done();
42 | });
43 | });
44 |
45 | it('should be returned correctly', function () {
46 | expect(emoney.UserId).to.equal(john.Id);
47 | expect(emoney.CreditedEMoney.Amount).to.equal(0);
48 | expect(emoney.CreditedEMoney.Currency).to.equal('EUR');
49 | expect(emoney.DebitedEMoney.Amount).to.equal(0);
50 | expect(emoney.DebitedEMoney.Currency).to.equal('EUR');
51 | });
52 | });
53 | });
54 |
55 |
--------------------------------------------------------------------------------
/test/services/Idempotency.js:
--------------------------------------------------------------------------------
1 | var expect = require('chai').expect;
2 | var api = require('../main');
3 |
4 | var helpers = require('../helpers');
5 | var mangopay = require('../../index');
6 |
7 | var api = global.api = new mangopay({
8 | clientId: 'sdk-unit-tests',
9 | clientApiKey: 'cqFfFrWfCcb7UadHNxx2C9Lo6Djw8ZduLi7J9USTmu8bhxxpju'
10 | });
11 |
12 | describe('Idempotency', function () {
13 | var idempotencyKey = helpers.generateRandomString();
14 |
15 | describe('Get Valid Response', function () {
16 | var validIdempotencyResponse;
17 | var payIn;
18 | var john = helpers.data.getUserNatural();
19 |
20 | before(function (done) {
21 | api.Users.create(john, function () {
22 | done();
23 | });
24 | });
25 |
26 | before(function (done) {
27 | helpers.getNewPayInCardWebWithIdempotencyKey(api, john, idempotencyKey, function (data, response) {
28 | payIn = data;
29 | done();
30 | });
31 | });
32 |
33 | before(function (done) {
34 | api.Idempotency.get(idempotencyKey, function (data, response) {
35 | validIdempotencyResponse = data;
36 | done();
37 | });
38 | });
39 |
40 | it('should get the Valid Idempotency Response', function () {
41 | expect(validIdempotencyResponse.StatusCode).to.equal('200');
42 | expect(validIdempotencyResponse.Resource).to.exist;
43 | });
44 | });
45 |
46 | });
47 |
--------------------------------------------------------------------------------
/test/services/RateLimit.js:
--------------------------------------------------------------------------------
1 | var expect = require('chai').expect;
2 | var helpers = require('../helpers');
3 | const mangopay = require("../../index");
4 |
5 | var api = global.api = new mangopay({
6 | clientId: 'sdk-unit-tests',
7 | clientApiKey: 'cqFfFrWfCcb7UadHNxx2C9Lo6Djw8ZduLi7J9USTmu8bhxxpju'
8 | });
9 |
10 | describe('Rate Limits', function () {
11 | expect(api.rateLimits).to.be.empty;
12 | var john = helpers.data.getUserNatural();
13 |
14 | before(function (done) {
15 | api.Users.create(john).then(function () {
16 | done();
17 | });
18 | });
19 |
20 | describe('Exist', function () {
21 | it('should exist', function () {
22 | expect(john.Id).to.exist;
23 |
24 | expect(api.rateLimits).not.to.be.empty;
25 | expect(api.rateLimits.length).to.equal(4);
26 |
27 | expect(api.rateLimits[0].minutesInterval).to.equal(15);
28 | expect(api.rateLimits[1].minutesInterval).to.equal(30);
29 | expect(api.rateLimits[2].minutesInterval).to.equal(60);
30 | expect(api.rateLimits[3].minutesInterval).to.equal(60 * 24);
31 |
32 | expect(api.rateLimits[0].callsMade).to.be.greaterThan(0);
33 | expect(api.rateLimits[1].callsMade).to.be.greaterThan(0);
34 | expect(api.rateLimits[2].callsMade).to.be.greaterThan(0);
35 | expect(api.rateLimits[3].callsMade).to.be.greaterThan(0);
36 |
37 | expect(api.rateLimits[0].callsRemaining).to.be.greaterThan(0);
38 | expect(api.rateLimits[1].callsRemaining).to.be.greaterThan(0);
39 | expect(api.rateLimits[2].callsRemaining).to.be.greaterThan(0);
40 | expect(api.rateLimits[3].callsRemaining).to.be.greaterThan(0);
41 |
42 | expect(api.rateLimits[0].resetTimeMillis).to.be.greaterThan(0);
43 | expect(api.rateLimits[1].resetTimeMillis).to.be.greaterThan(0);
44 | expect(api.rateLimits[2].resetTimeMillis).to.be.greaterThan(0);
45 | expect(api.rateLimits[3].resetTimeMillis).to.be.greaterThan(0);
46 | });
47 | });
48 | });
49 |
--------------------------------------------------------------------------------
/test/services/Regulatory.js:
--------------------------------------------------------------------------------
1 | var expect = require('chai').expect;
2 | var api = require('../main');
3 |
4 | describe('Regulatory', function() {
5 |
6 | describe('Get Authorizations For One Country', function () {
7 | var countryAuthorization;
8 |
9 | before(function(done){
10 | api.Regulatory.getCountryAuthorizations("FR", function(data, response){
11 | countryAuthorization = data;
12 | done();
13 | });
14 | });
15 |
16 | it('should be returned', function () {
17 | expect(countryAuthorization).not.to.be.undefined;
18 | expect(countryAuthorization.CountryCode).not.to.be.undefined;
19 | expect(countryAuthorization.CountryName).not.to.be.undefined;
20 | expect(countryAuthorization.Authorization).not.to.be.undefined;
21 | expect(countryAuthorization.LastUpdate).not.to.be.undefined;
22 | });
23 | });
24 |
25 | describe('Get Authorizations For All Countries', function () {
26 | var countryAuthorizations;
27 |
28 | before(function(done){
29 | api.Regulatory.getAllCountriesAuthorizations(function(data, response){
30 | countryAuthorizations = data;
31 | done();
32 | });
33 | });
34 |
35 | it('should be returned', function () {
36 | expect(countryAuthorizations).not.to.be.undefined;
37 | expect(countryAuthorizations).not.to.be.empty;
38 |
39 | expect(countryAuthorizations[0].CountryCode).not.to.be.undefined;
40 | expect(countryAuthorizations[0].CountryName).not.to.be.undefined;
41 | expect(countryAuthorizations[0].Authorization).not.to.be.undefined;
42 | expect(countryAuthorizations[0].LastUpdate).not.to.be.undefined;
43 | });
44 | });
45 | });
46 |
--------------------------------------------------------------------------------
/test/services/Repudiations.js:
--------------------------------------------------------------------------------
1 | var expect = require('chai').expect;
2 | var api = require('../main');
3 |
4 | describe('Repudiations', function() {
5 | var REPUDIATION_ID = '41631014';
6 |
7 | describe('Get Refunds', function() {
8 | var getRefunds;
9 |
10 | before(function(done) {
11 | api.Repudiations.getRefunds(REPUDIATION_ID, function(data, response) {
12 | getRefunds = data;
13 | done();
14 | })
15 | });
16 |
17 | it('should be retrieved', function() {
18 | expect(getRefunds).not.to.be.undefined;
19 | expect(getRefunds).to.be.an('array');
20 | });
21 | });
22 | });
23 |
--------------------------------------------------------------------------------
/test/services/Tokens.js:
--------------------------------------------------------------------------------
1 | var expect = require('chai').expect;
2 | var mangopay = require('../../index');
3 | var api = require('../main');
4 |
5 | describe('Tokens', function() {
6 | var authentication1, authentication2;
7 |
8 | before(function(done){
9 | api.authorize()
10 | .then(function(data){
11 | authentication1 = data;
12 | api.authorize()
13 | .then(function(data){
14 | authentication2 = data;
15 | done();
16 | });
17 | });
18 | });
19 |
20 | it('should have different token values', function(){
21 | expect(authentication1.access_token).to.not.equal(authentication2.access_token);
22 | });
23 | });
24 |
25 | describe('When trying to authenticate with wrong credentials', function() {
26 | var wrongCredentialsError;
27 |
28 | before('Build API object with wrong credentials', function(done){
29 | var wrongApi = new mangopay({
30 | clientId: 'sdk-unit-tests',
31 | clientApiKey: 'wrongPass'
32 | });
33 |
34 | wrongApi.authorize()
35 | .then(function(){
36 | done('Promise should not pass');
37 | })
38 | .catch(function(data) {
39 | wrongCredentialsError = data;
40 | done();
41 | })
42 | });
43 |
44 | it('should have the right error message', function(){
45 | expect(wrongCredentialsError.error).to.equal('invalid_client');
46 | })
47 | });
48 |
--------------------------------------------------------------------------------
/typings/models/address.d.ts:
--------------------------------------------------------------------------------
1 | import { CountryISO } from "../types";
2 | import { Models } from "../models";
3 |
4 | export namespace address {
5 | type AddressType = string | AddressData | Models.Address | CreateAddress;
6 |
7 | interface AddressData {
8 | /**
9 | * The first line of the address
10 | */
11 | AddressLine1: string;
12 |
13 | /**
14 | * The second line of the address
15 | */
16 | AddressLine2: string;
17 |
18 | /**
19 | * The city of the address
20 | */
21 | City: string;
22 |
23 | /**
24 | * The region of the address - this is optional except if the Country is US, CA or MX
25 | */
26 | Region: string;
27 |
28 | /**
29 | * The postal code of the address - can be alphanumeric, dashes or spaces
30 | */
31 | PostalCode: string;
32 |
33 | /**
34 | * The Country of the Address
35 | */
36 | Country: CountryISO;
37 | }
38 |
39 | interface CreateAddress {
40 | /**
41 | * The first line of the address
42 | */
43 | AddressLine1: string;
44 |
45 | /**
46 | * The second line of the address
47 | */
48 | AddressLine2?: string;
49 |
50 | /**
51 | * The city of the address
52 | */
53 | City: string;
54 |
55 | /**
56 | * The region of the address - this is optional except if the Country is US, CA or MX
57 | */
58 | Region?: string;
59 |
60 | /**
61 | * The postal code of the address - can be alphanumeric, dashes or spaces
62 | */
63 | PostalCode: string;
64 |
65 | /**
66 | * The Country of the Address
67 | */
68 | Country: CountryISO;
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/typings/models/billing.d.ts:
--------------------------------------------------------------------------------
1 | import { Models } from "../models";
2 | import { address } from "./address";
3 |
4 | export namespace billing {
5 | interface BillingData {
6 | Address: Models.Address | address.AddressData | string;
7 | }
8 |
9 | interface CompleteBillingData {
10 | FirstName: string;
11 |
12 | LastName: string;
13 |
14 | Address: address.AddressData;
15 | }
16 |
17 | // todo: replace with CompleteBillingData
18 | interface BillingOrShippingRecurringPayInData {
19 | FirstName: string;
20 |
21 | LastName: string;
22 |
23 | Address: address.AddressData;
24 | }
25 |
26 | interface CreateBilling {
27 | /**
28 | * The name of the user
29 | */
30 | FirstName: string;
31 |
32 | /**
33 | * The last name of the user
34 | */
35 | LastName: string;
36 |
37 | /**
38 | * The address
39 | */
40 | Address: address.CreateAddress;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/typings/models/birthplace.d.ts:
--------------------------------------------------------------------------------
1 | import { CountryISO } from "../types";
2 |
3 | export namespace birthplace {
4 | interface Birthplace {
5 | City: string;
6 |
7 | Country: CountryISO;
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/typings/models/conversionRate.d.ts:
--------------------------------------------------------------------------------
1 | export namespace conversionRate {
2 | interface ConversionRateData {
3 | /**
4 | * The sell currency – the currency of the wallet to be debited
5 | */
6 | DebitedCurrency: string;
7 |
8 | /**
9 | * The buy currency – the currency of the wallet to be credited.
10 | */
11 | CreditedCurrency: string;
12 |
13 | /**
14 | * The market rate plus Mangopay's commission,
15 | * charged during the platform's billing cycle. This is an indicative rate.
16 | */
17 | ClientRate: string;
18 |
19 | /**
20 | * The rate used for the conversion, excluding Mangopay's commission.
21 | */
22 | MarketRate: string;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/typings/models/countryAuthorization.d.ts:
--------------------------------------------------------------------------------
1 | import { CountryISO } from "../types";
2 |
3 | export namespace countryAuthorization {
4 | interface AuthorizationData {
5 | BlockUserCreation: boolean;
6 | BlockBankAccountCreation: boolean;
7 | BlockPayout: boolean;
8 | }
9 |
10 | interface CountryAuthorizationData {
11 | CountryCode: CountryISO;
12 | CountryName: string;
13 | Authorization: AuthorizationData;
14 | LastUpdate: number;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/typings/models/entityBase.d.ts:
--------------------------------------------------------------------------------
1 | export namespace entityBase {
2 | interface EntityBaseData {
3 | Id: string;
4 |
5 | Tag: string;
6 |
7 | CreationDate: number;
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/typings/models/hook.d.ts:
--------------------------------------------------------------------------------
1 | import { event } from "./event";
2 | import { entityBase } from "./entityBase";
3 | import { PickPartialRequired } from "../types";
4 |
5 | export namespace hook {
6 | type HookValidity = "UNKNOWN" | "VALID" | "INVALID";
7 |
8 | type HookStatus = "DISABLED" | "ENABLED";
9 |
10 | interface HookData extends entityBase.EntityBaseData {
11 | /**
12 | * This is the URL where your receive notification for each EventType
13 | */
14 | Url: string;
15 |
16 | /**
17 | * Whether the hook is enabled or not
18 | */
19 | Status: HookStatus;
20 |
21 | /**
22 | * Whether the hook is valid or not
23 | */
24 | Validity: HookValidity;
25 |
26 | /**
27 | * The event type
28 | */
29 | EventType: event.EventType;
30 | }
31 |
32 | interface CreateHook extends PickPartialRequired