Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Adapter/ApplepayAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function validMerchantValidationDomain(string $merchantValidationURL): bo
* This is necessary if the ssl cert file doesn't contain key already.
* @param string|null $caCert Path to CA certificate.
*/
public function init(string $sslCert, string $sslKey = null, string $caCert = null): void
public function init(string $sslCert, ?string $sslKey = null, ?string $caCert = null): void
{
$timeout = EnvironmentService::getTimeout();
$curlVerbose = EnvironmentService::isCurlVerbose();
Expand Down
9 changes: 4 additions & 5 deletions src/Adapter/CurlAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@

namespace UnzerSDK\Adapter;

use UnzerSDK\Unzer;
use UnzerSDK\Services\EnvironmentService;
use UnzerSDK\Exceptions\UnzerApiException;
use RuntimeException;

use UnzerSDK\Exceptions\UnzerApiException;
use UnzerSDK\Services\EnvironmentService;
use UnzerSDK\Unzer;
use function extension_loaded;
use function in_array;

Expand All @@ -37,7 +36,7 @@ public function __construct()
/**
* {@inheritDoc}
*/
public function init(string $url, string $payload = null, string $httpMethod = HttpAdapterInterface::REQUEST_GET): void
public function init(string $url, ?string $payload = null, string $httpMethod = HttpAdapterInterface::REQUEST_GET): void
{
$timeout = EnvironmentService::getTimeout();
$curlVerbose = EnvironmentService::isCurlVerbose();
Expand Down
2 changes: 1 addition & 1 deletion src/Adapter/HttpAdapterInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ interface HttpAdapterInterface
* @param string|null $payload Json encoded payload string.
* @param string $httpMethod The Http method to perform.
*/
public function init(string $url, string $payload = null, string $httpMethod = HttpAdapterInterface::REQUEST_GET): void;
public function init(string $url, ?string $payload = null, string $httpMethod = HttpAdapterInterface::REQUEST_GET): void;

/**
* Executes the request and returns the response.
Expand Down
4 changes: 2 additions & 2 deletions src/Exceptions/UnzerApiException.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ class UnzerApiException extends Exception
*
* @param string $merchantMessage
* @param string $clientMessage
* @param string $code
* @param string|null $code
* @param string|null $errorId
*/
public function __construct($merchantMessage = '', $clientMessage = '', $code = null, string $errorId = null)
public function __construct($merchantMessage = '', $clientMessage = '', $code = null, ?string $errorId = null)
{
$merchantMessage = empty($merchantMessage) ? static::MESSAGE : $merchantMessage;
$this->clientMessage = empty($clientMessage) ? static::CLIENT_MESSAGE : $clientMessage;
Expand Down
36 changes: 18 additions & 18 deletions src/Interfaces/CancelServiceInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@

namespace UnzerSDK\Interfaces;

use RuntimeException;
use UnzerSDK\Constants\CancelReasonCodes;
use UnzerSDK\Exceptions\UnzerApiException;
use UnzerSDK\Resources\Payment;
use UnzerSDK\Resources\TransactionTypes\Authorization;
use UnzerSDK\Resources\TransactionTypes\Cancellation;
use UnzerSDK\Resources\TransactionTypes\Charge;
use RuntimeException;

interface CancelServiceInterface
{
Expand All @@ -30,7 +30,7 @@ interface CancelServiceInterface
* @throws UnzerApiException An UnzerApiException is thrown if there is an error returned on API-request.
* @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK.
*/
public function cancelAuthorization(Authorization $authorization, float $amount = null): Cancellation;
public function cancelAuthorization(Authorization $authorization, ?float $amount = null): Cancellation;

/**
* Performs a Cancellation transaction for the Authorization of the given Payment object.
Expand All @@ -44,7 +44,7 @@ public function cancelAuthorization(Authorization $authorization, float $amount
* @throws UnzerApiException An UnzerApiException is thrown if there is an error returned on API-request.
* @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK.
*/
public function cancelAuthorizationByPayment($payment, float $amount = null): Cancellation;
public function cancelAuthorizationByPayment($payment, ?float $amount = null): Cancellation;

/**
* Performs a Cancellation transaction for the given Charge and returns the resulting Cancellation object.
Expand All @@ -67,11 +67,11 @@ public function cancelAuthorizationByPayment($payment, float $amount = null): Ca
public function cancelChargeById(
$payment,
string $chargeId,
float $amount = null,
string $reasonCode = null,
string $referenceText = null,
float $amountNet = null,
float $amountVat = null
?float $amount = null,
?string $reasonCode = null,
?string $referenceText = null,
?float $amountNet = null,
?float $amountVat = null
): Cancellation;

/**
Expand All @@ -93,11 +93,11 @@ public function cancelChargeById(
*/
public function cancelCharge(
Charge $charge,
float $amount = null,
string $reasonCode = null,
string $referenceText = null,
float $amountNet = null,
float $amountVat = null
?float $amount = null,
?string $reasonCode = null,
?string $referenceText = null,
?float $amountNet = null,
?float $amountVat = null
): Cancellation;

/**
Expand All @@ -119,11 +119,11 @@ public function cancelCharge(
*/
public function cancelPayment(
$payment,
float $amount = null,
?float $amount = null,
?string $reasonCode = CancelReasonCodes::REASON_CODE_CANCEL,
string $referenceText = null,
float $amountNet = null,
float $amountVat = null
?string $referenceText = null,
?float $amountNet = null,
?float $amountVat = null
): array;

/**
Expand Down Expand Up @@ -167,5 +167,5 @@ public function cancelChargedPayment($payment, ?Cancellation $cancellation = nul
* @throws UnzerApiException An UnzerApiException is thrown if there is an error returned on API-request.
* @throws RuntimeException A RuntimeException is thrown when there is a error while using the SDK.
*/
public function cancelPaymentAuthorization($payment, float $amount = null): ?Cancellation;
public function cancelPaymentAuthorization($payment, ?float $amount = null): ?Cancellation;
}
48 changes: 24 additions & 24 deletions src/Interfaces/PaymentServiceInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
namespace UnzerSDK\Interfaces;

use DateTime;
use RuntimeException;
use UnzerSDK\Exceptions\UnzerApiException;
use UnzerSDK\Resources\AbstractUnzerResource;
use UnzerSDK\Resources\Basket;
Expand All @@ -24,7 +25,6 @@
use UnzerSDK\Resources\TransactionTypes\Charge;
use UnzerSDK\Resources\TransactionTypes\Payout;
use UnzerSDK\Resources\TransactionTypes\Shipment;
use RuntimeException;

interface PaymentServiceInterface
{
Expand All @@ -48,8 +48,8 @@ public function performAuthorization(
Authorization $authorization,
$paymentType,
$customer = null,
Metadata $metadata = null,
Basket $basket = null
?Metadata $metadata = null,
?Basket $basket = null
): Authorization;

/**
Expand Down Expand Up @@ -130,8 +130,8 @@ public function performCharge(
Charge $charge,
$paymentType,
$customer = null,
Metadata $metadata = null,
Basket $basket = null
?Metadata $metadata = null,
?Basket $basket = null
): Charge;

/**
Expand Down Expand Up @@ -229,9 +229,9 @@ public function performChargeOnPayment(
*/
public function chargeAuthorization(
$payment,
float $amount = null,
string $orderId = null,
string $invoiceId = null
?float $amount = null,
?string $orderId = null,
?string $invoiceId = null
): Charge;

/**
Expand All @@ -252,9 +252,9 @@ public function chargeAuthorization(
*/
public function chargePayment(
$payment,
float $amount = null,
string $orderId = null,
string $invoiceId = null
?float $amount = null,
?string $orderId = null,
?string $invoiceId = null
): Charge;

/**
Expand Down Expand Up @@ -284,11 +284,11 @@ public function payout(
$paymentType,
string $returnUrl,
$customer = null,
string $orderId = null,
Metadata $metadata = null,
Basket $basket = null,
string $invoiceId = null,
string $referenceText = null
?string $orderId = null,
?Metadata $metadata = null,
?Basket $basket = null,
?string $invoiceId = null,
?string $referenceText = null
): Payout;

/**
Expand All @@ -303,7 +303,7 @@ public function payout(
* @throws UnzerApiException An UnzerApiException is thrown if there is an error returned on API-request.
* @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK.
*/
public function ship($payment, string $invoiceId = null, string $orderId = null): Shipment;
public function ship($payment, ?string $invoiceId = null, ?string $orderId = null): Shipment;

/**
* Initializes a PayPage for charge transaction and returns the PayPage resource.
Expand All @@ -328,9 +328,9 @@ public function ship($payment, string $invoiceId = null, string $orderId = null)
*/
public function initPayPageCharge(
Paypage $paypage,
Customer $customer = null,
Basket $basket = null,
Metadata $metadata = null
?Customer $customer = null,
?Basket $basket = null,
?Metadata $metadata = null
): Paypage;

/**
Expand All @@ -356,9 +356,9 @@ public function initPayPageCharge(
*/
public function initPayPageAuthorize(
Paypage $paypage,
Customer $customer = null,
Basket $basket = null,
Metadata $metadata = null
?Customer $customer = null,
?Basket $basket = null,
?Metadata $metadata = null
): Paypage;

/**
Expand All @@ -378,7 +378,7 @@ public function fetchInstallmentPlans(
float $amount,
string $currency,
float $effectiveInterest,
DateTime $orderDate = null
?DateTime $orderDate = null
): InstalmentPlans;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Interfaces/ResourceServiceInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function fetchPayout($payment): Payout;
* @throws UnzerApiException An UnzerApiException is thrown if there is an error returned on API-request.
* @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK.
*/
public function activateRecurringPayment($paymentType, string $returnUrl, string $recurrenceType = null): Recurring;
public function activateRecurringPayment($paymentType, string $returnUrl, ?string $recurrenceType = null): Recurring;

/**
* Fetch and return payment by given payment id or payment object.
Expand Down
4 changes: 2 additions & 2 deletions src/Interfaces/WebhookServiceInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

namespace UnzerSDK\Interfaces;

use RuntimeException;
use UnzerSDK\Exceptions\UnzerApiException;
use UnzerSDK\Resources\AbstractUnzerResource;
use UnzerSDK\Resources\Webhook;
use RuntimeException;

interface WebhookServiceInterface
{
Expand Down Expand Up @@ -106,5 +106,5 @@ public function registerMultipleWebhooks(string $url, array $events): array;
* @throws UnzerApiException An UnzerApiException is thrown if there is an error returned on API-request.
* @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK.
*/
public function fetchResourceFromEvent(string $eventJson = null): AbstractUnzerResource;
public function fetchResourceFromEvent(?string $eventJson = null): AbstractUnzerResource;
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,7 @@ class SignedMessage extends AbstractUnzerResource
/** @var string */
protected $encryptedMessage;

/**
* @param string $tag
* @param string $ephemeralPublicKey
* @param string $encryptedMessage
*/
public function __construct(string $tag = null, string $ephemeralPublicKey = null, string $encryptedMessage = null)
public function __construct(?string $tag = null, ?string $ephemeralPublicKey = null, ?string $encryptedMessage = null)
{
$this->tag = $tag;
$this->ephemeralPublicKey = $ephemeralPublicKey;
Expand Down
24 changes: 12 additions & 12 deletions src/Resources/InstalmentPlan.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
namespace UnzerSDK\Resources;

use DateTime;
use stdClass;
use UnzerSDK\Adapter\HttpAdapterInterface;
use UnzerSDK\Resources\PaymentTypes\BasePaymentType;
use UnzerSDK\Traits\CanAuthorizeWithCustomer;
use stdClass;

/**
* Resource representing the installment plan for Installment Secured.
Expand Down Expand Up @@ -77,17 +77,17 @@ class InstalmentPlan extends BasePaymentType
* @param float|null $lastRate
*/
public function __construct(
int $numberOfRates = null,
string $dayOfPurchase = null,
float $totalPurchaseAmount = null,
float $totalInterestAmount = null,
float $totalAmount = null,
float $effectiveInterestRate = null,
float $nominalInterestRate = null,
float $feeFirstRate = null,
float $feePerRate = null,
float $monthlyRate = null,
float $lastRate = null
?int $numberOfRates = null,
?string $dayOfPurchase = null,
?float $totalPurchaseAmount = null,
?float $totalInterestAmount = null,
?float $totalAmount = null,
?float $effectiveInterestRate = null,
?float $nominalInterestRate = null,
?float $feeFirstRate = null,
?float $feePerRate = null,
?float $monthlyRate = null,
?float $lastRate = null
) {
$this->numberOfRates = $numberOfRates;
$this->dayOfPurchase = $dayOfPurchase;
Expand Down
14 changes: 7 additions & 7 deletions src/Resources/Payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -829,11 +829,11 @@ public function getExternalId(): ?string
* @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK.
*/
public function cancelAmount(
float $amount = null,
?float $amount = null,
?string $reasonCode = CancelReasonCodes::REASON_CODE_CANCEL,
string $paymentReference = null,
float $amountNet = null,
float $amountVat = null
?string $paymentReference = null,
?float $amountNet = null,
?float $amountVat = null
): array {
return $this->getUnzerObject()->cancelPayment($this, $amount, $reasonCode, $paymentReference, $amountNet, $amountVat);
}
Expand All @@ -850,7 +850,7 @@ public function cancelAmount(
* @throws UnzerApiException An UnzerApiException is thrown if there is an error returned on API-request.
* @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK.
*/
public function cancelAuthorizationAmount(float $amount = null): ?Cancellation
public function cancelAuthorizationAmount(?float $amount = null): ?Cancellation
{
return $this->getUnzerObject()->cancelPaymentAuthorization($this, $amount);
}
Expand All @@ -865,7 +865,7 @@ public function cancelAuthorizationAmount(float $amount = null): ?Cancellation
* @throws UnzerApiException An UnzerApiException is thrown if there is an error returned on API-request.
* @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK.
*/
public function charge(float $amount = null): Charge
public function charge(?float $amount = null): Charge
{
return $this->getUnzerObject()->chargePayment($this, $amount);
}
Expand All @@ -881,7 +881,7 @@ public function charge(float $amount = null): Charge
* @throws UnzerApiException An UnzerApiException is thrown if there is an error returned on API-request.
* @throws RuntimeException A RuntimeException is thrown when there is an error while using the SDK.
*/
public function ship(string $invoiceId = null, string $orderId = null)
public function ship(?string $invoiceId = null, ?string $orderId = null)
{
return $this->getUnzerObject()->ship($this, $invoiceId, $orderId);
}
Expand Down
Loading