0.7.3 • Published 1 year ago

embedded-microservice-test v0.7.3

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

About the Project

This package allows you to consume the different methods that the Verituity API exposes.

Table of Contents

  1. About The Project.
  2. Content Table.
  3. Tech Stack.
  4. Installation.
  5. File Structure.

Tech Stack

  • NodeJs v16.0.0 >=

Installation

yarn add embedded-microservice-test

Import

const { payor, payee, pay, session } = require("embedded-microservice-test");

File Structure

/
├──  src
│   ├── config
│   ├── constants
│   ├── gql
│   ├── methods
│   ├── services
│   └── utils
├── .dockerignore
├── .gitignore
├── .eslintrc
├── .prettierrc
├── Dockerfile
├── README.md
└── package.json

Methods

These are the methods that allow the package to be consumed with their respective input and output values.

Session

Authentication: none

login: Allows registered users (payor and admin) to authenticate.

Input

session.login({
  account: "admin@email.com",
  password: "embeddedapi",
});

Output

{
  "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhdXRob3JpemF0aW9uIiwiaXNzIjoidmVyaXR1aXR5IiwiaHR0cHM6Ly9oYXN1cmEuaW8vand0L2NsYWltcyI6eyJ4LWhhc3VyYS11c2VyLWlkIjoiMSIsIngtaGFzdXJhLXVzZXItZW1haWwiOiJhZG1pbkBlbWFpbC5jb20iLCJ4LWhhc3VyYS1kZWZhdWx0LXJvbGUiOiJhZG1pbiIsIngtaGFzdXJhLWFsbG93ZWQtcm9sZXMiOlsiYWRtaW4iXX0sImlhdCI6MTY3MzYzMDQ2NywiZXhwIjoxNjczNjMxMzY3fQ.-3_bbnR-hk50QAzzmtlnf5RBbA2p9cIlduM57nRRcDA",
  "refreshToken": "0JR3uMtCXPKG-y5LuZ868SHL3vr_xM4lL"
}

refreshToken: Allows you to refresh the access token to be able to continue consuming the methods without logging in again.

Input

session.refreshToken({
  accessToken:
    "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhdXRob3JpemF0aW9uIiwiaXNzIjoidmVyaXR1aXR5IiwiaHR0cHM6Ly9oYXN1cmEuaW8vand0L2NsYWltcyI6eyJ4LWhhc3VyYS11c2VyLWlkIjoiMSIsIngtaGFzdXJhLXVzZXItZW1haWwiOiJhZG1pbkBlbWFpbC5jb20iLCJ4LWhhc3VyYS1kZWZhdWx0LXJvbGUiOiJhZG1pbiIsIngtaGFzdXJhLWFsbG93ZWQtcm9sZXMiOlsiYWRtaW4iXX0sImlhdCI6MTY3MzYzMDQ2NywiZXhwIjoxNjczNjMxMzY3fQ.-3_bbnR-hk50QAzzmtlnf5RBbA2p9cIlduM57nRRcDA",
  refreshToken: "0JR3uMtCXPKG-y5LuZ868SHL3vr_xM4lL",
});

Output

{
  "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhdXRob3JpemF0aW9uIiwiaXNzIjoidmVyaXR1aXR5IiwiaHR0cHM6Ly9oYXN1cmEuaW8vand0L2NsYWltcyI6eyJ4LWhhc3VyYS11c2VyLWlkIjoiMSIsIngtaGFzdXJhLXVzZXItZW1haWwiOiJhZG1pbkBlbWFpbC5jb20iLCJ4LWhhc3VyYS1kZWZhdWx0LXJvbGUiOiJhZG1pbiIsIngtaGFzdXJhLWFsbG93ZWQtcm9sZXMiOlsiYWRtaW4iXX0sImlhdCI6MTY3MzYzMDQ2NywiZXhwIjoxNjczNjMxMzY3fQ.-3_bbnR-hk50QAzzmtlnf5RBbA2p9cIlduM57nRRcDD",
  "refreshToken": "0JR3uMtCXPKG-y5LuZ868SHL3vr_xM4lH"
}

Payor

Authentication: admin

add: Allows you to register a new payor.

Input

