Payu\Serializer\PaymentRequestSerializer::serialize PHP Метод

serialize() публичный Метод

public serialize ( ) : serialize
Результат serialize
    public function serialize()
    {
        $concatenatedData = array_merge($this->serializeCard(), $this->serializeOrder(), $this->serializeBilling(), $this->serializeDelivery(), $this->serializeBasket());
        $filteredData = array_filter($concatenatedData);
        $filteredData['MERCHANT'] = $this->configuration->getMerchantId();
        $filteredData['ORDER_HASH'] = $this->calculateHash($filteredData);
        return $filteredData;
    }

Usage Example

Пример #1
0
 public function build()
 {
     $request = new PaymentRequest($this->card, $this->order, $this->billing, $this->delivery, $this->basket);
     $validator = new PaymentRequestValidator($request);
     $validator->validate();
     $serializer = new PaymentRequestSerializer($request, $this->configuration);
     $rawData = $serializer->serialize();
     $request->setRawData($rawData);
     return $request;
 }