currentObject->setPaymentId($value); return $this; } /** * Устанавливает комментарий к возврату. * * @param string|null $value Комментарий к возврату * * @return CreateRefundRequestBuilder Инстанс текущего билдера * * @throws InvalidPropertyValueTypeException Выбрасывается если была передана не строка */ public function setDescription(?string $value): CreateRefundRequestBuilder { $this->currentObject->setDescription($value); return $this; } /** * Устанавливает источники возврата. * * @param array|SourceInterface[]|ListObjectInterface $value Массив трансферов * * @return self Инстанс билдера запросов */ public function setSources(array $value): self { $this->currentObject->setSources($value); return $this; } /** * Добавляет источник возврата. * * @param array|SourceInterface $value Источник возврата * * @return self Инстанс билдера запросов */ public function addSource(mixed $value): self { $this->currentObject->getSources()->add($value); return $this; } /** * Устанавливает сделку. * * @param null|array|RefundDealData $value Данные о сделке, в составе которой проходит возврат * * @return CreateRefundRequestBuilder Инстанс билдера запросов * * @throws InvalidPropertyValueTypeException */ public function setDeal(mixed $value): CreateRefundRequestBuilder { $this->currentObject->setDeal($value); return $this; } /** * Устанавливает метод возврата. * * @param AbstractRefundMethodData|array|null $value * * @return self */ public function setRefundMethodData(mixed $value = null): self { $this->currentObject->setRefundMethodData($value); return $this; } /** * Строит объект запроса к API. * * @param null|array $options Устанавливаемые параметры запроса * * @return CreateRefundRequest|AbstractRequestInterface Инстанс сгенерированного объекта запроса к API */ public function build(?array $options = null): AbstractRequestInterface { if (!empty($options)) { $this->setOptions($options); } $this->currentObject->setAmount($this->amount); if ($this->receipt->notEmpty()) { $this->currentObject->setReceipt($this->receipt); } return parent::build(); } /** * Возвращает новый объект для сборки. * * @return CreateRefundRequest Собираемый объект запроса к API */ protected function initCurrentObject(): CreateRefundRequest { parent::initCurrentObject(); return new CreateRefundRequest(); } }