setAttribute( 'id', $id ); } if ( empty( $this->attributes['id'] ) ) { return new \WP_Error( 'not_saved', __( 'Please provide a shipping provider.', 'surecart' ) ); } return $this->makeRequest( [ 'method' => 'GET', 'query' => $this->query, ], $this->endpoint . '/' . rawurlencode( $this->attributes['id'] ) . '/carrier_accounts' ); } /** * Get the carrier parcel templates available to a shipping provider. * * Carrier-defined packages (USPS Flat Rate boxes, FedEx paks, and so on). * Like carrier accounts this is a read-only list sub-resource, so the raw * API response is returned as-is. * * Availability differs between test and live mode providers, which is why * the catalogue hangs off a provider rather than the account. * * @param string $id Model id. * @return array|\WP_Error */ protected function carrierParcelTemplates( $id = null ) { if ( $id ) { $this->setAttribute( 'id', $id ); } if ( empty( $this->attributes['id'] ) ) { return new \WP_Error( 'not_saved', __( 'Please provide a shipping provider.', 'surecart' ) ); } return $this->makeRequest( [ 'method' => 'GET', 'query' => $this->query, ], $this->endpoint . '/' . rawurlencode( $this->attributes['id'] ) . '/carrier_parcel_templates' ); } }