# AX91 Migration using the Old Code Process
- Use this [query](https://metabase-bbps.setu.co/question/285-biller-details-by-biller-id?bbps_biller_id=BLVFEE000KAR04) to get the config details such as baseURL, settlement details , report details.
- Search for the folder in which the code is present ( API Gateway > Lambda > Code )
- Create a new branch from `direct-lambda-migration-ax91` .
- if the url patter is not :
```python
urlPattern = r"^/(.*)/bills/(.*)/modules/(.*)/bbps/bills/(.*)$"
```
then change it to something like :
```python
urlPattern = r"^/manappuram/bills/(.*)/modules/(.*)/bbps/bills/(.*)$"
```
*The URL should have the biller's folder name.*
- Comment lines in lambda_function.py like :
```python
# token parse
auth_token = event["multiValueHeaders"]["Authorization"][0].split(" ")[-1]
# token verify
if not verify_auth_token(auth_token):
statusCode = 403
data = {
"status": 403,
"success": False,
"error": {
"code": "auth-error",
},
}
#Change
elif fetchPart == "fetch":
#To
if fetchPart == "fetch":
```
- Change complianceRespCd and complianceReason for
- Successful bill fetch
- BFR001
- BFR004
- Successful payment
- BPR005
- Duplicate payment ( if its there)
- If there is `./build.sh` then we will use that only to build our `package.zip`.
- Delete old `package.zip` and old `lib` folder if present.
- Run `./build.sh`
***Any update required for AX41 should be built from a different branch where AX91 related changes are not present***
- If there is no `./build.sh`and if the deployment zip package (`f.zip`) is present and in Readme it says :
```bash
zip -g f.zip lambda_function.py
```
Then create a duplicate of this zip and name it as `f_ax91.zip` .
Add changes to it :
```
zip -g f_ax91.zip lambda_function.py
```
- To update the `package.zip` built with `./build.sh` copy the `zip -g` lines from `./update.sh` only and run them.
- Create the function with function name : `eldia-bbps-connect-<biller-folder-name>-direct-migration-prod`. Only special character allowed is `-`
Example :
```bash
# Manappuram
aws lambda create-function \
--function-name eldia-bbps-connect-manappuram-direct-migration-prod \
--runtime python3.8 \
--handler lambda_function.lambda_handler \
--role arn:aws:iam::448903783933:role/dev_rel_bbps_template \
--zip-file fileb://f_ax91.zip \
--timeout 90 \
--vpc-config SubnetIds=subnet-088f443f3c2d59a90,subnet-096acc2b3937d00b2,SecurityGroupIds=sg-0bbe7ba27c43d2102
# GTPL
aws lambda create-function \
--function-name eldia-bbps-connect-gtpl-direct-migration-prod \
--runtime python3.8 \
--handler lambda_function.lambda_handler \
--role arn:aws:iam::448903783933:role/dev_rel_bbps_template \
--zip-file fileb://package.zip \
--timeout 90 \
--vpc-config SubnetIds=subnet-088f443f3c2d59a90,subnet-096acc2b3937d00b2,SecurityGroupIds=sg-0bbe7ba27c43d2102
```
These billers did not need IP whitelisting so we deployed using eldia vpc. But from now on we will use the following `vpc-config` :
```bash
aws lambda create-function \
--function-name eldia-bbps-connect-ebony-greens-apartments-direct-migration-prod \
--runtime python3.8 \
--handler lambda_function.lambda_handler \
--role arn:aws:iam::448903783933:role/dev_rel_bbps_template \
--zip-file fileb://package.zip \
--timeout 90 \
--vpc-config SubnetIds=subnet-0f42cc1d54d19d94a,SecurityGroupIds=sg-0c8b908e9c77dc090
```
- Update function when needed:
Example 1 :
```bash
zip -g f_ax91.zip lambda_function.py
aws lambda update-function-code --function-name eldia-bbps-connect-manappuram-direct-migration-prod --zip-file fileb://f_ax91.zip
```
Example 2 :
```bash
./build.sh
zip -g package.zip lambda_function.py
zip -g package.zip remote.py
zip -g package.zip errors.py
zip -g package.zip storage.py
aws lambda update-function-code --function-name eldia-bbps-connect-gtpl-direct-migration-prod --zip-file fileb://package.zip
```
- Example Configs in AX91
Partner :
```json
// Manappuram
{
"status": 201,
"success": true,
"data": {
"companyName": "Manappuram Finance Limited",
"email": "integrations@setu.co",
"mobile": "9988778899",
"name": "Manappuram Finance Limited",
"id": "902288950972909239"
}
}
//GTPL
{
"status": 201,
"success": true,
"data": {
"companyName": "GTPL KCBPL Broadband Pvt Ltd",
"email": "integrations@setu.co",
"mobile": "9988778899",
"name": "GTPL KCBPL Broadband Pvt Ltd",
"id": "902373756024915308"
}
}
```
Biller :
```json
// Manappuram
{
"status": 201,
"success": true,
"data": {
"name": "Manappuram Finance Limited-Vehicle Loan",
"partnerId": 902288950972909239,
"id": "902290059435181439"
}
}
// GTPL
{
"status": 201,
"success": true,
"data": {
"name": "GTPL KCBPL Broadband Pvt Ltd",
"partnerId": 902373756024915308,
"id": "902375323436319777"
}
}
```
Copy whatever is there for AX41 for the following flags :
- `isDeemed`
- `repostingEnabled`
- `dailySettlementReportEnabled`
- `dailyTransactionReportEnabled`
- `dailyTransactionReportEnabled`
**Take special care dealing with the following flags:**
- `settlementEnabled`
- `splitEnabled`
Biller config :
```json
// Manappuram
{
"status": 200,
"success": true,
"data": {
"baseUrl": {
"authentication": {
"credentials": {},
"type": "SETU_DEFAULT_JWT"
},
"path": "https://setu-eldia-nlb.setu.co/invoke-lambda/eldia-bbps-connect-manappuram-direct-migration-prod/manappuram/bills/prod/modules/1"
},
"dailyReportReceivers": [
"kaustav@setu.co"
],
"dailySettlementReportEnabled": false,
"dailyTransactionReportEnabled": false,
"isDeemed": true,
"repostingEnabled": true,
"settlementEnabled": false,
"settlementSchedule": "Instant",
"shouldTransliterate": false,
"splitEnabled": false
}
}
// GTPL
{
"status": 200,
"success": true,
"data": {
"baseUrl": {
"authentication": {
"credentials": {},
"type": "SETU_DEFAULT_JWT"
},
"path": "https://setu-eldia-nlb.setu.co/invoke-lambda/eldia-bbps-connect-gtpl-direct-migration-prod/GTPL/bills/prod/modules/loan"
},
"dailyReportReceivers": [
"kaustav@setu.co"
],
"dailySettlementReportEnabled": false,
"dailyTransactionReportEnabled": false,
"isDeemed": true,
"repostingEnabled": true,
"settlementEnabled": false,
"settlementSchedule": "Instant",
"shouldTransliterate": false,
"splitEnabled": false
}
}
```
Module value should be the same as whatever is there in AX41
- Upload MDM
- Test Bill Fetch using Jamuna. Get Customer Identifier and test data from AX41 prod logs.
- Example Ref ID for Manappuram : `ref_id : "KAUSTAVXX21122016ACXXXXXXXXX250505"` and for GTPL : `ref_id : "KAUSTAVXX21122016ACXXXXXXXXX250506"`
- Add, commit and push changes to the branch and raise MR to merge with `direct-lambda-migration-ax91` branch