This is a RESSTful API IAW the takehome specifications from creditcards.com. The file index2.html is the first endpoint described in the documentation. The page populates a drop box with the available issuers from the database. Then, the user selects the issuer, clicks the button, and the page creates a table showing all cards from that card issuer. The file index.html is the second endpoint described in the documentation. The user enters a credit card number that is in the databse, a valid loan amount, and a valid payment then clicks the button. The page retrieves the credit card information and calulates the interest and remaining loan principle after the first month's payment. This page includes basic error handling. The page recognizes invalid card formats, valid card numbers not in the database, invalid loans or payments (e.g. "4.0.1", or "yes", or "4,000.25", only numbers and one decimal point are allowed), and invalid loan payment pairs (e.g. a loan of 40.25 and a payment of 50.00). Class declarations are in functions.php. This allows for centralized coding of core classes. Included in functions.php in a method test1. This function creates a sample database. This method is not called, but is there so show the structure of the database. Both index.html and index2.html use the smaller PHP files, through AJAX calls, to contact the database. These files instantiate the class of functions.php, call needed mthods, return the results as a JSON, then unset the instance of the class. This is to adhere to the RESTful constraint of statelessness. All other processing is handled by jQuery functions in index.html and index2.html, respectively.
-
Notifications
You must be signed in to change notification settings - Fork 0
belleskendall/cc_takehome
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published