C Payment App: SALE Transaction Implementation
C Payment App: SALE Transaction Implementation
Project Introduction
Payment systems are now available everywhere and everyone interacts with these systems every day.
There are different types of transactions you can make, SALE, REFUND, Pre-Authorization, and VOID.
• SALE: means to buy something and its price will be deducted from your bank account.
• REFUND: this means that you will return something and wants your money back to your bank account.
• Pre-Authorization: means holding an amount of money from your account, e.g Hotel reservation.
• VOID: this means canceling the transaction, e.g if the seller entered the wrong amount.
You are required to implement the SALE transaction only by simulating the card, terminal(ATM), and the server.
Project Requirements
Project Instructions
https://youtu.be/XELs0ERPezg
Application Flowchart
The project can be distributed over 6 main tasks:
Payment Application
Development environment preparation
You should deliver a screenshot of the solution explorer that clarifies your folder structure.
Create .c and .h file for each module 1. In the "Application" folder create app.c and app.h files
2. In the "Card" folder create card.c and card.h files
3. In the "Terminal" folder create terminal.c and terminal.h files
4. In the "Server" folder create server.c and server.h files
You should deliver a screenshot of the solution explorer that clarifies files in each folder.
Add header file gaurd 1. In the app.h file add the header file guard
2. In the card.h file add the header file guard
3. In the terminal.h file add the header file guard
4. In server.h file add the header file guard
You should deliver a screenshot for each .h file, the file name must appear in the screenshot, and the header file guard
Fill in card.h file with functions' 1. Use the following typedef as-is:
prototypes and typedefs
2. typedef struct ST_cardData_t
3. {
4. uint8_t cardHolderName[25];
5. uint8_t primaryAccountNumber[20];
6. uint8_t cardExpirationDate[6];
7. }ST_cardData_t;
9. {
11. }EN_cardError_t;
Implement getCardHolderName function 1. This function will ask for the cardholder's name and store it into card data.
2. Cardholder name is 24 alphabetic characters string max and 20 min.
3. If the cardholder name is NULL , less than 20 characters or more than 24 will return a WRONG_NAME error, else return CARD_OK .
4. Test your function:
CRITERIA MEETS SPECIFICATION S
o Create a test function void getCardHolderNameTest(void); to test all possible scenarios, happy-case, and worst-case scenarios.
o Print all results of your test cases on the console window, use the following as a guide:
5. You should deliver the test function as well as a screenshot of the results on the console.
Implement getCardExpiryDate function 1. This function will ask for the card expiry date and store it in card data.
2. Card expiry date is 5 characters string in the format "MM/YY", e.g "05/25".
3. If the card expiry date is NULL , less or more than 5 characters, or has the wrong format will return the WRONG_EXP_DATE error, else return CARD_OK .
4. Test your function:
o Create a test function void getCardExpiryDateTest (void); to test all possible scenarios, happy-case, and worst-case scenarios.
o Print all results of your test cases on the console window, use the following as a guide:
o Tester Name: your name
o Function Name: getCardExpiryDate
o Test Case 1:
o Input Data:
o Expected Result:
o Actual Result:
o Test Case 2:
o Input Data:
o Expected Result:
o Actual Result:
o .
o .
o .
o Test Case n:
o Input Data:
o Expected Result:
o Actual Result:
5. You should deliver the test function as well as a screenshot of the results on the console.
Implement getCardPAN function 1. This function will ask for the card's Primary Account Number and store it in card data.
2. PAN is 20 numeric characters string, 19 character max, and 16 character min.
3. If the PAN is NULL , less than 16 or more than 19 characters, will return the WRONG_PAN error, else return CARD_OK .
4. Test your function:
o Create a test function void getCardPANTest (void); to test all possible scenarios, happy-case, and worst-case scenarios.
o Print all results of your test cases on the console window, use the following as a guide:
o Test Case 2:
o Input Data:
o Expected Result:
o Actual Result:
o .
o .
o .
o Test Case n:
o Input Data:
o Expected Result:
o Actual Result:
5. You should deliver the test function as well as a screenshot of the results on the console.
Explain your work 1. Record a video where you discuss each function you implemented in this module.
2. Explain and execute all test functions you made.
3. The video is 4 minutes maximum.
4. You may record it in Arabic or English.
5. Muted videos will not be acceptable.
6. All of the above are mandatory to pass this criterion.
Fill in terminal.h file with functions' 1. Use the following typedef as is:
prototypes and typedefs
2. typedef struct ST_terminalData_t
3. {
4. float transAmount;
5. float maxTransAmount;
6. uint8_t transactionDate[11];
7. }ST_terminalData_t;
9. {
11. }EN_terminalError_t ;
Implement getTransactionDate function 1. This function will ask for the transaction date and store it in terminal data.
2. Transaction date is 10 characters string in the format DD/MM/YYYY, e.g 25/06/2022.
3. If the transaction date is NULL or is less than 10 characters or wrong format will return the WRONG_DATE error, else return TERMINAL_OK .
4. Test your function:
o Create a test function void getTransactionDateTest(void); to test all possible scenarios, happy-case, and worst-case scenarios.
o Print all results of your test cases on the console window, and use the following as a guide:
o Tester Name: your name
o Function Name: getTransactionDate
o Test Case 1:
o Input Data:
o Expected Result:
o Actual Result:
o Test Case 2:
o Input Data:
CRITERIA MEETS SPECIFICATION S
o Expected Result:
o Actual Result:
o .
o .
o .
o Test Case n:
o Input Data:
o Expected Result:
o Actual Result:
5. Optional:
The function will read the current date from your computer and store it into terminal data with the mentioned size and format.
6. You should deliver the test function as well as a screenshot of the results on the console.
Implement isCardExpried function 1. This function compares the card expiry date with the transaction date.
2. If the card expiration date is before the transaction date will return EXPIRED_CARD , else return TERMINAL_OK .
3. Test your function:
o Create a test function void isCardExpriedTest(void); to test all possible scenarios, happy-case, and worst-case scenarios.
o Print all results of your test cases on the console window, and use the following as a guide:
o Tester Name: your name
o Function Name: isCardExpried
o Test Case 1:
o Input Data:
o Expected Result:
o Actual Result:
o Test Case 2:
o Input Data:
o Expected Result:
o Actual Result:
o .
o .
o .
o Test Case n:
o Input Data:
o Expected Result:
o Actual Result:
4. You should deliver the test function as well as a screenshot of the results on the console.
Implement getTransactionAmount 1. This function asks for the transaction amount and saves it into terminal data.
function 2. If the transaction amount is less than or equal to 0 will return INVALID_AMOUNT , else return TERMINAL_OK .
3. Test your function:
o Create a test function void getTransactionAmountTest(void); to test all possible scenarios, happy-case, and worst-case scenarios.
o Print all results of your test cases on the console window, and use the following as a guide:
o Actual Result:
4. You should deliver the test function as well as a screenshot of the results on the console.
Implement isBelowMaxAmount function 1. This function compares the transaction amount with the terminal max allowed amount.
2. If the transaction amount is larger than the terminal max allowed amount will return EXCEED_MAX_AMOUNT , else return TERMINAL_OK .
3. Test your function:
o Create a test function void isBelowMaxAmountTest(void); to test all possible scenarios, happy-case, and worst-case scenarios.
o Print all results of your test cases on the console window, and use the following as a guide:
o Tester Name: your name
o Function Name: isBelowMaxAmount
o Test Case 1:
o Input Data:
o Expected Result:
o Actual Result:
o Test Case 2:
o Input Data:
o Expected Result:
o Actual Result:
o .
o .
o .
o Test Case n:
o Input Data:
o Expected Result:
o Actual Result:
4. You should deliver the test function as well as a screenshot of the results on the console.
Implement setMaxAmount function 1. This function takes the maximum allowed amount and stores it into terminal data.
2. Transaction max amount is a float number.
3. If transaction max amount less than or equal to 0 will return the INVALID_MAX_AMOUNT error, else return TERMINAL_OK .
4. Test your function:
o Create a test function void setMaxAmountTest(void); to test all possible scenarios, happy-case, and worst-case scenarios.
o Print all results of your test cases on the console window, and use the following as a guide:
o Tester Name: your name
o Function Name: setMaxAmount
o Test Case 1:
o Input Data:
o Expected Result:
o Actual Result:
o Test Case 2:
o Input Data:
o Expected Result:
o Actual Result:
o .
o .
o .
o Test Case n:
o Input Data:
o Expected Result:
o Actual Result:
5. You should deliver the test function as well as a screenshot of the results on the console.
Implement isValidCardPAN 1. This function will check if the PAN is a Luhn number or not.
function (Optional) 2. For more about Luhn number, and how to generate and check please refer to this Site.
3. If the number is not Luhn number, will return INVALID_CARD , else will return TERMINAL_OK .
4. Test your function:
o Create a test function void isValidCardPANTest(void); to test all possible scenarios, happy-case, and worst-case scenarios.
o Print all results of your test cases on the console window, and use the following as a guide:
CRITERIA MEETS SPECIFICATION S
5. If you are going to implement this function, please deliver the test function as well as a screenshot of the results on the console.
Explain your work 1. Record a video where you discuss each function you implemented in this module.
2. Explain and execute all test functions you made.
3. The video is 4 minutes maximum.
4. You may record it in Arabic or English.
5. Muted videos will not be acceptable.
6. All of the above are mandatory to pass this criterion.
Fill in server.h file with functions' 1. Use the following typedef as-is:
prototypes and typedefs
2. typedef enum EN_transState_t
3. {
5. }EN_transStat_t;
7. {
8. ST_cardData_t cardHolderData;
9. ST_terminalData_t terminalData;
12. }ST_transaction;
14. {
16. }EN_serverError_t ;
18. {
19. RUNNING,
20. BLOCKED
21. }EN_accountState_t;
23. {
27. }ST_accountsDB_t;
CRITERIA MEETS SPECIFICATION S
Implement server-side accounts' 1. Create a global array of ST_accountsDB_t for the valid accounts database.
database ST_accountsDB_t accountsDB[255];
2. Fill in the array initially with any valid data.
3. This array has a maximum of 255 element/account data.
4. You can fill up to 10 different accounts for the sake of testing.
5. Example of a running account: {2000.0, RUNNING, "8989374615436851"} .
6. Example of a blocked account, its card is stolen: {100000.0, BLOCKED, "5807007076043875"} .
7. You should deliver a screenshot of your accounts database array with a minimum of at least 5 different accounts for the different test cases, check all needed
Implement recieveTransactionData 1. This function will take all transaction data and validate its data, it contains all server logic.
function 2. It checks the account details and amount availability.
3. If the account does not exist return FRAUD_CARD , if the amount is not available will return DECLINED_INSUFFECIENT_FUND , if the account is blocked will
return DECLINED_STOLEN_CARD , if a transaction can't be saved will return INTERNAL_SERVER_ERROR , else returns APPROVED .
4. It will update the database with the new balance.
5. Test your function:
o Create a test function void recieveTransactionDataTest(void); to test all possible scenarios, happy-case, and worst-case scenarios.
o Print all results of your test cases on the console window, and use the following as a guide:
o Tester Name: your name
o Function Name: recieveTransactionData
o Test Case 1:
o Input Data:
o Expected Result:
o Actual Result:
o Test Case 2:
o Input Data:
o Expected Result:
o Actual Result:
o .
o .
o .
o Test Case n:
o Input Data:
o Expected Result:
o Actual Result:
6. You should deliver the test function as well as a screenshot of the results on the console.
Implement isValidAccount function 1. This function will take card data and validate if the account related to this card exists or not.
2. It checks if the PAN exists or not in the server's database (searches for the card PAN in the DB).
3. If the PAN doesn't exist will return ACCOUNT_NOT_FOUND and the account reference will be NULL , else will return SERVER_OK and return a reference to this account
in the DB.
5. You should deliver the test function as well as a screenshot of the results on the console.
Implement isBlockedAccount function 1. This function takes a reference to the account into the database and verifies if it is blocked or not.
2. If the account is running it will return SERVER_OK , else if the account is blocked it will return BLOCKED_ACCOUNT .
3. Test your function:
o Create a test function void isBlockedAccountTest(void); to test all possible scenarios, happy-case, and worst-case scenarios.
o Print all results of your test cases on the console window, and use the following as a guide:
o Tester Name: your name
o Function Name: isBlockedAccount
o Test Case 1:
o Input Data:
o Expected Result:
o Actual Result:
o Test Case 2:
o Input Data:
o Expected Result:
o Actual Result:
o .
o .
o .
o Test Case n:
o Input Data:
o Expected Result:
o Actual Result:
4. You should deliver the test function as well as a screenshot of the results on the console.
Implement isAmountAvailable function 1. This function will take terminal data and a reference to the account in the database and check if the account has a sufficient amount to withdraw or not.
2. It checks if the transaction's amount is available or not.
3. If the transaction amount is greater than the balance in the database will return LOW_BALANCE , else will return SERVER_OK .
4. Test your function:
o Create a test function void isAmountAvailableTest(void); to test all possible scenarios, happy-case, and worst-case scenarios.
o Print all results of your test cases on the console window, and use the following as a guide:
o Actual Result:
o .
o .
o .
o Test Case n:
o Input Data:
o Expected Result:
o Actual Result:
5. You should deliver the test function as well as a screenshot of the results on the console.
Implement saveTransaction function 1. This function will store all transaction data in the transactions database.
2. It gives a sequence number to a transaction, this number is incremented once a transaction is processed into the server, you must check the last sequence
number in the server to give the new transaction a new sequence number.
7. You should deliver the test function as well as a screenshot of the results on the console.
Implement listSavedTransactions 1. This function prints all transactions found in the transactions DB.
function 2. Please follow the following format for only one transaction data:
3. #########################
5. Transaction Date:
6. Transaction Amount:
7. Transaction State:
9. Cardholder Name:
10. PAN:
12. #########################
o Input Data:
o Expected Result:
o Actual Result:
o Test Case 2:
o Input Data:
o Expected Result:
o Actual Result:
o .
o .
o .
o Test Case n:
o Input Data:
o Expected Result:
o Actual Result:
14. You should deliver the test function as well as a screenshot of the results on the console.
Explain your work 1. Record a video where you discuss each function you implemented in this module.
2. Explain and execute all test functions you made.
3. The video is 4 minutes maximum.
4. You may record it in Arabic or English.
5. Muted videos will not be acceptable.
6. All of the above are mandatory to pass this criterion.
Fill in application.h file with functions' 1. Use the following prototypes as-is:
prototypes
2. void appStart(void);
Implement appStart function 1. Please refer to the flow chart attached under the instructions video in order to implement this application.
2. You should deliver all project folders and files.
Explain your work 1. Record a video where you discuss each function you implemented in this module.
2. The video is 2 minutes maximum.
3. You may record it in Arabic or English.
4. Muted videos will not be acceptable.
5. All of the above are mandatory to pass this criterion.
Transaction approved user story 1. As a bank customer have an account and has a valid and not expired card, I want to withdraw an amount of money less than the maximum allowed
and less than or equal to the amount in my balance, so that I am expecting that the transaction is approved and my account balance is reduced
Exceed the maximum amount user story 1. As a bank customer have an account, that has a valid and not expired card, I want to withdraw an amount of money that exceeds the maximum
Insufficient fund user story 1. As a bank customer have an account and has a valid and not expired card, I want to withdraw an amount of money less than the maximum
allowed and larger than the amount in my balance so that I am expecting that the transaction declined.
CRITERIA MEETS SPECIFICATION S
Expired card user story 1. As a bank customer have an account and a valid but expired card, I want to withdraw an amount of money so that I expect that the transaction declined.
2. You should deliver a screenshot of the test result on the console.
Stolen card user story 1. As a bank customer have an account and has a valid and not expired but stolen card, I want to block anyone from using my card so that I am expecting
Explain your work 1. Record a video where you discuss each test case.
2. The video is 4 minutes maximum.
3. You may record it in Arabic or English.
4. Muted videos will not be acceptable.
5. All of the above are mandatory to pass this criterion.