1 | <?php |
||
36 | class Addresscheck implements AddresscheckInterface |
||
37 | { |
||
38 | /** |
||
39 | * PAYONE addresscheck request model |
||
40 | * |
||
41 | * @var \Payone\Core\Model\Risk\Addresscheck |
||
42 | */ |
||
43 | protected $addresscheck; |
||
44 | |||
45 | /** |
||
46 | * Factory for the response object |
||
47 | * |
||
48 | * @var \Payone\Core\Service\V1\Data\AddresscheckResponseFactory |
||
49 | */ |
||
50 | protected $responseFactory; |
||
51 | |||
52 | /** |
||
53 | * Checkout session object |
||
54 | * |
||
55 | * @var \Magento\Checkout\Model\Session |
||
56 | */ |
||
57 | protected $checkoutSession; |
||
58 | |||
59 | /** |
||
60 | * Constructor |
||
61 | * |
||
62 | * @param \Payone\Core\Model\Risk\Addresscheck $addresscheck |
||
63 | * @param \Payone\Core\Service\V1\Data\AddresscheckResponseFactory $responseFactory |
||
64 | * @param \Magento\Checkout\Model\Session $checkoutSession |
||
65 | */ |
||
66 | public function __construct( |
||
75 | |||
76 | /** |
||
77 | * Generate the confirm message from the given address |
||
78 | * |
||
79 | * @param AddressInterface $addressData |
||
80 | * @return string |
||
81 | */ |
||
82 | protected function getConfirmMessage(AddressInterface $addressData) |
||
97 | |||
98 | /** |
||
99 | * Add the score to the correct session variable |
||
100 | * |
||
101 | * @param AddressInterface $oAddress |
||
102 | * @param bool $blIsBillingAddress |
||
103 | * @return void |
||
104 | */ |
||
105 | protected function addScoreToSession(AddressInterface $oAddress, $blIsBillingAddress) |
||
114 | |||
115 | /** |
||
116 | * Set error message if checkout is configured to stop on error or set success = true instead |
||
117 | * |
||
118 | * @param AddresscheckResponse $oResponse |
||
119 | * @return AddresscheckResponse |
||
120 | */ |
||
121 | protected function handleErrorCase(AddresscheckResponse $oResponse) |
||
131 | |||
132 | /** |
||
133 | * Handle the response according to its return status |
||
134 | * |
||
135 | * @param AddresscheckResponse $oResponse |
||
136 | * @param AddressInterface $oAddress |
||
137 | * @param array $aResponse |
||
138 | * @return AddresscheckResponse |
||
139 | */ |
||
140 | protected function handleResponse(AddresscheckResponse $oResponse, AddressInterface $oAddress, $aResponse) |
||
156 | |||
157 | /** |
||
158 | * Send addresscheck request and handle the response object |
||
159 | * |
||
160 | * @param AddresscheckResponse $oResponse |
||
161 | * @param AddressInterface $oAddress |
||
162 | * @param bool $blIsBillingAddress |
||
163 | * @return AddresscheckResponse |
||
164 | */ |
||
165 | protected function handleAddresscheck(AddresscheckResponse $oResponse, AddressInterface $oAddress, $blIsBillingAddress) { |
||
175 | |||
176 | /** |
||
177 | * PAYONE addresscheck |
||
178 | * The full class-paths must be given here otherwise the Magento 2 WebApi |
||
179 | * cant handle this with its fake type system! |
||
180 | * |
||
181 | * @param \Magento\Quote\Api\Data\AddressInterface $addressData |
||
182 | * @param bool $isBillingAddress |
||
183 | * @param bool $isVirtual |
||
184 | * @param double $dTotal |
||
185 | * @return \Payone\Core\Service\V1\Data\AddresscheckResponse |
||
186 | */ |
||
187 | public function checkAddress(\Magento\Quote\Api\Data\AddressInterface $addressData, $isBillingAddress, $isVirtual, $dTotal) |
||
196 | } |
||
197 |