Skip to content

SFCORE-3435: Handle upload document operation#133

Merged
mdumoulin merged 4 commits intomasterfrom
SFCORE-3435
Mar 12, 2025
Merged

SFCORE-3435: Handle upload document operation#133
mdumoulin merged 4 commits intomasterfrom
SFCORE-3435

Conversation

@Aurelieluciani
Copy link
Copy Markdown
Contributor

@Aurelieluciani Aurelieluciani commented Mar 12, 2025

Link to the issue

https://shopping-feed.atlassian.net/browse/SFCORE-3435

Reason for this PR

Add back functionality to manage upload document operation, inadvertently deleted in this PR: #119

What does the PR do

Restore the deleted code, than add the compatibility with the new version.

How to test

<?php
namespace ShoppingFeed\Sdk;

use Throwable;

require 'vendor/autoload.php';

// API client configuration
$apiUrl = 'http://localhost';
$token  = '<TOKEN>';

// Order configuration
$reference   = '#1A';
$channel     = 'amazon';
$id          = 1234;
$invoiceFile = '<PATH>/invoice.pdf';

$credential = new Credential\Token($token);
$options    = (new Client\ClientOptions())->setBaseUri($apiUrl);

# Deprecated old version
# $operation = new Api\Order\OrderOperation();
# $operation->uploadDocument($reference, $channel, new Api\Order\Document\Invoice($invoiceFile));

# New version
$operation = new Api\Order\Operation();
$operation->uploadDocument(new Id($id), new Api\Order\Document\Invoice($invoiceFile));

$orderApi = Client\Client::createSession($credential, $options)->getMainStore()->getOrderApi();
$orderApi->execute($operation);

@Aurelieluciani Aurelieluciani added the bug Something isn't working label Mar 12, 2025
@Aurelieluciani Aurelieluciani self-assigned this Mar 12, 2025
@Aurelieluciani Aurelieluciani requested a review from a team March 12, 2025 14:06
@mdumoulin mdumoulin merged commit 97b7554 into master Mar 12, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants