diff --git a/src/Interfaces/Payment/PaymentAttemptFailedInterface.php b/src/Interfaces/Payment/PaymentAttemptFailedInterface.php index ff252f1..e582f8b 100644 --- a/src/Interfaces/Payment/PaymentAttemptFailedInterface.php +++ b/src/Interfaces/Payment/PaymentAttemptFailedInterface.php @@ -4,6 +4,10 @@ namespace TrueLayer\Interfaces\Payment; +/** + * A failed payment attempt - it was authorized successfully, but the money did not move. Only reachable + * when payment retries are enabled; the payment may still succeed on a later attempt. + */ interface PaymentAttemptFailedInterface extends PaymentFailureInterface { } diff --git a/src/Interfaces/Payment/PaymentAuthorizationRequiredInterface.php b/src/Interfaces/Payment/PaymentAuthorizationRequiredInterface.php index b71537f..8acb592 100644 --- a/src/Interfaces/Payment/PaymentAuthorizationRequiredInterface.php +++ b/src/Interfaces/Payment/PaymentAuthorizationRequiredInterface.php @@ -4,6 +4,10 @@ namespace TrueLayer\Interfaces\Payment; +/** + * A payment yet to be authorized. This is the first status for a payment that requires further actions to + * be authorized. + */ interface PaymentAuthorizationRequiredInterface extends PaymentRetrievedInterface { } diff --git a/src/Interfaces/Payment/PaymentAuthorizedInterface.php b/src/Interfaces/Payment/PaymentAuthorizedInterface.php index 322b521..8c7e5e6 100644 --- a/src/Interfaces/Payment/PaymentAuthorizedInterface.php +++ b/src/Interfaces/Payment/PaymentAuthorizedInterface.php @@ -6,14 +6,22 @@ use TrueLayer\Interfaces\Payment\AuthorizationFlow\ConfigurationInterface; +/** + * An authorized payment - no more actions required, waiting for outcome. + */ interface PaymentAuthorizedInterface extends PaymentRetrievedInterface { /** + * Information about the authorization flow the payment went through. Null if the payment transitioned + * immediately to authorized or failed. + * * @return ConfigurationInterface|null */ public function getAuthorizationFlowConfig(): ?ConfigurationInterface; /** + * The date and time that TrueLayer determined that the payment was ready to be credited. + * * @return \DateTimeInterface|null */ public function getCreditableAt(): ?\DateTimeInterface; diff --git a/src/Interfaces/Payment/PaymentAuthorizingInterface.php b/src/Interfaces/Payment/PaymentAuthorizingInterface.php index 70339c8..1e50586 100644 --- a/src/Interfaces/Payment/PaymentAuthorizingInterface.php +++ b/src/Interfaces/Payment/PaymentAuthorizingInterface.php @@ -7,14 +7,22 @@ use TrueLayer\Interfaces\Payment\AuthorizationFlow\ActionInterface; use TrueLayer\Interfaces\Payment\AuthorizationFlow\ConfigurationInterface; +/** + * The payment's authorization_flow has started, but authorization has not completed yet. + */ interface PaymentAuthorizingInterface extends PaymentRetrievedInterface { /** + * The next action the user must take in the authorization flow, such as selecting a provider or being + * redirected. + * * @return ActionInterface|null */ public function getAuthorizationFlowNextAction(): ?ActionInterface; /** + * Information about the authorization flow the payment went through. + * * @return ConfigurationInterface|null */ public function getAuthorizationFlowConfig(): ?ConfigurationInterface; diff --git a/src/Interfaces/Payment/PaymentCreatedInterface.php b/src/Interfaces/Payment/PaymentCreatedInterface.php index a29af11..87490a5 100644 --- a/src/Interfaces/Payment/PaymentCreatedInterface.php +++ b/src/Interfaces/Payment/PaymentCreatedInterface.php @@ -12,29 +12,44 @@ use TrueLayer\Interfaces\HppInterface; use TrueLayer\Interfaces\Payment\AuthorizationFlow\AuthorizationFlowAuthorizingInterface; +/** + * The newly created payment, as returned by the payment creation response. + */ interface PaymentCreatedInterface extends ArrayableInterface { /** + * The unique ID of the payment. + * * @return string */ public function getId(): string; /** + * A payment token in JWT format, with a limited scope that is authorised to be used with this single + * payment. + * * @return string */ public function getResourceToken(): string; /** + * The unique ID of the user. If a user ID wasn't passed in the request body while creating the + * payment, TrueLayer generates one and returns it here. + * * @return string */ public function getUserId(): string; /** + * The Hosted Payments Page URI, if a hosted_page was requested on creation. + * * @return string|null */ public function getHostedPageUri(): ?string; /** + * Builds the Hosted Payments Page URL for this payment. + * * @return HppInterface */ public function hostedPaymentsPage(): HppInterface; @@ -54,6 +69,8 @@ public function hostedPaymentsPage(): HppInterface; public function startAuthorization(string $returnUri): AuthorizationFlowAuthorizingInterface; /** + * Starts building a request to manually start the authorization flow for this payment. + * * @throws InvalidArgumentException * * @return StartAuthorizationFlowRequestInterface @@ -61,6 +78,9 @@ public function startAuthorization(string $returnUri): AuthorizationFlowAuthoriz public function authorizationFlow(): StartAuthorizationFlowRequestInterface; /** + * Retrieves the full payment details, equivalent to calling `getPayment()` on the client with this + * payment's ID. + * * @throws ApiRequestJsonSerializationException * @throws ApiResponseUnsuccessfulException * diff --git a/src/Interfaces/Payment/PaymentExecutedInterface.php b/src/Interfaces/Payment/PaymentExecutedInterface.php index 6905a42..2bf0139 100644 --- a/src/Interfaces/Payment/PaymentExecutedInterface.php +++ b/src/Interfaces/Payment/PaymentExecutedInterface.php @@ -6,19 +6,29 @@ use TrueLayer\Interfaces\Payment\AuthorizationFlow\ConfigurationInterface; +/** + * An executed payment - the bank has accepted the payment. + */ interface PaymentExecutedInterface extends PaymentRetrievedInterface { /** + * The date and time the payment executed at. + * * @return \DateTimeInterface */ public function getExecutedAt(): \DateTimeInterface; /** + * Information about the authorization flow the payment went through. Null if the payment transitioned + * immediately to authorized or failed. + * * @return ConfigurationInterface|null */ public function getAuthorizationFlowConfig(): ?ConfigurationInterface; /** + * The date and time that TrueLayer determined that the payment was ready to be credited. + * * @return \DateTimeInterface|null */ public function getCreditableAt(): ?\DateTimeInterface; diff --git a/src/Interfaces/Payment/PaymentFailedAttemptInterface.php b/src/Interfaces/Payment/PaymentFailedAttemptInterface.php index 5e474db..b6fafe4 100644 --- a/src/Interfaces/Payment/PaymentFailedAttemptInterface.php +++ b/src/Interfaces/Payment/PaymentFailedAttemptInterface.php @@ -6,19 +6,29 @@ use TrueLayer\Interfaces\ArrayableInterface; +/** + * A failed payment attempt, recorded when payment retries are enabled. Contains details about when the + * attempt failed and why. + */ interface PaymentFailedAttemptInterface extends ArrayableInterface { /** + * The sequential number of this payment attempt. + * * @return int */ public function getAttemptNumber(): int; /** + * The date and time this payment attempt failed. + * * @return \DateTimeInterface */ public function getFailedAt(): \DateTimeInterface; /** + * The reason this attempt failed. Handle unexpected values gracefully as an unknown failure. + * * @return string */ public function getFailureReason(): string; diff --git a/src/Interfaces/Payment/PaymentFailedInterface.php b/src/Interfaces/Payment/PaymentFailedInterface.php index 405d3a3..e3adf98 100644 --- a/src/Interfaces/Payment/PaymentFailedInterface.php +++ b/src/Interfaces/Payment/PaymentFailedInterface.php @@ -4,24 +4,36 @@ namespace TrueLayer\Interfaces\Payment; +/** + * A failed payment - it was authorized successfully, but the money did not move. + */ interface PaymentFailedInterface extends PaymentFailureInterface { /** + * The date and time that TrueLayer determined that the payment was ready to be credited. + * * @return \DateTimeInterface|null */ public function getCreditableAt(): ?\DateTimeInterface; /** + * The date and time at which TrueLayer determined that the payment's settlement was stalled, based on + * the client's chosen delay or the default one. + * * @return \DateTimeInterface|null */ public function getSettlementStalledAt(): ?\DateTimeInterface; /** + * The date and time the payment was reversed, if it was. + * * @return \DateTimeInterface|null */ public function getReversedAt(): ?\DateTimeInterface; /** + * The reason for the payment reversal, one of `corrected`, `failed` or `disputed`. + * * @return string|null */ public function getReversalReason(): ?string; diff --git a/src/Interfaces/Payment/PaymentFailureInterface.php b/src/Interfaces/Payment/PaymentFailureInterface.php index 902c10c..91a8260 100644 --- a/src/Interfaces/Payment/PaymentFailureInterface.php +++ b/src/Interfaces/Payment/PaymentFailureInterface.php @@ -6,24 +6,39 @@ use TrueLayer\Interfaces\Payment\AuthorizationFlow\ConfigurationInterface; +/** + * Fields shared by a payment that was authorized successfully, but the money did not move (either + * permanently, via `PaymentFailedInterface`, or for a single retried attempt, via + * `PaymentAttemptFailedInterface`). + */ interface PaymentFailureInterface extends PaymentRetrievedInterface { /** + * The date and time the payment was marked as failed. + * * @return \DateTimeInterface */ public function getFailedAt(): \DateTimeInterface; /** + * The status the payment was in when it failed, one of `authorization_required`, `authorizing`, + * `authorized` or `executed`. + * * @return string */ public function getFailureStage(): string; /** + * The reason the payment failed. Handle unexpected values gracefully as an unknown failure. + * * @return string|null */ public function getFailureReason(): ?string; /** + * Information about the authorization flow the payment went through. Null if the payment transitioned + * immediately to authorized or failed. + * * @return ConfigurationInterface|null */ public function getAuthorizationFlowConfig(): ?ConfigurationInterface; diff --git a/src/Interfaces/Payment/PaymentHostedPageInterface.php b/src/Interfaces/Payment/PaymentHostedPageInterface.php index 5284a99..5c44d21 100644 --- a/src/Interfaces/Payment/PaymentHostedPageInterface.php +++ b/src/Interfaces/Payment/PaymentHostedPageInterface.php @@ -4,6 +4,10 @@ namespace TrueLayer\Interfaces\Payment; +/** + * Configures an auto-constructed Hosted Payments Page URI, returned on the payment creation response. + * Cannot be provided if starting the authorization flow explicitly. + */ interface PaymentHostedPageInterface { /** @@ -12,6 +16,9 @@ interface PaymentHostedPageInterface public function getReturnUri(): ?string; /** + * The URI where the user will be redirected after the authorization flow has completed on the hosted + * page. Must be registered as an allowed redirect URI in the Console. + * * @param string $returnUri * * @return PaymentHostedPageInterface @@ -24,6 +31,8 @@ public function returnUri(string $returnUri): PaymentHostedPageInterface; public function getCountryCode(): ?string; /** + * The country code of the user, used to determine which banks to show on the hosted page initially. + * * @param string $countryCode ISO 3166-1 alpha-2 country code * * @return PaymentHostedPageInterface @@ -36,6 +45,9 @@ public function countryCode(string $countryCode): PaymentHostedPageInterface; public function getLanguageCode(): ?string; /** + * The language code of the user, used to determine which language to show on the hosted page, + * overriding the browser's locale. + * * @param string $languageCode ISO 639-1 language code * * @return PaymentHostedPageInterface @@ -48,6 +60,9 @@ public function languageCode(string $languageCode): PaymentHostedPageInterface; public function getMaxWaitForResult(): ?int; /** + * The maximum time to wait for a result from the hosted page after the user has completed the + * authorization flow. + * * @param int $maxWaitForResult Seconds to wait for a result, between 0 and 60 * * @return PaymentHostedPageInterface diff --git a/src/Interfaces/Payment/PaymentRequestInterface.php b/src/Interfaces/Payment/PaymentRequestInterface.php index db28bf7..be46f32 100644 --- a/src/Interfaces/Payment/PaymentRequestInterface.php +++ b/src/Interfaces/Payment/PaymentRequestInterface.php @@ -9,9 +9,14 @@ use TrueLayer\Interfaces\RequestOptionsInterface; use TrueLayer\Interfaces\UserInterface; +/** + * Builds a payment creation request. + */ interface PaymentRequestInterface extends HasAttributesInterface { /** + * A 'cent' value representing the amount, e.g. 100 = 1 GBP or 100 = 1 EUR. + * * @param int $amount * * @return PaymentRequestInterface @@ -19,6 +24,8 @@ interface PaymentRequestInterface extends HasAttributesInterface public function amountInMinor(int $amount): PaymentRequestInterface; /** + * The three-letter ISO 4217 currency code the payment should be made in. + * * @param string $currency * * @return PaymentRequestInterface @@ -26,6 +33,9 @@ public function amountInMinor(int $amount): PaymentRequestInterface; public function currency(string $currency): PaymentRequestInterface; /** + * Optional custom key-value data to attach to the payment. Limited to 10 pairs, each key up to 40 + * characters and each value up to 500 characters. + * * @param array $metadata * * @return PaymentRequestInterface @@ -33,6 +43,8 @@ public function currency(string $currency): PaymentRequestInterface; public function metadata(array $metadata): PaymentRequestInterface; /** + * The payment method to use, such as a bank transfer. + * * @param PaymentMethodInterface $paymentMethod * * @return PaymentRequestInterface @@ -40,6 +52,9 @@ public function metadata(array $metadata): PaymentRequestInterface; public function paymentMethod(PaymentMethodInterface $paymentMethod): PaymentRequestInterface; /** + * Optional configuration for risk assessment and the `payment_creditable` webhook. Contact TrueLayer + * before sending this field. + * * @param PaymentRiskAssessmentInterface|null $riskAssessment * * @return PaymentRiskAssessmentInterface @@ -47,6 +62,9 @@ public function paymentMethod(PaymentMethodInterface $paymentMethod): PaymentReq public function riskAssessment(?PaymentRiskAssessmentInterface $riskAssessment): PaymentRiskAssessmentInterface; /** + * Details of the end user making the payment. Not required for payments made over a mandate, or when + * using your own PISP licence. + * * @param UserInterface $user * * @return PaymentRequestInterface @@ -54,6 +72,10 @@ public function riskAssessment(?PaymentRiskAssessmentInterface $riskAssessment): public function user(UserInterface $user): PaymentRequestInterface; /** + * Requests a hosted page URI as part of payment creation, so you don't have to build the Hosted + * Payments Page URL yourself afterwards. Cannot be combined with starting the authorization flow + * explicitly. + * * @param PaymentHostedPageInterface|null $hostedPage * * @return PaymentHostedPageInterface @@ -68,6 +90,8 @@ public function hostedPage(?PaymentHostedPageInterface $hostedPage = null): Paym public function requestOptions(RequestOptionsInterface $requestOptions): PaymentRequestInterface; /** + * Send the request to create the payment. + * * @return PaymentCreatedInterface */ public function create(): PaymentCreatedInterface; diff --git a/src/Interfaces/Payment/PaymentRetrievedInterface.php b/src/Interfaces/Payment/PaymentRetrievedInterface.php index 2d208e7..abe814a 100644 --- a/src/Interfaces/Payment/PaymentRetrievedInterface.php +++ b/src/Interfaces/Payment/PaymentRetrievedInterface.php @@ -7,24 +7,35 @@ use TrueLayer\Interfaces\ArrayableInterface; use TrueLayer\Interfaces\PaymentMethod\PaymentMethodInterface; +/** + * Fields and helpers shared by a payment resource regardless of its current status. + */ interface PaymentRetrievedInterface extends ArrayableInterface { /** + * The unique ID for the payment. + * * @return string */ public function getId(): string; /** + * A 'cent' value representing the amount, e.g. 100 = 1 GBP or 100 = 1 EUR. + * * @return int */ public function getAmountInMinor(): int; /** + * The three-letter ISO 4217 currency code the payment was made in. + * * @return string */ public function getCurrency(): string; /** + * Custom key-value data attached to the payment. + * * @return array */ public function getMetadata(): array; @@ -35,21 +46,29 @@ public function getMetadata(): array; public function getPaymentMethod(): PaymentMethodInterface; /** + * The unique ID of the user who made the payment. + * * @return string */ public function getUserId(): string; /** + * The date and time the payment was created at. + * * @return \DateTimeInterface */ public function getCreatedAt(): \DateTimeInterface; /** + * The current status of the payment. + * * @return string */ public function getStatus(): string; /** + * The list of failed payment attempts, if any. Only populated when payment retries are enabled. + * * @return PaymentFailedAttemptInterface[] */ public function getFailedAttempts(): array; @@ -65,11 +84,15 @@ public function isAuthorizationRequired(): bool; public function isAuthorizing(): bool; /** + * Will also return false when the payment has progressed to executed, failed or settled states. + * * @return bool */ public function isAuthorized(): bool; /** + * Will also return false when the payment has progressed to failed or settled states. + * * @return bool */ public function isExecuted(): bool; @@ -80,6 +103,8 @@ public function isExecuted(): bool; public function isFailed(): bool; /** + * Only true if payment retries are enabled and this attempt failed. + * * @return bool */ public function isAttemptFailed(): bool; @@ -90,6 +115,9 @@ public function isAttemptFailed(): bool; public function isSettled(): bool; /** + * Cancels the payment, as long as it hasn't been authorized yet, and returns a fresh version of the + * retrieved payment. + * * @return PaymentRetrievedInterface */ public function cancel(): PaymentRetrievedInterface; diff --git a/src/Interfaces/Payment/PaymentRiskAssessmentInterface.php b/src/Interfaces/Payment/PaymentRiskAssessmentInterface.php index 69c0fb2..bfe5e2a 100644 --- a/src/Interfaces/Payment/PaymentRiskAssessmentInterface.php +++ b/src/Interfaces/Payment/PaymentRiskAssessmentInterface.php @@ -4,6 +4,9 @@ namespace TrueLayer\Interfaces\Payment; +/** + * Optional configuration for risk assessment and the `payment_creditable` webhook. + */ interface PaymentRiskAssessmentInterface { /** @@ -12,6 +15,8 @@ interface PaymentRiskAssessmentInterface public function getSegment(): ?string; /** + * The risk segment of this payment. Contact TrueLayer before sending this field. + * * @param string $segment * * @return PaymentRiskAssessmentInterface diff --git a/src/Interfaces/Payment/PaymentSettledInterface.php b/src/Interfaces/Payment/PaymentSettledInterface.php index 5b0ef11..3a03ec5 100644 --- a/src/Interfaces/Payment/PaymentSettledInterface.php +++ b/src/Interfaces/Payment/PaymentSettledInterface.php @@ -10,34 +10,51 @@ use TrueLayer\Exceptions\SignerException; use TrueLayer\Interfaces\Payment\AuthorizationFlow\ConfigurationInterface; +/** + * A settled payment, i.e. the funds have settled into the beneficiary account. Only reachable for payments + * into merchant accounts. + */ interface PaymentSettledInterface extends PaymentRetrievedInterface { /** + * Information about the source of funds, if available from the remitter's bank. + * * @return PaymentSourceInterface */ public function getPaymentSource(): PaymentSourceInterface; /** + * The date and time the payment settled. + * * @return \DateTimeInterface */ public function getSettledAt(): \DateTimeInterface; /** + * The date and time the payment executed. + * * @return \DateTimeInterface */ public function getExecutedAt(): \DateTimeInterface; /** + * The date and time that TrueLayer determined that the payment was ready to be credited. + * * @return \DateTimeInterface|null */ public function getCreditableAt(): ?\DateTimeInterface; /** + * Information about the authorization flow the payment went through. Null if the payment transitioned + * immediately to authorized or failed. + * * @return ConfigurationInterface|null */ public function getAuthorizationFlowConfig(): ?ConfigurationInterface; /** + * Starts building a refund request for this payment. + * * @throws InvalidArgumentException * * @return RefundRequestInterface @@ -45,6 +62,8 @@ public function getAuthorizationFlowConfig(): ?ConfigurationInterface; public function refund(): RefundRequestInterface; /** + * Retrieves a single refund created from this payment. + * * @param string $refundId * * @throws ApiResponseUnsuccessfulException @@ -57,6 +76,8 @@ public function refund(): RefundRequestInterface; public function getRefund(string $refundId): RefundRetrievedInterface; /** + * Retrieves all refunds created from this payment. + * * @throws ApiResponseUnsuccessfulException * @throws InvalidArgumentException * @throws SignerException diff --git a/src/Interfaces/Payment/PaymentSourceInterface.php b/src/Interfaces/Payment/PaymentSourceInterface.php index 8d828b5..cc735a3 100644 --- a/src/Interfaces/Payment/PaymentSourceInterface.php +++ b/src/Interfaces/Payment/PaymentSourceInterface.php @@ -7,6 +7,10 @@ use TrueLayer\Interfaces\AccountIdentifier\AccountIdentifierInterface; use TrueLayer\Interfaces\ArrayableInterface; +/** + * Information about the source of funds, if available from the remitter's bank. Account identifiers will + * be those provided by the bank. + */ interface PaymentSourceInterface extends ArrayableInterface { /** diff --git a/src/Interfaces/Payment/RefundAuthorizedInterface.php b/src/Interfaces/Payment/RefundAuthorizedInterface.php index be504b3..1f80d12 100644 --- a/src/Interfaces/Payment/RefundAuthorizedInterface.php +++ b/src/Interfaces/Payment/RefundAuthorizedInterface.php @@ -4,6 +4,9 @@ namespace TrueLayer\Interfaces\Payment; +/** + * An authorized refund - no more actions required, waiting for outcome. + */ interface RefundAuthorizedInterface extends RefundRetrievedInterface { } diff --git a/src/Interfaces/Payment/RefundCreatedInterface.php b/src/Interfaces/Payment/RefundCreatedInterface.php index 9a9f572..59beedc 100644 --- a/src/Interfaces/Payment/RefundCreatedInterface.php +++ b/src/Interfaces/Payment/RefundCreatedInterface.php @@ -6,9 +6,14 @@ use TrueLayer\Interfaces\HasAttributesInterface; +/** + * The newly created refund, as returned by the refund creation response. + */ interface RefundCreatedInterface extends HasAttributesInterface { /** + * The unique ID of the refund. + * * @return string */ public function getId(): string; diff --git a/src/Interfaces/Payment/RefundExecutedInterface.php b/src/Interfaces/Payment/RefundExecutedInterface.php index 27a52ef..5f31d2c 100644 --- a/src/Interfaces/Payment/RefundExecutedInterface.php +++ b/src/Interfaces/Payment/RefundExecutedInterface.php @@ -4,9 +4,14 @@ namespace TrueLayer\Interfaces\Payment; +/** + * An executed refund. + */ interface RefundExecutedInterface extends RefundRetrievedInterface { /** + * The date and time the refund executed. + * * @return \DateTimeInterface */ public function getExecutedAt(): \DateTimeInterface; diff --git a/src/Interfaces/Payment/RefundFailedInterface.php b/src/Interfaces/Payment/RefundFailedInterface.php index 00702be..3331606 100644 --- a/src/Interfaces/Payment/RefundFailedInterface.php +++ b/src/Interfaces/Payment/RefundFailedInterface.php @@ -4,14 +4,21 @@ namespace TrueLayer\Interfaces\Payment; +/** + * A failed refund. + */ interface RefundFailedInterface extends RefundRetrievedInterface { /** + * The date and time the refund failed. + * * @return \DateTimeInterface */ public function getFailedAt(): \DateTimeInterface; /** + * The reason the refund failed. Handle unexpected values gracefully as an unknown failure. + * * @return string|null */ public function getFailureReason(): ?string; diff --git a/src/Interfaces/Payment/RefundPendingInterface.php b/src/Interfaces/Payment/RefundPendingInterface.php index 13c89d7..70fe35b 100644 --- a/src/Interfaces/Payment/RefundPendingInterface.php +++ b/src/Interfaces/Payment/RefundPendingInterface.php @@ -4,6 +4,9 @@ namespace TrueLayer\Interfaces\Payment; +/** + * A refund yet to be authorized. + */ interface RefundPendingInterface extends RefundRetrievedInterface { } diff --git a/src/Interfaces/Payment/RefundRequestInterface.php b/src/Interfaces/Payment/RefundRequestInterface.php index ba280ea..a985d58 100644 --- a/src/Interfaces/Payment/RefundRequestInterface.php +++ b/src/Interfaces/Payment/RefundRequestInterface.php @@ -7,9 +7,14 @@ use TrueLayer\Interfaces\HasAttributesInterface; use TrueLayer\Interfaces\RequestOptionsInterface; +/** + * Builds a refund request. Refunds are only supported for settled merchant account payments. + */ interface RefundRequestInterface extends HasAttributesInterface { /** + * The payment to refund, either its ID or a retrieved/created payment instance. + * * @param string|PaymentRetrievedInterface|PaymentCreatedInterface $payment * * @return RefundRequestInterface @@ -17,6 +22,8 @@ interface RefundRequestInterface extends HasAttributesInterface public function payment($payment): RefundRequestInterface; /** + * A 'cent' value representing the refund amount, e.g. 100 = 1 GBP or 100 = 1 EUR. + * * @param int $amount * * @return RefundRequestInterface @@ -24,6 +31,8 @@ public function payment($payment): RefundRequestInterface; public function amountInMinor(int $amount): RefundRequestInterface; /** + * A reference for the refund. + * * @param string $reference * * @return RefundRequestInterface @@ -31,6 +40,8 @@ public function amountInMinor(int $amount): RefundRequestInterface; public function reference(string $reference): RefundRequestInterface; /** + * Optional custom key-value data to attach to the refund. + * * @param array $metadata * * @return RefundRequestInterface @@ -45,6 +56,8 @@ public function metadata(array $metadata): RefundRequestInterface; public function requestOptions(RequestOptionsInterface $requestOptions): RefundRequestInterface; /** + * Send the request to create the refund. + * * @return RefundCreatedInterface */ public function create(): RefundCreatedInterface; diff --git a/src/Interfaces/Payment/RefundRetrievedInterface.php b/src/Interfaces/Payment/RefundRetrievedInterface.php index 08eac3f..0f37c6e 100644 --- a/src/Interfaces/Payment/RefundRetrievedInterface.php +++ b/src/Interfaces/Payment/RefundRetrievedInterface.php @@ -6,39 +6,56 @@ use TrueLayer\Interfaces\ArrayableInterface; +/** + * Fields and helpers shared by a refund resource regardless of its current status. + */ interface RefundRetrievedInterface extends ArrayableInterface { /** + * The unique ID for the refund. + * * @return string */ public function getId(): string; /** + * A 'cent' value representing the refund amount, e.g. 100 = 1 GBP or 100 = 1 EUR. + * * @return int */ public function getAmountInMinor(): int; /** + * The three-letter ISO 4217 currency code the refund was made in. + * * @return string */ public function getCurrency(): string; /** + * The reference for the refund. + * * @return string */ public function getReference(): string; /** + * Custom key-value data attached to the refund. + * * @return array */ public function getMetadata(): array; /** + * The date and time the refund was created at. + * * @return \DateTimeInterface */ public function getCreatedAt(): \DateTimeInterface; /** + * The current status of the refund. + * * @return string */ public function getStatus(): string; diff --git a/src/Interfaces/Payment/StartAuthorizationFlowRequestInterface.php b/src/Interfaces/Payment/StartAuthorizationFlowRequestInterface.php index 25d060b..1f5bef6 100644 --- a/src/Interfaces/Payment/StartAuthorizationFlowRequestInterface.php +++ b/src/Interfaces/Payment/StartAuthorizationFlowRequestInterface.php @@ -10,6 +10,10 @@ use TrueLayer\Interfaces\HasAttributesInterface; use TrueLayer\Interfaces\Payment\AuthorizationFlow\AuthorizationFlowResponseInterface; +/** + * Builds a request to manually start the authorization flow for a payment, declaring which parts of the + * flow your UI is able to support. Cannot be used if `hosted_page` was requested on payment creation. + */ interface StartAuthorizationFlowRequestInterface extends HasAttributesInterface { /** @@ -20,26 +24,40 @@ interface StartAuthorizationFlowRequestInterface extends HasAttributesInterface public function paymentId(string $paymentId): StartAuthorizationFlowRequestInterface; /** + * Declares that your UI can hand over to the Hosted Payments Page instead of rendering the + * authorization flow steps yourself. + * * @return StartAuthorizationFlowRequestInterface */ public function useHPPCapabilities(): StartAuthorizationFlowRequestInterface; /** + * Declares that your UI can render a provider selection screen. Required for payments with + * user-selected provider selection; optional for preselected provider selection. + * * @return StartAuthorizationFlowRequestInterface */ public function enableProviderSelection(): StartAuthorizationFlowRequestInterface; /** + * Declares that your UI can render a scheme selection screen. Required for payments with + * user-selected scheme selection; optional for other scheme selection types. + * * @return StartAuthorizationFlowRequestInterface */ public function enableSchemeSelection(): StartAuthorizationFlowRequestInterface; /** + * Declares that your UI can render a user account selection screen. + * * @return StartAuthorizationFlowRequestInterface */ public function enableUserAccountSelection(): StartAuthorizationFlowRequestInterface; /** + * The URI the end user is redirected to after they complete authorization on a third-party site, such + * as their bank. Must be registered as an allowed redirect URI in the Console. + * * @param string $returnUri * * @return StartAuthorizationFlowRequestInterface @@ -47,6 +65,11 @@ public function enableUserAccountSelection(): StartAuthorizationFlowRequestInter public function returnUri(string $returnUri): StartAuthorizationFlowRequestInterface; /** + * Only applicable if you're regulated and have a direct return URI registered with UK providers, + * allowing the authorization flow to redirect directly from the provider to your page without going + * via TrueLayer. `returnUri` should still be able to handle a non-direct return, in case the provider + * doesn't support this. + * * @param string $directReturnUri * * @return StartAuthorizationFlowRequestInterface @@ -54,6 +77,9 @@ public function returnUri(string $returnUri): StartAuthorizationFlowRequestInter public function directReturnUri(string $directReturnUri): StartAuthorizationFlowRequestInterface; /** + * Declares which form input types your UI supports, for providers that require additional inputs (such + * as remitter name or account details) during authorization. + * * @param string[] $types * * @return StartAuthorizationFlowRequestInterface @@ -61,6 +87,8 @@ public function directReturnUri(string $directReturnUri): StartAuthorizationFlow public function formInputTypes(array $types): StartAuthorizationFlowRequestInterface; /** + * Send the request to start the authorization flow. + * * @throws SignerException * @throws ApiResponseUnsuccessfulException * @throws InvalidArgumentException