File tree 3 files changed +25
-1
lines changed
3 files changed +25
-1
lines changed Original file line number Diff line number Diff line change
1
+ <?php declare (strict_types=1 );
2
+
3
+ namespace Seven \Api \Resource \Rcs ;
4
+
5
+ enum RcsFallbackType: string
6
+ {
7
+ case SMS = 'sms ' ;
8
+ case WebView = 'webview ' ;
9
+ }
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ class RcsParams implements ParamsInterface
15
15
protected string $ text ;
16
16
protected string $ to ;
17
17
protected ?int $ ttl = null ;
18
+ protected ?RcsFallbackType $ fallback = null ;
18
19
19
20
public function __construct (string $ text , string $ to )
20
21
{
@@ -108,6 +109,16 @@ public function toArray(): array
108
109
{
109
110
$ arr = get_object_vars ($ this );
110
111
if ($ this ->delay ) $ arr ['delay ' ] = $ this ->delay ->format ('Y-m-d h:i ' );
112
+ if ($ this ->fallback ) $ arr ['fallback ' ] = $ this ->fallback ->value ;
111
113
return $ arr ;
112
114
}
115
+
116
+ public function getFallback (): ?RcsFallbackType {
117
+ return $ this ->fallback ;
118
+ }
119
+
120
+ public function setFallback (?RcsFallbackType $ fallback ): self {
121
+ $ this ->fallback = $ fallback ;
122
+ return $ this ;
123
+ }
113
124
}
Original file line number Diff line number Diff line change 6
6
use DateTime ;
7
7
use Seven \Api \Resource \Rcs \RcsEvent ;
8
8
use Seven \Api \Resource \Rcs \RcsEventParams ;
9
+ use Seven \Api \Resource \Rcs \RcsFallbackType ;
9
10
use Seven \Api \Resource \Rcs \RcsParams ;
10
11
11
12
final class RcsTest extends BaseTest
12
13
{
13
14
public function testText (): void
14
15
{
15
- $ params = new RcsParams ('HI2U! The UNIX time is ' . time () . '. ' , '491716992343 ' );
16
+ $ params = (new RcsParams ('HI2U! The UNIX time is ' . time () . '. ' , '491716992343 ' ))
17
+ ->setDelay (new DateTime ('12-12-2050 ' ))
18
+ ->setFallback (RcsFallbackType::SMS )
19
+ ;
16
20
$ res = $ this ->resources ->rcs ->dispatch ($ params );
17
21
18
22
$ this ->assertCount (1 , $ res ->getMessages ());
You can’t perform that action at this time.
0 commit comments