Skip to content

Commit

Permalink
style(php): apply php cs fixer
Browse files Browse the repository at this point in the history
  • Loading branch information
thislg committed Jun 27, 2024
1 parent 892092a commit 6bcadf7
Show file tree
Hide file tree
Showing 13 changed files with 139 additions and 175 deletions.
9 changes: 2 additions & 7 deletions src/Action/CancelAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
class CancelAction extends GatewayAwareAction
{
/**
* {@inheritdoc}
*
* @param Cancel $request
*/
public function execute($request): void
Expand All @@ -23,14 +21,11 @@ public function execute($request): void
throw new \LogicException('Not implemented');
}

/**
* {@inheritdoc}
*/
public function supports($request)
{
return
$request instanceof Cancel &&
$request->getModel() instanceof \ArrayAccess
$request instanceof Cancel
&& $request->getModel() instanceof \ArrayAccess
;
}
}
9 changes: 2 additions & 7 deletions src/Action/CaptureAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ public function __construct()
}

/**
* {@inheritdoc}
*
* @param Capture $request
*/
public function execute($request): void
Expand All @@ -51,14 +49,11 @@ public function execute($request): void
}
}

/**
* {@inheritdoc}
*/
public function supports($request)
{
return
$request instanceof Capture &&
$request->getModel() instanceof \ArrayAccess
$request instanceof Capture
&& $request->getModel() instanceof \ArrayAccess
;
}
}
13 changes: 4 additions & 9 deletions src/Action/ChoosePaymentTypeAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ public function __construct($templateName)
}

/**
* {@inheritdoc}
*
* @param ChoosePaymentType $request
*/
public function execute($request): void
Expand All @@ -46,7 +44,7 @@ public function execute($request): void
$getHttpRequest = new GetHttpRequest();
$this->gateway->execute($getHttpRequest);

/* if form has been submitted, set the payment type and card type to complete the payment details*/
/* if form has been submitted, set the payment type and card type to complete the payment details */
if ('POST' == $getHttpRequest->method && isset($getHttpRequest->request['paymentType'])) {
$details[PayBoxRequestParams::PBX_TYPEPAIEMENT] = $getHttpRequest->request['paymentType'];
$details[PayBoxRequestParams::PBX_TYPECARTE] = $getHttpRequest->request['cardType'];
Expand All @@ -64,14 +62,11 @@ public function execute($request): void
throw new HttpResponse($template->getResult());
}

/**
* {@inheritdoc}
*/
public function supports($request)
{
return
$request instanceof ChoosePaymentType &&
$request->getModel() instanceof \ArrayAccess
;
$request instanceof ChoosePaymentType
&& $request->getModel() instanceof \ArrayAccess
;
}
}
13 changes: 4 additions & 9 deletions src/Action/ConvertPaymentAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ class ConvertPaymentAction extends ApiLoggerAwareAction implements ActionInterfa
use GenericTokenFactoryAwareTrait;

/**
* {@inheritdoc}
*
* @param Convert $request
*/
public function execute($request): void
Expand All @@ -30,7 +28,7 @@ public function execute($request): void

$details = ArrayObject::ensureArrayObject($payment->getDetails());
$details[PayBoxRequestParams::PBX_TOTAL] = $payment->getTotalAmount();
//TODO : dynamise currency code.
// TODO : dynamise currency code.
$details[PayBoxRequestParams::PBX_DEVISE] = '978';
$details[PayBoxRequestParams::PBX_CMD] = $payment->getNumber();
$details[PayBoxRequestParams::PBX_PORTEUR] = $payment->getClientEmail();
Expand All @@ -53,15 +51,12 @@ public function execute($request): void
$request->setResult((array) $details);
}

/**
* {@inheritdoc}
*/
public function supports($request)
{
return
$request instanceof Convert &&
$request->getSource() instanceof PaymentInterface &&
'array' === $request->getTo()
$request instanceof Convert
&& $request->getSource() instanceof PaymentInterface
&& 'array' === $request->getTo()
;
}
}
9 changes: 2 additions & 7 deletions src/Action/NotifyAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ public function __construct()
/**
* @See documentation ManuelIntegrationVerifone_PayboxSystem_V8 5.3 Instant Payment Notification
*
* {@inheritdoc}
*
* @param Notify $request
*/
public function execute($request): void
Expand Down Expand Up @@ -84,14 +82,11 @@ public function execute($request): void
throw new HttpResponse('OK', 200);
}

