Coder Social home page Coder Social logo

vgs-samples / calm-bulk-enrollment Goto Github PK

View Code? Open in Web Editor NEW
0.0 6.0 4.0 1.12 MB

Sample application showing an example of how to make initial bulk enrollment of cards to CALM API.

Home Page: https://www.verygoodsecurity.com/docs/payment-optimization/calm

Dockerfile 1.75% Python 98.25%

calm-bulk-enrollment's Introduction

VGS Logo

CALM Bulk Enrollment Sample

CircleCI

Environment

Sample is running on Sandbox by default. In order to run on Live environment specify value of live for ENVIRONMENT environment variable.

Enrollment of VGS aliased card data

To send VGS aliases directly to CALM API you need to perform the following steps.

Pre-requisites

  1. In your existing VGS Vault (where you store card data) you need to configure an outbound route for sending data to CALM API. There are two ways to do it:
    1. Go to Vault Dashboard. Select your vault -> Routes -> Add Route (From YAML file) -> Add routes/calm_outbound.yaml route.
    2. Using VGS CLI: vgs apply routes --vault <VAULT_ID> -f routes/calm_outbound.yaml where <VAULT_ID> corresponds to your vault id in which you store card data.
  2. Generate Vault Credentials on Vault Dashboard and save them.
  3. Generate CALM API Credentials and save them.
  4. Run Docker daemon.

Prepare card data

csv/aliased_cards.csv file should contain cardholder name, card number aliases from your existing vault, expiration month and expiration year of the card (you can adjust the sample code to contain billing address too according to our API Reference).

Aliased cards

Testing on sample data

For testing purposes you can use new sandbox vault and redact testing card numbers data. To do it

  • Add alias_inbound.yaml route to your vault following steps in "Pre-requisites" section.
  • Run sample in Docker replacing <VAULT_ID> with your test vault id (or change it in docker-compose.yaml):
    • docker compose build
    • VAULT_ID='<VAULT_ID>' docker compose run alias-test-cards

Perform Bulk Enrollment

To start enrollment process of cards in csv/aliased_cards.csv file use values from "Pre-requisites" step 2 and 3. In command below:

  1. Replace <VAULT_ID> with your test vault id.
  2. Replace <VAULT_USERNAME> and <VAULT_PASSWORD> with your vault username and password from "Pre-requisites" step 2.
  3. Replace <CALM_CLIENT_ID> and <CALM_CLIENT_SECRET> with API credentials client id and secret values from "Pre-requisites" step 3.

Run:

VAULT_ID='<VAULT_ID>' \
VAULT_USERNAME='<VAULT_USERNAME>' \
VAULT_PASSWORD='<VAULT_PASSWORD>' \
CALM_CLIENT_ID='<CALM_CLIENT_ID>' \
CALM_CLIENT_SECRET='<CALM_CLIENT_SECRET>' \
docker compose run bulk-aliases-enrollment

As a result you will get aliased updated cards:

Updated cards

Enrollment of raw card data

Pre-requisites

  1. Create vault on Vault Dashboard.
  2. Use Vault ID to generate CALM API Credentials and save them.
  3. Run Docker daemon.

Prepare card data

Add your card data to csv/card_numbers.csv file according to its format.

Raw cards

Perform Bulk Enrollment

To start enrollment process of cards in csv/card_numbers.csv file use values from "Pre-requisites" step 2 and replace <CALM_CLIENT_ID> and <CALM_CLIENT_SECRET> with API credentials client id and secret values.

Run:

CALM_CLIENT_ID='<CALM_CLIENT_ID>' \
CALM_CLIENT_SECRET='<CALM_CLIENT_SECRET>' \
docker compose run bulk-raw-enrollment

Next Steps

After enrolling your cards, you can get updated cards with synchronous pull or asynchronous push model.

Recommend Projects

  • React photo React

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

  • Vue.js photo Vue.js

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

  • Typescript photo Typescript

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

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

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

  • web

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

  • server

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

  • Machine learning

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

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

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

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.