Giter VIP home page Giter VIP logo

payment-integration-test's Introduction

Payment Integration Test

Project Setup

Requirements

  • docker
  • composer
  1. Clone the repository from GitHub from Terminal.
git clone [email protected]:thihakyaw/payment-integration-test.git
  1. Get into the project directory.
cd payment-integration-test
  1. Install packages using composer .
composer install

If you are still using the composer version 1 and faced memory limit issue, please use this command.

COMPOSER_MEMORY_LIMIT=-1 composer install
  1. create a new file .env in root directory of the project and copy everything inside from .env.example. For STRIPE_KEY and STRIPE_SECRET values, you can have your own keys from your Stripe account if you prefer to see the customers and payments created on Stripe side. The API keys inside .env.example is values that are generated from my account.

  2. In project directory, run this command to setup the project in docker. It will take around 5-10 minutes for the first time composing for Laravel project.

  • Tip - set up alias in zsh for ./vendor/bin/sail follow this guideline or if you are using bash, follow the bash alias setup guideline

if you have any mysql service running on localhost with port 3306, please stop that and continue this setup

./vendor/bin/sail up -d

Install composer again using sail command just to make sure every packages required are in sail.

./vendor/bin/sail composer install

I recommend running in development (-d) mode as we are testing this on local machine.

  1. Generate application key for Laravel before starting for the first time.
./vendor/bin/sail artisan key:generate
  1. Migrate database following this command
./vendor/bin/sail artisan migrate

Now, we can access the project from localhost. Screen Shot 2022-04-04 at 09 25 47

The architecture and the design

Framework - Laravel

Third-party Stripe Library - Laravel Cashier

Database Design

Untitled Diagram drawio

Sequence Diagram

Untitled Diagram drawio (2)

Testing

As this project use Laravel Cashier package, there is no separated service classes for charging payment. There is no unit test therefore. Instead, I wrote Feature Test as a user’s perspective.

Note - for feature test, I wanted to use fake name generator and fake email generator rather than hardcoding the name and email but there is something wrong with Faker from Laravel and time is limited, I have to use hard coded values for name and email.

To run the tests, run this command

./vendor/bin/sail artisan test

image

User Interface

Untitled

When you start call the http://localhost , you will start to see the checkout component only first. After finished step 1, step 2 component will appear and after finishing the step 2, step 3 component will appear.

  1. The checkout component. You have to fill in the price not lower than 349$. This is for a test purpose. You can fill any amount that you want to charge for the Sony WH-1000XM4. Fill in your name and email and then press checkout . You will see payment section
  2. Fill the card information. Card holder name can be anyone’s name. For card information testing, you can use these number -
  • Visa Card - 4242 4242 4242 4242
  • Master Card - 5200828282828210

Expiry Month and Expiry Year can be Any future date. CVC and ZIP number can be any number.

For more Cards to test, check this Stripe Card Testing Page.

  1. After payment is charger, you will see the payment information including payment status and card information that Stripe has offer

Database Connection Access

In case you want to access database from SequelPro or Workbench, use these credentials.

The credentials are from .env.example .

host - localhost

port - 3306

username - root

password - password

Postman Collection

Add {{host}} as localhost in env setup. Check the PaymentIntegrationTestPostmanCollection.json from the project root directory.

payment-integration-test's People

Contributors

thihakyaw avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.