This commit is contained in:
Daniel Camargo 2013-08-13 11:52:31 -03:00
parent 51326f7235
commit 2c8c058d04
3 changed files with 13 additions and 4 deletions

View File

@ -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;

View File

@ -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) {

View File

@ -39,6 +39,15 @@
<input type="text" name="name">
</td>
</tr>
<tr>
<td>Type</td>
<td>
<select name="type" class="chzn-select" >
<option value="checking" default>Checking</option>
<option value="savings">Savings</option>
</select>
</td>
</tr>
<tr>
<td colspan="2">
<br />
@ -363,6 +372,7 @@
$.post('/api/restaurant/<?=$this->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;