Skip to the content.
package com.bookshop.structural.adapter;

/** Outcome of a charge attempt in the shop's own vocabulary. */
public record PaymentResult(boolean successful, String message) {

    public static PaymentResult success() {
        return new PaymentResult(true, "ok");
    }

    public static PaymentResult failure(String message) {
        return new PaymentResult(false, message);
    }
}

Raw file