{"basePath":"/","consumes":["application/json"],"definitions":{"AccessibleReportsSuccessfulResponse":{"properties":{"date_added":{"example":"2023-01-15","type":"string"},"id":{"example":"TEC-RW-1","type":"string"},"name":{"enum":["Technical","Finance","Retail","Portfolio","Repairs","Supply_Chain"],"example":"Technical","type":"string"},"url":{"example":"https://example.com/report","type":"string"}},"type":"object"},"BadRequestCreditScoreResponse":{"properties":{"message":{"example":"Invalid customer_odoo13_id format type","type":"string"},"status":{"example":400,"type":"integer"}},"type":"object"},"BadRequestPaymentPatternResponse":{"properties":{"error":{"example":"Internal Server Error","type":"string"},"status":{"example":400,"type":"integer"}},"type":"object"},"CommissionBadRequestResponse":{"properties":{"error":{"example":"Invalid commission date format. Accepted format is YYYY-MM-DD","type":"string"},"status":{"example":400,"type":"integer"}},"type":"object"},"CommissionItem":{"items":{"properties":{"agent_email":{"example":"example@email.com","format":"email","type":"string"},"base_commission":{"example":225.14,"format":"float","type":"number"},"commission_after_tax":{"example":250.442,"format":"float","type":"number"},"commission_date":{"example":"2023-11-03 18:15:18","format":"date-time","type":"string"},"commission_state":{"example":"draft","type":"string"},"commissions_with_supplement":{"example":0.0,"format":"float","type":"number"},"contract_reference":{"example":"BXCR33660567-04","type":"string"},"customer_name":{"example":"Example Customer","type":"string"},"stage":{"example":2,"type":"integer"},"supplement_added":{"example":50.0,"format":"float","type":"number"},"supplement_percentage":{"example":10.0,"format":"float","type":"number"},"tax":{"example":10.0,"format":"float","type":"number"},"unique_account_id":{"example":"BXCR33660567","type":"string"},"unique_commission_id":{"example":"BXCR33660567-04_2","type":"string"}},"type":"object"},"type":"array"},"CommissionNotFoundResponse":{"properties":{"message":{"example":"No commission found for sales agent example@email.com","type":"string"}},"type":"object"},"CommissionResponse":{"properties":{"data":{"$ref":"#/definitions/CommissionItem"},"pagination":{"$ref":"#/definitions/PaginationInfo"},"total_values":{"$ref":"#/definitions/total_values"}},"type":"object"},"CreditScoreHistoryBadRequestResponse":{"properties":{"message":{"example":"Invalid customer_odoo13_id format type","type":"string"},"status":{"example":400,"type":"integer"}},"type":"object"},"CreditScoreHistoryNotFoundResponse":{"properties":{"message":{"example":"Data not found for the specified customer_odoo13_id","type":"string"},"status":{"example":404,"type":"integer"}},"type":"object"},"CreditScoreHistorySuccessfulResponse":{"properties":{"customer_odoo13_id":{"example":"12345","type":"string"},"score":{"example":"0-999","type":"integer"},"score_date":{"example":"2000-01-01 00:00:00","format":"date-time","type":"string"}},"type":"object"},"ForbiddenResponse":{"properties":{"message":{"example":"Forbidden - Access Denied","type":"string"},"status":{"example":403,"type":"integer"}},"type":"object"},"InvalidTokenResponse":{"properties":{"message":{"example":"Unable to decode token / Token expired / Invalid token","type":"string"},"status":{"example":401,"type":"integer"}},"type":"object"},"NotFoundCreditScoreResponse":{"properties":{"message":{"example":"Data not found for the specified customer_odoo13_id","type":"string"},"status":{"example":404,"type":"integer"}},"type":"object"},"NotFoundPaymentPatternResponse":{"properties":{"message":{"example":"Data not found for the specified unique_account_id","type":"string"},"status":{"example":404,"type":"integer"}},"type":"object"},"PaginationInfo":{"properties":{"current_page":{"example":1,"type":"integer"},"next_page":{"example":2,"type":"integer"},"per_page":{"example":40,"type":"integer"},"prev_page":{"example":null,"type":"integer"},"total_pages":{"example":3,"type":"integer"},"total_records":{"example":91,"type":"integer"}},"type":"object"},"PaymentPatternItem":{"items":{"properties":{"account_id":{"example":"59ab6930f43ce08814260cadc4193e61","type":"string"},"class_labels":{"example":"MI","type":"string"},"label_end_date":{"example":"2024-11-24 00:00:00","format":"date-time","type":"string"},"label_start_date":{"example":"2024-08-27 00:00:00","format":"date-time","type":"string"},"model_version":{"example":"CNN_v4","type":"string"},"prediction_confidence":{"example":0.999,"format":"float","type":"number"},"unique_account_id":{"example":"BXCR33660567","type":"string"}},"type":"object"},"type":"array"},"PaymentPatternResponse":{"properties":{"data":{"$ref":"#/definitions/PaymentPatternItem"},"pagination":{"$ref":"#/definitions/PaginationInfo"}},"type":"object"},"SalesAgentBadRequestResponse":{"properties":{"message":{"example":"Invalid sales_person format type","type":"string"},"status":{"example":400,"type":"integer"}},"type":"object"},"SalesAgentNotFoundResponse":{"properties":{"message":{"example":"Data not found for the specified sales_person","type":"string"},"status":{"example":404,"type":"integer"}},"type":"object"},"SalesAgentPortfolioCommissionsInternalServerErrorResponse":{"properties":{"message":{"example":"An error occurred while processing your request","type":"string"},"status":{"example":500,"type":"integer"}},"type":"object"},"SalesAgentPortfolioCommissionsNotFoundResponse":{"properties":{"message":{"example":"Account manager 'manager@email.com' not found","type":"string"},"status":{"example":404,"type":"integer"}},"type":"object"},"SalesAgentPortfolioCommissionsSuccessfulResponse":{"properties":{"data":{"items":{"properties":{"account_manager":{"example":"manager@email.com","type":"string"},"active_accounts":{"example":100,"type":"integer"},"churned_accounts":{"example":3,"type":"integer"},"country":{"example":"burkina_faso","type":"string"},"defaulted_accounts":{"example":5,"type":"integer"},"eligible":{"example":true,"type":"boolean"},"paid_accounts":{"example":90,"type":"integer"},"par_120_accounts":{"example":2,"type":"integer"},"performance_metrics":{"properties":{"cumulative_churn_rate":{"properties":{"met_target":{"example":true,"type":"boolean"},"value":{"example":0.12,"format":"float","type":"number"}},"type":"object"},"linearized_collection_rate":{"properties":{"met_target":{"example":true,"type":"boolean"},"value":{"example":0.85,"format":"float","type":"number"}},"type":"object"},"portfolio_in_default":{"properties":{"met_target":{"example":true,"type":"boolean"},"value":{"example":0.03,"format":"float","type":"number"}},"type":"object"}},"type":"object"},"portfolio_commission":{"example":250.44,"format":"float","type":"number"},"portfolio_commission_after_tax":{"example":250.44,"format":"float","type":"number"},"tax_amount":{"example":183.75,"format":"float","type":"number"},"total_recurring_cash_collected":{"example":9500.0,"format":"float","type":"number"},"total_recurring_cash_expected":{"example":10000.0,"format":"float","type":"number"},"total_recurring_cash_used":{"example":9000.0,"format":"float","type":"number"},"week_monday_start":{"example":"2025-09-08","format":"date","type":"string"}},"type":"object"},"type":"array"},"pagination":{"properties":{"current_page":{"example":1,"type":"integer"},"has_next":{"example":true,"type":"boolean"},"has_prev":{"example":false,"type":"boolean"},"items_per_page":{"example":10,"type":"integer"},"total_items":{"example":100,"type":"integer"},"total_pages":{"example":10,"type":"integer"}},"type":"object"},"status":{"example":"success","type":"string"},"thresholds":{"properties":{"CCR_THRESHOLD":{"example":0.15,"format":"float","type":"number"},"LCR_THRESHOLD":{"example":0.5,"format":"float","type":"number"},"PID_THRESHOLD":{"example":0.2,"format":"float","type":"number"},"PRCC_THRESHOLD":{"example":0.05,"format":"float","type":"number"}},"type":"object"}},"type":"object"},"SalesAgentSuccessfulResponse":{"properties":{"adverse_feature_0":{"enum":["customer_age","current_utilisation_rate","days_since_last_missed_payment"],"example":"current_utilisation_rate","type":"string"},"adverse_feature_1":{"enum":["null","last_3_months_utilisation_rate","total_paid","last_12_months_par60_times"],"example":"last_3_months_utilisation_rate","type":"string"},"adverse_feature_2":{"enum":["null","std_payment_size","last_12_months_par30_times"],"example":"std_payment_size","type":"string"},"advice_adverse_feature_0":{"enum":["N/A","Show long-term payment consistency","Never miss payments"],"example":"Show long-term payment consistency","type":"string"},"advice_adverse_feature_1":{"enum":["Reduce your overall debt","Show short-term payment consistency","Avoid 60 consecutive late days default mark"],"example":"Show short-term payment consistency","type":"string"},"advice_adverse_feature_2":{"enum":["N/A","Avoid 30 consecutive late days default mark","Keep payment amounts consistent"],"example":"Keep payment amounts consistent","type":"string"},"customer_odoo13_id":{"example":"12345","type":"string"},"dwh_create_date":{"example":"2022-12-20","type":"string"},"sales_person":{"example":"rw000@sa.bboxx.co.uk","type":"string"},"score":{"example":"0-999","type":"integer"}},"type":"object"},"SchemaNotFoundResponse":{"properties":{"message":{"example":"Schema not set for user","type":"string"},"status":{"example":403,"type":"integer"}},"type":"object"},"SuccessfulCreditScoreResponse":{"properties":{"adverse_feature_0":{"enum":["customer_age","current_utilisation_rate","days_since_last_missed_payment"],"example":"current_utilisation_rate","type":"string"},"adverse_feature_1":{"enum":["null","last_3_months_utilisation_rate","total_paid","last_12_months_par60_times"],"example":"last_3_months_utilisation_rate","type":"string"},"adverse_feature_2":{"enum":["null","std_payment_size","last_12_months_par30_times"],"example":"std_payment_size","type":"string"},"advice_adverse_feature_0":{"enum":["N/A","Show long-term payment consistency","Never miss payments"],"example":"Show long-term payment consistency","type":"string"},"advice_adverse_feature_1":{"enum":["Reduce your overall debt","Show short-term payment consistency","Avoid 60 consecutive late days default mark"],"example":"Show short-term payment consistency","type":"string"},"advice_adverse_feature_2":{"enum":["N/A","Avoid 30 consecutive late days default mark","Keep payment amounts consistent"],"example":"Keep payment amounts consistent","type":"string"},"customer_odoo13_id":{"example":"12345","type":"string"},"dwh_create_date":{"example":"2022-12-20","type":"string"},"score":{"example":"0-999","type":"integer"}},"type":"object"},"UnauthorizedResponse":{"properties":{"message":{"example":"Unauthorized - Invalid, expired, or missing token","type":"string"},"status":{"example":401,"type":"integer"}},"type":"object"},"total_values":{"properties":{"total_base_commission":{"example":397862.5,"format":"float","type":"number"},"total_commission_after_tax":{"example":326247.25,"format":"float","type":"number"},"total_commissions_with_supplement":{"example":50555.46,"format":"float","type":"number"},"total_tax":{"example":71615.25,"format":"float","type":"number"}},"type":"object"}},"info":{"description":"Documentation for BBOXX Data Warehouse API endpoints. All API users must authenticate with a BBOXX JWT token within the HTTP header of your request.","title":"Data Warehouse API docs","version":"DWH-V2.0.1"},"paths":{"/sales_agent/commission/{company_code}":{"get":{"description":"Get sales agent commissions filtered by company code, commission date, and agent email","parameters":[{"description":"Company code (NGU) to filter commissions (e.g. BXCR)","in":"path","name":"company_code","required":true,"type":"string"},{"description":"get commission for a specific date (format YYYY-MM-DD)","format":"date","in":"query","name":"commission_date","required":false,"type":"string"},{"description":"Agent email to filter commissions","format":"email","in":"query","name":"agent_email","required":false,"type":"string"},{"description":"Stage to filter commissions (requires agent_email)","in":"query","name":"stage","required":false,"type":"integer"},{"description":"Contract reference to filter commissions","in":"query","name":"contract_reference","required":false,"type":"string"},{"description":"Customer name to filter commissions","in":"query","name":"customer_name","required":false,"type":"string"},{"description":"Unique account ID to filter commissions","in":"query","name":"unique_account_id","required":false,"type":"string"},{"description":"pagination page number (default to 1)","in":"query","name":"page","required":false,"type":"integer"},{"description":"Number of records per page (default to 40)","in":"query","name":"per_page","required":false,"type":"integer"},{"description":"Start date to filter (format YYYY-MM-DD) once provided, end_date is required","format":"date","in":"query","name":"start_date","required":false,"type":"string"},{"description":"End date to filter (format YYYY-MM-DD) once provided, start_date is required","format":"date","in":"query","name":"end_date","required":false,"type":"string"}],"responses":{"200":{"description":"Successful operation","schema":{"$ref":"#/definitions/CommissionResponse"}},"400":{"description":"Bad request","schema":{"$ref":"#/definitions/CommissionBadRequestResponse"}},"401":{"description":"Unauthorized - Invalid, expired, or missing JWT token","schema":{"$ref":"#/definitions/UnauthorizedResponse"}},"403":{"description":"Forbidden - Access denied or schema not found for user","schema":{"$ref":"#/definitions/ForbiddenResponse"}},"404":{"description":"Not found","schema":{"$ref":"#/definitions/CommissionNotFoundResponse"}}},"security":[{"BearerAuth":[]}],"summary":"Retrieve sales agent commissions","tags":["Sales Agent Commission"]}},"/sales_agent/get_credit_score_outputs_by_sales_person/{company_code}/{sales_person}":{"get":{"description":"A scheduled cron job filters sales agents that have customers stores their data in the BBOXX Data warehouse. When this specific endpoint is triggered with the sales_person, it scans the table and returns the customers under that sales agent with a credit score.","parameters":[{"description":"Add company_code to filter by ngu","in":"path","name":"company_code","required":true,"type":"string"},{"description":"Add sales_person to check customer's credit scores under a specific agent","in":"path","name":"sales_person","required":true,"type":"string"}],"responses":{"200":{"description":"Successful operation","schema":{"$ref":"#/definitions/SalesAgentSuccessfulResponse"}},"400":{"description":"Bad request. The provided sales_person is invalid.","schema":{"$ref":"#/definitions/SalesAgentBadRequestResponse"}},"404":{"description":"sales_person not found. The requested sales_person does not exist.","schema":{"$ref":"#/definitions/SalesAgentNotFoundResponse"}}},"security":[{"BearerAuth":[]}],"summary":"Returns customers assigned with a credit score under the sales_person","tags":["Sales Agent Application endpoints"]}},"/sales_agent/get_sales_agent_portfolio_commissions/{company_code}/{account_manager}":{"get":{"description":"Retrieves sales agent portfolio commission data with advanced filtering options.","parameters":[{"description":"Company code (NGU) to filter commissions","in":"path","name":"company_code","required":true,"type":"string"},{"description":"Account manager email to filter commissions","in":"path","name":"account_manager","required":true,"type":"string"},{"description":"Start date to filter portfolio commissions (format YYYY-MM-DD)","in":"query","name":"start_date","required":false,"type":"string"},{"description":"End date to filter portfolio commissions (format YYYY-MM-DD)","in":"query","name":"end_date","required":false,"type":"string"},{"description":"pagination page number (default to 1)","in":"query","name":"page","required":false,"type":"integer"},{"description":"Number of records per page (default to 40)","in":"query","name":"per_page","required":false,"type":"integer"},{"default":false,"description":"Whether to include granular details in the response. Accepted values are 'true' or 'false'. Default is 'false'.","enum":[true,false],"in":"query","name":"granular_details","required":false,"type":"boolean"}],"responses":{"200":{"description":"Successful operation","schema":{"$ref":"#/definitions/SalesAgentPortfolioCommissionsSuccessfulResponse"}},"401":{"description":"Unauthorized - Invalid, expired, or missing JWT token","schema":{"$ref":"#/definitions/UnauthorizedResponse"}},"403":{"description":"Forbidden - Access denied or schema not found for user","schema":{"$ref":"#/definitions/ForbiddenResponse"}},"404":{"description":"Resource was not found","schema":{"$ref":"#/definitions/SalesAgentPortfolioCommissionsNotFoundResponse"}},"500":{"description":"Internal Server error","schema":{"$ref":"#/definitions/SalesAgentPortfolioCommissionsInternalServerErrorResponse"}}},"security":[{"BearerAuth":[]}],"summary":"Returns paginated results when page/per_page parameters are provided, otherwise returns all matching records.","tags":["Sales Agent Application endpoints"]}},"/user/customer/payment_patterns/{company_code}/{unique_account_id}/":{"get":{"description":"Returns the payment patterns of a customer by entering the company_code and unique_account_id","parameters":[{"description":"Add company_code to filter payment patterns","in":"path","name":"company_code","required":true,"type":"string"},{"description":"Add unique_account_id to check payment patterns","in":"path","name":"unique_account_id","required":true,"type":"string"},{"description":"filter mode return eighter 'all' or 'latest' accepted values ['one', 'all']. default is one","in":"query","name":"filter_mode","required":false,"type":"string"},{"description":"pagination page number (default to 1)","in":"query","name":"page","required":false,"type":"integer"},{"description":"Number of records per page (default to 40)","in":"query","name":"per_page","required":false,"type":"integer"}],"responses":{"200":{"description":"Successful operation","schema":{"$ref":"#/definitions/PaymentPatternResponse"}},"400":{"description":"Internal Server Error","schema":{"$ref":"#/definitions/BadRequestPaymentPatternResponse"}},"404":{"description":"Data not found for the specified unique_account_id.","schema":{"$ref":"#/definitions/NotFoundPaymentPatternResponse"}}},"security":[{"BearerAuth":[]}],"summary":"Returns the payment patterns of a customer","tags":["User Modules endpoints"]}},"/user/get_credit_score_history/{company_code}/{customer_odoo13_id}":{"get":{"description":"A scheduled cron job filters customers that are eligible to obtain a credit score and stores their data in the BBOXX Data warehouse. When the endpoint is triggered with the customer_id, it scans the table and returns the customer's credit score history as a response.","parameters":[{"description":"Add company_code to filter by ngu","in":"path","name":"company_code","required":true,"type":"string"},{"description":"Add customer to help filter by customer_odoo13_id","in":"path","name":"customer_odoo13_id","required":true,"type":"string"},{"description":"Start date to filter score history (format YYYY-MM-DD)","format":"date","in":"query","name":"start_date","required":false,"type":"string"},{"description":"End date to filter score history (format YYYY-MM-DD)","format":"date","in":"query","name":"end_date","required":false,"type":"string"},{"description":"Return only the most recent score after applying filters. Default is 'false'.","enum":["true","false"],"in":"query","name":"last_score","required":false,"type":"string"}],"responses":{"200":{"description":"Successful operation","schema":{"$ref":"#/definitions/CreditScoreHistorySuccessfulResponse"}},"400":{"description":"Bad request. The provided customer_id is invalid.","schema":{"$ref":"#/definitions/CreditScoreHistoryBadRequestResponse"}},"404":{"description":"customer_id not found. The requested customer_id does not exist.","schema":{"$ref":"#/definitions/CreditScoreHistoryNotFoundResponse"}}},"security":[{"BearerAuth":[]}],"summary":"Returns the credit score history of a customer by entering the customer_id","tags":["User Modules endpoints"]}},"/user/get_credit_score_outputs_by_id/{company_code}/{customer_odoo13_id}":{"get":{"description":"A scheduled cron job filters customers that are eligible to obtain a credit score and stores their data in the BBOXX Data warehouse. When the endpoint is triggered with the customer_odoo13_id, it scans the table and returns the customer's credit score as a response.","parameters":[{"description":"Add company_code to filter credit score","in":"path","name":"company_code","required":true,"type":"string"},{"description":"Add customer_odoo13_id to check credit score","in":"path","name":"customer_odoo13_id","required":true,"type":"string"}],"responses":{"200":{"description":"Successful operation","schema":{"$ref":"#/definitions/SuccessfulCreditScoreResponse"}},"400":{"description":"Bad request. The provided customer_odoo13_id is invalid.","schema":{"$ref":"#/definitions/BadRequestCreditScoreResponse"}},"404":{"description":"customer_odoo13_id not found. The requested customer_odoo13_id does not exist.","schema":{"$ref":"#/definitions/NotFoundCreditScoreResponse"}}},"security":[{"BearerAuth":[]}],"summary":"Returns the credit score of a customer by entering the customer_odoo13_id","tags":["User Modules endpoints"]}},"/user/{company_code}/get_accessible_reports":{"get":{"parameters":[{"description":"Add company_code to filter by NGU","in":"path","name":"company_code","required":true,"type":"string"}],"responses":{"200":{"description":"Successful operation","schema":{"$ref":"#/definitions/AccessibleReportsSuccessfulResponse"}}},"security":[{"BearerAuth":[]}],"summary":"Returns the parameters of PowerBI reports that are available to a user","tags":["User Modules endpoints"]}}},"produces":["application/json"],"securityDefinitions":{"BearerAuth":{"in":"header","name":"Authorization","type":"apiKey"}},"swagger":"2.0","tags":[{"description":"endpoints that help access PowerBI reports and customer credit score - BaseURL(/user)","name":"User Modules endpoints"},{"description":"endpoints used by the sales agent application - BaseURL(/sales_agent)","name":"Sales Agent Application endpoints"},{"description":"endpoints related to sales agent commissions","name":"Sales Agent Commission"}]}
