The Payment Processor is a Ruby application designed to process payment data from a CSV file and generate a detailed report of the processed payments.
- Processes payment data from a CSV file.
- Identifies the card type (Visa, Mastercard, AmEx) based on the card number.
- Checks for card expiration and skips processing expired cards.
- Generates a detailed report including total payments and dollar amounts by card type.
-
Clone the repository:
git clone <repository_url>
-
Install the required dependencies. This project requires the
timecop
gem for mocking time:gem install timecop
-
Prepare your payment data in a CSV file. The CSV file should have the following columns:
- Name
- Card Number
- CCV
- Zip Code
- Expiration Date (MM/YYYY)
- Amount (in cents)
- Card Type
Example:
Name,Card Number,CCV,Zip Code,Expiration Date,Amount (in cents),Card Type John Doe,4242424242424242,123,12345,12/2023,5000,Visa
-
Run the payment processor script with the path to your CSV file as an argument:
ruby payment_processor.rb path/to/your/input.csv
Example:
ruby payment_processor.rb inputs.csv
-
View the generated report.
To run the tests for this project, execute the following command:
rspec spec/payment_processor_spec.rb