Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 13 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| BuySMSController | |
0.00% |
0 / 13 |
|
0.00% |
0 / 2 |
20 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
| resendSMS | |
0.00% |
0 / 10 |
|
0.00% |
0 / 1 |
12 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace BuyerKiosk\SMS\Controllers; |
| 4 | |
| 5 | use BuyerKiosk\Core\Controllers\BaseController; |
| 6 | |
| 7 | class BuySMSController extends BaseController { |
| 8 | |
| 9 | private $store; |
| 10 | private $storeDB; |
| 11 | public function __construct($app, \Store $store) |
| 12 | { |
| 13 | parent::__construct($app); |
| 14 | $this->store = $store; |
| 15 | $this->storeDB = dbConnectByName($store->getDbName()); |
| 16 | } |
| 17 | |
| 18 | public function resendSMS($buyID) { |
| 19 | $buy = getQueueItemArray($this->store, $buyID); |
| 20 | if(count($buy) == 0) { |
| 21 | $this->_app->notFound(); |
| 22 | } |
| 23 | $storeTypeName = $this->store->getCompanyName(); |
| 24 | $messageText = $buy['firstName'] . ", your offer with " . $storeTypeName . " is ready to be picked up. Reply STOP to Opt Out. Phone: ".$this->store->getPhone(); |
| 25 | |
| 26 | |
| 27 | |
| 28 | if($this->store->getBuyTextSMSType() == 0) { |
| 29 | //Vonage |
| 30 | $vonage = new \BuyerKiosk\SMS\Vonage($this->store); |
| 31 | return $vonage->send($buy['phone'], $messageText); |
| 32 | } else { |
| 33 | //Twilio |
| 34 | $twilio = new \BuyerKiosk\SMS\Twilio($this->store); |
| 35 | return $twilio->send($buy['phone'], $messageText); |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | } |