/**
* @return array{email: string, cart: array<array-key, array{discount?: int<min, max>|null,
* discount_type: 1|2|null, face: int, id: int, name: string, quantity: 1}>}
*/
protected function getPIFO(P $payment): array
{
$productsInfo = [];
$oIAT = $payment->getOIAT();
$oI = $oIAT['oI'];
$o = $this->client->query('getO', ['o_i' => $oI]);
$productsInfo['cart'][$oI]['face'] = (int)$o[$oI]['face'];
$sum = (int)$order[$oI]['sum'];
$discount = $productsInfo['cart'][$oI]['face'] - $sum;
$productsInfo['cart'][$oI]['name'] = (string)$o[$oI]['product_title'];
$productsInfo['cart'][$oI]['id'] = (int)$o[$oI]['product_id'];
$productsInfo['cart'][$oI]['quantity'] = 1;
$productsInfo['email'] = (string)$o[$oI]['from_email'];
$productsInfo['cart'][$oI]['discount_type'] = null;
$productsInfo['cart'][$oI]['discount'] = null;
if ($discount !== 0) {
$type = $discount > 0 ? self::DISCOUNT : self::EXTRA_CHARGE;
$productsInfo['cart'][$oI]['discount_type'] = $type;
$productsInfo['cart'][$oI]['discount'] = $discount;
}
return $productsInfo;
}
null
$data = addcslashes(json_encode($args, JSON_THROW_ON_ERROR), '"');
{\"order_id\": \"FACTPRECHR152632\", \"amount\": \"8300.00\"} //изображаю без кавычек для понимания что это значение переменной а не рукописная строка
'{\"order_id\": \"FACTPRECHR152632\", \"amount\": \"8300.00\"}'
"{\"order_id\": \"FACTPRECHR152632\", \"amount\": \"8300.00\"}"
$data = addcslashes(json_encode($args, JSON_THROW_ON_ERROR), '"');
return hash("sha1", $data . $this->secretKey);
addcslashes(json_encode($args, JSON_THROW_ON_ERROR), '"')
Точнее выполняя приведенный код я получаю хэш такой же как если бы строка была в одинарных кавычках.