You are here

interface USPSRateRequestInterface in Commerce USPS 8

The interface for fetching and returning rates using the USPS API.

@package Drupal\commerce_usps

Hierarchy

Expanded class hierarchy of USPSRateRequestInterface

All classes that implement USPSRateRequestInterface

1 file declares its use of USPSRateRequestInterface
USPSBase.php in src/Plugin/Commerce/ShippingMethod/USPSBase.php

File

src/USPSRateRequestInterface.php, line 13

Namespace

Drupal\commerce_usps
View source
interface USPSRateRequestInterface {

  /**
   * Fetch rates for the shipping method.
   *
   * @param \Drupal\commerce_shipping\Entity\ShipmentInterface $commerce_shipment
   *   The commerce shipment.
   * @param \Drupal\commerce_shipping\Entity\ShippingMethodInterface $shipping_method
   *   The shipping method being rated.
   *
   * @return array
   *   An array of ShippingRate objects.
   */
  public function getRates(ShipmentInterface $commerce_shipment, ShippingMethodInterface $shipping_method);

  /**
   * Build the rate object.
   */
  public function buildRate();

  /**
   * Alter the rate object.
   */
  public function alterRate();

  /**
   * Parse the rate response and return shipping rates.
   *
   * @param array $response
   *   The USPS RateRequest response as an array.
   *
   * @return array
   *   Returns an array of ShippingRate objects
   */
  public function resolveRates(array $response);

}

Members

Namesort descending Modifiers Type Description Overrides
USPSRateRequestInterface::alterRate public function Alter the rate object. 1
USPSRateRequestInterface::buildRate public function Build the rate object. 1
USPSRateRequestInterface::getRates public function Fetch rates for the shipping method. 1
USPSRateRequestInterface::resolveRates public function Parse the rate response and return shipping rates. 2