Skip to content

Commit

Permalink
Merge pull request #69 from Bandwidth/SWI-4587
Browse files Browse the repository at this point in the history
SWI-4587 add `transferCallerDisplayName`
  • Loading branch information
ajrice6713 authored Feb 21, 2024
2 parents 3d39291 + a9366bb commit 708bb4a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
15 changes: 15 additions & 0 deletions src/Voice/Bxml/Transfer.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ class Transfer extends Verb {
* @var string
*/
private $transferCallerId;
/**
* @var string
*/
private $transferCallerDisplayName;
/**
* @var string
*/
Expand Down Expand Up @@ -114,6 +118,13 @@ public function transferCallerId(string $transferCallerId) {
$this->transferCallerId = $transferCallerId;
}

/**
* Sets the transferCallerDisplayName attribute for Transfer
*/
public function transferCallerDisplayName(string $transferCallerDisplayName) {
$this->transferCallerDisplayName = $transferCallerDisplayName;
}

/**
* Sets the callTimeout attribute for Transfer
*
Expand Down Expand Up @@ -231,6 +242,10 @@ public function toBxml(DOMDocument $doc) {
$element->setAttribute("transferCallerId", $this->transferCallerId);
}

if(isset($this->transferCallerDisplayName)) {
$element->setAttribute("transferCallerDisplayName", $this->transferCallerDisplayName);
}

if(isset($this->callTimeout)) {
$element->setAttribute("callTimeout", $this->callTimeout);
}
Expand Down
3 changes: 2 additions & 1 deletion tests/BxmlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ public function testTransfer() {
$number2->fallbackPassword("fpass");
$transfer = new BandwidthLib\Voice\Bxml\Transfer();
$transfer->transferCallerId("+18999999999");
$transfer->transferCallerDisplayName("test");
$transfer->transferCompleteUrl("https://test.com");
$transfer->transferCompleteMethod("GET");
$transfer->username("user");
Expand All @@ -293,7 +294,7 @@ public function testTransfer() {
$transfer->fallbackPassword("fpassw");
$response = new BandwidthLib\Voice\Bxml\Response();
$response->addVerb($transfer);
$expectedXml = '<?xml version="1.0" encoding="UTF-8"?><Response><Transfer username="user" password="pass" tag="tag" transferCompleteUrl="https://test.com" transferCompleteMethod="GET" transferCallerId="+18999999999" callTimeout="3" diversionTreatment="none" diversionReason="away" transferCompleteFallbackUrl="https://test3.com" transferCompleteFallbackMethod="POST" fallbackUsername="fusern" fallbackPassword="fpassw"><PhoneNumber username="user" password="pass" tag="tag" transferAnswerUrl="https://test.com" transferAnswerMethod="GET">+17777777777</PhoneNumber><PhoneNumber username="user2" password="pass2" tag="tag2" transferAnswerUrl="https://test2.com" transferAnswerMethod="GET" transferAnswerFallbackUrl="https://test3.com" transferAnswerFallbackMethod="POST" fallbackUsername="fuser" fallbackPassword="fpass">+17777777779</PhoneNumber></Transfer></Response>';
$expectedXml = '<?xml version="1.0" encoding="UTF-8"?><Response><Transfer username="user" password="pass" tag="tag" transferCompleteUrl="https://test.com" transferCompleteMethod="GET" transferCallerId="+18999999999" transferCallerDisplayName="test" callTimeout="3" diversionTreatment="none" diversionReason="away" transferCompleteFallbackUrl="https://test3.com" transferCompleteFallbackMethod="POST" fallbackUsername="fusern" fallbackPassword="fpassw"><PhoneNumber username="user" password="pass" tag="tag" transferAnswerUrl="https://test.com" transferAnswerMethod="GET">+17777777777</PhoneNumber><PhoneNumber username="user2" password="pass2" tag="tag2" transferAnswerUrl="https://test2.com" transferAnswerMethod="GET" transferAnswerFallbackUrl="https://test3.com" transferAnswerFallbackMethod="POST" fallbackUsername="fuser" fallbackPassword="fpass">+17777777779</PhoneNumber></Transfer></Response>';
$responseXml = $response->toBxml();
$this->assertEquals($expectedXml, $responseXml);
}
Expand Down

0 comments on commit 708bb4a

Please sign in to comment.