/**
* {@inheritdoc}
*/
public function supports($request)
{
return
$request instanceof Notify &&
$request->getModel() instanceof \ArrayAccess
$request instanceof Notify
&& $request->getModel() instanceof \ArrayAccess
;
}

Expand Down
9 changes: 2 additions & 7 deletions src/Action/RefundAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
class RefundAction extends GatewayAwareAction
{
/**
* {@inheritdoc}
*
* @param Refund $request
*/
public function execute($request): void
Expand All @@ -23,14 +21,11 @@ public function execute($request): void
throw new \LogicException('Not implemented');
}

/**
* {@inheritdoc}
*/
public function supports($request)
{
return
$request instanceof Refund &&
$request->getModel() instanceof \ArrayAccess
$request instanceof Refund
&& $request->getModel() instanceof \ArrayAccess
;
}
}
25 changes: 10 additions & 15 deletions src/Action/StatusAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,23 @@

class StatusAction implements ActionInterface
{
const SUCCESS = '00000';
public const SUCCESS = '00000';

const CONTACT_CARD_OWNER = '01';
public const CONTACT_CARD_OWNER = '01';

const INVALID_TRANSACTION = '12';
public const INVALID_TRANSACTION = '12';

const INVALID_AMOUNT = '13';
public const INVALID_AMOUNT = '13';

const INVALID_HOLDER_NUMBER = '14';
public const INVALID_HOLDER_NUMBER = '14';

const CUSTOM_CANCELATION = '17';
public const CUSTOM_CANCELATION = '17';

const RETRY_LATER = '19';
public const RETRY_LATER = '19';

const EXPIRED_CARD = '33';
public const EXPIRED_CARD = '33';

/**
* {@inheritdoc}
*
* @param GetStatusInterface $request
*/
public function execute($request): void
Expand All @@ -51,14 +49,11 @@ public function execute($request): void
$request->markFailed();
}

/**
* {@inheritdoc}
*/
public function supports($request)
{
return
$request instanceof GetStatusInterface &&
$request->getModel() instanceof \ArrayAccess
$request instanceof GetStatusInterface
&& $request->getModel() instanceof \ArrayAccess
;
}
}
19 changes: 9 additions & 10 deletions src/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,24 @@
use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerAwareTrait;
use Psr\Log\NullLogger;
use RuntimeException;

class Api implements LoggerAwareInterface
{
use LoggerAwareTrait;
/**
* Primary server.
*/
const MAIN_SERVER = 'tpeweb.paybox.com';
public const MAIN_SERVER = 'tpeweb.paybox.com';

/**
* Backup server.
*/
const BACKUP_SERVER = 'tpeweb1.paybox.com';
public const BACKUP_SERVER = 'tpeweb1.paybox.com';

/**
* Sandbox server.
*/
const SANDBOX_SERVER = 'preprod-tpeweb.paybox.com';
public const SANDBOX_SERVER = 'preprod-tpeweb.paybox.com';

/**
* @var HttpClientInterface
Expand All @@ -47,7 +46,7 @@ class Api implements LoggerAwareInterface
*/
protected $options = [];

const PAYBOX_IP_ADDRESSES = [
public const PAYBOX_IP_ADDRESSES = [
// incoming ip addresses
// pre-production
'195.101.99.73',
Expand All @@ -63,7 +62,7 @@ class Api implements LoggerAwareInterface
// outgoing ip addresses
// pre-production
'195.101.99.76',
//production
// production
'194.2.122.158',
'194.2.122.190',
'195.25.7.166',
Expand Down Expand Up @@ -113,7 +112,7 @@ protected function doRequest(string $method, array $fields): ResponseInterface
*
* @return string server url
*
* @throws RuntimeException if no server available
* @throws \RuntimeException if no server available
*/
protected function getApiEndpoint()
{
Expand All @@ -134,7 +133,7 @@ protected function getApiEndpoint()
}
}

throw new RuntimeException('No server available.');
throw new \RuntimeException('No server available.');
}

/**
Expand Down Expand Up @@ -244,8 +243,8 @@ private function checkPayboxSignature(GetHttpRequest $httpRequest): bool
$signatureInitialized = $signature;
} else {
$this->logger->error('Fail to base_decode signature', [
'signature' => $signature,
]);
'signature' => $signature,
]);

return false;
}
Expand Down
Loading

0 comments on commit 6bcadf7

Please sign in to comment.