Skip to content

Commit

Permalink
changed htran generation method
Browse files Browse the repository at this point in the history
  • Loading branch information
samuraee committed Jun 29, 2023
1 parent f0165de commit a9a407d
Show file tree
Hide file tree
Showing 11 changed files with 206 additions and 496 deletions.
12 changes: 6 additions & 6 deletions config/wallet.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
*/

'mode' => env('WALLET_MODE', 'production'),

'asanpardakht' => [
'debug' => true,
'host_id' => '',
'url' => '',
'private_key' => '',
]

'host_id' => env('ASANPARDAKHT_WALLET_HOST_ID'),
'url' => env(
'ASANPARDAKHT_WALLET_URL',
'https://thirdparty.dev.tasn.ir/exts/v1/'
).env('ASANPARDAKHT_WALLET_HOST_ID').'/1',
],
];
11 changes: 5 additions & 6 deletions src/Contracts/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@

interface Factory
{

// /**
// * @param $driver
// * @return mixed
// */
// public function driver($driver = null): mixed;
// /**
// * @param $driver
// * @return mixed
// */
// public function driver($driver = null): mixed;
}
50 changes: 2 additions & 48 deletions src/Contracts/Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,88 +6,42 @@ interface Provider
{
/**
* Determines whether the provider supports reverse transaction
*
* @return bool
*/
public function refundSupport(): bool;

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

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

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


/**
* @return array
*/
public function getFormParameters(): array;


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

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


/**
* @return bool
*/
public function settleTransaction(): bool;


/**
* @return bool
*/
public function refundTransaction(): bool;


/**
* @return string
*/
public function getGatewayReferenceId(): string;


/**
* @param string $action
* @return string
*/
public function getUrlFor(string $action): string;


/**
* @return bool
*/
public function canContinueWithCallbackParameters(): bool;


/**
* @param array $parameters
* @return void
*/
public function checkRequiredActionParameters(array $parameters): void;
}
75 changes: 2 additions & 73 deletions src/Contracts/Transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,12 @@ 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 mixed
*/
Expand All @@ -24,105 +20,38 @@ public function setGatewayToken(string $token, bool $save = true): bool;
/**
* set reference ID of transaction
*
* @param string $referenceId
* @param bool $save
*
* @return mixed
*/
public function setReferenceId(string $referenceId, bool $save = true): bool;


/**
* @return int
*/
public function getGatewayOrderId(): int;


/**
* @return bool
*/
public function isReadyForTokenRequest(): bool;


/**
* @return bool
*/
public function isReadyForVerify(): bool;


/**
* @return bool
*/
public function isReadyForInquiry(): bool;


/**
* @return bool
*/
public function isReadyForSettle(): bool;


/**
* @return bool
*/
public function isReadyForRefund(): bool;


/**
* @param bool $save
* @return bool
*/
public function setVerified(bool $save = true): bool;


/**
* @param bool $save
* @return bool
*/
public function setSettled(bool $save = true): bool;


/**
* @param bool $save
* @return bool
*/
public function setAccomplished(bool $save = true): bool;


/**
* @param bool $save
* @return bool
*/
public function setRefunded(bool $save = true): bool;


/**
* @return int
*/
public function getPayableAmount(): int;


/**
* @param string $cardNumber
* @param bool $save
* @return bool
*/
public function setCardNumber(string $cardNumber, bool $save = false): bool;


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


/**
* @param string $key
* @param $value
* @param bool $save
* @return bool
*/
public function addExtra(string $key, $value, bool $save = true): bool;

public function getWalletTransactionId(): int;
}
4 changes: 0 additions & 4 deletions src/Enums/AsanpardakhtStatusEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

namespace PhpMonsters\LaraWallet\Enums;

/**
*
*/
enum AsanpardakhtStatusEnum: int
{
//----------------------generate by Asanpardakht-------------------
Expand All @@ -31,7 +28,6 @@ enum AsanpardakhtStatusEnum: int
case SettleRequestHop = 2002;
case RefundRequestHop = 2003;


//----------------------generate by code-------------------
case SuccessResponse = 10001;
case AccessDeniedResponse = 10000;
Expand Down
3 changes: 0 additions & 3 deletions src/Exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

namespace PhpMonsters\LaraWallet;

/**
*
*/
class Exception extends \Exception
{
}
5 changes: 0 additions & 5 deletions src/Facades/LaraWallet.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,12 @@
use PhpMonsters\LaraWallet\Contracts\Factory;

/**
*
* @method static log(string $message, array $params, string $level)
*/
class LaraWallet extends Facade
{
/**
* @return string
*/
public static function getFacadeAccessor(): string
{
return Factory::class;
}

}
12 changes: 1 addition & 11 deletions src/LaraWalletServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,10 @@
use Illuminate\Support\ServiceProvider;
use PhpMonsters\LaraWallet\Contracts\Factory;

/**
*
*/
class LaraWalletServiceProvider extends ServiceProvider
{
/**
* Register services.
*
* @return void
*/
public function register(): void
{
Expand All @@ -24,21 +19,16 @@ public function register(): void

/**
* Bootstrap services.
*
* @return void
*/
public function boot(): void
{
$this->registerPublishing();
}

/**
* @return void
*/
protected function registerPublishing(): void
{
$this->publishes([
__DIR__ . '/../config/wallet.php' => config_path('wallet.php')
__DIR__.'/../config/wallet.php' => config_path('wallet.php'),
], 'config');
}
}
Loading

0 comments on commit a9a407d

Please sign in to comment.