Skip to content

Commit

Permalink
PLUG-106: Add support for refund failed webhook, refund transaction t…
Browse files Browse the repository at this point in the history
…able, refactoring.
  • Loading branch information
lighe committed Jun 11, 2024
1 parent 0c83e02 commit 22db05b
Show file tree
Hide file tree
Showing 43 changed files with 1,556 additions and 1,180 deletions.
4 changes: 2 additions & 2 deletions Api/Log/LogService.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function error(string $type, $data): LogService;
public function debug(string $type, $data): LogService;

/**
* @param string $prefix
* @param string|int $prefix
*/
public function prefix(string $prefix): LogService;
public function prefix($prefix): LogService;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,23 @@
*/
declare(strict_types=1);

namespace TrueLayer\Connect\Api\Transaction\Data;
namespace TrueLayer\Connect\Api\Transaction;

use Magento\Framework\Api\ExtensibleDataInterface;

/**
* Interface for transaction model
* @api
*/
interface DataInterface extends ExtensibleDataInterface
interface BaseTransactionDataInterface extends ExtensibleDataInterface
{
/**
* Constants for keys of data array.
*/
public const ENTITY_ID = 'entity_id';
public const QUOTE_ID = 'quote_id';
public const ORDER_ID = 'order_id';
public const UUID = 'uuid';
public const TOKEN = 'token';
public const STATUS = 'status';
public const FAILURE_REASON = 'failure_reason';
public const INVOICE_UUID = 'invoice_uuid';
public const PAYMENT_URL = 'payment_url';
public const IS_LOCKED = 'is_locked';

/**
Expand All @@ -36,21 +31,6 @@ interface DataInterface extends ExtensibleDataInterface
*/
public function getEntityId(): int;

/**
* Returns the quote ID.
*
* @return int|null quote ID.
*/
public function getQuoteId(): ?int;

/**
* Sets the quote ID.
*
* @param int $quoteId
* @return $this
*/
public function setQuoteId(int $quoteId): self;

/**
* Returns the order ID.
*
Expand All @@ -66,21 +46,6 @@ public function getOrderId(): ?int;
*/
public function setOrderId(int $orderId): self;

/**
* Return token.
*
* @return string|null
*/
public function getToken(): ?string;

/**
* Set token.
*
* @param string $value
* @return $this
*/
public function setToken(string $value): self;

/**
* Return the payment uuid.
*
Expand Down Expand Up @@ -126,48 +91,18 @@ public function getFailureReason(): ?string;
*/
public function setFailureReason(string $failureReason): self;

/**
* Return invoice_uuid.
*
* @return string|null
*/
public function getInvoiceUuid(): ?string;

/**
* Set invoice_uid.
*
* @param string $invoiceUuid
* @return $this
*/
public function setInvoiceUuid(string $invoiceUuid): self;

/**
* Return payment_url.
*
* @return string|null
*/
public function getPaymentUrl(): ?string;

/**
* Set payment_url.
*
* @param string $paymentUrl
* @return $this
*/
public function setPaymentUrl(string $paymentUrl): self;

/**
* Return is_locked.
*
* @return int|null
* @return bool
*/
public function getIsLocked(): ?int;
public function getIsLocked(): bool;

/**
* Set is_locked.
*
* @param int $isLocked
* @param bool $isLocked
* @return $this
*/
public function setIsLocked(int $isLocked): self;
public function setIsLocked(bool $isLocked): self;
}
33 changes: 0 additions & 33 deletions Api/Transaction/Data/SearchResultsInterface.php

This file was deleted.

86 changes: 86 additions & 0 deletions Api/Transaction/Payment/PaymentTransactionDataInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<?php
/**
* Copyright © TrueLayer Ltd. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace TrueLayer\Connect\Api\Transaction\Payment;

use TrueLayer\Connect\Api\Transaction\BaseTransactionDataInterface;

/**
* Interface for transaction model
* @api
*/
interface PaymentTransactionDataInterface extends BaseTransactionDataInterface
{
/**
* Constants for keys of data array.
*/
public const QUOTE_ID = 'quote_id';
public const UUID = 'uuid';
public const TOKEN = 'token';
public const INVOICE_UUID = 'invoice_uuid';
public const PAYMENT_URL = 'payment_url';

/**
* Returns the quote ID.
*
* @return int|null quote ID.
*/
public function getQuoteId(): ?int;

/**
* Sets the quote ID.
*
* @param int $quoteId
* @return $this
*/
public function setQuoteId(int $quoteId): self;

/**
* Return token.
*
* @return string|null
*/
public function getToken(): ?string;

/**
* Set token.
*
* @param string $value
* @return $this
*/
public function setToken(string $value): self;

/**
* Return invoice_uuid.
*
* @return string|null
*/
public function getInvoiceUuid(): ?string;

/**
* Set invoice_uid.
*
* @param string $invoiceUuid
* @return $this
*/
public function setInvoiceUuid(string $invoiceUuid): self;

/**
* Return payment_url.
*
* @return string|null
*/
public function getPaymentUrl(): ?string;

/**
* Set payment_url.
*
* @param string $paymentUrl
* @return $this
*/
public function setPaymentUrl(string $paymentUrl): self;
}
72 changes: 72 additions & 0 deletions Api/Transaction/Payment/PaymentTransactionRepositoryInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?php
/**
* Copyright © TrueLayer Ltd. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace TrueLayer\Connect\Api\Transaction\Payment;

use Magento\Framework\Exception\InputException;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Exception\NoSuchEntityException;

/**
* Transaction repository interface
* @api
*/
interface PaymentTransactionRepositoryInterface
{
/**
* Exception text
*/
public const INPUT_EXCEPTION = 'An "%1" is needed. Set the "%1" and try again.';
public const NO_SUCH_ENTITY_EXCEPTION = 'The transaction with id "%1" does not exist.';
public const COULD_NOT_DELETE_EXCEPTION = 'Could not delete the transaction: %1';
public const COULD_NOT_SAVE_EXCEPTION = 'Could not save the transaction: %1';

/**
* Loads a specified quote
*
* @param int $entityId
*
* @return PaymentTransactionDataInterface
* @throws LocalizedException
*/
public function get(int $entityId): PaymentTransactionDataInterface;

/**
* Return quote object
*
* @return PaymentTransactionDataInterface
*/
public function create(): PaymentTransactionDataInterface;

/**
* Perform persist operations for one entity
*
* @param PaymentTransactionDataInterface $entity
*
* @return PaymentTransactionDataInterface
* @throws LocalizedException
*/
public function save(PaymentTransactionDataInterface $entity): PaymentTransactionDataInterface;

/**
* @param int $orderId
*
* @return PaymentTransactionDataInterface
* @throws InputException
* @throws NoSuchEntityException
*/
public function getByOrderId(int $orderId): PaymentTransactionDataInterface;

/**
* @param string $uuid
*
* @return PaymentTransactionDataInterface
* @throws InputException
* @throws NoSuchEntityException
*/
public function getByPaymentUuid(string $uuid): PaymentTransactionDataInterface;
}
Loading

0 comments on commit 22db05b

Please sign in to comment.