Skip to content

Commit

Permalink
feat: change whether to use sms failover
Browse files Browse the repository at this point in the history
  • Loading branch information
calc2te committed Oct 8, 2024
1 parent b3e80c6 commit 4d5c967
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ Set your key and defaults in `config/sens-alimtalk.php`:
* KakaoTalk Channel ID ((Old) Plus Friend ID)
*/
'plus_friend_id' => '',

/*
* SMS Failover use status
*/
'use_sms_failover' => true,
```

## Usage
Expand Down Expand Up @@ -109,6 +114,7 @@ class MentoringAdopt extends Notification
* `to(string|array)`
* `content(string)`
* `button(array)`
* `useSmsFailover(boolean)`
* `reserveTime(string)`
* `reserveAfterMinute(int)`
* `reserveAfterDay(int)`
Expand Down
5 changes: 5 additions & 0 deletions config/sens-alimtalk.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,9 @@
* KakaoTalk Channel ID ((Old) Plus Friend ID)
*/
'plus_friend_id' => '',

/*
* SMS Failover use status
*/
'use_sms_failover' => true,
];
14 changes: 14 additions & 0 deletions src/SensAlimtalkMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class SensAlimtalkMessage
public $to;
public $content;
public $buttons;
public $useSmsFailover;
public $failoverConfigContent;
public $reserveTime;
public $countryCode;
Expand All @@ -26,6 +27,7 @@ class SensAlimtalkMessage
public function __construct()
{
$this->plusFriendId = config('sens-alimtalk.plus_friend_id');
$this->useSmsFailover = config('sens-alimtalk.use_sms_failover');
$this->countryCode = '+82';
}

Expand Down Expand Up @@ -84,6 +86,17 @@ public function button($button): SensAlimtalkMessage
return $this;
}

/**
* @param $useSmsFailover
* @return $this
*/
public function useSmsFailover($useSmsFailover): SensAlimtalkMessage
{
$this->useSmsFailover = $useSmsFailover;

return $this;
}

/**
* @param $linkPc
* @return $this
Expand Down Expand Up @@ -236,6 +249,7 @@ public function toArray(): array
"content" => $this->content,
"buttons" => $this->buttons,
"countryCode" => $this->countryCode,
"useSmsFailover" => $this->useSmsFailover,
"failoverConfig" => [
"content" => $this->failoverConfigContent ??
$this->content . "\n\n" . ($this->buttons[0]['linkMobile'] ?? '')
Expand Down

0 comments on commit 4d5c967

Please sign in to comment.