Skip to content

Feign client for consuming the Payment service's public API

License

MIT, MIT licenses found

Licenses found

MIT
LICENSE
MIT
LICENSE.md
Notifications You must be signed in to change notification settings

hmcts/payments-java-client

Repository files navigation

Payments java client

Download

This is a client library for interacting with the Payments application.

Getting started

Prerequisites

Usage

Just include the library as your dependency and you will be to use the client class. You will also need to set the spring configuration property of payments.api.url

A client (PaymentsClient) is provided for interacting with the PaymentsApi feign client to simplify the flow:

@Service
class PaymentsService {
    private final PaymentsClient paymentsClient;

    PaymentsService(PaymentsClient paymentsClient) {
        this.paymentsClient = paymentsClient;
    }

    public PaymentDTO createCreditAccountPayment(String authorisation, CreditAccountPaymentRequest paymentRequest) {
        return paymentsClient.createCreditAccountPayment(authorisation, paymentRequest);
    }

    public PaymentDTO createCardPayment(String authorisation, CardPaymentRequest paymentRequest, String redirect) {
        return paymentsClient.createCardPayment(authorisation, paymentRequest, redirect);
    }

    public PaymentDTO retrieveCardPayment(String authorisation, String paymentReference) {
        return paymentsClient.retrieveCardPayment(authorisation, paymentReference);
    }

    public void cancelCardPayment(String authorisation, String paymentReference) {
        paymentsClient.cancelCardPayment(authorisation, paymentReference);
    }
}

Components provided by this library will get automatically configured in a Spring context if payments.api.url configuration property is defined and does not equal false.

Building

The project uses Gradle as a build tool but you don't have install it locally since there is a ./gradlew wrapper script.

To build project please execute the following command:

    ./gradlew build

Developing

Coding style tests

To run all checks (including unit tests) please execute the following command:

    ./gradlew check

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

About

Feign client for consuming the Payment service's public API

Resources

License

MIT, MIT licenses found

Licenses found

MIT
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Packages

No packages published

Languages