payor.add({
  newOrgUuid: "fccb752f-6521-42e2-8209-a57116fc63a9",
  orgName: "Organization Name",
  email: "email@email.com",
  password: "password",
  paymentMethods: [
    {
      id: "154c7d1e-831b-45d3-b8f4-36f3cc456934",
      name: "PayPal",
      status: "ACTIVE",
    },
    {
      id: "a5751366-a43b-494a-bdd4-0055fc9b7ac3",
      name: "Bank Account",
      status: "ACTIVE",
    },
  ],
});

Output

{ "id": "d93511fb-42f2-4b87-934d-f14a816b7572" }

getAll: Returns all registered payors.

Input

payor.getAll();

Output

[
  {
    "id": "a1311a64-754d-4619-836e-c826509f328d",
    "name": "test",
    "email": "ArEZwm@email.com",
    "password": "$2b$08$OxSkpDJqcdIx4PfuAm4Rjuya4yQeu/wix/jnQyrgGVsQOjSHAVCzS"
  },
  {
    "id": "4d41c9c1-4826-4a73-b404-e0fd11ad6e13",
    "name": "test",
    "email": "vQhn6K@email.com",
    "password": "$2b$08$fEyg8VTfe9Wf4kGTNlxE/exf8PT6xe7lcNo27hNvMBaRApg5y6OWC"
  }
]

get: Return the data of a specific payor, filter by id or by email.

Input

payor.get('ArEZwm@email.com') or payor.get('a1311a64-754d-4619-836e-c826509f328d')

Output

{
  "id": "a1311a64-754d-4619-836e-c826509f328d",
  "name": "test",
  "email": "ArEZwm@email.com",
  "password": "$2b$08$OxSkpDJqcdIx4PfuAm4Rjuya4yQeu/wix/jnQyrgGVsQOjSHAVCzS"
}

Payee

Authentication: payor

add: Allows you to register a new Payee.

Input

payee.add({
  firstName: "npm payee",
  lastName: "npm payee lastName",
  middleName: "npm payee middleName",
  email: "emailPayee@email.com",
  profileType: "test",
  lockProfileType: true,
  payorId: "fccb752f-6521-42e2-8109-a57117fc63a8",
});

Output

{ "clientUserId": "d93511fb-42f2-4b87-934d-f14a816b7572" }

getAll: Returns all registered payees.

Input

payee.getAll();

Output

[
  {
    "clientUserId": "5118c60d-67c2-40af-b5fe-b222fd0b6175",
    "firstName": "npm payee",
    "lastName": "npm payee lastName",
    "middleName": "npm payee middleName",
    "email": "emails@email.com",
    "personAttributes": null,
    "profileType": "test",
    "lockProfileType": true,
    "payorId": "bbe97622-a963-4228-8850-6acd74af3b93",
    "created_at": "2023-01-13T21:26:56.177438+00:00",
    "updated_at": "2023-01-13T21:26:56.177438+00:00"
  },
  {
    "clientUserId": "b3a486dd-f8d7-4c12-a207-47b09f52588b",
    "firstName": "npm payee",
    "lastName": "npm payee lastName",
    "middleName": "npm payee middleName",
    "email": "emailsr@email.com",
    "personAttributes": null,
    "profileType": "test",
    "lockProfileType": true,
    "payorId": "24a62f7c-c6dc-4780-bf6d-7fa600d3b7c5",
    "created_at": "2023-01-13T21:25:55.718304+00:00",
    "updated_at": "2023-01-13T21:25:55.718304+00:00"
  }
]

get: Return the data of a specific payee, filter by id or by email.

Input

payor.get('emails@email.com') or payor.get('5118c60d-67c2-40af-b5fe-b222fd0b617')

Output

{
  "clientUserId": "5118c60d-67c2-40af-b5fe-b222fd0b6175",
  "firstName": "npm payee",
  "lastName": "npm payee lastName",
  "middleName": "npm payee middleName",
  "email": "emails@email.com",
  "personAttributes": null,
  "profileType": "test",
  "lockProfileType": true,
  "payorId": "bbe97622-a963-4228-8850-6acd74af3b93",
  "created_at": "2023-01-13T21:26:56.177438+00:00",
  "updated_at": "2023-01-13T21:26:56.177438+00:00"
}

Payment

Authentication: payor

generate: Generate a payment from a specific payor to one of your payeers.

Input

pay.generate({
  clientId: "fccb752f-6521-42a4-8109-a57117fc63a3",
  amount: 60,
  currencyCode: "USD",
  description: "Test pay",
  programId: "154c7d1e-831b-45d3-b8f4-36f3cc456934",
  payorId: "fccb752f-6521-42e2-8109-a57117fc63a8",
});

