forgie1/toptrans-api-wrapper

Toptrans API wrapper

v1.1.1 2024-08-11 20:19 UTC

This package is auto-updated.

Last update: 2025-03-11 21:49:02 UTC


README

This wrapper is to simplify communication with Toptrans API:

Implemented Toptrans endpoints:

  • /order/list by OrderListMethod::class
  • /order/price by OrderPriceMethod::class
  • /order/save by OrderSaveMethod::class
  • /order/search by OrderSearchMethod::class

Useage:

    $order = new Order();
    $order->setLoading($loading)
        ->setDischarge($discharge)
        ->setPacks($packs)
        ->setOrderValue($orderValue)
    // build order entity here ...

    $method = new OrderSaveMethod($order)
    $request = new Request ('userName', 'password');

    try {
        $response = $method->sendRequest($request)
    } catch (ResponseStatusException $e) {
        // handle Exception
    }