src/Returns.php
public function createAuthorizedReturn(
        array $returner,
        array $receiver,
        array $parcel,
        array $options = []
    ) {
        $content = $this->buildReturnsArray(
            $returner,
            $receiver,
            $parcel,
            $options
        );

        $xml = Array2XML::createXML('authorized-return', $content);
        $envelope = $xml->documentElement;
        $envelope->setAttribute('xmlns',
            'http://www.canadapost.ca/ws/authreturn-v2');
        $payload = $xml->saveXML();

        $response = $this->post(
            "rs/{$this->customerNumber}/{$this->customerNumber}/authorizedreturn",
            [
                'Accept' => 'application/vnd.cpc.authreturn-v2+xml',
                'Content-Type' => 'application/vnd.cpc.authreturn-v2+xml',
            ],
            $payload,
            $options
        );
        return $response;
    }
public function createAuthorizedReturn(
        array $returner,
        array $receiver,
        array $parcel,
        array $options = []
    ) {
        $content = $this->buildReturnsArray(
            $returner,
            $receiver,
            $parcel,
            $options
        );

        $xml = Array2XML::createXML('authorized-return', $content);
        $envelope = $xml->documentElement;
        $envelope->setAttribute('xmlns',
            'http://www.canadapost.ca/ws/authreturn-v2');
        $payload = $xml->saveXML();

        $response = $this->post(
            "rs/{$this->customerNumber}/{$this->customerNumber}/authorizedreturn",
            [
                'Accept' => 'application/vnd.cpc.authreturn-v2+xml',
                'Content-Type' => 'application/vnd.cpc.authreturn-v2+xml',
            ],
            $payload,
            $options
        );
        return $response;
    }
public function createAuthorizedReturn ( array $ returner , array $ receiver , array $ parcel , array $ options = [ ] ) { $ content = $ this -> buildReturnsArray ( $ returner , $ receiver , $ parcel , $ options ) ; $ xml = Array2XML :: createXML ( 'authorized-return' , $ content ) ; $ envelope = $ xml -> documentElement ; $ envelope -> setAttribute ( 'xmlns' , 'http://www.canadapost.ca/ws/authreturn-v2' ) ; $ payload = $ xml -> saveXML ( ) ; $ response = $ this -> post ( "rs/{$this->customerNumber}/{$this->customerNumber}/authorizedreturn" , [ 'Accept' => 'application/vnd.cpc.authreturn-v2+xml' , 'Content-Type' => 'application/vnd.cpc.authreturn-v2+xml' , ] , $ payload , $ options ) ; return $ response ; }
Create an authorized return.

@param array $returner
The returner info.
<code>
$returner = [
'name'    => 'Jane Doe',
'company' => 'Acro Media',
'domestic-address' => [
'address-line-1' => '103-2303 Leckie Rd',
'city'           => 'Kelowna',
'province'     => 'BC',
'postal-code'    => 'V1X 6Y5',
],
]
</code>
@param array $receiver
The receiver info.
<code>
$receiver = [
'name'            => 'John Smith',
'company' => 'Acro Media',
'domestic-address' => [
'address-line-1'  => '123 Main St',
'city'            => 'Kelowna',
'province'      => 'BC',
'postal-code' => 'V1X 1M2',
],
]
</code>
@param array $parcel
The parcel characteristics.
<code>
$parcel = [
'weight'     => 0.500,   // in kg.
'dimensions' => [        // in cm.
'length' => 30,
'width'  => 10,
'height' => 20,
],
],
]
</code>
@param array $options
The options array.

@return \DOMDocument
@throws \GuzzleHttp\Exception\GuzzleException
Create an authorized return .