/Vegapay

Accounts API for Vegapay credit

Primary LanguageJava

Vegapay

These APIs allows you to manage credit card limits and offers for customers.

One-to-One Multiplicity && Uni-directional Association

  • Each LimitOffer corresponds to a single Account.
  • Each Account can have multiple associated LimitOffers.
  • Given a LimitOffer, you can access the associated Account.
  • However, a direct reference from an Account to its associated LimitOffers might not be present.

1. Create Account

Request:

curl --location 'http://localhost:8080/v1/accounts' \
--header 'Content-Type: application/json' \
--data '{
    "customerId": 1432667,
    "accountLimit": 200000.0,
    "perTransactionLimit": 40000.0
}'

Response:

{
    "accountLimit": 200000.0,
    "perTransactionLimit": 40000.0
}

2. Get Account

Request:

curl --location 'http://localhost:8080/v1/accounts/{accountId}

Response:

{
    "accountLimit": 200000.0,
    "perTransactionLimit": 80000.0
}

3. Create LimitOffer for Account

Request:

curl --location 'http://localhost:8080/v1/limit-offers' \
--header 'Content-Type: application/json' \
--data '{
    "accountId": 7,
    "limitType": "ACCOUNT_LIMIT",
    "newLimit": 800000.0,
    "offerActivationTime": "2023-08-07T10:00:00",
    "offerExpiryTime": "2023-08-15T23:59:59"
}'

Response:

LimitOffer
{
    "accountId": 7,
    "limitType": "ACCOUNT_LIMIT",
    "newLimit": 800000.0,
    "offerActivationTime": "2023-08-07T10:00:00",
    "offerExpiryTime": "2023-08-15T23:59:59"
}

4. Get List of LimitOffer for an account

Request:

curl --location 'http://localhost:8080/v1/limit-offers/active/{accountId}'

Response:

[
    {
        "accountId": 7,
        "limitType": "ACCOUNT_LIMIT",
        "newLimit": 800000.0,
        "offerActivationTime": "2023-08-07T10:00:00",
        "offerExpiryTime": "2023-08-15T23:59:59"
    }
]

5. Update limitOffer status based on user input from PENDING -> ACCEPTED , REJECTED.

Request:

curl --location --request PUT 'http://localhost:8080/v1/limit-offers/{limitOfferId}/status' \
--header 'Content-Type: application/json' \
--data '{
    "status": "ACCEPTED"
}'

Response:

{
    "accountId": 7,
    "limitType": "ACCOUNT_LIMIT",
    "newLimit": 800000.0,
    "offerActivationTime": "2023-08-08T10:00:00",
    "offerExpiryTime": "2023-08-15T23:59:59"
}