From 4d5c967886918d3d0f5c187fbc6774e8b96e0b0f Mon Sep 17 00:00:00 2001 From: Seobs Date: Tue, 8 Oct 2024 15:05:48 +0900 Subject: [PATCH] feat: change whether to use sms failover --- README.md | 6 ++++++ config/sens-alimtalk.php | 5 +++++ src/SensAlimtalkMessage.php | 14 ++++++++++++++ 3 files changed, 25 insertions(+) diff --git a/README.md b/README.md index 96b7935..e5dda21 100644 --- a/README.md +++ b/README.md @@ -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 @@ -109,6 +114,7 @@ class MentoringAdopt extends Notification * `to(string|array)` * `content(string)` * `button(array)` +* `useSmsFailover(boolean)` * `reserveTime(string)` * `reserveAfterMinute(int)` * `reserveAfterDay(int)` diff --git a/config/sens-alimtalk.php b/config/sens-alimtalk.php index e52da13..6a7b9b5 100644 --- a/config/sens-alimtalk.php +++ b/config/sens-alimtalk.php @@ -22,4 +22,9 @@ * KakaoTalk Channel ID ((Old) Plus Friend ID) */ 'plus_friend_id' => '', + + /* + * SMS Failover use status + */ + 'use_sms_failover' => true, ]; diff --git a/src/SensAlimtalkMessage.php b/src/SensAlimtalkMessage.php index b686c9e..bf7210b 100644 --- a/src/SensAlimtalkMessage.php +++ b/src/SensAlimtalkMessage.php @@ -12,6 +12,7 @@ class SensAlimtalkMessage public $to; public $content; public $buttons; + public $useSmsFailover; public $failoverConfigContent; public $reserveTime; public $countryCode; @@ -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'; } @@ -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 @@ -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'] ?? '')