Merge branch 'master' of github.com:crunchbutton/crunchbutton

This commit is contained in:
arzynik 2013-08-13 13:19:51 -07:00
commit ae5dc7fa7e
5 changed files with 35 additions and 11 deletions

View File

@ -148,6 +148,7 @@ class Controller_api_restaurant extends Crunchbutton_Controller_Rest {
if ($r->id_restaurant) {
$r->balanced_id = c::config()->balanced->sharedMerchant;
$r->save();
echo json_encode( [ 'success' => 'success' ] );
}
break;
@ -155,6 +156,7 @@ class Controller_api_restaurant extends Crunchbutton_Controller_Rest {
if ($r->id_restaurant) {
$r->balanced_id = null;
$r->save();
echo json_encode( [ 'success' => 'success' ] );
}
break;
@ -162,6 +164,7 @@ class Controller_api_restaurant extends Crunchbutton_Controller_Rest {
if ($r->id_restaurant) {
$r->balanced_bank = null;
$r->save();
echo json_encode( [ 'success' => 'success' ] );
}
break;

View File

@ -216,7 +216,7 @@ class Crunchbutton_Order extends Cana_Table {
}
}
Log::debug(['giftcardValue'=> $this->giftcardValue]);
Log::debug([ 'issue' => '#1551', 'method' => 'process', '$this->final_price' => $this->final_price, 'giftcardValue'=> $this->giftcardValue ]);
$res = $this->verifyPayment();
@ -382,11 +382,10 @@ class Crunchbutton_Order extends Cana_Table {
$chargedByCredit = Crunchbutton_Credit::calcDebitFromUserCredit( $final_price, $this->id_user, $this->id_restaurant, $this->id_order, true );
$final_price = $final_price - $chargedByCredit;
}
Log::debug([ '$this->final_price' => $this->final_price, 'giftcardValue'=> $this->giftcardValue, 'final_price' => $final_price, ]);
Log::debug([ 'issue' => '#1551', 'method' => 'calcFinalPriceMinusUsersCredit', '$this->final_price' => $this->final_price, 'giftcardValue'=> $this->giftcardValue, 'final_price' => $final_price, ]);
if( $final_price < 0 ){ $final_price = 0; }
return Util::ceil( $final_price, 2 );
}
return $final_price;
}
@ -476,6 +475,7 @@ class Crunchbutton_Order extends Cana_Table {
}
$amount = $this->calcFinalPriceMinusUsersCredit();
Log::debug([ 'issue' => '#1551', 'method' => 'verifyPayment', '$this->final_price' => $this->final_price, 'giftcardValue'=> $this->giftcardValue, 'amount' => $amount ]);
// If the amount is 0 it means that the user used his credit.
if( $amount > 0 ){

View File

@ -271,6 +271,7 @@ class Crunchbutton_Restaurant extends Cana_Table_Trackchange {
$info = $this->merchant()->addBankAccount($bank);
$this->balanced_bank = $bank->id;
$this->save();
echo json_encode( [ 'success' => 'success' ] );
} catch (Exception $e) {
print_r($e);
exit;

View File

@ -52,6 +52,7 @@
<td colspan="2">
<br />
<button type="submit" class="btn btn-blue restaurant-bank-info-button"><i class="icon-save"></i>&nbsp;&nbsp;&nbsp; Save </button>
&nbsp;&nbsp;&nbsp;<i class="restaurant-bank-info-button-loading icon-spinner icon-spin" style="display:none;"></i>
</td>
</tr>
</table>
@ -369,13 +370,28 @@
$('.restaurant-bank-info-button').click(function() {
var form = $(this).closest('form');
$.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;
$( '.restaurant-bank-info-button-loading' ).show();
$.ajax({
type: 'POST',
url: '/api/restaurant/<?=$this->restaurant->id_restaurant?>/bankinfo',
data: {
routing: form.find('[name="routing"]').val(),
account: form.find('[name="account"]').val(),
type: form.find('[name="type"]').val(),
name: form.find('[name="name"]').val()
}
}).done(function( data ) {
if( data.success ){
location.href = location.href;
} else {
$( '.restaurant-bank-info-button-loading' ).hide();
alert( 'Error: see the console!' );
console.log('Err:', data );
}
}).fail(function(jqXHR, textStatus) {
$( '.restaurant-bank-info-button-loading' ).hide();
alert( 'Error: see the console!' );
console.log('Err:', jqXHR.responseText);
});
});

View File

@ -87,7 +87,11 @@ NGApp.factory( 'GiftCardService', function( $http, $location, AccountModalServic
service.giftCardModal.open();
service.processModal();
}
service.accountModal.signinOpen();
service.modal.close();
setTimeout( function(){
service.accountModal.signinOpen();
}, 500 );
}
service.modal.close = function(){