-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add bin filter * Add GitHub actions * Fixing condition php * Implement charge method * Implement charge method
- Loading branch information
1 parent
2aa0f2b
commit 09dcdd8
Showing
9 changed files
with
325 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Ziswapp\Payment\Contracts; | ||
|
||
use Ziswapp\Payment\Input\ChargeCardInput; | ||
|
||
interface CardInputFactoryInterface extends InputInterface | ||
{ | ||
public function fromChargeInput(ChargeCardInput $input): self; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Ziswapp\Payment\Contracts; | ||
|
||
use Ziswapp\Payment\Output\ChargeCardOutput; | ||
|
||
interface CardOutputFactoryInterface | ||
{ | ||
public function fromChargeArray(array $data): ChargeCardOutput; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Ziswapp\Payment\Contracts; | ||
|
||
use Ziswapp\Payment\Input\ChargeCardInput; | ||
|
||
interface CardPaymentInterface | ||
{ | ||
/** | ||
* @return mixed | ||
*/ | ||
public function charge(ChargeCardInput $input); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Ziswapp\Payment\Input; | ||
|
||
use Ziswapp\Payment\ValueObject\Transaction; | ||
|
||
final class ChargeCardInput extends TransactionInput | ||
{ | ||
private string $token; | ||
|
||
private bool $authentication; | ||
|
||
private bool $savedToken; | ||
|
||
private array $allowedBins; | ||
|
||
public function __construct(Transaction $transaction, string $token, bool $authentication, bool $savedToken = false, array $allowedBins = []) | ||
{ | ||
$this->token = $token; | ||
$this->authentication = $authentication; | ||
$this->savedToken = $savedToken; | ||
$this->allowedBins = $allowedBins; | ||
|
||
parent::__construct($transaction); | ||
} | ||
|
||
public function getToken(): string | ||
{ | ||
return $this->token; | ||
} | ||
|
||
public function isAuthentication(): bool | ||
{ | ||
return $this->authentication; | ||
} | ||
|
||
public function isSavedToken(): bool | ||
{ | ||
return $this->savedToken; | ||
} | ||
|
||
public function getAllowedBins(): array | ||
{ | ||
return $this->allowedBins; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Ziswapp\Payment\Output; | ||
|
||
use DateTimeInterface; | ||
|
||
final class ChargeCardOutput extends TransactionOutput | ||
{ | ||
private ?string $redirectUrl = null; | ||
|
||
private string $fraudStatus; | ||
|
||
private DateTimeInterface $transactionDate; | ||
|
||
public static function create( | ||
string $transactionId, | ||
string $orderId, | ||
string $status, | ||
string $fraudStatus, | ||
float $amount, | ||
DateTimeInterface $transactionDate, | ||
?string $redirectUrl = null, | ||
array $originalOutput = [] | ||
): self { | ||
$self = new self(); | ||
|
||
$self->transactionId = $transactionId; | ||
$self->orderId = $orderId; | ||
$self->status = $status; | ||
$self->fraudStatus = $fraudStatus; | ||
$self->amount = $amount; | ||
$self->redirectUrl = $redirectUrl; | ||
$self->transactionDate = $transactionDate; | ||
$self->originalOutput = $originalOutput; | ||
|
||
return $self; | ||
} | ||
|
||
public function getRedirectUrl(): ?string | ||
{ | ||
return $this->redirectUrl; | ||
} | ||
|
||
public function getFraudStatus(): string | ||
{ | ||
return $this->fraudStatus; | ||
} | ||
|
||
public function getTransactionDate(): DateTimeInterface | ||
{ | ||
return $this->transactionDate; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.