diff --git a/include/config/config.xml b/include/config/config.xml index a94c02d6d..f7adbfe7a 100755 --- a/include/config/config.xml +++ b/include/config/config.xml @@ -71,7 +71,7 @@ _PHONE_ male - Hi. This is crunchbutton + This is crunchbutton diff --git a/include/controllers/default/crunchbutton/api/order/index.php b/include/controllers/default/crunchbutton/api/order/index.php index 71edd3ee6..2a8bb1e6b 100644 --- a/include/controllers/default/crunchbutton/api/order/index.php +++ b/include/controllers/default/crunchbutton/api/order/index.php @@ -19,25 +19,42 @@ class Controller_api_order extends Crunchbutton_Controller_Rest { case 'say': header('Content-type: text/xml'); echo ''."\n" - .''.c::config()->twilio->greeting.' with an order for you.' + .'' + .''.c::config()->twilio->greeting.' with an order for '.($order->delivery_type == 'delivery' ? 'delivery' : 'pickup').'.' .'' - .''.$order->message('phone').'' - .'' - .'Press 1 to repeat this message.' + .'Press 1 to hear the order. Otherwise we will call back in 2 minutes.' + .'' + .'Press 1 to hear the order. Otherwise we will call back in 2 minutes.' + .'' + .'Press 1 to hear the order. Otherwise we will call back in 2 minutes.' + .'' .''; exit; break; case 'sayorder': header('Content-type: text/xml'); - echo ''."\n" - .'' - .'' - .''.$order->message('phone').'' - .'' - .'Press 1 to repeat this message.' - .''; - exit; + echo ''."\n"; + + switch ($this->request()['Digits']) { + case '1': + default: + echo '' + .'Thank you. At the end of the message, you must confirm the order.' + .'' + .''.$order->message('phone').'' + .'' + .'Press 1 to repeat this message, or press 2 to confirm this order.'; + break; + case '2': + echo 'Thank you. This order has been confirmed.'; + $order->confirmed = 1; + $order->save(); + break; + + } + echo ''; + exit; break; case 'doconfirm':