You can install the package via composer:
composer require ptchr/magento2-rest-client
$client = new Ptchr\Magento2RestClient\Client('BASE_URL', 'ADMIN_USERNAME', 'ADMIN_PASSWORD');
$customer = $client->searchCustomerByEmail('[email protected]');
Magento docs: https://magento.redoc.ly/2.3.5-admin/#operation/salesOrderRepositoryV1GetListGet
$orders = $this->client->getOrders($currentPage, $resultsPerPage, $filters, $sort);
$quoteId = $client->createCart($customer['id']);
$cart = $client->addProductToCart($quoteId, 'SKU', 3);
$shippingMethods = $client->estimateAvailableShippingMethodsForCart($customer, $quoteId);
$shippingInfo = $client->addShippingInformationToCart($customer, $quoteId);
$shippingMethods = $client->estimateAvailableShippingMethodsForCart($customer, $quoteId);
$shippingMethod = $shippingMethods[0];
$shippingInfo = $client->addShippingInformationToCart($customer, $quoteId, $shippingMethod['method_code'], $shippingMethod['carrier_code']);
$paymentMethods = $this->client->getAvailablePaymentMethodsForCart($quoteId);
$this->client->setPaymentInformation($quoteId, $paymentMethod);
$this->client->setPaymentInformation($quoteId, $paymentMethod, 'purchase_order_number');
$orderId = $client->createOrder($quoteId, $paymentMethod);
$orderId = $client->createOrder($quoteId, $paymentMethod, '123');
Paid:
$client->fullInvoiceOrder($orderId, true);
Not paid:
$client->fullInvoiceOrder($orderId, false);
$orderId = $client->shipOrder($orderId);
$client->cancelOrder($orderId);
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.