@@ -14,6 +14,9 @@ class Webhook implements WebhookInterface
1414 /** @var OrderDataInterface Информация о Заказе */
1515 private OrderDataInterface $ orderData ;
1616
17+ /** @var WebhookAuthorizationInterface Информация об авторизации */
18+ private WebhookAuthorizationInterface $ authorization ;
19+
1720 /** @inheritDoc */
1821 public function catchJsonRequest (): self
1922 {
@@ -32,7 +35,7 @@ public function catchJsonRequest(): self
3235 $ this ->orderData ->setCurrency ($ request ['orderData ' ]['currency ' ]);
3336 $ this ->orderData ->setAmount ($ request ['orderData ' ]['amount ' ]);
3437 $ this ->orderData ->setCommission ((float ) $ request ['orderData ' ]['commission ' ]);
35- $ this ->orderData ->setLoyaltyPointsAmount ((string ) $ request ['orderData ' ]['loyaltyPointsAmount ' ]);
38+ $ this ->orderData ->setLoyaltyPointsAmount ((int ) $ request ['orderData ' ]['loyaltyPointsAmount ' ]);
3639 $ this ->orderData ->setLoyaltyPointsDetails ((array ) $ request ['orderData ' ]['loyaltyPointsDetails ' ]);
3740
3841 $ cardDetails = new CardDetails ;
@@ -95,6 +98,23 @@ public function catchJsonRequest(): self
9598 $ client ->setDelivery ($ delivery );
9699 }
97100
101+ if (isset ($ request ['authorization ' ]['storedCredentials ' ])) {
102+ $ storedCredentialsArray = $ request ['authorization ' ]['storedCredentials ' ];
103+
104+ $ storedCredentials = new WebhookStoredCredentials ;
105+
106+ if (isset ($ storedCredentialsArray ['ypmnBindingId ' ])) {
107+ $ storedCredentials ->setYpmnBindingId ($ storedCredentialsArray ['ypmnBindingId ' ]);
108+ }
109+
110+ if (isset ($ storedCredentialsArray ['useId ' ])) {
111+ $ storedCredentials ->setUseId ($ storedCredentialsArray ['useId ' ]);
112+ }
113+
114+ $ this ->authorization = new WebhookAuthorization ;
115+ $ this ->authorization ->setStoredCredentials ($ storedCredentials );
116+ }
117+
98118 return $ this ;
99119 }
100120
@@ -123,4 +143,17 @@ public function setOrderData(OrderDataInterface $orderData): self
123143 $ this ->orderData = $ orderData ;
124144 return $ this ;
125145 }
146+
147+ /** @inheritDoc */
148+ public function setAuthorization (WebhookAuthorizationInterface $ authorization ): self
149+ {
150+ $ this ->authorization = $ authorization ;
151+ return $ this ;
152+ }
153+
154+ /** @inheritDoc */
155+ public function getAuthorization (): WebhookAuthorizationInterface
156+ {
157+ return $ this ->authorization ;
158+ }
126159}
0 commit comments