Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/Model/Bxml/AttestationLevel.php

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to add a test for this in EnumTest.php

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace Bandwidth\Model\Bxml;

enum AttestationLevel: string
{
case A = 'A';
case B = 'B';
case C = 'C';
}
6 changes: 6 additions & 0 deletions src/Model/Bxml/Transfer.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class Transfer extends NestableVerb
* @param string|null $tag Custom string sent with all future callbacks. Max 256 characters.
* @param DiversionTreatment|null $diversionTreatment How Diversion headers are handled on the outbound leg.
* @param DiversionReason|null $diversionReason Only considered when diversionTreatment is stack.
* @param AttestationLevel|null $requestedAttestationLevel STIR/SHAKEN attestation level to sign the transferred call with. Only applies to accounts using the Hosted Signing Service. Cannot be combined with identity.
* @param string|null $identity SIP Identity header value (PASSporT) signed by you, sent unmodified. Max 2000 characters. Cannot be combined with requestedAttestationLevel.
*/
public function __construct(
array $transferTo = [],
Expand All @@ -39,6 +41,8 @@ public function __construct(
public readonly ?string $tag = null,
public readonly ?DiversionTreatment $diversionTreatment = null,
public readonly ?DiversionReason $diversionReason = null,
public readonly ?AttestationLevel $requestedAttestationLevel = null,
public readonly ?string $identity = null,
) {
parent::__construct('Transfer', null, $transferTo);
}
Expand Down Expand Up @@ -66,6 +70,8 @@ protected function attributes(): array
'tag' => $this->tag,
'diversionTreatment' => $this->diversionTreatment,
'diversionReason' => $this->diversionReason,
'requestedAttestationLevel' => $this->requestedAttestationLevel,
'identity' => $this->identity,
];
}
}
8 changes: 8 additions & 0 deletions tests/Unit/Model/Bxml/EnumTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Bandwidth\Test\Unit\Model\Bxml;

use Bandwidth\Model\Bxml\AttestationLevel;
use Bandwidth\Model\Bxml\DiversionReason;
use Bandwidth\Model\Bxml\DiversionTreatment;
use Bandwidth\Model\Bxml\FileFormat;
Expand All @@ -13,6 +14,13 @@

class EnumTest extends TestCase
{
public function testAttestationLevelValues(): void
{
$this->assertSame('A', AttestationLevel::A->value);
$this->assertSame('B', AttestationLevel::B->value);
$this->assertSame('C', AttestationLevel::C->value);
}

public function testHttpMethodValues(): void
{
$this->assertSame('GET', HttpMethod::GET->value);
Expand Down
10 changes: 8 additions & 2 deletions tests/Unit/Model/Bxml/TransferTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Bandwidth\Test\Unit\Model\Bxml;

use Bandwidth\Model\Bxml\AttestationLevel;
use Bandwidth\Model\Bxml\DiversionReason;
use Bandwidth\Model\Bxml\DiversionTreatment;
use Bandwidth\Model\Bxml\Hangup;
Expand Down Expand Up @@ -37,7 +38,9 @@ public function testAllAttributes(): void
fallbackPassword: 'fallbackPass',
tag: 'my-tag',
diversionTreatment: DiversionTreatment::PROPAGATE,
diversionReason: DiversionReason::NO_ANSWER
diversionReason: DiversionReason::NO_ANSWER,
requestedAttestationLevel: AttestationLevel::B,
identity: 'eyJhbGciOiJFUzI1NiJ9.sig;info=<https://example.com/c.pem>;ppt="shaken"'
);

$this->assertSame(
Expand All @@ -47,7 +50,10 @@ public function testAllAttributes(): void
. ' transferCompleteFallbackUrl="/completeFallback"'
. ' transferCompleteFallbackMethod="GET" username="user" password="pass"'
. ' fallbackUsername="fallbackUser" fallbackPassword="fallbackPass" tag="my-tag"'
. ' diversionTreatment="propagate" diversionReason="no-answer"/>',
. ' diversionTreatment="propagate" diversionReason="no-answer"'
. ' requestedAttestationLevel="B"'
. ' identity="eyJhbGciOiJFUzI1NiJ9.sig;info=&lt;https://example.com/c.pem&gt;'
. ';ppt=&quot;shaken&quot;"/>',
$transfer->toBxml()
);
}
Expand Down