vendredi 30 juillet 2021

Python - To make sure that clients receive accurate monthly invoices based on verifications checks that have been processed

A kind of homework for python from my college. Question is below:-

A company is looking to build a billing system in order to ensure that all of their clients receive accurate monthly-invoices that is based on verifications (or "checks") that's processed.

You have two tables in the following structure:

| Check type              | Price | Currency |
|-------------------------|-------|----------|
| document_photo          | 0.5   | USD      |
| document_video          | 0.9   | USD      |
| facial_similarity_photo | 0.3   | USD      |
| facial_similarity_video | 0.8   | USD      |
| right_to_work           | 1.25  | USD      |
 
| client   | Check Type              | Result    |
|----------|-------------------------|-----------|
| ABC Bank | facial_similarity_video | pass      |
| ABC Bank | facial_similarity_video | fail      |
| XYCoin   | document_photo          | bad_input |
| XYCoin   | facial_similarity_photo | pass      |
| XYCoin   | document_photo          | pass      |
 

Given the following input, calculate an invoice for a given vendors. To simplify the problem, you don't have to focus on any specific time period:

Input:
pricing = [{"check_type": "document_photo", "price":0.5, "currency":"USD"},
    {"check_type": "document_video", "price":0.9, "currency":"USD"},
    {"check_type": "facial_similarity_photo", "price":0.3, "currency":"USD"},
    {"check_type": "facial_similarity_video", "price":0.8, "currency":"USD"},
    {"check_type": "right_to_work", "price":1.25, "currency":"USD"}]
 
checks = [{"client": "ABC Bank", "check_type": "facial_similarity_video", "result": "pass"},
    {"client": "ABC Bank", "check_type": "facial_similarity_video", "result": "fail"},
    {"client": "XYCoin", "check_type": "document_photo", "result": "bad_input"},
    {"client": "XYCoin", "check_type": "facial_similarity_photo", "result": "pass"},
    {"client": "XYCoin", "check_type": "document_photo", "result": "pass"}]    


  Test cases:     
    calculate_invoice("ABC Bank") == 1.6    
    calculate_invoice("XYCoin") == 0.8 

Aucun commentaire:

Enregistrer un commentaire