mirakl / sdk-php-shop

Mirakl PHP SDK for sellers
29 stars 16 forks source link

RefundOrder error #50

Closed simone-bianco closed 5 months ago

simone-bianco commented 1 year ago

Is refundOrder still working?

`protected function prepareRefundsCollection(array $refunds): CreateRefundCollection { $collectionRefunds = new CreateRefundCollection();

    foreach ($refunds as $refund) {
        $collectionRefund = new CreateRefund();
        $collectionRefund->setOrderLineId($refund['order_line_id']);
        $collectionRefund->setQuantity($refund['quantity']);
        $collectionRefund->setAmount($refund['amount']);
        $collectionRefund->setShippingAmount($refund['shipping_amount']);
        $collectionRefund->setCurrencyIsoCode('EUR');
        $collectionRefund->setReasonCode(self::REASON_CODE);

        $collectionRefunds->add($collectionRefund);
    }

    return $collectionRefunds;
}

/**
 * @param array $refunds
 * @return void
 * @throws ClientException
 * @throws ApiException
 */
public function execute(array $refunds): void
{
    $collection = $this->prepareRefundsCollection($refunds);
    $request = new CreateRefundRequest($collection);
    $request->setRefunds($collection);
    /** @var ShopOrderCollection $result */
    $this->request(function () use ($request) {
        return $this->shopApiClient->refundOrder($request);
    });
}`

Getting: Client error: PUT https://adeo-marketplace.mirakl.net/api/orders/refund?shop_id=xxxx resulted in a 404 Not Found response

amarie75 commented 1 year ago

Hi,

I see successful call since you opened the ticket, do you have found the issue?

If not, can you share the content of the collection var_dump($collection)?

Best regards, Alexandre