forgie1/toptrans-api-wrapper

Toptrans API wrapper

Installs: 3 926

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:project

pkg:composer/forgie1/toptrans-api-wrapper

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

This package is auto-updated.

Last update: 2025-10-11 23:01:17 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
    }