diff --git a/docs/ArrayAccess.html b/docs/ArrayAccess.html index fc88688..34233fb 100644 --- a/docs/ArrayAccess.html +++ b/docs/ArrayAccess.html @@ -197,11 +197,11 @@
Symfony\Component\OptionsResolver\OptionsResolver::offsetExists()
ArrayObject::offsetExists()
ArrayIterator::offsetExists()
Symfony\Component\OptionsResolver\OptionsResolver::offsetExists()
Symfony\Component\OptionsResolver\OptionsResolver::offsetGet()
ArrayObject::offsetGet()
ArrayIterator::offsetGet()
Symfony\Component\OptionsResolver\OptionsResolver::offsetGet()
Symfony\Component\OptionsResolver\OptionsResolver::offsetSet()
ArrayObject::offsetSet()
ArrayIterator::offsetSet()
Symfony\Component\OptionsResolver\OptionsResolver::offsetSet()
Symfony\Component\OptionsResolver\OptionsResolver::offsetUnset()
ArrayObject::offsetUnset()
ArrayIterator::offsetUnset()
Symfony\Component\OptionsResolver\OptionsResolver::offsetUnset()
Symfony\Component\OptionsResolver\OptionsResolver::count()
ArrayObject::count()
ArrayIterator::count()
Symfony\Component\OptionsResolver\OptionsResolver::count()
<T is
-IPay\Api\AuthenticatedApi
+IPay\Api\UnauthenticatedApi
- uses
- LazyGhostTrait
-IPay\Api\UnauthenticatedApi
+IPay\Api\AuthenticatedApi
+ uses
+ LazyGhostTrait
diff --git a/docs/IPay.Api.AuthenticatedApi.html b/docs/IPay.Api.AuthenticatedApi.html
index b2f41df..4e29262 100644
--- a/docs/IPay.Api.AuthenticatedApi.html
+++ b/docs/IPay.Api.AuthenticatedApi.html
@@ -194,7 +194,7 @@ Overrides
- transactions(?string $accountNumber = null): TransactionBuilder
+ transactions(?string $accountNumber = null): TransactionBuilder
diff --git a/docs/InvalidArgumentException.html b/docs/InvalidArgumentException.html
index a63144f..05d4982 100644
--- a/docs/InvalidArgumentException.html
+++ b/docs/InvalidArgumentException.html
@@ -144,12 +144,12 @@
-Symfony\Component\OptionsResolver\Exception\MissingOptionsException
+Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException
-Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException
+Symfony\Component\OptionsResolver\Exception\MissingOptionsException
diff --git a/docs/LogicException.html b/docs/LogicException.html
index c223fbd..576df77 100644
--- a/docs/LogicException.html
+++ b/docs/LogicException.html
@@ -144,12 +144,12 @@
-Symfony\Component\OptionsResolver\Exception\MissingOptionsException
+Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException
-Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException
+Symfony\Component\OptionsResolver\Exception\MissingOptionsException
@@ -158,14 +158,14 @@
-Symfony\Component\OptionsResolver\Exception\AccessException
+Symfony\Component\OptionsResolver\Exception\OptionDefinitionException
implements
ExceptionInterface
-Symfony\Component\OptionsResolver\Exception\OptionDefinitionException
+Symfony\Component\OptionsResolver\Exception\AccessException
implements
ExceptionInterface
diff --git a/docs/RuntimeException.html b/docs/RuntimeException.html
index 192b77c..98206c8 100644
--- a/docs/RuntimeException.html
+++ b/docs/RuntimeException.html
@@ -127,7 +127,7 @@
-EventSauce\ObjectHydrator\UnableToHydrateObject
+EventSauce\ObjectHydrator\UnableToSerializeObject
diff --git a/docs/Stringable.html b/docs/Stringable.html
index e90f297..b7c670f 100644
--- a/docs/Stringable.html
+++ b/docs/Stringable.html
@@ -134,94 +134,94 @@
-
-IPay\Exception\LoginException
+IPay\Exception\SessionException
-
-IPay\Exception\SessionException
+IPay\Exception\LoginException
-
-RuntimeException
+LogicException
-
-EventSauce\ObjectHydrator\UnableToSerializeObject
+InvalidArgumentException
-
+
-
-LogicException
+Symfony\Component\OptionsResolver\Exception\MissingOptionsException
-
+
+
+
+
+
-InvalidArgumentException
+Symfony\Component\OptionsResolver\Exception\OptionDefinitionException
+ implements
+ ExceptionInterface
-
+
-Symfony\Component\OptionsResolver\Exception\InvalidArgumentException
+Symfony\Component\OptionsResolver\Exception\AccessException
implements
ExceptionInterface
-
+
+
+
-Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
+RuntimeException
-
+
-
-Symfony\Component\OptionsResolver\Exception\MissingOptionsException
+EventSauce\ObjectHydrator\UnableToHydrateObject
-
-Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException
+OutOfBoundsException
-
-
-
-
-
+
-
-Symfony\Component\OptionsResolver\Exception\AccessException
+Symfony\Component\OptionsResolver\Exception\NoSuchOptionException
implements
ExceptionInterface
+
+
-Symfony\Component\OptionsResolver\Exception\OptionDefinitionException
+EventSauce\ObjectHydrator\UnableToSerializeObject
- implements
- ExceptionInterface
@@ -252,21 +252,21 @@
-
-Symfony\Component\OptionsResolver\Exception\AccessException
+Symfony\Component\OptionsResolver\Exception\OptionDefinitionException
implements
ExceptionInterface
-
-Symfony\Component\OptionsResolver\Exception\OptionDefinitionException
+Symfony\Component\OptionsResolver\Exception\NoSuchOptionException
implements
ExceptionInterface
-
-Symfony\Component\OptionsResolver\Exception\NoSuchOptionException
+Symfony\Component\OptionsResolver\Exception\AccessException
implements
ExceptionInterface
@@ -285,12 +285,12 @@
-
-Symfony\Component\OptionsResolver\Exception\MissingOptionsException
+Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException
-
-Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException
+Symfony\Component\OptionsResolver\Exception\MissingOptionsException
diff --git a/docs/Symfony.Component.OptionsResolver.Exception.ExceptionInterface.html b/docs/Symfony.Component.OptionsResolver.Exception.ExceptionInterface.html
index 27b426c..3ae77cb 100644
--- a/docs/Symfony.Component.OptionsResolver.Exception.ExceptionInterface.html
+++ b/docs/Symfony.Component.OptionsResolver.Exception.ExceptionInterface.html
@@ -181,21 +181,21 @@
-
-Symfony\Component\OptionsResolver\Exception\AccessException
+Symfony\Component\OptionsResolver\Exception\OptionDefinitionException
implements
ExceptionInterface
-
-Symfony\Component\OptionsResolver\Exception\OptionDefinitionException
+Symfony\Component\OptionsResolver\Exception\NoSuchOptionException
implements
ExceptionInterface
-
-Symfony\Component\OptionsResolver\Exception\NoSuchOptionException
+Symfony\Component\OptionsResolver\Exception\AccessException
implements
ExceptionInterface
@@ -214,12 +214,12 @@
-
-Symfony\Component\OptionsResolver\Exception\MissingOptionsException
+Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException
-
-Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException
+Symfony\Component\OptionsResolver\Exception\MissingOptionsException
diff --git a/docs/Symfony.Component.OptionsResolver.Exception.InvalidArgumentException.html b/docs/Symfony.Component.OptionsResolver.Exception.InvalidArgumentException.html
index 449f304..f432acb 100644
--- a/docs/Symfony.Component.OptionsResolver.Exception.InvalidArgumentException.html
+++ b/docs/Symfony.Component.OptionsResolver.Exception.InvalidArgumentException.html
@@ -211,12 +211,12 @@
-
-Symfony\Component\OptionsResolver\Exception\MissingOptionsException
+Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException
-
-Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException
+Symfony\Component\OptionsResolver\Exception\MissingOptionsException
diff --git a/docs/Throwable.html b/docs/Throwable.html
index 4b5acc1..265eeb0 100644
--- a/docs/Throwable.html
+++ b/docs/Throwable.html
@@ -126,94 +126,94 @@
-
-IPay\Exception\LoginException
+IPay\Exception\SessionException
-
-IPay\Exception\SessionException
+IPay\Exception\LoginException
-
-RuntimeException
+LogicException
-
-EventSauce\ObjectHydrator\UnableToSerializeObject
+InvalidArgumentException
-
+
-
-LogicException
+Symfony\Component\OptionsResolver\Exception\MissingOptionsException
-
+
+
+
+
+
-
-InvalidArgumentException
+Symfony\Component\OptionsResolver\Exception\OptionDefinitionException
+ implements
+ ExceptionInterface
-
+
-
-Symfony\Component\OptionsResolver\Exception\InvalidArgumentException
+Symfony\Component\OptionsResolver\Exception\AccessException
implements
ExceptionInterface
-
+
+
+
-Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
+RuntimeException
-
+
-
-Symfony\Component\OptionsResolver\Exception\MissingOptionsException
+EventSauce\ObjectHydrator\UnableToHydrateObject
-
-Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException
+OutOfBoundsException
-
-
-
-
-
+
-
-Symfony\Component\OptionsResolver\Exception\AccessException
+Symfony\Component\OptionsResolver\Exception\NoSuchOptionException
implements
ExceptionInterface
+
+
-Symfony\Component\OptionsResolver\Exception\OptionDefinitionException
+EventSauce\ObjectHydrator\UnableToSerializeObject
- implements
- ExceptionInterface
@@ -244,21 +244,21 @@
-
-Symfony\Component\OptionsResolver\Exception\AccessException
+Symfony\Component\OptionsResolver\Exception\OptionDefinitionException
implements
ExceptionInterface
-
-Symfony\Component\OptionsResolver\Exception\OptionDefinitionException
+Symfony\Component\OptionsResolver\Exception\NoSuchOptionException
implements
ExceptionInterface
-
-Symfony\Component\OptionsResolver\Exception\NoSuchOptionException
+Symfony\Component\OptionsResolver\Exception\AccessException
implements
ExceptionInterface
@@ -277,12 +277,12 @@
-
-Symfony\Component\OptionsResolver\Exception\MissingOptionsException
+Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException
-
-Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException
+Symfony\Component\OptionsResolver\Exception\MissingOptionsException
diff --git a/docs/source-Api.AuthenticatedApi.html b/docs/source-Api.AuthenticatedApi.html
index d5de639..97190ec 100644
--- a/docs/source-Api.AuthenticatedApi.html
+++ b/docs/source-Api.AuthenticatedApi.html
@@ -100,7 +100,7 @@ Classes
- 1: <?php 2: 3: namespace IPay\Api; 4: 5: use IPay\Builder\TransactionBuilder; 6: use IPay\Entity\Account; 7: use IPay\Entity\Customer; 8: use IPay\Entity\Transaction; 9: use IPay\Enum\TransactionType; 10: use IPay\IPayClient; 11: use IPay\Session\AuthenticatedSession; 12: use Symfony\Component\OptionsResolver\Options; 13: use Symfony\Component\VarExporter\LazyGhostTrait; 14: 15: /** 16: * @psalm-import-type ParametersType from TransactionBuilder 17: * 18: * @extends AbstractApi<AuthenticatedSession> 19: */ 20: final class AuthenticatedApi extends AbstractApi 21: { 22: use LazyGhostTrait; 23: 24: public Customer $customer; 25: 26: /** @var list<Account> */ 27: public array $accounts; 28: 29: public function __construct( 30: IPayClient $iPayClient, 31: AuthenticatedSession $session, 32: ) { 33: parent::__construct($iPayClient, $session); 34: self::createLazyGhost( 35: initializer: $this->populateLazyProperties(...), 36: instance: $this, 37: ); 38: } 39: 40: private function populateLazyProperties(): void 41: { 42: $this->customer = $this->customer(); 43: $this->accounts = $this->accounts(); 44: } 45: 46: /** 47: * @throws \IPay\Exception\SessionException 48: */ 49: private function customer(): Customer 50: { 51: return $this->objectMapper->hydrateObject( 52: Customer::class, 53: $this->post('getCustomerDetails')['customerInfo'], 54: ); 55: } 56: 57: /** 58: * @return list<Account> 59: * 60: * @throws \IPay\Exception\SessionException 61: */ 62: private function accounts(): array 63: { 64: return $this->objectMapper->hydrateObjects( 65: Account::class, 66: $this->post('getEntitiesAndAccounts')['accounts'], 67: )->toArray(); 68: } 69: 70: public function transactions(?string $accountNumber = null): TransactionBuilder 71: { 72: return new TransactionBuilder( 73: ['accountNumber' => $accountNumber ?? $this->customer->accountNumber], 74: $this->getTransactions(...), 75: ); 76: } 77: 78: /** 79: * @param ParametersType $parameters 80: * 81: * @return \Traversable<int, Transaction> 82: * 83: * @throws \IPay\Exception\SessionException 84: */ 85: private function getTransactions(array $parameters): \Traversable 86: { 87: $datetimeNormalizer = fn ( 88: Options $resolver, 89: \DateTimeInterface $value 90: ): string => $value->format('Y-m-d'); 91: 92: $transactionTypeNormalizer = fn ( 93: Options $resolver, 94: TransactionType $value 95: ): string => $value->value; 96: 97: $resolver = self::createOptionsResolver() 98: ->setRequired('accountNumber') 99: ->setDefined([ 100: 'tranType', 101: 'startDate', 102: 'endDate', 103: ]) 104: ->setAllowedTypes('accountNumber', 'string') 105: ->setAllowedTypes('tranType', TransactionType::class) 106: ->setAllowedTypes('startDate', \DateTimeInterface::class) 107: ->setAllowedTypes('endDate', \DateTimeInterface::class) 108: ->setNormalizer('tranType', $transactionTypeNormalizer) 109: ->setNormalizer('startDate', $datetimeNormalizer) 110: ->setNormalizer('endDate', $datetimeNormalizer) 111: ; 112: 113: $parameters = $resolver->resolve($parameters); 114: 115: $parameters['pageNumber'] = 0; 116: do { 117: $transactions = $this->post( 118: 'getHistTransactions', 119: $parameters 120: )['transactions']; 121: foreach ($this->objectMapper->hydrateObjects( 122: Transaction::class, 123: $transactions 124: )->getIterator() as $transaction) { 125: yield $transaction; 126: } 127: ++$parameters['pageNumber']; 128: } while (count($transactions) > 0); 129: } 130: } 131:
+ 1: <?php 2: 3: namespace IPay\Api; 4: 5: use IPay\Builder\TransactionBuilder; 6: use IPay\Entity\Account; 7: use IPay\Entity\Customer; 8: use IPay\Entity\Transaction; 9: use IPay\Enum\TransactionType; 10: use IPay\IPayClient; 11: use IPay\Session\AuthenticatedSession; 12: use Symfony\Component\OptionsResolver\Options; 13: use Symfony\Component\VarExporter\LazyGhostTrait; 14: 15: /** 16: * @psalm-import-type ParametersType from TransactionBuilder 17: * 18: * @extends AbstractApi<AuthenticatedSession> 19: */ 20: final class AuthenticatedApi extends AbstractApi 21: { 22: use LazyGhostTrait; 23: 24: public Customer $customer; 25: 26: /** @var list<Account> */ 27: public array $accounts; 28: 29: public function __construct( 30: IPayClient $iPayClient, 31: AuthenticatedSession $session, 32: ) { 33: parent::__construct($iPayClient, $session); 34: self::createLazyGhost( 35: initializer: $this->populateLazyProperties(...), 36: instance: $this, 37: ); 38: } 39: 40: private function populateLazyProperties(): void 41: { 42: $this->customer = $this->objectMapper->hydrateObject( 43: Customer::class, 44: $this->post('getCustomerDetails')['customerInfo'], 45: ); 46: $this->accounts = $this->objectMapper->hydrateObjects( 47: Account::class, 48: $this->post('getEntitiesAndAccounts')['accounts'], 49: )->toArray(); 50: } 51: 52: public function transactions(?string $accountNumber = null): TransactionBuilder 53: { 54: return new TransactionBuilder( 55: ['accountNumber' => $accountNumber ?? $this->customer->accountNumber], 56: $this->getTransactions(...), 57: ); 58: } 59: 60: /** 61: * @param ParametersType $parameters 62: * 63: * @return \Traversable<int, Transaction> 64: * 65: * @throws \IPay\Exception\SessionException 66: */ 67: private function getTransactions(array $parameters): \Traversable 68: { 69: $datetimeNormalizer = fn ( 70: Options $resolver, 71: \DateTimeInterface $value 72: ): string => $value->format('Y-m-d'); 73: 74: $transactionTypeNormalizer = fn ( 75: Options $resolver, 76: TransactionType $value 77: ): string => $value->value; 78: 79: $resolver = self::createOptionsResolver() 80: ->setRequired('accountNumber') 81: ->setDefined([ 82: 'tranType', 83: 'startDate', 84: 'endDate', 85: ]) 86: ->setAllowedTypes('accountNumber', 'string') 87: ->setAllowedTypes('tranType', TransactionType::class) 88: ->setAllowedTypes('startDate', \DateTimeInterface::class) 89: ->setAllowedTypes('endDate', \DateTimeInterface::class) 90: ->setNormalizer('tranType', $transactionTypeNormalizer) 91: ->setNormalizer('startDate', $datetimeNormalizer) 92: ->setNormalizer('endDate', $datetimeNormalizer) 93: ; 94: 95: $parameters = $resolver->resolve($parameters); 96: 97: $parameters['pageNumber'] = 0; 98: do { 99: $transactions = $this->post( 100: 'getHistTransactions', 101: $parameters 102: )['transactions']; 103: foreach ($this->objectMapper->hydrateObjects( 104: Transaction::class, 105: $transactions 106: )->getIterator() as $transaction) { 107: yield $transaction; 108: } 109: ++$parameters['pageNumber']; 110: } while (count($transactions) > 0); 111: } 112: } 113: