@@ 25-83 (lines=59) @@ | ||
22 | use eBayEnterprise\RetailOrderManagement\Payload\TPayload; |
|
23 | use Psr\Log\LoggerInterface; |
|
24 | ||
25 | class ErrorLocation implements IErrorLocation |
|
26 | { |
|
27 | use TPayload; |
|
28 | ||
29 | const ROOT_NODE = 'ErrorLocation'; |
|
30 | ||
31 | /** @var string */ |
|
32 | protected $fieldName; |
|
33 | ||
34 | /** |
|
35 | * @param IValidatorIterator |
|
36 | * @param ISchemaValidator |
|
37 | * @param IPayloadMap |
|
38 | * @param LoggerInterface |
|
39 | * @param IPayload |
|
40 | * @SuppressWarnings(PHPMD.UnusedFormalParameter) |
|
41 | */ |
|
42 | public function __construct( |
|
43 | IValidatorIterator $validators, |
|
44 | ISchemaValidator $schemaValidator, |
|
45 | IPayloadMap $payloadMap, |
|
46 | LoggerInterface $logger, |
|
47 | IPayload $parentPayload = null |
|
48 | ) { |
|
49 | $this->logger = $logger; |
|
50 | $this->validators = $validators; |
|
51 | $this->parentPayload = $parentPayload; |
|
52 | ||
53 | $this->extractionPaths = [ |
|
54 | 'fieldName' => 'string()', |
|
55 | ]; |
|
56 | } |
|
57 | ||
58 | public function getFieldName() |
|
59 | { |
|
60 | return $this->fieldName; |
|
61 | } |
|
62 | ||
63 | public function setFieldName($fieldName) |
|
64 | { |
|
65 | $this->fieldName = $fieldName; |
|
66 | return $this; |
|
67 | } |
|
68 | ||
69 | protected function serializeContents() |
|
70 | { |
|
71 | return $this->xmlEncode($this->getFieldName()); |
|
72 | } |
|
73 | ||
74 | protected function getRootNodeName() |
|
75 | { |
|
76 | return static::ROOT_NODE; |
|
77 | } |
|
78 | ||
79 | protected function getXmlNamespace() |
|
80 | { |
|
81 | return self::XML_NS; |
|
82 | } |
|
83 | } |
|
84 |
@@ 26-81 (lines=56) @@ | ||
23 | use Psr\Log\LoggerInterface; |
|
24 | use Psr\Log\NullLogger; |
|
25 | ||
26 | class InvoiceTextCode implements IInvoiceTextCode |
|
27 | { |
|
28 | use TPayload; |
|
29 | ||
30 | const ROOT_NODE = 'InvoiceTextCode'; |
|
31 | ||
32 | /** |
|
33 | * @param IValidatorIterator |
|
34 | * @param ISchemaValidator |
|
35 | * @param IPayloadMap |
|
36 | * @param LoggerInterface |
|
37 | * @param IPayload |
|
38 | * @SuppressWarnings(PHPMD.UnusedFormalParameter) |
|
39 | */ |
|
40 | public function __construct( |
|
41 | IValidatorIterator $validators, |
|
42 | ISchemaValidator $schemaValidator, |
|
43 | IPayloadMap $payloadMap, |
|
44 | LoggerInterface $logger, |
|
45 | IPayload $parentPayload = null |
|
46 | ) { |
|
47 | $this->logger = $logger; |
|
48 | $this->validators = $validators; |
|
49 | $parentPayload = $parentPayload; |
|
50 | ||
51 | $this->extractionPaths = [ |
|
52 | 'code' => 'string()', |
|
53 | ]; |
|
54 | } |
|
55 | ||
56 | public function getCode() |
|
57 | { |
|
58 | return $this->code; |
|
59 | } |
|
60 | ||
61 | public function setCode($code) |
|
62 | { |
|
63 | $this->code = $code; |
|
64 | return $this; |
|
65 | } |
|
66 | ||
67 | protected function serializeContents() |
|
68 | { |
|
69 | return $this->xmlEncode($this->getCode()); |
|
70 | } |
|
71 | ||
72 | protected function getRootNodeName() |
|
73 | { |
|
74 | return static::ROOT_NODE; |
|
75 | } |
|
76 | ||
77 | protected function getXmlNamespace() |
|
78 | { |
|
79 | return self::XML_NS; |
|
80 | } |
|
81 | } |
|
82 |
@@ 30-101 (lines=72) @@ | ||
27 | * Class ProtectPanReply |
|
28 | * @package eBayEnterprise\RetailOrderManagement\Payload\Payment |
|
29 | */ |
|
30 | class ProtectPanReply implements IProtectPanReply |
|
31 | { |
|
32 | use TTopLevelPayload; |
|
33 | ||
34 | /** @var string */ |
|
35 | protected $token; |
|
36 | ||
37 | /** |
|
38 | * @param IValidatorIterator |
|
39 | * @param ISchemaValidator |
|
40 | * @param IPayloadMap |
|
41 | * @param LoggerInterface |
|
42 | * @param IPayload |
|
43 | * @SuppressWarnings(PHPMD.UnusedFormalParameter) |
|
44 | */ |
|
45 | public function __construct( |
|
46 | IValidatorIterator $validators, |
|
47 | ISchemaValidator $schemaValidator, |
|
48 | IPayloadMap $payloadMap, |
|
49 | LoggerInterface $logger, |
|
50 | IPayload $parentPayload = null |
|
51 | ) { |
|
52 | $this->logger = $logger; |
|
53 | $this->validators = $validators; |
|
54 | $this->schemaValidator = $schemaValidator; |
|
55 | $this->parentPayload = $parentPayload; |
|
56 | ||
57 | $this->extractionPaths = [ |
|
58 | 'token' => 'string(x:Token)', |
|
59 | ]; |
|
60 | } |
|
61 | ||
62 | public function getToken() |
|
63 | { |
|
64 | return $this->token; |
|
65 | } |
|
66 | ||
67 | /** |
|
68 | * Serialize the various parts of the payload into XML strings and |
|
69 | * simply concatenate them together. |
|
70 | * @return string |
|
71 | */ |
|
72 | protected function serializeContents() |
|
73 | { |
|
74 | return $this->serializeRequiredValue('Token', $this->getToken()); |
|
75 | } |
|
76 | ||
77 | protected function getSchemaFile() |
|
78 | { |
|
79 | return $this->getSchemaDir() . self::XSD; |
|
80 | } |
|
81 | ||
82 | /** |
|
83 | * Return the name of the xml root node. |
|
84 | * |
|
85 | * @return string |
|
86 | */ |
|
87 | protected function getRootNodeName() |
|
88 | { |
|
89 | return static::ROOT_NODE; |
|
90 | } |
|
91 | ||
92 | /** |
|
93 | * The XML namespace for the payload. |
|
94 | * |
|
95 | * @return string |
|
96 | */ |
|
97 | protected function getXmlNamespace() |
|
98 | { |
|
99 | return static::XML_NS; |
|
100 | } |
|
101 | } |
|
102 |