{
  "openapi": "3.0.0",
  "info": {
    "title": "Solar Category Schema",
    "description": "The API will be organized around REST. Our API will have predictable, resource-oriented URLs, and will use HTTP response codes to indicate API errors. ",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://mconnectuat-1.creditfair.in",
      "description": "mconnect uat server"
    }
  ],
  "paths": {
    "/customerRest/customerSrv/createCustomer": {
      "post": {
        "tags": [
          "Mconnect Create Customer"
        ],
        "requestBody": {
          "content": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "minLength": 3,
                "message": {
                  "return_code": "201002",
                  "message": "Customer name is required",
                  "CF_code": "CF300",
                  "pattern": ""
                }
              },
              "fatherName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "applicantReligion": {
                "type": [
                  "string",
                  "null"
                ],
                "message": {
                  "return_code": "201002",
                  "message": "Please select valid religion",
                  "CF_code": "CF300"
                }
              },
              "communicationMobileNumber": {
                "type": "string",
                "pattern": "^[0-9]\\d{9}$",
                "minLength": 10,
                "maxLength": 10,
                "message": {
                  "return_code": "201002",
                  "message": "Communication Mobile Number is required in the correct format & length. It should be string",
                  "CF_code": "CF300",
                  "pattern": ""
                }
              },
              "isCommunicationMobileNumberAadharLinked": {
                "type": [
                  "boolean",
                  "null"
                ],
                "message": {
                  "return_code": "201002",
                  "message": "Please confirm if the communication mobile number is aadhaar linked",
                  "CF_code": "CF300",
                  "pattern": ""
                }
              },
              "aadharLinkedMobileNumber": {
                "type": [
                  "string",
                  "null"
                ],
                "pattern": "^[0-9]\\d{9}$",
                "message": {
                  "return_code": "201002",
                  "message": "Aadhar Linked Mobile Number is required in the correct format",
                  "CF_code": "CF300",
                  "pattern": ""
                }
              },
              "email": {
                "type": "string",
                "pattern": "[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Z|a-z]{2,7}",
                "message": {
                  "return_code": "201002",
                  "message": "Customer email is required in the correct format",
                  "CF_code": "CF300",
                  "pattern": ""
                }
              },
              "aadharNumber": {
                "type": [
                  "string",
                  "null"
                ],
                "pattern": "^\\d{12}$",
                "message": {
                  "return_code": "201002",
                  "message": "Aadhar Number is required in the correct format",
                  "CF_code": "CF300",
                  "pattern": ""
                }
              },
              "gender": {
                "type": "string",
                "minLength": 1,
                "maxLength": 1,
                "enum": [
                  "F",
                  "M"
                ],
                "message": {
                  "return_code": "201002",
                  "message": "Gender is required",
                  "CF_code": "CF300",
                  "pattern": ""
                }
              },
              "maritalStatus": {
                "type": [
                  "string",
                  "null"
                ],
                "minLength": 1,
                "maxLength": 1,
                "enum": [
                  "M",
                  "S"
                ],
                "message": {
                  "return_code": "201002",
                  "message": "Marital status is required",
                  "CF_code": "CF300",
                  "pattern": ""
                }
              },
              "dateofBirth": {
                "description": "dateofBirth",
                "type": "string",
                "pattern": "^\\d{4}\\-(0?[1-9]|1[012])\\-(0?[1-9]|[12][0-9]|3[01])$",
                "message": {
                  "return_code": "201002",
                  "message": "Date of Birth is Required Property",
                  "CF_code": "CF300",
                  "pattern": "Correct format of Date Of Birth is dd-mmm-yyyy"
                }
              },
              "panNumber": {
                "type": "string",
                "pattern": "^[A-Z]{5}[0-9]{4}[A-Z]{1}$",
                "minLength": 10,
                "maxLength": 10,
                "message": {
                  "return_code": "201002",
                  "message": "PAN Number is required in the correct format. It should be captial",
                  "CF_code": "CF300",
                  "pattern": ""
                }
              },
              "preferredLanguage": {
                "type": [
                  "string",
                  "null"
                ],
                "minLength": 2,
                "maxLength": 2,
                "message": {
                  "return_code": "201002",
                  "message": "Preferred language is required",
                  "CF_code": "CF300",
                  "pattern": ""
                }
              },
              "centreID": {
                "type": [
                  "integer",
                  "null"
                ],
                "message": {
                  "return_code": "201002",
                  "message": "Center ID is required",
                  "CF_code": "CF300",
                  "pattern": ""
                }
              },
              "uniqueCustomerId": {
                "type": [
                  "string"
                ],
                "message": {
                  "return_code": "201002",
                  "message": "Unique customer ID is required",
                  "CF_code": "CF300",
                  "pattern": ""
                }
              },
              "loanAmount": {
                "description": "Error",
                "type": [
                  "number"
                ],
                "minimum": 10000,
                "maximum": 2000000,
                "message": {
                  "message": "Loan amount is required and it should be between 10000 to 2000000",
                  "pattern": "",
                  "return_code": "201002",
                  "CF_code": "CF300"
                }
              },
              "productName": {
                "description": "Error",
                "type": [
                  "string",
                  "null"
                ],
                "message": {
                  "message": "Product Name is required in the correct format",
                  "pattern": "",
                  "return_code": "201002",
                  "CF_code": "CF300"
                }
              },
              "offerId": {
                "description": "Error",
                "type": [
                  "number"
                ],
                "message": {
                  "message": "Offer Id is required in the correct format",
                  "pattern": "",
                  "return_code": "201002",
                  "CF_code": "CF300"
                }
              },
              "inverterToBeInstalled": {
                "type": [
                  "string",
                  "null"
                ],
                "message": {
                  "return_code": "201006",
                  "message": "inverterToBeInstalled is required",
                  "CF_code": "CF300",
                  "pattern": ""
                }
              },
              "panelToBeInstalled": {
                "type": [
                  "string",
                  "null"
                ],
                "message": {
                  "return_code": "201006",
                  "message": "panelToBeInstalled is required",
                  "CF_code": "CF300",
                  "pattern": ""
                }
              },
              "monthlyPowerBill": {
                "type": [
                  "integer",
                  "null"
                ],
                "message": {
                  "return_code": "201006",
                  "message": "MonthlyPowerBill is required",
                  "CF_code": "CF300"
                }
              },
              "kwInstallation": {
                "type": [
                  "number",
                  "null"
                ],
                "message": {
                  "return_code": "201006",
                  "message": "kwInstallation is required",
                  "CF_code": "CF300",
                  "pattern": ""
                }
              },
              "grossProjectValue": {
                "type": [
                  "number",
                  "null"
                ],
                "message": {
                  "return_code": "201006",
                  "message": "grossProjectValue is required",
                  "CF_code": "CF300",
                  "pattern": ""
                }
              },
              "subsidyAmount": {
                "type": [
                  "number",
                  "null"
                ],
                "message": {
                  "return_code": "201006",
                  "message": "subsidyAmount is required",
                  "CF_code": "CF300",
                  "pattern": ""
                }
              },
              "typeOfCustomer": {
                "type": [
                  "integer",
                  "null"
                ],
                "minLength": 1,
                "maxLength": 1,
                "enum": [
                  1,
                  2,
                  3,
                  4,
                  5
                ],
                "message": {
                  "return_code": "201002",
                  "message": "Please select valid type of customer",
                  "CF_code": "CF300"
                }
              },
              "solarPowerType": {
                "type": [
                  "integer",
                  "null"
                ],
                "minLength": 1,
                "maxLength": 1,
                "enum": [
                  1,
                  2,
                  3
                ],
                "message": {
                  "return_code": "201002",
                  "message": "Please select valid solar power type",
                  "CF_code": "CF300"
                }
              },
              "typeOfCustomerApplication": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "Individual",
                  "Non-Individual"
                ],
                "message": {
                  "return_code": "201002",
                  "message": "Please select valid type of customer application value",
                  "CF_code": "CF300",
                  "pattern": ""
                }
              },
              "coApplicant": {
                "type": [
                  "object",
                  "null"
                ],
                "properties": {
                  "name": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 3,
                    "message": {
                      "return_code": "201002",
                      "message": "Co-Applicant name is required",
                      "CF_code": "CF300",
                      "pattern": ""
                    }
                  },
                  "phone": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 10,
                    "maxLength": 10,
                    "pattern": "^[0-9]\\d{9}$",
                    "message": {
                      "return_code": "201002",
                      "message": "Co-Applicant phone is required",
                      "CF_code": "CF300",
                      "pattern": ""
                    }
                  },
                  "email": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "pattern": "[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Z|a-z]{2,7}",
                    "message": {
                      "return_code": "201002",
                      "message": "Co-Applicant email is required",
                      "CF_code": "CF300",
                      "pattern": ""
                    }
                  },
                  "gender": {
                    "anyOf": [
                      {
                        "type": [
                          "string"
                        ],
                        "enum": [
                          "F",
                          "M"
                        ],
                        "message": {
                          "return_code": "201002",
                          "message": "Co-Applicant gender is required",
                          "CF_code": "CF300",
                          "pattern": ""
                        }
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "maritalStatus": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 1,
                    "maxLength": 1,
                    "enum": [
                      "M",
                      "U"
                    ],
                    "message": {
                      "return_code": "201002",
                      "message": "Co-Applicant marital status is required",
                      "CF_code": "CF300",
                      "pattern": ""
                    }
                  },
                  "dateofBirth": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "minLength": 10,
                    "maxLength": 10,
                    "pattern": "^\\d{4}\\-(0?[1-9]|1[012])\\-(0?[1-9]|[12][0-9]|3[01])$",
                    "message": {
                      "return_code": "201002",
                      "message": "Co-Applicant date of birth is required",
                      "CF_code": "CF300",
                      "pattern": ""
                    }
                  },
                  "panNumber": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "pattern": "^[A-Z]{5}[0-9]{4}[A-Z]{1}$",
                    "minLength": 10,
                    "maxLength": 10,
                    "message": {
                      "return_code": "201002",
                      "message": "Co-Applicant PAN Number is required in the correct format. It should be captial",
                      "CF_code": "CF300",
                      "pattern": ""
                    }
                  },
                  "city": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "message": {
                      "return_code": "201002",
                      "message": "Co-Applicant city is required in the correct format.",
                      "CF_code": "CF300",
                      "pattern": ""
                    }
                  },
                  "addrLine1": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "message": {
                      "return_code": "201002",
                      "message": "Co-Applicant address line1 is required in the correct format.",
                      "CF_code": "CF300",
                      "pattern": ""
                    }
                  },
                  "addrLine2": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "message": {
                      "return_code": "201002",
                      "message": "Co-Applicant address line2 is required in the correct format.",
                      "CF_code": "CF300",
                      "pattern": ""
                    }
                  },
                  "state": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "message": {
                      "return_code": "201002",
                      "message": "Co-Applicant state is required in the correct format.",
                      "CF_code": "CF300",
                      "pattern": ""
                    }
                  },
                  "pincode": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "message": {
                      "return_code": "201002",
                      "message": "Co-Applicant pincode is required in the correct format.",
                      "CF_code": "CF300",
                      "pattern": ""
                    }
                  }
                },
                "required": [
                  "name",
                  "phone",
                  "email",
                  "gender",
                  "city",
                  "addrLine1",
                  "addrLine2",
                  "state",
                  "pincode",
                  "dateofBirth",
                  "panNumber"
                ]
              },
              "addresses": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": "object",
                  "properties": {
                    "addrType": {
                      "description": "Error",
                      "type": "string",
                      "enum": [
                        "CURRES",
                        "PERMA",
                        "INSTALLATION"
                      ],
                      "message": {
                        "return_code": "201002",
                        "message": "Address type is required",
                        "CF_code": "CF300",
                        "pattern": ""
                      }
                    },
                    "addrLine1": {
                      "description": "Error",
                      "type": [
                        "string"
                      ],
                      "minLength": 1,
                      "message": {
                        "return_code": "201002",
                        "message": "Address line1 is required.",
                        "CF_code": "CF300",
                        "pattern": ""
                      }
                    },
                    "addrLine2": {
                      "description": "Error",
                      "type": [
                        "string"
                      ],
                      "message": {
                        "return_code": "201002",
                        "message": "Address line2 is required",
                        "CF_code": "CF300",
                        "pattern": ""
                      }
                    },
                    "landmark": {
                      "description": "Error",
                      "type": [
                        "string",
                        "null"
                      ],
                      "minLength": 1,
                      "message": {
                        "return_code": "201002",
                        "message": "Landmark is required",
                        "CF_code": "CF300",
                        "pattern": ""
                      }
                    },
                    "city": {
                      "description": "Error",
                      "type": [
                        "string"
                      ],
                      "minLength": 1,
                      "message": {
                        "return_code": "201002",
                        "message": "City is required",
                        "CF_code": "CF300",
                        "pattern": ""
                      }
                    },
                    "state": {
                      "description": "Error",
                      "anyOf": [
                        {
                          "type": [
                            "string"
                          ],
                          "enum": [
                            "AN",
                            "AP",
                            "AR",
                            "AS",
                            "BR",
                            "CH",
                            "CG",
                            "DN",
                            "DD",
                            "DL",
                            "GA",
                            "GJ",
                            "HR",
                            "HP",
                            "JK",
                            "JH",
                            "KA",
                            "KL",
                            "LD",
                            "MP",
                            "MH",
                            "MN",
                            "ML",
                            "MZ",
                            "NL",
                            "OR",
                            "PY",
                            "PB",
                            "RJ",
                            "SK",
                            "TN",
                            "TR",
                            "UP",
                            "UL",
                            "WB",
                            "TS"
                          ],
                          "message": {
                            "return_code": "201002",
                            "message": "State is required",
                            "CF_code": "CF300",
                            "pattern": ""
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "pincode": {
                      "type": [
                        "string"
                      ],
                      "minLength": 6,
                      "maxLength": 6,
                      "message": {
                        "return_code": "201002",
                        "message": "Pincode is required",
                        "CF_code": "CF300",
                        "pattern": ""
                      }
                    },
                    "addressStatus": {
                      "type": "string",
                      "enum": [
                        "OWNED",
                        "RENTED",
                        "PARENTS HOUSE",
                        "Self Owned",
                        "Parent Owned",
                        "Rented With Family",
                        "Rented With Friend",
                        "Company Allotted"
                      ],
                      "message": {
                        "return_code": "201002",
                        "message": "Please select valid address status",
                        "CF_code": "CF300"
                      }
                    }
                  }
                }
              },
              "references": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "message": {
                        "return_code": "201002",
                        "message": "Reference name is required",
                        "CF_code": "CF300",
                        "pattern": ""
                      }
                    },
                    "phone": {
                      "description": "Error",
                      "type": [
                        "string",
                        "null"
                      ],
                      "message": {
                        "return_code": "201002",
                        "message": "Reference phone is required",
                        "CF_code": "CF300",
                        "pattern": ""
                      }
                    },
                    "relation": {
                      "description": "Error",
                      "type": [
                        "string",
                        "null"
                      ],
                      "message": {
                        "return_code": "201002",
                        "message": "Relation is required",
                        "CF_code": "CF300",
                        "pattern": ""
                      }
                    }
                  }
                }
              },
              "profession": {
                "type": [
                  "object"
                ],
                "properties": {
                  "professionType": {
                    "type": [
                      "string"
                    ],
                    "minLength": 1,
                    "maxLength": 2,
                    "enum": [
                      "U",
                      "S",
                      "B",
                      "SB",
                      "SP",
                      "P",
                      "H"
                    ],
                    "message": {
                      "return_code": "201002",
                      "message": "Profession type is required in the correct format",
                      "CF_code": "CF300",
                      "pattern": ""
                    }
                  },
                  "professionDetails": {
                    "type": "object",
                    "properties": {
                      "company": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "minLength": 1,
                        "pattern": "^(\\s*\\w\\s*){2,}$",
                        "message": {
                          "return_code": "201002",
                          "message": "Company is required",
                          "CF_code": "CF300",
                          "pattern": ""
                        }
                      },
                      "companyEmail": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "message": {
                          "return_code": "201002",
                          "message": "Company Email is required",
                          "CF_code": "CF300",
                          "pattern": ""
                        }
                      },
                      "companyPhone": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "minLength": 10,
                        "maxLength": 10,
                        "pattern": "^[0-9]\\d{9}$",
                        "message": {
                          "return_code": "201002",
                          "message": "Company phone is required",
                          "CF_code": "CF300",
                          "pattern": ""
                        }
                      },
                      "monthlyIncome": {
                        "type": "integer",
                        "minLength": 4,
                        "pattern": "^(\\s*\\w\\s*){2,}$",
                        "message": {
                          "return_code": "201002",
                          "message": "Monthly income is required",
                          "CF_code": "CF300",
                          "pattern": ""
                        }
                      },
                      "designation": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "message": {
                          "return_code": "201002",
                          "message": "Designation is required",
                          "CF_code": "CF300",
                          "pattern": ""
                        }
                      },
                      "department": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "message": {
                          "return_code": "201002",
                          "message": "Department is required",
                          "CF_code": "CF300",
                          "pattern": ""
                        }
                      },
                      "companyAddress": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "message": {
                          "return_code": "201002",
                          "message": "Company address is required",
                          "CF_code": "CF300",
                          "pattern": ""
                        }
                      },
                      "landmark": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "message": {
                          "return_code": "201002",
                          "returnText": "Landmark is required",
                          "CF_code": "CF300",
                          "pattern": ""
                        }
                      },
                      "city": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "message": {
                          "return_code": "201002",
                          "message": "City is required",
                          "CF_code": "CF300",
                          "pattern": ""
                        }
                      },
                      "state": {
                        "anyOf": [
                          {
                            "type": [
                              "string"
                            ],
                            "enum": [
                              "AN",
                              "AP",
                              "AR",
                              "AS",
                              "BR",
                              "CH",
                              "CG",
                              "DN",
                              "DD",
                              "DL",
                              "GA",
                              "GJ",
                              "HR",
                              "HP",
                              "JK",
                              "JH",
                              "KA",
                              "KL",
                              "LD",
                              "MP",
                              "MH",
                              "MN",
                              "ML",
                              "MZ",
                              "NL",
                              "OR",
                              "PY",
                              "PB",
                              "RJ",
                              "SK",
                              "TN",
                              "TR",
                              "UP",
                              "UL",
                              "WB",
                              "TS"
                            ],
                            "message": {
                              "return_code": "201002",
                              "message": "State is required",
                              "CF_code": "CF300",
                              "pattern": ""
                            }
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "pincode": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "minLength": 6,
                        "maxLength": 6,
                        "message": {
                          "return_code": "201002",
                          "message": "Pincode is required",
                          "CF_code": "CF300",
                          "pattern": ""
                        }
                      }
                    }
                  }
                }
              },
              "customersBankInfo": {
                "type": "object",
                "properties": {
                  "accountHolder": {
                    "minLength": 3,
                    "type": [
                      "string",
                      "null"
                    ],
                    "message": {
                      "return_code": "201002",
                      "message": "Account holder is required",
                      "CF_code": "CF300",
                      "pattern": ""
                    }
                  },
                  "bankBranch": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "message": {
                      "return_code": "201002",
                      "message": "Bank branch is required",
                      "CF_code": "CF300",
                      "pattern": ""
                    }
                  },
                  "bankName": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "message": {
                      "return_code": "201002",
                      "message": "Bank name is required",
                      "CF_code": "CF300",
                      "pattern": ""
                    }
                  },
                  "accountNumber": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "message": {
                      "return_code": "201002",
                      "message": "Account Number is required",
                      "CF_code": "CF300",
                      "pattern": ""
                    }
                  },
                  "accountType": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "message": {
                      "return_code": "201002",
                      "message": "Account type is required in the correct format",
                      "CF_code": "CF300",
                      "pattern": ""
                    }
                  },
                  "bankIfsc": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "message": {
                      "return_code": "201002",
                      "message": "Bank IFSC is required",
                      "CF_code": "CF300",
                      "pattern": ""
                    }
                  },
                  "salaryAccount": {
                    "type": [
                      "boolean",
                      "null"
                    ],
                    "message": {
                      "return_code": "201002",
                      "message": "Salary account is required",
                      "CF_code": "CF300",
                      "pattern": ""
                    }
                  }
                },
                "message": {
                  "return_code": "201002",
                  "message": "Customer Bank Info object is required.",
                  "CF_code": "CF300",
                  "pattern": ""
                }
              },
              "documentOCRDetails": {
                "type": "object",
                "properties": {
                  "applicant": {
                    "type": "object",
                    "properties": {
                      "PAN": {
                        "type": "object",
                        "properties": {
                          "nameAsPerDocument": {
                            "type": "string"
                          },
                          "matchPercentage": {
                            "type": "integer"
                          }
                        },
                        "message": {
                          "return_code": "201002",
                          "message": "PAN document OCR details is required. Please send nameAsPerDocument & matchPercentage keys.",
                          "CF_code": "CF300"
                        },
                        "required": [
                          "nameAsPerDocument",
                          "matchPercentage"
                        ]
                      },
                      "Aadhar": {
                        "type": "object",
                        "properties": {
                          "nameAsPerDocument": {
                            "type": "string"
                          },
                          "matchPercentage": {
                            "type": "integer"
                          }
                        },
                        "message": {
                          "return_code": "201002",
                          "message": "Aadhar document OCR details is required. Please send nameAsPerDocument & matchPercentage keys.",
                          "CF_code": "CF300"
                        },
                        "required": [
                          "nameAsPerDocument",
                          "matchPercentage"
                        ]
                      },
                      "PropertyTax": {
                        "type": "object",
                        "properties": {
                          "nameAsPerDocument": {
                            "type": "string"
                          },
                          "matchPercentage": {
                            "type": "integer"
                          }
                        },
                        "message": {
                          "return_code": "201002",
                          "message": "Property tax document OCR details is required. Please send nameAsPerDocument & matchPercentage keys.",
                          "CF_code": "CF300"
                        },
                        "required": [
                          "nameAsPerDocument",
                          "matchPercentage"
                        ]
                      },
                      "electricityBill": {
                        "type": "object",
                        "properties": {
                          "nameAsPerDocument": {
                            "type": "string"
                          },
                          "matchPercentage": {
                            "type": "integer"
                          }
                        },
                        "message": {
                          "return_code": "201002",
                          "message": "Electricity bill OCR details is required. Please send nameAsPerDocument & matchPercentage keys.",
                          "CF_code": "CF300"
                        },
                        "required": [
                          "nameAsPerDocument",
                          "matchPercentage"
                        ]
                      }
                    },
                    "required": [
                      "PAN",
                      "Aadhar",
                      "PropertyTax",
                      "electricityBill"
                    ]
                  },
                  "coApplicant": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "properties": {
                      "PAN": {
                        "type": "object",
                        "properties": {
                          "nameAsPerDocument": {
                            "type": "string"
                          },
                          "matchPercentage": {
                            "type": "integer"
                          }
                        },
                        "message": {
                          "return_code": "201002",
                          "message": "Co-applicant PAN document OCR details is required. Please send nameAsPerDocument & matchPercentage keys.",
                          "CF_code": "CF300"
                        },
                        "required": [
                          "nameAsPerDocument",
                          "matchPercentage"
                        ]
                      },
                      "Aadhar": {
                        "type": "object",
                        "properties": {
                          "nameAsPerDocument": {
                            "type": "string"
                          },
                          "matchPercentage": {
                            "type": "integer"
                          }
                        },
                        "message": {
                          "return_code": "201002",
                          "message": "Co-applicant aadhar document OCR details is required. Please send nameAsPerDocument & matchPercentage keys.",
                          "CF_code": "CF300"
                        },
                        "required": [
                          "nameAsPerDocument",
                          "matchPercentage"
                        ]
                      }
                    },
                    "message": {
                      "return_code": "201002",
                      "message": "CoApplicant in documentOCRDetails is required and should have PAN & Aadhar keys.",
                      "CF_code": "CF300"
                    },
                    "required": [
                      "PAN",
                      "Aadhar"
                    ]
                  }
                },
                "required": [
                  "applicant",
                  "coApplicant"
                ]
              }
            },
            "required": [
              "name",
              "communicationMobileNumber",
              "isCommunicationMobileNumberAadharLinked",
              "aadharLinkedMobileNumber",
              "aadharNumber",
              "email",
              "gender",
              "applicantReligion",
              "maritalStatus",
              "dateofBirth",
              "panNumber",
              "preferredLanguage",
              "inverterToBeInstalled",
              "panelToBeInstalled",
              "monthlyPowerBill",
              "kwInstallation",
              "grossProjectValue",
              "subsidyAmount",
              "coApplicant",
              "addresses",
              "references",
              "profession",
              "customersBankInfo",
              "loanAmount",
              "offerId",
              "uniqueCustomerId",
              "documentOCRDetails"
            ]
          },
          "rules": {
            "data": [
              {
                "conditions": [
                  "$request.fatherName",
                  "equals",
                  "null"
                ],
                "true": {
                  "operation": "returnResponse",
                  "message": "Please input valid Father Name or else pass it as null",
                  "CF_code": "CF300",
                  "return_code": "201002"
                }
              },
              {
                "conditions": [
                  "$request.panNumber",
                  "notEquals",
                  "$request.coApplicant.panNumber"
                ],
                "false": {
                  "operation": "returnResponse",
                  "return_code": "201004",
                  "message": "Applicant & co-Applicant PAN can't be same",
                  "CF_code": "CF300"
                }
              },
              {
                "conditions": [
                  "$request.communicationMobileNumber",
                  "notEquals",
                  "$request.coApplicant.phone"
                ],
                "false": {
                  "operation": "returnResponse",
                  "return_code": "201004",
                  "CF_code": "CF300",
                  "message": "Applicant & co-Applicant mobile numbers can't be same"
                }
              },
              {
                "conditions": [
                  "$request.email",
                  "notEquals",
                  "$request.coApplicant.email"
                ],
                "false": {
                  "operation": "returnResponse",
                  "return_code": "201004",
                  "CF_code": "CF300",
                  "message": "Applicant & co-Applicant email can't be same"
                }
              },
              {
                "conditions": [
                  "$request.profession.professionDetails.companyPhone",
                  "notEquals",
                  "$request.communicationMobileNumber"
                ],
                "false": {
                  "operation": "returnResponse",
                  "return_code": "201004",
                  "CF_code": "CF300",
                  "message": "Applicant & company phone can't be same"
                }
              },
              {
                "conditions": [
                  "$request.coApplicant.name",
                  "isNotNull"
                ],
                "true": {
                  "conditions": [
                    "$request.coApplicant.phone",
                    "isNotNull"
                  ],
                  "false": {
                    "operation": "returnResponse",
                    "return_code": "201004",
                    "CF_code": "CF300",
                    "message": "Co-Applicant phone should be mandatory"
                  }
                }
              },
              {
                "conditions": [
                  "$request.coApplicant.name",
                  "isNotNull"
                ],
                "true": {
                  "conditions": [
                    "$request.coApplicant.email",
                    "isNotNull"
                  ],
                  "false": {
                    "operation": "returnResponse",
                    "return_code": "201004",
                    "CF_code": "CF300",
                    "message": "Co-Applicant email should be mandatory"
                  }
                }
              },
              {
                "conditions": [
                  "$request.coApplicant.name",
                  "isNotNull"
                ],
                "true": {
                  "conditions": [
                    "$request.coApplicant.gender",
                    "isNotNull"
                  ],
                  "false": {
                    "operation": "returnResponse",
                    "return_code": "201004",
                    "CF_code": "CF300",
                    "message": "Co-Applicant gender should be mandatory"
                  }
                }
              },
              {
                "conditions": [
                  "$request.coApplicant.name",
                  "isNotNull"
                ],
                "true": {
                  "conditions": [
                    "$request.coApplicant.dateofBirth",
                    "isNotNull"
                  ],
                  "false": {
                    "operation": "returnResponse",
                    "return_code": "201004",
                    "CF_code": "CF300",
                    "message": "Co-Applicant dateofBirth should be mandatory"
                  }
                }
              },
              {
                "conditions": [
                  "$request.coApplicant.name",
                  "isNotNull"
                ],
                "true": {
                  "conditions": [
                    "$request.coApplicant.panNumber",
                    "isNotNull"
                  ],
                  "false": {
                    "operation": "returnResponse",
                    "return_code": "201004",
                    "CF_code": "CF300",
                    "message": "Co-Applicant panNumber should be mandatory"
                  }
                }
              },
              {
                "conditions": [
                  "$request.coApplicant.name",
                  "isNotNull"
                ],
                "true": {
                  "conditions": [
                    "$request.coApplicant.city",
                    "isNotNull"
                  ],
                  "false": {
                    "operation": "returnResponse",
                    "return_code": "201004",
                    "CF_code": "CF300",
                    "message": "Co-Applicant city should be mandatory"
                  }
                }
              },
              {
                "conditions": [
                  "$request.coApplicant.name",
                  "isNotNull"
                ],
                "true": {
                  "conditions": [
                    "$request.coApplicant.state",
                    "isNotNull"
                  ],
                  "false": {
                    "operation": "returnResponse",
                    "return_code": "201004",
                    "CF_code": "CF300",
                    "message": "Co-Applicant state should be mandatory"
                  }
                }
              },
              {
                "conditions": [
                  "$request.coApplicant.name",
                  "isNotNull"
                ],
                "true": {
                  "conditions": [
                    "$request.coApplicant.addrLine1",
                    "isNotNull"
                  ],
                  "false": {
                    "operation": "returnResponse",
                    "return_code": "201004",
                    "CF_code": "CF300",
                    "message": "Co-Applicant address line1 should be mandatory"
                  }
                }
              },
              {
                "conditions": [
                  "$request.coApplicant.name",
                  "isNotNull"
                ],
                "true": {
                  "conditions": [
                    "$request.coApplicant.addrLine2",
                    "isNotNull"
                  ],
                  "false": {
                    "operation": "returnResponse",
                    "return_code": "201004",
                    "CF_code": "CF300",
                    "message": "Co-Applicant address line2 should be mandatory"
                  }
                }
              },
              {
                "conditions": [
                  "$request.coApplicant.name",
                  "isNotNull"
                ],
                "true": {
                  "conditions": [
                    "$request.coApplicant.pincode",
                    "isNotNull"
                  ],
                  "false": {
                    "operation": "returnResponse",
                    "return_code": "201004",
                    "CF_code": "CF300",
                    "message": "Co-Applicant pincode should be mandatory"
                  }
                }
              },
              {
                "conditions": [
                  "$request.customersBankInfo.bankName",
                  "equals",
                  "null"
                ],
                "true": {
                  "operation": "returnResponse",
                  "return_code": "201002",
                  "CF_code": "CF300",
                  "message": "Bank name is required"
                }
              },
              {
                "conditions": [
                  "$request.customersBankInfo.accountType",
                  "equals",
                  "null"
                ],
                "true": {
                  "operation": "returnResponse",
                  "return_code": "201002",
                  "CF_code": "CF300",
                  "message": "Bank account type is required"
                }
              },
              {
                "conditions": [
                  "$request.applicantReligion",
                  "isNotNull"
                ],
                "true": {
                  "conditions": [
                    "$request.applicantReligion",
                    "in",
                    "['HINDU','MUSLIM','CHRISTIAN','SIKH','JAIN','ZOROASTRIANS','BUDDHIST','PARSI','BAHAI','null']"
                  ],
                  "false": {
                    "operation": "returnResponse",
                    "message": "Please select valid religion",
                    "CF_code": "CF300",
                    "return_code": "201002"
                  }
                }
              },
              {
                "conditions": [
                  "$request.preferredLanguage",
                  "isNotNull"
                ],
                "true": {
                  "conditions": [
                    "$request.preferredLanguage",
                    "in",
                    "['EN','HI','MR','GU','BE','PU','TA','TE','KA','MA','UR','OD','ML']"
                  ],
                  "false": {
                    "operation": "returnResponse",
                    "message": "Please select valid preferred language or pass null",
                    "CF_code": "CF300",
                    "return_code": "201002"
                  }
                }
              },
              {
                "conditions": [
                  "$request.maritalStatus",
                  "isNotNull"
                ],
                "true": {
                  "conditions": [
                    "$request.maritalStatus",
                    "in",
                    "['M','S']"
                  ],
                  "false": {
                    "operation": "returnResponse",
                    "message": "Please select valid marital status or pass null",
                    "CF_code": "CF300",
                    "return_code": "201002"
                  }
                }
              },
              {
                "conditions": [
                  "$request.coApplicant.name",
                  "isNotNull"
                ],
                "true": {
                  "conditions": [
                    "$request.documentOCRDetails.coApplicant",
                    "isNotNull"
                  ],
                  "false": {
                    "operation": "returnResponse",
                    "message": "Co-applicant OCR details are requried.",
                    "CF_code": "CF300",
                    "return_code": "201002"
                  }
                }
              }
            ]
          }
        },
        "responses": {
          "CF300": {
            "content": {
              "application/json": {
                "request_id": "$request_id",
                "returnStatus": {
                  "returnCode": "$response.return_code",
                  "returnText": "$response.message"
                }
              },
              "status_code": 400
            },
            "actions": [
              {
                "operation": "query",
                "queryType": "update",
                "table": "merchant_api_request",
                "clause": {
                  "where": [
                    "id"
                  ],
                  "queryParams": [
                    "$merchant_api_request_id"
                  ]
                },
                "values": {
                  "response": "json_dumps->$response",
                  "request_id": "$request_id",
                  "updated_at": "datetime.CUR_TIMESTAMP"
                }
              }
            ]
          },
          "CF200": {
            "content": {
              "application/json": {
                "applicationNo": "get_loan_application_number->$consumer_application_id,$merchant_id",
                "cif": "$customers_id",
                "coif": "$customers_co_app_id",
                "returnStatus": {
                  "returnCode": "000000",
                  "returnText": "Success"
                }
              },
              "status_code": 200
            },
            "actions": [
              {
                "operation": "query",
                "queryType": "update",
                "table": "merchant_api_request",
                "clause": {
                  "where": [
                    "id"
                  ],
                  "queryParams": [
                    "$merchant_api_request_id"
                  ]
                },
                "values": {
                  "response": "json_dumps->$response",
                  "request_id": "$request_id",
                  "updated_at": "datetime.CUR_TIMESTAMP"
                }
              }
            ]
          },
          "CF500": {
            "content": {
              "application/json": "null",
              "status_code": 400
            }
          }
        },
        "functions": {
          "init": [
            {
              "conditions": [
                "$request.coApplicant.name",
                "isNotNull"
              ],
              "false": {
                "operation": "setData",
                "stateKey": "customers_co_app_id",
                "value": 0
              }
            },
            {
              "operation": "setData",
              "stateKey": "request_id",
              "value": "UUID"
            },
            {
              "operation": "query",
              "queryType": "insert",
              "table": "merchant_api_request",
              "values": {
                "created_at": "datetime.CUR_TIMESTAMP",
                "merchant_id": "$merchant_details.id",
                "request": "json_dumps->$request"
              },
              "auto_id": "id"
            },
            {
              "operation": "length",
              "key": "$request.references",
              "stateKey": "referenceCount"
            },
            {
              "operation": "length",
              "key": "$request.addresses",
              "stateKey": "addressCount"
            },
            {
              "conditions": [
                "$addressCount",
                "greaterThan",
                "4"
              ],
              "true": {
                "operation": "returnResponse",
                "return_code": "201002",
                "CF_code": "CF300",
                "message": "Address should contain CURRES, PERMA & INSTALLATION parameters"
              }
            },
            {
              "conditions": [
                "$request.centreID",
                "isNotNull"
              ],
              "false": {
                "operation": "setData",
                "value": "0",
                "stateKey": "center_number"
              },
              "true": {
                "operation": "setData",
                "value": "$request.centreID",
                "stateKey": "center_number"
              }
            },
            {
              "operation": "setData",
              "stateKey": "merchant_id",
              "value": "$merchant_details.id"
            },
            {
              "operation": "setData",
              "value": "set_address_value->$request.addresses,CURRES",
              "stateKey": "current_address"
            },
            {
              "operation": "setData",
              "value": "set_address_value->$request.addresses,PERMA",
              "stateKey": "permanent_address"
            },
            {
              "operation": "setData",
              "value": "set_address_value->$request.addresses,INSTALLATION",
              "stateKey": "installation_address"
            },
            {
              "conditions": [
                "$current_address",
                "isNotNull"
              ],
              "true": {
                "operation": "concat",
                "stateKey": "currentAddressMerge",
                "values": [
                  "$current_address.addrLine1",
                  " ",
                  "$current_address.addrLine2"
                ]
              }
            },
            {
              "conditions": [
                "$permanent_address",
                "isNotNull"
              ],
              "true": {
                "operation": "concat",
                "stateKey": "permanentAddressMerge",
                "values": [
                  "$permanent_address.addrLine1",
                  " ",
                  "$permanent_address.addrLine2"
                ]
              }
            },
            {
              "conditions": [
                "$installation_address",
                "isNotNull"
              ],
              "true": {
                "operation": "concat",
                "stateKey": "installationAddressMerge",
                "values": [
                  "$installation_address.addrLine1",
                  " ",
                  "$installation_address.addrLine2"
                ]
              }
            },
            {
              "conditions": [
                "$request.maritalStatus",
                "isNotNull"
              ],
              "true": {
                "operation": "mapData",
                "stateKey": "marital_status",
                "key": "$request.maritalStatus",
                "enum": {
                  "M": "MARRIED",
                  "S": "SINGLE"
                }
              }
            },
            {
              "conditions": [
                "$request.isCommunicationMobileNumberAadharLinked",
                "isNotNull"
              ],
              "true": {
                "operation": "mapData",
                "stateKey": "isAadharLinkedMobile",
                "key": "$request.isCommunicationMobileNumberAadharLinked",
                "enum": {
                  "True": 1,
                  "False": 0
                }
              },
              "false": {
                "operation": "setData",
                "stateKey": "isAadharLinkedMobile",
                "value": 0
              }
            },
            {
              "conditions": [
                "$request.preferredLanguage",
                "isNotNull"
              ],
              "true": {
                "operation": "mapData",
                "stateKey": "language",
                "key": "$request.preferredLanguage",
                "enum": {
                  "EN": "ENGLISH",
                  "HI": "HINDI",
                  "MA": "MARATHI",
                  "GU": "GUJARATI",
                  "BE": "BENGALI",
                  "PU": "PUNJABI",
                  "TA": "TAMIL",
                  "TE": "TELUGU",
                  "KA": "KANNADA",
                  "ML": "MALAYALAM",
                  "UR": "URDU",
                  "OD": "ODIA"
                },
                "false": {
                  "operation": "setData",
                  "stateKey": "language",
                  "value": "ENGLISH"
                }
              }
            },
            {
              "conditions": [
                "$request.profession.professionType",
                "isNotNull"
              ],
              "true": {
                "operation": "mapData",
                "stateKey": "profession_type",
                "key": "$request.profession.professionType",
                "enum": {
                  "U": "UNEMPLOYED",
                  "S": "SALARIED",
                  "B": "BUSINESS",
                  "SB": "Self Employed - Business",
                  "SP": "Self Employed - Professional",
                  "P": "PENSIONER",
                  "H": "HOUSEWIFE"
                }
              }
            },
            {
              "conditions": [
                "$request.gender",
                "isNotNull"
              ],
              "true": {
                "operation": "mapData",
                "stateKey": "customer_gender",
                "key": "$request.gender",
                "enum": {
                  "M": 2,
                  "F": 1
                }
              }
            },
            {
              "conditions": [
                "$request.gender",
                "isNotNull"
              ],
              "true": {
                "operation": "mapData",
                "stateKey": "gender",
                "key": "$request.gender",
                "enum": {
                  "M": "MALE",
                  "F": "FEMALE"
                }
              }
            },
            {
              "conditions": [
                "$request.coApplicant.gender",
                "isNotNull"
              ],
              "true": {
                "operation": "mapData",
                "stateKey": "co_customer_gender",
                "key": "$request.coApplicant.gender",
                "enum": {
                  "M": 2,
                  "F": 1
                }
              }
            },
            {
              "conditions": [
                "$request.coApplicant.gender",
                "isNotNull"
              ],
              "true": {
                "operation": "mapData",
                "stateKey": "co_app_gender",
                "key": "$request.coApplicant.gender",
                "enum": {
                  "M": "MALE",
                  "F": "FEMALE"
                }
              }
            },
            {
              "conditions": [
                "$request.customersBankInfo.accountType",
                "isNotNull"
              ],
              "true": {
                "operation": "mapData",
                "stateKey": "account_type",
                "key": "$request.customersBankInfo.accountType",
                "enum": {
                  "SA": "savings",
                  "CA": "current",
                  "CC": "cc",
                  "NRE": "nre",
                  "NRO": "nro"
                }
              },
              "false": {
                "operation": "setData",
                "stateKey": "account_type",
                "value": ""
              }
            },
            {
              "operation": "insert",
              "table": "merchant_api_request",
              "values": {
                "request": "$request",
                "created_at": "datetime.CUR_TIMESTAMP",
                "merchant_id": "$merchant_id"
              },
              "auto_id": "id"
            },
            {
              "operation": "calculate",
              "stateKey": "inverter_power_savings",
              "value": "$request.kwInstallation * 1000"
            }
          ],
          "offerValid": [
            {
              "operation": "query",
              "name": "isOfferValid",
              "queryType": "raw",
              "dbRaw": "select mo.id from merchant_offers mo where mo.merchant_id = %s and mo.id = %s",
              "queryParams": [
                "$merchant_details.id",
                "$request.offerId"
              ],
              "stateKey": "offer_id"
            },
            {
              "conditions": [
                "$offer_id",
                "isNotNull"
              ],
              "false": {
                "operation": "returnResponse",
                "return_code": "201002",
                "CF_code": "CF300",
                "message": "Invalid Offer ID"
              }
            }
          ],
          "getBank": [
            {
              "conditions": [
                "$request.customersBankInfo.accountHolder",
                "isNotNull"
              ],
              "false": {
                "operation": "setData",
                "stateKey": "acct_holder",
                "value": ""
              },
              "true": {
                "operation": "setData",
                "stateKey": "acct_holder",
                "value": "$request.customersBankInfo.accountHolder"
              }
            },
            {
              "conditions": [
                "$request.customersBankInfo.bankName",
                "isNotNull"
              ],
              "false": {
                "operation": "setData",
                "stateKey": "bnk_name",
                "value": ""
              },
              "true": {
                "operation": "setData",
                "stateKey": "bnk_name",
                "value": "$request.customersBankInfo.bankName"
              }
            },
            {
              "conditions": [
                "$request.customersBankInfo.accountNumber",
                "isNotNull"
              ],
              "false": {
                "operation": "setData",
                "stateKey": "acct_number",
                "value": ""
              },
              "true": {
                "operation": "setData",
                "stateKey": "acct_number",
                "value": "$request.customersBankInfo.accountNumber"
              }
            },
            {
              "conditions": [
                "$request.customersBankInfo.bankBranch",
                "isNotNull"
              ],
              "false": {
                "operation": "setData",
                "stateKey": "bnk_branch",
                "value": ""
              },
              "true": {
                "operation": "setData",
                "stateKey": "bnk_branch",
                "value": "$request.customersBankInfo.bankBranch"
              }
            },
            {
              "conditions": [
                "$request.customersBankInfo.bankIfsc",
                "isNotNull"
              ],
              "false": {
                "operation": "setData",
                "stateKey": "bnk_ifsc",
                "value": ""
              },
              "true": {
                "operation": "setData",
                "stateKey": "bnk_ifsc",
                "value": "$request.customersBankInfo.bankIfsc"
              }
            }
          ],
          "getCoapplicant": [
            {
              "conditions": [
                "$request.coApplicant.name",
                "isNotNull"
              ],
              "true": {
                "operation": "setData",
                "stateKey": "co_app_name",
                "value": "$request.coApplicant.name"
              }
            },
            {
              "conditions": [
                "$request.coApplicant.name",
                "isNotNull"
              ],
              "true": {
                "operation": "setData",
                "stateKey": "co_app_pan_card",
                "value": "$request.coApplicant.panNumber"
              }
            },
            {
              "conditions": [
                "$request.coApplicant.name",
                "isNotNull"
              ],
              "true": {
                "operation": "setData",
                "stateKey": "co_app_email",
                "value": "$request.coApplicant.email"
              }
            },
            {
              "conditions": [
                "$request.coApplicant.name",
                "isNotNull"
              ],
              "false": {
                "operation": "setData",
                "stateKey": "co_app_phone",
                "value": ""
              },
              "true": {
                "operation": "setData",
                "stateKey": "co_app_phone",
                "value": "$request.coApplicant.phone"
              }
            },
            {
              "conditions": [
                "$request.coApplicant.name",
                "isNotNull"
              ],
              "true": {
                "operation": "setData",
                "stateKey": "co_app_dob",
                "value": "$request.coApplicant.dateofBirth"
              }
            },
            {
              "conditions": [
                "$request.coApplicant.relationShip",
                "isNotNull"
              ],
              "true": {
                "operation": "setData",
                "stateKey": "co_app_relationship",
                "value": "$request.coApplicant.relationShip"
              }
            }
          ],
          "applicationCreation": [
            {
              "operation": "query",
              "table": "customers",
              "queryType": "insert",
              "values": {
                "name": "$request.name",
                "email": "$request.email",
                "mobile_number": "$request.communicationMobileNumber",
                "gender": "$request.gender",
                "pan_card": "$request.panNumber",
                "dob": "$request.dateofBirth",
                "marital_status": "$marital_status",
                "is_verified": "0",
                "created_at": "datetime.CUR_TIMESTAMP",
                "updated_at": "datetime.CUR_TIMESTAMP"
              },
              "auto_id": "id"
            },
            {
              "conditions": [
                "$request.coApplicant.name",
                "isNotNull"
              ],
              "true": {
                "operation": "query",
                "table": "customers",
                "queryType": "insert",
                "values": {
                  "name": "$request.coApplicant.name",
                  "email": "$request.coApplicant.email",
                  "mobile_number": "$request.coApplicant.phone",
                  "gender": "$request.coApplicant.gender",
                  "pan_card": "$request.coApplicant.panNumber",
                  "dob": "$request.coApplicant.dateofBirth",
                  "is_verified": "0",
                  "created_at": "datetime.CUR_TIMESTAMP",
                  "updated_at": "datetime.CUR_TIMESTAMP"
                },
                "auto_id": "co_app_id"
              }
            },
            {
              "operation": "query",
              "table": "consumer_application",
              "queryType": "insert",
              "values": {
                "loan_amount": "$request.loanAmount",
                "offer_id": "$request.offerId",
                "company_name": "get_company_id->$request.profession.professionDetails.company",
                "current_address_state": "get_state->$current_address.state",
                "name": "$request.name",
                "mobile_number": "encrypt->$request.communicationMobileNumber",
                "email": "encrypt->$request.email",
                "gender": "$gender",
                "applicant_id": "$customers_id",
                "co_applicant_id": "$customers_co_app_id",
                "marital_status": "$marital_status",
                "dob": "$request.dateofBirth",
                "pan_card": "encrypt->$request.panNumber",
                "aadhaar_card": "encrypt->$request.aadharNumber",
                "current_address_line_1": "$currentAddressMerge",
                "current_address_landmark": "$current_address.landmark",
                "current_address_city": "$current_address.city",
                "current_address_pincode": "$current_address.pincode",
                "current_address_status": "$current_address.addressStatus",
                "state": "in-process",
                "updated_by": "MERCHANT API",
                "lender_id": 2,
                "merchant_id": "$merchant_id",
                "created_at": "datetime.CUR_TIMESTAMP",
                "updated_at": "datetime.CUR_TIMESTAMP",
                "employee_status": "$profession_type",
                "work_address_line_1": "$request.profession.professionDetails.companyAddress",
                "work_address_landmark": "$request.profession.professionDetails.landmark",
                "work_address_city": "$request.profession.professionDetails.city",
                "work_address_state": "get_state->$request.profession.professionDetails.state",
                "work_address_pincode": "$request.profession.professionDetails.pincode",
                "co_applicant_name": "$co_app_name",
                "co_applicant_mobile_number": "encrypt->$co_app_phone",
                "co_applicant_email": "encrypt->$co_app_email",
                "co_applicant_gender": "$co_app_gender",
                "co_applicant_dob": "$co_app_dob",
                "co_applicant_pan_card": "encrypt->$co_app_pan_card",
                "co_applicant_relationship": "$co_app_relationship",
                "permanent_address_line_1": "$permanentAddressMerge",
                "permanent_address_landmark": "$permanent_address.landmark",
                "permanent_address_city": "$permanent_address.city",
                "permanent_address_state": "get_state->$permanent_address.state",
                "permanent_address_pincode": "$permanent_address.pincode",
                "permanent_address_status": "$permanent_address.addressStatus",
                "monthly_income": "$request.profession.professionDetails.monthlyIncome",
                "purpose": "$merchant_details.category_id"
              },
              "auto_id": "id"
            }
          ]
        },
        "persistence": [
          {
            "table": "consumer_application_element",
            "queryType": "insert",
            "values": {
              "preferred_language": "$language",
              "center_id": "$center_number",
              "reference_name_1": "$request.references[0].name",
              "reference_contact_1": "$request.references[0].phone",
              "reference_relation_1": "$request.references[0].relation",
              "reference_name_2": "$request.references[1].name",
              "reference_contact_2": "$request.references[1].phone",
              "reference_relation_2": "$request.references[1].relation",
              "work_email": "$request.profession.professionDetails.companyEmail",
              "contact": "$request.profession.professionDetails.companyPhone",
              "designation": "$request.profession.professionDetails.designation",
              "department": "$request.profession.professionDetails.department",
              "unique_id_number": "$request.uniqueCustomerId",
              "created_at": "datetime.CUR_TIMESTAMP",
              "inverter": "$request.inverterToBeInstalled",
              "panel": "$request.panelToBeInstalled",
              "inverter_monthly_power_bill": "$request.monthlyPowerBill",
              "inverter_KW_installation": "$request.kwInstallation",
              "inverter_gross_project_amount": "$request.grossProjectValue",
              "inverter_subsidy_amount": "$request.subsidyAmount",
              "inverter_power_savings": "$inverter_power_savings",
              "installation_address_line_1": "$installationAddressMerge",
              "installation_address_landmark": "$installation_address.landmark",
              "installation_address_city": "$installation_address.city",
              "installation_address_pincode": "$installation_address.pincode",
              "installation_address_status": "$installation_address.addressStatus",
              "installation_address_state": "get_state->$installation_address.state",
              "application_id": "$consumer_application_id",
              "type_of_customer": "$request.typeOfCustomer",
              "solar_power_type": "$request.solarPowerType",
              "father_name": "$request.fatherName",
              "applicant_religion": "$request.applicantReligion",
              "type_of_customer_application": "$request.typeOfCustomerApplication"
            }
          },
          {
            "table": "consumer_application_additional",
            "queryType": "insert",
            "values": {
              "application_id": "$consumer_application_id",
              "initial_applied_tenure": "$request.offerId",
              "created_at": "datetime.CUR_TIMESTAMP",
              "is_comm_no_linked_to_aadhar": "$isAadharLinkedMobile",
              "aadhar_linked_mobile": "$request.aadharLinkedMobileNumber"
            }
          },
          {
            "conditions": [
              "$request.customersBankInfo.accountHolder",
              "isNotNull"
            ],
            "true": {
              "table": "bank",
              "queryType": "insert",
              "values": {
                "application_id": "$consumer_application_id",
                "applicant_type": 1,
                "name": "$acct_holder",
                "account_type": "$account_type",
                "bank_name": "$bnk_name",
                "account_number": "encrypt->$acct_number",
                "branch_name": "$bnk_branch",
                "ifsc_code": "$bnk_ifsc",
                "created_at": "datetime.CUR_TIMESTAMP"
              }
            }
          },
          {
            "table": "pro_forma_invoice",
            "queryType": "insert",
            "values": {
              "application_id": "$consumer_application_id",
              "loan_application_no": "get_loan_application_number->$consumer_application_id,$merchant_id",
              "created_at": "datetime.CUR_TIMESTAMP"
            }
          },
          {
            "table": "bre_service_application_details",
            "queryType": "insert",
            "values": {
              "application_id": "$consumer_application_id",
              "bank_name": "$request.customersBankInfo.bankName",
              "bank_account_type": "$request.customersBankInfo.accountType",
              "document_ocr": "json_dumps->$request.documentOCRDetails",
              "created_at": "datetime.CUR_TIMESTAMP"
            }
          },
          {
            "queryType": "insert",
            "table": "status_logs",
            "values": {
              "application_id": "$consumer_application_id",
              "user_id": "107",
              "status": "in-process",
              "created_at": "datetime.CUR_TIMESTAMP"
            }
          }
        ]
      }
    },
    "/customerRest/documentSrv/uploadDocument": {
      "post": {
        "tags": [
          "Mconnect Loan Details"
        ],
        "requestBody": {
          "content": {
            "type": "object",
            "properties": {
              "applicationNo": {
                "type": [
                  "string"
                ],
                "minLength": 4,
                "message": {
                  "return_code": "201002",
                  "message": "Loan application Number is required in the correct format",
                  "pattern": "",
                  "CF_code": "CF300"
                }
              },
              "applicantType": {
                "type": [
                  "number"
                ],
                "enum": [
                  1,
                  2
                ],
                "minLength": 1,
                "message": {
                  "return_code": "201002",
                  "message": "Applicant Type is required in the correct format",
                  "pattern": "",
                  "CF_code": "CF300"
                }
              },
              "docCategory": {
                "description": "Error",
                "type": [
                  "string"
                ],
                "enum": [
                  "KYC",
                  "Banking",
                  "Profession",
                  "Oth"
                ],
                "minLength": 3,
                "message": {
                  "return_code": "201002",
                  "message": "Document category is required in the correct format",
                  "CF_code": "CF300",
                  "pattern": ""
                }
              },
              "custDocIssuedCountry": {
                "description": "Error",
                "type": [
                  "string"
                ],
                "minLength": 1,
                "message": {
                  "return_code": "201002",
                  "message": "Document issued country is required in the correct format",
                  "pattern": "",
                  "CF_code": "CF300"
                }
              },
              "custDocIssuedAuth": {
                "description": "Error",
                "type": [
                  "string"
                ],
                "minLength": 3,
                "message": {
                  "return_code": "201002",
                  "message": "Document issued authority is required in the correct format",
                  "CF_code": "CF300",
                  "pattern": ""
                }
              },
              "docFormat": {
                "description": "Error",
                "type": [
                  "string"
                ],
                "enum": [
                  "jpg",
                  "gif",
                  "mp4",
                  "jpeg",
                  "png",
                  "bmp",
                  "tif",
                  "tiff",
                  "xlsx",
                  "xls",
                  "pdf",
                  "txt",
                  "odt",
                  "xml"
                ],
                "minLength": 3,
                "message": {
                  "return_code": "201002",
                  "message": "Document format is required in the correct format",
                  "CF_code": "CF300",
                  "pattern": ""
                }
              },
              "docRefId": {
                "description": "Error",
                "type": [
                  "string"
                ],
                "message": {
                  "return_code": "201002",
                  "message": "Document reference id is required in the correct format.",
                  "CF_code": "CF300",
                  "pattern": ""
                }
              },
              "custDocIssuedOn": {
                "description": "Error",
                "type": [
                  "string",
                  "null"
                ],
                "pattern": "^\\d{4}\\-(0?[1-9]|1[012])\\-(0?[1-9]|[12][0-9]|3[01])$",
                "message": {
                  "return_code": "201002",
                  "message": "Customer document issued on date is required in the correct format.",
                  "CF_code": "CF300",
                  "pattern": ""
                }
              },
              "custDocExpDate": {
                "description": "Error",
                "type": [
                  "string",
                  "null"
                ],
                "pattern": "^\\d{4}\\-(0?[1-9]|1[012])\\-(0?[1-9]|[12][0-9]|3[01])$",
                "message": {
                  "return_code": "201002",
                  "message": "Customer document expiry date is required in the correct format.",
                  "CF_code": "CF300",
                  "pattern": ""
                }
              },
              "custDocPassword": {
                "description": "Error",
                "type": [
                  "string"
                ],
                "message": {
                  "return_code": "201002",
                  "message": "Document password is required in the correct format.",
                  "CF_code": "CF300",
                  "pattern": ""
                }
              },
              "docName": {
                "description": "Error",
                "type": [
                  "string"
                ],
                "enum": [
                  "PAN",
                  "SECURITY_CHEQUE",
                  "APPLICANT_PHOTO",
                  "APPLICANT_AADHAAR_FRONT",
                  "APPLICANT_AADHAAR_BACK",
                  "ELECTRICITY_BILL",
                  "GAS_BILL",
                  "PASSPORT",
                  "BANK_STATEMENT",
                  "SALARY_SLIP",
                  "ITR",
                  "MCA",
                  "MCA",
                  "UTILITY_BILL_VALIDATION",
                  "CPV",
                  "ENACH",
                  "RENT_AGREEMENT",
                  "SALE_DEED",
                  "SHOP_ACT",
                  "GST_CERTIFICATE",
                  "CO_APPLICANT_BANK_STATEMENT_3",
                  "CO_APPLICANT_PAN",
                  "CO_APPLICANT_AADHAAR_FRONT",
                  "CO_APPLICANT_AADHAAR_BACK",
                  "CO_APPLICANT_PHOTO",
                  "PASSBOOK",
                  "AADHAR_XML",
                  "TFR",
                  "SOLAR_QUOTATION",
                  "ADVANCE_AMOUNT_RECEIPT",
                  "OTH",
                  "UDYOG_AADHAR_CERTIFICATE",
                  "FORM_16",
                  "STATEMENT_OF_ACCOUNT",
                  "EMI_DEDUCTION_BANK_STATEMENT",
                  "PROPERTY_TAX_INVOICE",
                  "PROPERTY_OWNERSHIP_PROOF",
                  "VOTAR_ID_FRONT",
                  "VOTAR_ID_BACK",
                  "INVOICE",
                  "NET_METERING_AGREEMENT",
                  "DCR_CERTIFICATE"
                ],
                "minLength": 1,
                "message": {
                  "return_code": "201002",
                  "message": "Document name is required in the correct format",
                  "CF_code": "CF300",
                  "pattern": ""
                }
              },
              "docContent": {
                "description": "Error",
                "type": [
                  "string"
                ],
                "minLength": 1,
                "message": {
                  "return_code": "201002",
                  "message": "Base64 encoded document is required in the correct format",
                  "CF_code": "CF300",
                  "pattern": ""
                }
              }
            },
            "required": [
              "applicationNo",
              "applicantType",
              "docCategory",
              "custDocIssuedCountry",
              "custDocIssuedAuth",
              "docFormat",
              "docRefId",
              "docName",
              "docContent"
            ]
          }
        },
        "responses": {
          "CF300": {
            "content": {
              "application/json": {
                "request_id": "$request_id",
                "returnStatus": {
                  "returnCode": "$response.return_code",
                  "returnText": "$response.message"
                }
              },
              "status_code": 400
            },
            "actions": [
              {
                "operation": "query",
                "queryType": "update",
                "table": "merchant_api_request",
                "clause": {
                  "where": [
                    "id"
                  ],
                  "queryParams": [
                    "$merchant_api_request_id"
                  ]
                },
                "values": {
                  "response": "json_dumps->$response",
                  "request_id": "$request_id",
                  "updated_at": "datetime.CUR_TIMESTAMP"
                }
              }
            ]
          },
          "CF200": {
            "content": {
              "application/json": {
                "request_id": "$request_id",
                "returnStatus": {
                  "returnCode": "000000",
                  "returnText": "Document uploaded successfully"
                }
              },
              "status_code": 200
            },
            "actions": [
              {
                "operation": "query",
                "queryType": "update",
                "table": "merchant_api_request",
                "clause": {
                  "where": [
                    "id"
                  ],
                  "queryParams": [
                    "$merchant_api_request_id"
                  ]
                },
                "values": {
                  "response": "json_dumps->$response",
                  "request_id": "$request_id",
                  "updated_at": "datetime.CUR_TIMESTAMP"
                }
              }
            ]
          }
        },
        "functions": {
          "init": [
            {
              "operation": "setData",
              "value": null,
              "stateKey": "is_masked"
            },
            {
              "operation": "setData",
              "stateKey": "request_id",
              "value": "UUID"
            },
            {
              "operation": "query",
              "queryType": "insert",
              "table": "merchant_api_request",
              "values": {
                "created_at": "datetime.CUR_TIMESTAMP",
                "merchant_id": "$merchant_details.id",
                "request": "json_dumps->$request"
              },
              "auto_id": "id"
            },
            {
              "operation": "mapData",
              "stateKey": "doc_name",
              "key": "$request.docName",
              "enum": {
                "AADHAR_XML": "aadhar_xml",
                "ADVANCE_AMOUNT_RECEIPT": "advance_amount_receipt",
                "APPLICANT_AADHAAR_BACK": "aadhar_card_back",
                "APPLICANT_AADHAAR_FRONT": "aadhar_card",
                "APPLICANT_PHOTO": "customer_photo",
                "BANK_STATEMENT": "bank_statement",
                "BANK_STATEMENT_2": "bank_statement_2",
                "BANK_STATEMENT_3": "bank_statement_3",
                "BANK_STATEMENT_4": "bank_statement_4",
                "BANK_STATEMENT_5": "bank_statement_5",
                "BANK_STATEMENT_6": "bank_statement_6",
                "CO_APPLICANT_AADHAAR_BACK": "co_applicant_aadhar_card_back",
                "CO_APPLICANT_AADHAAR_FRONT": "co_applicant_aadhar_card",
                "CO_APPLICANT_BANK_STATEMENT": "co_applicant_bank_statement",
                "CO_APPLICANT_PAN": "co_applicant_pan_card",
                "CO_APPLICANT_PHOTO": "co_applicant_customer_photo",
                "CPV": "cpv",
                "DCR_CERTIFICATE": "dcr_certificate",
                "ELECTRICITY_BILL": "electricity_bill",
                "EMI_DEDUCTION_BANK_STATEMENT": "emi_deduction_bank_statement",
                "FORM_16": "form_16",
                "GAS_BILL": "gas_bill",
                "GST_CERTIFICATE": "gst_certificate",
                "INVOICE": "invoice",
                "ITR": "itr",
                "MCA": "mca",
                "NET_METERING_AGREEMENT": "net_metering_agreement",
                "OTH": "other",
                "PAN": "pan_card",
                "PASSBOOK": "passbook_copy",
                "PASSPORT": "passport",
                "PROPERTY_OWNERSHIP_PROOF": "property_ownership_proof",
                "PROPERTY_TAX_INVOICE": "property_tax_invoice",
                "RENT_AGREEMENT": "rent_agreement",
                "SALARY_SLIP": "salary_slip",
                "SALE_DEED": "sale_deed",
                "SECURITY_CHEQUE": "security_cheques",
                "SHOP_ACT": "shop_act",
                "SOLAR_QUOTATION": "proforma",
                "STATEMENT_OF_ACCOUNT": "statement_of_account",
                "TFR": "tfr",
                "UDYOG_AADHAR_CERTIFICATE": "udyog_aadhar_certificate",
                "UTILITY_BILL_VALIDATION": "utilitybillvalidation",
                "VOTAR_ID_BACK": "votar_id_back",
                "VOTAR_ID_FRONT": "votar_id_front"
              }
            }
          ],
          "getIdByApplicationNo": [
            {
              "operation": "query",
              "name": "getidbyapplicationno",
              "queryType": "select",
              "table": "pro_forma_invoice",
              "columns": [
                "application_id"
              ],
              "clause": {
                "where": [
                  "loan_application_no"
                ],
                "queryParams": [
                  "$request.applicationNo"
                ]
              },
              "ordering": {
                "sorting": "DESC",
                "column": "created_at"
              },
              "stateKey": "application_id"
            },
            {
              "conditions": [
                "$application_id",
                "isNotNull"
              ],
              "false": {
                "operation": "returnResponse",
                "return_code": "201003",
                "CF_code": "CF300",
                "message": "Loan Application Number Not Exist"
              }
            }
          ],
          "uploadDocument": [
            {
              "operation": "setData",
              "stateKey": "applicantType",
              "value": "$request.applicantType"
            },
            {
              "conditions": [
                "$doc_name",
                "equals",
                "pan_card"
              ],
              "true": {
                "operation": "concat",
                "values": [
                  "$application_id",
                  "/",
                  "$applicantType",
                  "/",
                  "$doc_name",
                  ".",
                  "$request.docFormat"
                ],
                "stateKey": "s3_path"
              },
              "false": {
                "operation": "concat",
                "values": [
                  "$application_id",
                  "/",
                  "$doc_name",
                  ".",
                  "$request.docFormat"
                ],
                "stateKey": "s3_path"
              }
            },
            {
              "operation": "s3Upload",
              "contentKey": "$request.docContent",
              "path": "$s3_path",
              "stateKey": "doc_upload_status"
            },
            {
              "conditions": [
                "$doc_name",
                "equals",
                "bank_statement"
              ],
              "true": [
                {
                  "operation": "query",
                  "queryType": "raw",
                  "dbRaw": "SELECT COUNT(*) as cnt FROM consumer_application_files WHERE consumer_application_id = %s AND file_type = 'bank_statement' AND applicant_type = %s AND deleted_at is null",
                  "queryParams": [
                    "$application_id",
                    "$applicantType"
                  ],
                  "stateKey": "bank_statement_count"
                },
                {
                  "conditions": [
                    "$bank_statement_count.cnt",
                    "lesserThan",
                    "4"
                  ],
                  "true": [
                    {
                      "operation": "setData",
                      "stateKey": "pirimid_api_result-new",
                      "value": "uploadPirimidDocument->$application_id,$applicantType,$request.docContent,$request.docFormat,$request.custDocPassword"
                    }
                  ]
                }
              ]
            },
            {
              "conditions": [
                "$doc_name",
                "in",
                "['aadhar_card','aadhar_card_back','co_applicant_aadhar_card','co_applicant_aadhar_card_back']"
              ],
              "true": [
                {
                  "operation": "query",
                  "queryType": "raw",
                  "dbRaw": "SELECT COUNT(*) as cnt FROM consumer_application_files WHERE consumer_application_id = %s AND file_type = %s AND applicant_type = %s AND deleted_at is null",
                  "queryParams": [
                    "$application_id",
                    "doc_name",
                    "$applicantType"
                  ],
                  "stateKey": "aadhar_count"
                },
                {
                  "conditions": [
                    "$aadhar_count.cnt",
                    "lesserThan",
                    "3"
                  ],
                  "true": [
                    {
                      "operation": "setData",
                      "stateKey": "mask_result",
                      "value": "MaskAadhar->$application_id,$applicantType,$request.docContent,$doc_name,$request.docFormat"
                    }
                  ]
                }
              ]
            },
            {
              "conditions": [
                "$mask_result.status",
                "equals",
                "success"
              ],
              "true": {
                "operation": "setData",
                "value": 1,
                "stateKey": "is_masked"
              },
              "false": {
                "operation": "setData",
                "value": 0,
                "stateKey": "is_masked"
              }
            },
            {
              "conditions": [
                "$mask_result.s3_key",
                "isNotNull"
              ],
              "true": {
                "operation": "setData",
                "stateKey": "s3_path",
                "value": "$mask_result.s3_key"
              }
            },
            {
              "conditions": [
                "$doc_name",
                "equals",
                "advance_amount_receipt"
              ],
              "true": [
                {
                  "operation": "setData",
                  "value": "get_comment_tag->",
                  "stateKey": "comment_tag"
                },
                {
                  "operation": "concat",
                  "stateKey": "comment_text",
                  "values": [
                    "$comment_tag",
                    " Advance amount receipt is received"
                  ]
                }
              ]
            },
            {
              "conditions": [
                "$doc_upload_status",
                "equals",
                "False"
              ],
              "true": {
                "operation": "returnResponse",
                "message": "Base64 encoding issue",
                "CF_code": "CF300",
                "return_code": "201002"
              }
            }
          ],
          "moveToDCD": [
            {
              "conditions": [
                "$doc_name",
                "in",
                "['tfr', 'proforma']"
              ],
              "true": [
                {
                  "operation": "setData",
                  "stateKey": "dcd_check",
                  "value": "disbursement_checklist_check->$application_id,$merchant_details.id"
                },
                {
                  "conditions": [
                    "$dcd_check",
                    "equals",
                    true
                  ],
                  "true": [
                    {
                      "operation": "concat",
                      "values": [
                        "{'is_reversed_status': 0,",
                        "'id': '",
                        "$application_id",
                        "','status': 'disbursement checklist done',",
                        "'previous_status': 'approved',",
                        "'auth_user_id': 107,",
                        "'lender_id': 2,",
                        "'log_decision': 'true',",
                        "'request_ap_id': '",
                        "$request_ap_id",
                        "'}"
                      ],
                      "stateKey": "payload"
                    }
                  ]
                }
              ]
            }
          ],
          "quotationCheck": [
            {
              "conditions": [
                "$doc_name",
                "equals",
                "proforma"
              ],
              "true": {
                "operation": "setData",
                "stateKey": "created_by",
                "value": 107
              }
            }
          ],
          "runEBillWorkflow": [
            {
              "conditions": [
                "$doc_name",
                "equals",
                "electricity_bill"
              ],
              "true": [
                {
                  "operation": "concat",
                  "values": [
                    "{'id':'",
                    "$application_id",
                    "'file_path': '",
                    "$s3_path",
                    "'}"
                  ],
                  "stateKey": "workflowPayload"
                }
              ]
            }
          ]
        },
        "persistence": [
          {
            "table": "consumer_application_files",
            "queryType": "insert",
            "values": {
              "consumer_application_id": "$application_id",
              "file_type": "$doc_name",
              "file_path": "$s3_path",
              "created_at": "datetime.CUR_TIMESTAMP",
              "applicant_type": "$applicantType",
              "cust_doc_no": "$request.custDocNo",
              "doc_category": "$request.docCategory",
              "cust_doc_issued_country": "$request.custDocIssuedCountry",
              "cust_doc_issued_auth": "$request.custDocIssuedAuth",
              "doc_ref_id": "$request.docRefId",
              "cust_doc_issued_on": "$request.custDocIssuedOn",
              "cust_doc_exp_date": "$request.custDocExpDate",
              "password": "$request.custDocPassword",
              "created_by": "$created_by",
              "is_masked": "$is_masked"
            }
          },
          {
            "conditions": [
              "$dcd_check",
              "equals",
              true
            ],
            "true": {
              "queryType": "insert",
              "table": "status_logs",
              "values": {
                "application_id": "$application_id",
                "user_id": "107",
                "status": "disbursement checklist done",
                "created_at": "datetime.CUR_TIMESTAMP"
              }
            }
          },
          {
            "conditions": [
              "$dcd_check",
              "equals",
              true
            ],
            "true": {
              "queryType": "update",
              "table": "consumer_application",
              "clause": {
                "where": [
                  "id"
                ],
                "queryParams": [
                  "$application_id"
                ]
              },
              "values": {
                "state": "disbursement checklist done"
              }
            }
          },
          {
            "conditions": [
              "$dcd_check",
              "equals",
              true
            ],
            "true": {
              "table": "jobs",
              "queryType": "insert",
              "values": {
                "`from`": "statusChange",
                "payload": "json_dumps->$payload",
                "application_id": "$application_id",
                "available_at": "datetime.CUR_TIMESTAMP",
                "created_at": "datetime.CUR_TIMESTAMP",
                "updated_at": "datetime.CUR_TIMESTAMP"
              }
            }
          },
          {
            "conditions": [
              "$workflowPayload",
              "isNotNull"
            ],
            "true": {
              "table": "jobs",
              "queryType": "insert",
              "values": {
                "`from`": "run_ebill_ocr_workflow",
                "payload": "json_dumps->$workflowPayload",
                "application_id": "$application_id",
                "available_at": "datetime.CUR_TIMESTAMP",
                "created_at": "datetime.CUR_TIMESTAMP",
                "updated_at": "datetime.CUR_TIMESTAMP"
              }
            }
          },
          {
            "conditions": [
              "$doc_name",
              "equals",
              "advance_amount_receipt"
            ],
            "true": {
              "table": "comments",
              "queryType": "insert",
              "values": {
                "application_id": "$application_id",
                "user_id": 107,
                "comment": "$comment_text",
                "show_consumer": 0,
                "show_merchant": 0,
                "created_at": "datetime.CUR_TIMESTAMP",
                "updated_at": "datetime.CUR_TIMESTAMP",
                "type": "consumer"
              }
            }
          }
        ]
      }
    },
    "/customerRest/customerSrv/save-consent": {
      "post": {
        "requestBody": {
          "content": {
            "type": "object",
            "properties": {
              "applicationLoanNo": {
                "type": [
                  "string"
                ],
                "minLength": 4,
                "message": {
                  "return_code": "201002",
                  "message": "Loan Number is required in the correct format",
                  "pattern": "",
                  "CF_code": "CF300"
                }
              },
              "applicant_type": {
                "type": [
                  "number"
                ],
                "enum": [
                  1,
                  2
                ],
                "minLength": 1,
                "message": {
                  "return_code": "201002",
                  "message": "Applicant Type is required in the correct format",
                  "pattern": "",
                  "CF_code": "CF300"
                }
              },
              "latitude": {
                "type": [
                  "string"
                ],
                "message": {
                  "return_code": "201002",
                  "message": "Latitude is required as string",
                  "CF_code": "CF300",
                  "pattern": ""
                }
              },
              "longitude": {
                "type": [
                  "string"
                ],
                "message": {
                  "return_code": "201002",
                  "message": "Longitude is required as string",
                  "CF_code": "CF300",
                  "pattern": ""
                }
              },
              "ip": {
                "type": [
                  "string",
                  "null"
                ],
                "message": {
                  "return_code": "201002",
                  "message": "IP is required as string",
                  "CF_code": "CF300",
                  "pattern": ""
                }
              },
              "status": {
                "type": [
                  "string"
                ],
                "message": {
                  "return_code": "201002",
                  "message": "Status is required as string",
                  "CF_code": "CF300",
                  "pattern": ""
                }
              }
            },
            "required": [
              "applicationLoanNo",
              "applicant_type",
              "latitude",
              "longitude",
              "status",
              "ip"
            ]
          },
          "rules": {
            "data": [
              {
                "conditions": [
                  "$request.latitude",
                  "equals",
                  "null"
                ],
                "true": {
                  "operation": "returnResponse",
                  "return_code": "201004",
                  "CF_code": "CF300",
                  "message": "Null string is not allowed in latitude"
                }
              },
              {
                "conditions": [
                  "$request.longitude",
                  "equals",
                  "null"
                ],
                "true": {
                  "operation": "returnResponse",
                  "return_code": "201004",
                  "CF_code": "CF300",
                  "message": "Null string is not allowed in longitude"
                }
              }
            ]
          }
        },
        "responses": {
          "CF300": {
            "content": {
              "application/json": {
                "request_id": "$request_id",
                "returnStatus": {
                  "returnCode": "$response.return_code",
                  "returnText": "$response.message"
                }
              },
              "status_code": 400
            },
            "actions": [
              {
                "operation": "query",
                "queryType": "update",
                "table": "merchant_api_request",
                "clause": {
                  "where": [
                    "id"
                  ],
                  "queryParams": [
                    "$merchant_api_request_id"
                  ]
                },
                "values": {
                  "response": "json_dumps->$response",
                  "request_id": "$request_id",
                  "updated_at": "datetime.CUR_TIMESTAMP"
                }
              }
            ]
          },
          "CF200": {
            "content": {
              "application/json": {
                "request_id": "$request_id",
                "returnStatus": {
                  "returnCode": "000000",
                  "returnText": "Success"
                }
              },
              "status_code": 200
            },
            "actions": [
              {
                "operation": "query",
                "queryType": "update",
                "table": "merchant_api_request",
                "clause": {
                  "where": [
                    "id"
                  ],
                  "queryParams": [
                    "$merchant_api_request_id"
                  ]
                },
                "values": {
                  "response": "json_dumps->$response",
                  "request_id": "$request_id",
                  "updated_at": "datetime.CUR_TIMESTAMP"
                }
              }
            ]
          },
          "CF201": {
            "content": {
              "application/json": {
                "request_id": "$request_id",
                "returnStatus": {
                  "returnCode": "$response.return_code",
                  "returnText": "$response.message"
                }
              },
              "status_code": 200
            },
            "actions": [
              {
                "operation": "query",
                "queryType": "update",
                "table": "merchant_api_request",
                "clause": {
                  "where": [
                    "id"
                  ],
                  "queryParams": [
                    "$merchant_api_request_id"
                  ]
                },
                "values": {
                  "response": "json_dumps->$response",
                  "request_id": "$request_id",
                  "updated_at": "datetime.CUR_TIMESTAMP"
                }
              }
            ]
          }
        },
        "functions": {
          "init": [
            {
              "operation": "setData",
              "stateKey": "request_id",
              "value": "UUID"
            },
            {
              "operation": "query",
              "queryType": "insert",
              "table": "merchant_api_request",
              "values": {
                "created_at": "datetime.CUR_TIMESTAMP",
                "merchant_id": "$merchant_details.id",
                "request": "json_dumps->$request"
              },
              "auto_id": "id"
            },
            {
              "conditions": [
                "$request.ip",
                "isNotNull"
              ],
              "false": {
                "operation": "setData",
                "value": "UNKNOWN",
                "stateKey": "ip"
              },
              "true": {
                "operation": "setData",
                "value": "$request.ip",
                "stateKey": "ip"
              }
            }
          ],
          "getIdByApplicationNo": [
            {
              "operation": "query",
              "name": "getidbyapplicationno",
              "queryType": "select",
              "table": "pro_forma_invoice",
              "columns": [
                "application_id"
              ],
              "clause": {
                "where": [
                  "loan_application_no"
                ],
                "queryParams": [
                  "$request.applicationLoanNo"
                ]
              },
              "ordering": {
                "sorting": "DESC",
                "column": "created_at"
              },
              "stateKey": "application_id"
            },
            {
              "conditions": [
                "$application_id",
                "isNotNull"
              ],
              "false": {
                "operation": "returnResponse",
                "return_code": "201003",
                "CF_code": "CF300",
                "message": "Loan Application Number Not Exist"
              }
            }
          ],
          "checkConsentExists": [
            {
              "operation": "query",
              "queryType": "select",
              "table": "consent_log",
              "columns": [
                "application_id"
              ],
              "clause": {
                "where": [
                  "application_id",
                  "applicant_type"
                ],
                "logicalOperator": "AND",
                "queryParams": [
                  "$application_id",
                  "$request.applicant_type"
                ]
              },
              "stateKey": "consent_exists"
            },
            {
              "conditions": [
                "$consent_exists",
                "isNotNull"
              ],
              "true": {
                "operation": "returnResponse",
                "CF_code": "CF201",
                "return_code": "201002",
                "message": "Consent already exists"
              }
            },
            {
              "operation": "concat",
              "values": [
                "{'application_id': '",
                "$application_id",
                "', 'applicant_type': '",
                "$request.applicant_type",
                "'}"
              ],
              "stateKey": "payload"
            }
          ],
          "checkCoApplicantExists": [
            {
              "operation": "setData",
              "stateKey": "createQueue",
              "value": "checkQueueConditions->$application_id,$request.applicant_type"
            }
          ],
          "queueLog": [
            {
              "operation": "concat",
              "values": [
                "{'cmd':'command:PSUDecision','con':'PSUDecision','param':{'id':'",
                "$application_id",
                "','merchant_id':",
                "$merchant_details.id",
                "},'job_handler':'App\\\\Helpers\\\\CmdHelper@runCommand'}"
              ],
              "stateKey": "queue_input"
            },
            {
              "operation": "setData",
              "stateKey": "json_queue_input",
              "value": "json_dumps->$queue_input"
            }
          ]
        },
        "persistence": [
          {
            "conditions": [
              "$request.applicant_type",
              "equals",
              2
            ],
            "true": {
              "queryType": "update",
              "table": "consumer_application_element",
              "clause": {
                "where": [
                  "application_id"
                ],
                "queryParams": [
                  "$application_id"
                ]
              },
              "values": {
                "is_co_app_consent": 1
              }
            },
            "false": {
              "queryType": "update",
              "table": "consumer_application_element",
              "clause": {
                "where": [
                  "application_id"
                ],
                "queryParams": [
                  "$application_id"
                ]
              },
              "values": {
                "is_consent": 1
              }
            }
          },
          {
            "table": "consent_log",
            "queryType": "insert",
            "values": {
              "application_id": "$application_id",
              "ips": "$ip",
              "latitude": "$request.latitude",
              "longitude": "$request.longitude",
              "status": "1",
              "type": "bureau & KYC",
              "applicant_type": "$request.applicant_type",
              "created_at": "datetime.CUR_TIMESTAMP",
              "updated_at": "datetime.CUR_TIMESTAMP"
            }
          },
          {
            "table": "jobs",
            "queryType": "insert",
            "values": {
              "`from`": "preEligibilityConsent",
              "payload": "json_dumps->$payload",
              "application_id": "$application_id",
              "available_at": "datetime.CUR_TIMESTAMP",
              "created_at": "datetime.CUR_TIMESTAMP",
              "updated_at": "datetime.CUR_TIMESTAMP"
            }
          },
          {
            "conditions": [
              "$createQueue",
              "equals",
              true
            ],
            "true": {
              "queryType": "insert",
              "name": "autoDecisionQueueLogs",
              "table": "queue_log",
              "values": {
                "uid": "null",
                "status": "pen",
                "exchange": "job_exch",
                "route_key": "exch_rout_key_job",
                "job_handler": "App\\Helpers\\CmdHelper@runCommand",
                "input": "$json_queue_input",
                "attempt_count": "0",
                "created_at": "datetime.CUR_TIMESTAMP",
                "application_id": "$application_id"
              }
            }
          }
        ]
      }
    }
  }
}