From 2c8c058d04969d03ff3c258b9c1be2498fc0b2a4 Mon Sep 17 00:00:00 2001 From: Daniel Camargo Date: Tue, 13 Aug 2013 11:52:31 -0300 Subject: [PATCH] partial #1381 --- .../default/crunchbutton/api/restaurant/index.php | 2 +- include/library/Crunchbutton/Restaurant.php | 5 ++--- include/views/default/cockpit/restaurants/pay.phtml | 10 ++++++++++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/include/controllers/default/crunchbutton/api/restaurant/index.php b/include/controllers/default/crunchbutton/api/restaurant/index.php index bc91686c6..18a7dd580 100644 --- a/include/controllers/default/crunchbutton/api/restaurant/index.php +++ b/include/controllers/default/crunchbutton/api/restaurant/index.php @@ -212,7 +212,7 @@ class Controller_api_restaurant extends Crunchbutton_Controller_Rest { case 'bankinfo': if ($r->id_restaurant) { - $r->saveBankInfo($this->request()['name'],$this->request()['account'],$this->request()['routing']); + $r->saveBankInfo($this->request()['name'],$this->request()['account'],$this->request()['routing'],$this->request()['type']); } break; diff --git a/include/library/Crunchbutton/Restaurant.php b/include/library/Crunchbutton/Restaurant.php index a0c7259fe..9d2c47068 100644 --- a/include/library/Crunchbutton/Restaurant.php +++ b/include/library/Crunchbutton/Restaurant.php @@ -265,11 +265,10 @@ class Crunchbutton_Restaurant extends Cana_Table_Trackchange { return $merchant; } - public function saveBankInfo($name, $account, $routing) { + public function saveBankInfo($name, $account, $routing, $type) { try { - $bank = c::balanced()->createBankAccount($name, $account, $routing); + $bank = c::balanced()->createBankAccount($name, $account, $routing, $type); $info = $this->merchant()->addBankAccount($bank); - $this->balanced_bank = $bank->id; $this->save(); } catch (Exception $e) { diff --git a/include/views/default/cockpit/restaurants/pay.phtml b/include/views/default/cockpit/restaurants/pay.phtml index 61aa34978..3e91daf27 100644 --- a/include/views/default/cockpit/restaurants/pay.phtml +++ b/include/views/default/cockpit/restaurants/pay.phtml @@ -39,6 +39,15 @@ + + Type + + + +
@@ -363,6 +372,7 @@ $.post('/api/restaurant/restaurant->id_restaurant?>/bankinfo', { routing: form.find('[name="routing"]').val(), account: form.find('[name="account"]').val(), + type: form.find('[name="type"]').val(), name: form.find('[name="name"]').val() }, function() { location.href = location.href;