Download the PHP package rasuvaeff/payments-testing without Composer

On this page you can find all versions of the php package rasuvaeff/payments-testing. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package payments-testing

rasuvaeff/payments-testing

Latest Stable Version Total Downloads Build Static analysis Psalm level

Testing toolkit for the rasuvaeff/payments contracts: deterministic in-memory fake gateways for unit tests and local development, plus framework-agnostic contract assertions that verify any real gateway adapter honours the same contracts the fakes do.

Using an AI coding assistant? llms.txt contains a compact API reference.

Requirements

Installation

Usage

Fake gateways

The fakes are fully deterministic:

Each fake implements only the optional operation its class names; the base fake never implements capture, confirm, cancel or refund implicitly.

Type Optional interface
FakePaymentGateway None; base gateway only
FakeCaptureGateway CaptureGatewayInterface
FakeConfirmGateway ConfirmGatewayInterface
FakeCancelGateway CancelGatewayInterface
FakeRefundGateway RefundGatewayInterface
FakeGatewayConfig Provider, capabilities, fixed time and create state

Configuration:

PartialRefundCapability in the capability set of a non-refund fake throws InvalidArgumentException — capabilities must stay truthful.

Contract assertions

Static assertion classes run a real (or fake) gateway adapter through the contract and throw ContractViolationException on any violation. They are framework-agnostic — an uncaught exception fails the test in any framework (Testo, PHPUnit, Pest, plain PHP script).

Class Method Verifies
PaymentGatewayAssertions assertCapabilities() PartialRefundCapability implies RefundGatewayInterface
PaymentGatewayAssertions assertCreatePayment() Provider consistency, operation id and amount preserved
PaymentGatewayAssertions assertCreatePaymentIdempotency() Replaying a key returns the same payment, a different key starts a new one, and reusing a key with a changed request is refused
PaymentGatewayAssertions assertRetrievePayment() Provider consistency, operation id and payment reference preserved
CaptureGatewayAssertions assertCapturePayment() Capture preserves operation id and amount, provider consistent
ConfirmGatewayAssertions assertConfirmPayment() Confirm preserves operation id and payment reference
CancelGatewayAssertions assertCancelPayment() Cancel preserves operation id and payment reference
RefundGatewayAssertions assertCreateRefund() Refund provider/payment/refund consistency, requested amount preserved
RefundGatewayAssertions assertCreateRefundIdempotency() Replaying a key returns the same refund, a different key starts a new one, and reusing a key with a changed amount is refused
RefundGatewayAssertions assertRetrieveRefund() Provider consistency, operation id and refund reference preserved

Capability-specific classes require the intersection type (e.g. PaymentGatewayInterface&CaptureGatewayInterface), so calling them on an adapter that does not implement the optional interface is a type error, not a runtime surprise. Every assertion method returns the resulting attempt for further framework-specific checks.

Idempotency assertions require idempotencyKey on the request and throw InvalidArgumentException when it is missing.

Security

The package is test-only. Never place production credentials, PAN/CVC or raw webhook bodies in fake requests. Idempotency fingerprints are kept in memory and contain only normalized request values.

Examples

See examples/.

Script Shows Needs server?
create-payment.php Deterministic create and retrieve flow No

Development

License

BSD-3-Clause


All versions of payments-testing with dependencies

PHP Build Version
Package Version
Requires php Version 8.3 - 8.5
rasuvaeff/payments Version ^0.1 || ^0.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package rasuvaeff/payments-testing contains the following files

Loading the files please wait ...