Skip to content

Commit

Permalink
fixed code style using Pint tool
Browse files Browse the repository at this point in the history
  • Loading branch information
samuraee committed Jun 28, 2023
1 parent 7567b13 commit cba6355
Show file tree
Hide file tree
Showing 26 changed files with 521 additions and 648 deletions.
34 changes: 17 additions & 17 deletions config/shaparak.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@
|--------------------------------------------------------------------------
*/
'saman' => [
'terminal_id' => env('SAMAN_TERMINAL_ID'),
'terminal_id' => env('SAMAN_TERMINAL_ID'),
'terminal_pass' => env('SAMAN_TERMINAL_PASS'),
],
],
/*
|--------------------------------------------------------------------------
| Parsian gateway configuration
Expand All @@ -58,45 +58,45 @@
|--------------------------------------------------------------------------
*/
'pasargad' => [
'terminal_id' => env('PASARGAD_TERMINAL_ID'),
'merchant_id' => env('PASARGAD_MERCHANT_ID'),
'certificate_path' => env('PASARGAD_CERT_PATH', storage_path('shaparak/pasargad/certificate.xml')),
'terminal_id' => env('PASARGAD_TERMINAL_ID'),
'merchant_id' => env('PASARGAD_MERCHANT_ID'),
'certificate_path' => env('PASARGAD_CERT_PATH', storage_path('shaparak/pasargad/certificate.xml')),
],
/*
|--------------------------------------------------------------------------
| Mellat gateway configuration
|--------------------------------------------------------------------------
*/
'mellat' => [
'username' => env('MELLAT_USERNAME'),
'password' => env('MELLAT_PASSWORD'),
'mellat' => [
'username' => env('MELLAT_USERNAME'),
'password' => env('MELLAT_PASSWORD'),
'terminal_id' => env('MELLAT_TERMINAL_ID'),
],
/*
|--------------------------------------------------------------------------
| Melli/Sadad gateway configuration
|--------------------------------------------------------------------------
*/
'melli' => [
'merchant_id' => env('MELLI_MERCHANT_ID'),
'terminal_id' => env('MELLI_TERMINAL_ID'),
'melli' => [
'merchant_id' => env('MELLI_MERCHANT_ID'),
'terminal_id' => env('MELLI_TERMINAL_ID'),
'transaction_key' => env('MELLI_TRANS_KEY'),
],
/*
|--------------------------------------------------------------------------
| Zarinpal gateway configuration
|--------------------------------------------------------------------------
*/
'saderat' => [
'terminal_id' => env('SADERAT_MERCHANT_ID'),
'saderat' => [
'terminal_id' => env('SADERAT_MERCHANT_ID'),
],
/*
|--------------------------------------------------------------------------
| Zarinpal gateway configuration
|--------------------------------------------------------------------------
*/
'zarinpal' => [
'merchant_id' => env('ZARINPAL_MERCHANT_ID'),
'zarinpal' => [
'merchant_id' => env('ZARINPAL_MERCHANT_ID'),
],
],

Expand All @@ -109,7 +109,7 @@
|
*/
'httpClientOptions' => [
'soap' => [],
'curl' => [],
'soap' => [],
'curl' => [],
],
];
2 changes: 0 additions & 2 deletions src/Contracts/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

namespace PhpMonsters\Shaparak\Contracts;

use InvalidArgumentException;

interface Factory
{
/**
Expand Down
59 changes: 16 additions & 43 deletions src/Contracts/Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,107 +9,80 @@ interface Provider
{
/**
* Determines whether the provider supports reverse transaction
*
* @return bool
*/
function refundSupport(): bool;
public function refundSupport(): bool;

/**
* @param array $parameters operation parameters
*
* @return Provider
* @param array $parameters operation parameters
*/
function setParameters(array $parameters = []): Provider;
public function setParameters(array $parameters = []): Provider;

/**
* @param string|null $key
*
* @param null $default
*
* @param null $default
* @return mixed
*/
function getParameters(string $key = null, $default = null);
public function getParameters(string $key = null, $default = null);

/**
* return rendered goto gate form
*
* @return View
*/
function getForm(): View;
public function getForm(): View;

/**
* return parameters that require for generating goto gate form
*
* @return array
*/
function getFormParameters(): array;
public function getFormParameters(): array;

/**
* get the transaction
*
* @return Transaction
*/
function getTransaction(): Transaction;
public function getTransaction(): Transaction;

/**
* verify transaction
*
* @return bool
*/
function verifyTransaction(): bool;
public function verifyTransaction(): bool;

/**
* for handling after verify methods like settle in Mellat gateway
*
* @return mixed
*/
function settleTransaction(): bool;
public function settleTransaction(): bool;

/**
* reverse/refund transaction if supported by the provider
*
* @return bool
*/
function refundTransaction(): bool;
public function refundTransaction(): bool;

/**
* accomplish transaction. It means the transaction is immutable from now on
*
* @return bool
*/
function accomplishTransaction(): bool;
public function accomplishTransaction(): bool;

/**
* fetch bak gateway reference id from callback parameters
*
* @return string
*/
function getGatewayReferenceId(): string;
public function getGatewayReferenceId(): string;

/**
* get the Url of different parts of a payment process of the gateway
*
* @param string $action
*
* @return string
* @throws Exception
*
*/
function getUrlFor(string $action): string;
public function getUrlFor(string $action): string;

/**
* Specifies whether it is possible to continue payment process with the return parameters from the bank gateway
*
* @return bool
*/
function canContinueWithCallbackParameters(): bool;
public function canContinueWithCallbackParameters(): bool;

/**
* check for required parameters
*
* @param array $parameters
*
* @throws Exception
*/
function checkRequiredActionParameters(array $parameters): void;
public function checkRequiredActionParameters(array $parameters): void;
}
58 changes: 0 additions & 58 deletions src/Contracts/Transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,154 +6,96 @@ interface Transaction
{
/**
* return the callback url of the transaction process
*
* @return string
*/
public function getCallbackUrl(): string;

/**
* set gateway token of transaction
*
* @param string $token
* @param bool $save
*
* @return bool
*/
public function setGatewayToken(string $token, bool $save = true): bool;

/**
* set reference ID of transaction شناسه/کد پیگیری
*
* @param string $referenceId
* @param bool $save
*
* @return bool
*/
public function setReferenceId(string $referenceId, bool $save = true): bool;

/**
* get reference ID of the
* @return string
*/
public function getReferenceId(): string;

/**
* return an order id for the transaction to requesting a payment token from the gateway
*
* @return int
*/
public function getGatewayOrderId(): int;

/**
* check if transaction is ready for requesting token from payment gateway or not
*
* @return boolean
*/
public function isReadyForTokenRequest(): bool;

/**
* check if transaction is ready for requesting verify method from payment gateway or not
*
* @return bool
*/
public function isReadyForVerify(): bool;

/**
* check if transaction is ready for requesting inquiry method from payment gateway or not
* This feature does not append to all payment gateways
*
* @return bool
*/
public function isReadyForInquiry(): bool;

/**
* check if transaction is ready for requesting settlement method from payment gateway or not
* This feature does not append to all payment gateways.
* for example in Mellat gateway this method can assume as SETTLE method
*
* @return bool
*/
public function isReadyForSettle(): bool;

/**
* check if transaction is ready for requesting refund method from payment gateway or not
* This feature does not append to all payment gateways
*
* @return bool
*/
public function isReadyForRefund(): bool;

/**
* Mark transaction as a verified transaction
*
* @param bool $save
*
* @return bool
*/
public function setVerified(bool $save = true): bool;

/**
* Mark transaction as a after verified transaction
* For example SETTLED in Mellat gateway
*
* @param bool $save
*
* @return bool
*/
public function setSettled(bool $save = true): bool;

/**
* Mark transaction as a paid/successful transaction
*
* @param bool $save
*
* @return bool
*/
public function setAccomplished(bool $save = true): bool;

/**
* Mark transaction as a refunded transaction
*
* @param bool $save
*
* @return bool
*/
public function setRefunded(bool $save = true): bool;

/**
* Returns the payable amount af the transaction
*
* @return int
*/
public function getPayableAmount(): int;

/**
* save the pan/card number that used for paying the transaction
* @param string $cardNumber
* @param bool $save
*
* @return bool
*/
public function setCardNumber(string $cardNumber, bool $save = false): bool;

/**
* Set callback parameters from payment gateway
*
* @param array $parameters
* @param bool $save
*
* @return bool
*/
public function setCallBackParameters(array $parameters, bool $save = true): bool;

/**
* Set extra values of the transaction. Every key/value pair that you want to bind to the transaction
*
* @param string $key
* @param $value
* @param bool $save
*
* @return bool
*/
public function addExtra(string $key, $value, bool $save = true): bool;
}
5 changes: 4 additions & 1 deletion src/Exception.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php

namespace PhpMonsters\Shaparak;

class Exception extends \Exception {}
class Exception extends \Exception
{
}
1 change: 0 additions & 1 deletion src/Exceptions/RefundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@

class RefundException extends Exception
{

}
1 change: 0 additions & 1 deletion src/Exceptions/RequestTokenException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@

class RequestTokenException extends Exception
{

}
1 change: 0 additions & 1 deletion src/Exceptions/SettlementException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@

class SettlementException extends Exception
{

}
Loading

0 comments on commit cba6355

Please sign in to comment.