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,39 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\BusProNet\XmlParser;
|
||||
|
||||
use App\BusProNet\Model\VoucherPaymentMethod;
|
||||
use Symfony\Component\DomCrawler\Crawler;
|
||||
|
||||
/**
|
||||
* Parses GUTSCHEINZAHLUNGSARTEN responses.
|
||||
*
|
||||
* Expected XML structure (test system, 2026-10-01):
|
||||
* <ergebnis>
|
||||
* <satz typ="GUTSCHEINZAHLUNGSARTEN"></satz>
|
||||
* <zahlungsarten>
|
||||
* <zahlungsart id="2" bezeichnung="Überweisung" art="UEBERW"></zahlungsart>
|
||||
* </zahlungsarten>
|
||||
* </ergebnis>
|
||||
*/
|
||||
final class VoucherPaymentMethodsParser extends AbstractParser
|
||||
{
|
||||
/**
|
||||
* @return list<VoucherPaymentMethod>
|
||||
*/
|
||||
public function parse(Crawler $node): array
|
||||
{
|
||||
$paymentMethods = [];
|
||||
$node->filterXPath('//zahlungsarten/zahlungsart')->each(function (Crawler $methodNode) use (&$paymentMethods): void {
|
||||
$paymentMethods[] = new VoucherPaymentMethod(
|
||||
id: (int) $this->getRequiredAttrValue($methodNode, 'id', 'voucher payment method'),
|
||||
label: $this->getRequiredAttrValue($methodNode, 'bezeichnung', 'voucher payment method'),
|
||||
type: $this->getRequiredAttrValue($methodNode, 'art', 'voucher payment method'),
|
||||
);
|
||||
});
|
||||
|
||||
return $paymentMethods;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user