Output

{ "id": "b06a099d-b878-4b92-a76c-452e64eba4e5" }

getAll: Returns all generate payments.

Input

pay.getAll();

Output

[
  {
    "id": "38125622-6e67-4d6d-b065-bbbe8b113879",
    "recipientUserId": "883787fd-3718-490d-981e-e8e0c0429b7f",
    "clientPaymentId": "70ed4ec4-5cab-4f67-b3e4-c6f16bff24d1",
    "amount": 60,
    "programId": "154c7d1e-831b-45d3-b8f4-36f3cc456934",
    "description": "Test pay",
    "status": "ACTIVE",
    "currencyCode": "USD",
    "created_at": "2023-01-16T18:19:29.672734+00:00",
    "updated_at": "2023-01-16T18:19:29.672734+00:00"
  },
  {
    "id": "91a326fe-965d-4df4-8ed5-98f1a2dd41bc",
    "recipientUserId": "ed0a3ca6-a4a9-482b-927b-c7a3a5cfbb57",
    "clientPaymentId": "b7ec1480-75c3-4f40-9f7e-43370dbfc368",
    "amount": 70,
    "programId": "154c7d1e-831b-45d3-b8f4-36f3cc456934",
    "description": "Test pay",
    "status": "CANCELLED",
    "currencyCode": "USD",
    "created_at": "2023-01-16T18:06:53.156767+00:00",
    "updated_at": "2023-01-16T18:06:53.203306+00:00"
  }
]

get: Return the data of a specific payment, filter by id.

Input

pay.get("91a326fe-965d-4df4-8ed5-98f1a2dd41bc");

Output

{
  "id": "91a326fe-965d-4df4-8ed5-98f1a2dd41bc",
  "recipientUserId": "ed0a3ca6-a4a9-482b-927b-c7a3a5cfbb57",
  "clientPaymentId": "b7ec1480-75c3-4f40-9f7e-43370dbfc368",
  "amount": 70,
  "programId": "154c7d1e-831b-45d3-b8f4-36f3cc456934",
  "description": "Test pay",
  "status": "CANCELLED",
  "currencyCode": "USD",
  "created_at": "2023-01-16T18:06:53.156767+00:00",
  "updated_at": "2023-01-16T18:06:53.203306+00:00"
}

putOnHold: Allows you to put a payment on hold.

Input

pay.putOnHold({ payId: "fccb752f-6526-42e2-8109-a57117fc63a6" });

Output

{ "update_pay": { "affected_rows": 1 } }

cancel: Allows you to cancel a payment.

Input

pay.cancel({ payId: "fccb752f-6526-42e2-8109-a57117fc63a6" });

Output

{ "update_pay": { "affected_rows": 1 } }
0.6.7

1 year ago

0.4.9

1 year ago

0.6.6

1 year ago

0.4.8

1 year ago

0.6.9

1 year ago

0.6.8

1 year ago

0.3.0

1 year ago

0.7.2

1 year ago

0.5.4

1 year ago

0.3.6

1 year ago

0.1.8

1 year ago

0.7.1

1 year ago

0.5.3

1 year ago

0.3.5

1 year ago

0.5.6

1 year ago

0.3.8

1 year ago

0.7.3

1 year ago

0.5.5

1 year ago

0.3.7

1 year ago

0.1.9

1 year ago

0.5.0

1 year ago

0.3.2

1 year ago

0.3.1

1 year ago

0.7.0

1 year ago

0.5.2

1 year ago

0.3.4

1 year ago

0.1.6

1 year ago

0.5.1

1 year ago

0.3.3

1 year ago

0.1.5

1 year ago

0.5.8

1 year ago

0.5.7

1 year ago

0.3.9

1 year ago

0.5.9

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.6.3

1 year ago

0.4.5

1 year ago

0.2.7

1 year ago

0.6.2

1 year ago

0.4.4

1 year ago

0.2.6

1 year ago

0.6.5

1 year ago

0.4.7

1 year ago

0.2.9

1 year ago

0.6.4

1 year ago

0.4.6

1 year ago

0.2.8

1 year ago

0.4.1

1 year ago

0.2.3

1 year ago

0.4.0

1 year ago

0.2.2

1 year ago

0.6.1

1 year ago

0.4.3

1 year ago

0.2.5

1 year ago

0.6.0

1 year ago

0.4.2

1 year ago

0.2.4

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago