1.0.0 • Published 8 months ago

viam.customer.api v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
8 months ago

Viam.Customer.API

Serverless implementation for Customer API using Apollo GraphQL, NodeJS 10.x, DynamoDB and serverless framework.

This server allows Save/edit Viamericas customer, validating OFAC and subscribe sender to SMS application.

Business

As a user, I need the ability to manage the users that belong to the company. For this purpose is needed to have a Backend that supports all the task that I need to accomplish my goal.

This backend application allows:

-Create a new Customer: This functionality allows create a new customer. User can input only the required fields or all information available for a new customer. Once created, is needed to scan Compliance verification. If the customer is an OFAC match, is needed ask for additional information like DOB (date of birth). Besides, if the customer selects receipt notifications (transactional or promotional), the system must subscribe the number to internal SMS service.

-Edit Customer: This functionality allows update current sender information and add new additional information like email, IDs, and others.

-Get Customer: This functionality alloes gets an existing customer by IdSenderGlobal field.

Built with

Serverless configuration.

The file serverless.yml contains all configuration needed to create the graphQl Server attached to an existing API Gateway.

Queries and mutations

  • getCustomer: This query allows retrieve a Customer by IdSenderGlobal. Using Playground you can execute the follow query:
query {
  GetCustomer( idSenderGlobal : "058c7e54-625a-414a-83ba-0296344c4a5e" )
{
idSenderGlobal
chainId
currentBranch
searchField
fullName
firstName
secondName
lastName
secondLastName
dob
address
  location
zipCode
stateId
stateName
cityId
cityName
countryId
countryName
phone1
email
transactionalSMS
promotionalSMS
photoObjectKey
blockDescription
status
user
creationDate
additionalInfo
}
}

And the response for this instruction is as follow:

{
  "data": {
    "GetCustomer": {
      "idSenderGlobal": "058c7e54-625a-414a-83ba-0296344c4a5e",
      "chainId": [
        "USA000586"
      ],
      "currentBranch": "A00765",
      "searchField": null,
      "fullName": "JORGE ARBELAEZ",
      "firstName": "JORGE",
      "secondName": null,
      "lastName": "ARBELAEZ",
      "secondLastName": null,
      "dob": null,
      "address": null,
      "location": "MEDELLIN, ANTIOQUIA, COLOMBIA",
      "zipCode": null,
      "stateId": "ANT  ",
      "stateName": null,
      "cityId": "O0561",
      "cityName": null,
      "countryId": "COL",
      "countryName": null,
      "phone1": "3128464671",
      "email": null,
      "transactionalSMS": null,
      "promotionalSMS": null,
      "photoObjectKey": "",
      "blockDescription": null,
      "status": null,
      "user": null,
      "creationDate": null,
      "additionalInfo": null
    }
  }
}
  • addCustomer: This mutation allows create a Customer y dynamoDB. In addition, if the registration requirement is requested then calls will be made to the corresponding external url, as well as the call for verification by OFAC and record the response in the "additionalInfo" field.

    Using Playground you can execute the follow sentence:

    Remember for this action the authentication code must be provided

mutation{AddCustomer(
chainId: ["USA000586"]
currentBranch: "A00765"
fullName: ""
creationDate: "2020-03-10T18:28:33.261Z"
status: "A"
user: "yolenyvcl"
idSenderGlobalRelated: [""]
phone1: "7542266835"
zipCode: "33324"
countryId: "US"
countryName: "Estados Unidos"
stateId: "FL"
stateName: "Florida"
cityId: "Broward County"
cityName: "Broward County"
address: "1805 S University Dr, Davie, FL 33324, EE. UU."
transactionalSMS: false
promotionalSMS: false
firstName: "Eduardo"
lastName: "Cartagena"
secondLastName: "Escobar"
),
  { idSenderGlobal
  }
}

And the response for this instruction is as follow:

{
  "data": {
    "AddCustomer": {
      "idSenderGlobal": "e68d43f2-ec1e-49cd-a3a5-6e9e56a9f29a"
    }
  }
}
  • updateCustomer: This functionality allows to update customer information by idSenderGlobal

    Using Playground you can execute the follow sentense:

    Remember for this action the authentication code must be provided

mutation {  UpdateCustomer(
idSenderGlobal: "21df66a4-0898-4809-a1d0-54e4a84a8491"
chainId: ["USA000586"]
currentBranch: "A00765"
fullName: "Eduardo Cartagena Escobar"
firstName: "Eduardo"
secondName: null
lastName: "Cartagena"
secondLastName: "Escobar"
dob: "2019-09-12T16:00:00.000Z"
address: "1805 S University Dr, Davie, FL 33324, EE. UU."
location: null
zipCode: "33324"
stateId: "FL"
stateName: "Florida"
cityId: "Broward County"
cityName: "Broward County"
countryId: "US"
countryName: "Estados Unidos"
phone1: "7542266839"
email: ""
transactionalSMS: false
promotionalSMS: false
photoObjectKey: ""
blockDescription: null
status: "A"
user: "yolenyvcl"
creationDate: "2020-03-10T18:28:33.261Z"
additionalInfo: false
idSenderGlobalRelated: [null]
)
  {
    idSenderGlobal,
    fullName,
    searchField
  }
}

And the response for this instruction is as follow:

{
  "data": {
    "UpdateCustomer": {
      "idSenderGlobal": "21df66a4-0898-4809-a1d0-54e4a84a8491",
      "fullName": "Eduardo Cartagena Escobar",
      "searchField": "EduardoCartagenaEscobar"
    }
  }
}
  • GetlastTransactionList: This functionality GET the list of last transaction from idSenderGlobal

    Using Playground you can execute the follow sentense:

query {
  GetlastTransactionList(
    idSenderGlobal: "bbf393b7-a910-4893-8b2b-ad8c169a8c85"
  ) {
  chainId
  claveReceiver
  costs{
    fixFee
    fundingFee
    originalRate
    otherFees
    percentageFee
    viaTasa
  }
  dateTransaction
  idBranch
  idReceiver
  idSenderGlobal
  isSync
  netAmount
  payer {
    accountNumber
  accountType
  cityId
  countryId
  currencyISO
  currencyMode
  deliveryMode
  deliveryName
  id
  payerName
  paymentLocationCode
  paymentLocationName
  processedByCode
  subDivisionCode
}
  recipient{
  address
  chainId
  cityId
  countryId
  currentBranch
  firstName
  fullName
  idSenderGlobal
  idSenderGlobalRelated
  lastName
  location
  phone1
  secondLastName
  secondName
  stateId
  }
  status
  totalAmount
  transaction_uuid
  additionalFields {
    entity
    field
    value
    fieldLabel
  }

}
}

And the response for this instruction is as follow:

{
  "data": {
    "GetlastTransactionList": [
      {
        "chainId": "USA000586",
        "claveReceiver": "170610765047510",
        "costs": {
          "fixFee": 0,
          "fundingFee": 0,
          "originalRate": "3251",
          "otherFees": 0,
          "percentageFee": 0.03,
          "viaTasa": 0
        },
        "dateTransaction": "3/6/2020 2:51:30 PM",
        "idBranch": "A00765",
        "idReceiver": 700463,
        "idSenderGlobal": "bbf393b7-a910-4893-8b2b-ad8c169a8c85",
        "isSync": false,
        "netAmount": 200,
        "payer": {
          "accountNumber": null,
          "accountType": null,
          "cityId": "O0111",
          "countryId": "COL",
          "currencyISO": "COP",
          "currencyMode": "N",
          "deliveryMode": "P",
          "deliveryName": "CASH PICKUP",
          "id": "4041",
          "payerName": "GRUPO EXITO",
          "paymentLocationCode": "T46001",
          "paymentLocationName": "EXITO COLOMBIA",
          "processedByCode": "T246",
          "subDivisionCode": "DBC  "
        },
        "recipient": {
          "address": " ",
          "chainId": [
            "USA000586"
          ],
          "cityId": "O0111",
          "countryId": "COL",
          "currentBranch": "A00765",
          "firstName": "ANDRES",
          "fullName": "ANDRES CARPA",
          "idSenderGlobal": "acf43e93-01a6-49bd-9d78-49896b7dee27",
          "idSenderGlobalRelated": [
            "bbf393b7-a910-4893-8b2b-ad8c169a8c85"
          ],
          "lastName": "CARPA",
          "location": "BOGOTA, SANTA FE DE BOGOTA, COLOMBIA",
          "phone1": null,
          "secondLastName": null,
          "secondName": null,
          "stateId": "DBC  "
        },
        "status": "new",
        "totalAmount": "206.00",
        "transaction_uuid": "55e5c62a-2449-4e9c-b9e6-ef7733240fa9",
        "additionalFields": [
          {
            "entity": "dba.RECEIVER",
            "field": "TYPEID",
            "value": "CC",
            "fieldLabel": null
          },
          {
            "entity": "dba.RECEIVER",
            "field": "NUMID",
            "value": "77989632",
            "fieldLabel": null
          },
          {
            "entity": "dba.RECEIVER",
            "field": "PHONE1_RECEIVER",
            "value": "(320) 123-6549",
            "fieldLabel": null
          },
          {
            "entity": "dba.RECEIVER",
            "field": "ADDRESS_RECEIVER",
            "value": "Calle 72, Bogotá, Colombia",
            "fieldLabel": null
          }
        ]
      },
      {
        "chainId": "USA000586",
        "claveReceiver": "8420765037510",
        "costs": {
          "fixFee": 0,
          "fundingFee": 0,
          "originalRate": "3255",
          "otherFees": 0,
          "percentageFee": 0.03,
          "viaTasa": 0
        },
        "dateTransaction": "3/6/2020 2:44:29 PM",
        "idBranch": "A00765",
        "idReceiver": 700462,
        "idSenderGlobal": "bbf393b7-a910-4893-8b2b-ad8c169a8c85",
        "isSync": false,
        "netAmount": 190,
        "payer": {
          "accountNumber": null,
          "accountType": null,
          "cityId": "O0561",
          "countryId": "COL",
          "currencyISO": "COP",
          "currencyMode": "N",
          "deliveryMode": "P",
          "deliveryName": "CASH PICKUP",
          "id": "3374",
          "payerName": "DAVIVIENDA",
          "paymentLocationCode": "U10001",
          "paymentLocationName": "ABEJORRAL",
          "processedByCode": "T110",
          "subDivisionCode": "ANT  "
        },
        "recipient": {
          "address": " ",
          "chainId": [
            "USA000586"
          ],
          "cityId": "O0561",
          "countryId": "COL",
          "currentBranch": "A00765",
          "firstName": "ANDRES",
          "fullName": "ANDRES CAMILLA",
          "idSenderGlobal": "d274071e-f0ae-4fa0-b625-44ce46c40b5c",
          "idSenderGlobalRelated": [
            "bbf393b7-a910-4893-8b2b-ad8c169a8c85"
          ],
          "lastName": "CAMILLA",
          "location": "MEDELLIN, ANTIOQUIA, COLOMBIA",
          "phone1": null,
          "secondLastName": null,
          "secondName": null,
          "stateId": "ANT  "
        },
        "status": "new",
        "totalAmount": "195.70",
        "transaction_uuid": "e8dc63c3-5c60-47b4-96be-ca403b8f1779",
        "additionalFields": [
          {
            "entity": "dba.RECEIVER",
            "field": "TYPEID",
            "value": "CC",
            "fieldLabel": null
          },
          {
            "entity": "dba.RECEIVER",
            "field": "NUMID",
            "value": "12356874885",
            "fieldLabel": null
          },
          {
            "entity": "dba.RECEIVER",
            "field": "PHONE1_RECEIVER",
            "value": "(350) 593-1236",
            "fieldLabel": null
          },
          {
            "entity": "dba.RECEIVER",
            "field": "ADDRESS_RECEIVER",
            "value": "Calle 36 #47, Itagüi, Antioquia, Colombia",
            "fieldLabel": null
          }
        ]
      }
    ]
  }
}

Authors

  • Melina Arevalo - Initial work
  • Eduardo Cartagena - Initial work