generated from pagopa/pagopa-functions-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
34 changed files
with
1,199 additions
and
6,724 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,80 @@ | ||
<?php | ||
|
||
namespace pagopa\crawler; | ||
|
||
use pagopa\crawler\methods\MethodInterface; | ||
use SimpleXMLElement; | ||
|
||
/** | ||
* La classe AbstractMethod offre constanti di configurazione usate dai corrispondenti metodi per ricavare | ||
* informazioni dalle strutture xml/json sfruttando Xpath/JsonPath | ||
* | ||
* Ogni Constante definita viene utilizzata attraverso dei placeholder numerati | ||
* | ||
* %1$d | ||
* %2$d | ||
* %3$d | ||
* etc | ||
* | ||
* Ogni costante sostituisce a questi placeholder vari valori. | ||
* Le sostituzioni sono 3 e riguardano la posizione iesima del pagamento (nel carrello), la posizione iesima del transfer, la posizione iesima del metadata (key, value) | ||
* Ogni costante usa i placeholder a modo suo (alcune costanti usano %1$d per l'iesimo transfer, altri per l'iesimo payment) | ||
*/ | ||
class AbstractResponseMethod extends AbstractMethod implements FaultInterface | ||
{ | ||
|
||
const XPATH_FAULT_CODE = '/fault/faultCode'; | ||
|
||
const XPATH_FAULT_STRING = '/fault/faultString'; | ||
|
||
const XPATH_FAULT_DESCRIPTION = '/fault/description'; | ||
|
||
|
||
/** | ||
* @return bool | ||
*/ | ||
public function isFaultEvent(): bool | ||
{ | ||
if (static::XPATH_FAULT_CODE == null) | ||
{ | ||
return false; | ||
} | ||
return !(is_null($this->getElement(static::XPATH_FAULT_CODE))); | ||
} | ||
|
||
/** | ||
* @return string|null | ||
*/ | ||
public function getFaultCode(): string|null | ||
{ | ||
if (static::XPATH_FAULT_CODE == null) | ||
{ | ||
return false; | ||
} | ||
return $this->getElement(static::XPATH_FAULT_CODE); | ||
} | ||
|
||
/** | ||
* @return string|null | ||
*/ | ||
public function getFaultString(): string|null | ||
{ | ||
if (static::XPATH_FAULT_STRING == null) | ||
{ | ||
return false; | ||
} | ||
return $this->getElement(static::XPATH_FAULT_STRING); | ||
} | ||
|
||
/** | ||
* @return string|null | ||
*/ | ||
public function getFaultDescription(): string|null | ||
{ | ||
if (static::XPATH_FAULT_DESCRIPTION == null) | ||
{ | ||
return false; | ||
} | ||
return $this->getElement(static::XPATH_FAULT_DESCRIPTION); | ||
} | ||
} |
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.