Skip to content

Bounded Context for the Wikimedia Deutschland fundraising payment subdomain

License

Notifications You must be signed in to change notification settings

wmde/fundraising-payments

Repository files navigation

Fundraising Payments

Build Status Scrutinizer Code Quality Code Coverage

Bounded Context for the Wikimedia Deutschland fundraising payment (sub-)domain. Used by the user facing donation application and the "Fundraising Operations Center" (which is not public software).

Installation

To use the Fundraising Payments library in your project, add a dependency on wmde/fundraising-payments to your project's composer.json file. Here is a minimal example of a composer.json file that just defines a dependency on Fundraising Payments 1.x:

{
    "require": {
        "wmde/fundraising-payments": "~1.0"
    }
}

Setting up the PayPal API

The payment context calls the PayPal REST API to create payments. These API calls need credentials and a one-time setup of subscription plans (i.e. definition of recurring payments) on the PayPal server. There is a command line tool to do the subscription plan setup. You can call this command (create-subscription-plans) from the console in Fundraising Application or from the bin/console file in this bounded context.

There is another command, list-subscription-plans that lists all the configured plans.

See Configuring the PayPal API for more details on these commands and their configuration.

Development

This project has a Makefile that runs all tasks in Docker containers via docker-compose. You need to have Docker and the docker-compose CLI installed on your machine.

Installing dependencies

To pull in the project dependencies via Composer, run:

make install-php

Running the CI checks

To run all CI checks, which includes PHPUnit tests, PHPCS style checks and coverage tag validation, run:

make ci

Running the tests

To run the PHPUnit tests run

make test

To run a subset of PHPUnit tests or otherwise pass flags to PHPUnit, run

docker-compose run --rm app ./vendor/bin/phpunit --filter SomeClassNameOrFilter

Architecture

This Bounded context follows the architecture rules outlined in Clean Architecture + Bounded Contexts.

Architecture diagram

You can also look at the dependency graph of the different namespaces.

To regenerate the dependency graph, you can either use deptrac directly (on a system or container that has both PHP and GraphViz available):

docker-compose run --rm --no-deps app php ./vendor/bin/deptrac --formatter=graphviz-image --output=docs/dependency-graph.svg

Or you can use deptrac to generate the input file inside the Docker container and use dot to create the SVG:

docker-compose run --rm --no-deps app php ./vendor/bin/deptrac --formatter=graphviz-dot --output=docs/dependency-graph.dot 
dot -odocs/dependency-graph.svg -Tsvg docs/dependency-graph.dot