feat: voucher purchase flow
This commit is contained in:
1 parent
a628e96d06
commit
f3dd122678
70 files changed
+3672
-122
No files matched your search
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\BusProNet\Model;
|
||||
|
||||
/**
|
||||
* A GUTSCHEINBUCHUNG response that is not a HINWEIS.
|
||||
*
|
||||
* The dry run (buchungsart Anfrage) answers <buchung>möglich</buchung> and nothing else, so every
|
||||
* other field is only set by the actual purchase (buchungsart Buchung, <buchung>erfolgt</buchung>).
|
||||
*
|
||||
* The redemption code is deliberately not exposed to the customer before payment: BusPro mails the
|
||||
* voucher itself once the transfer has arrived.
|
||||
*/
|
||||
final readonly class VoucherSaleResponse
|
||||
{
|
||||
public const string SALE_POSSIBLE = 'möglich';
|
||||
public const string SALE_PROCESSED = 'erfolgt';
|
||||
|
||||
public function __construct(
|
||||
public string $status,
|
||||
public ?int $voucherId = null,
|
||||
public ?string $voucherNumber = null,
|
||||
public ?string $redemptionCode = null,
|
||||
public ?float $price = null,
|
||||
public ?string $invoiceNumber = null,
|
||||
public ?string $email = null,
|
||||
) {
|
||||
}
|
||||
|
||||
public function isInquiryValid(): bool
|
||||
{
|
||||
return self::SALE_POSSIBLE === $this->status;
|
||||
}
|
||||
|
||||
public function isSaleSuccessful(): bool
|
||||
{
|
||||
return self::SALE_PROCESSED === $this->status;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user