Merge branch 'Settlement' of https://github.com/crunchbutton/crunchbutton into Settlement
This commit is contained in:
commit
9fb16683cd
@ -11,19 +11,6 @@ class Controller_api_order extends Crunchbutton_Controller_RestAccount {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$_POST = [
|
|
||||||
'card' => [
|
|
||||||
'id' => 'CC1yW7tINe5OHE77eplt5hPs',
|
|
||||||
'uri' => '/cards/CC1yW7tINe5OHE77eplt5hPs',
|
|
||||||
'lastfour' => '4242',
|
|
||||||
'card_type' => 'visa',
|
|
||||||
'month' => '2',
|
|
||||||
'year' => '2016'
|
|
||||||
],
|
|
||||||
'pay_type' => 'card',
|
|
||||||
'delivery_type' => 'delivery',
|
|
||||||
];
|
|
||||||
|
|
||||||
// @todo check to see if the restaurant has the permissions for that restaurant id
|
// @todo check to see if the restaurant has the permissions for that restaurant id
|
||||||
// $_POST['restaurant']
|
// $_POST['restaurant']
|
||||||
|
|
||||||
|
|||||||
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
<script src="/assets/js/base.js?v=<?=Cana_Util::gitVersion()?>"></script>
|
<script src="/assets/js/base.js?v=<?=Cana_Util::gitVersion()?>"></script>
|
||||||
<script src="/assets/js/util.js?v=<?=Cana_Util::gitVersion()?>"></script>
|
<script src="/assets/js/util.js?v=<?=Cana_Util::gitVersion()?>"></script>
|
||||||
|
<script src="/assets/js/tokenizeCard.js?v=<?=Cana_Util::gitVersion()?>"></script>
|
||||||
|
|
||||||
<!-- AngularJS Controllers -->
|
<!-- AngularJS Controllers -->
|
||||||
<script src="/assets/cockpit/js/controllers.js?v=<?=Cana_Util::gitVersion()?>"></script>
|
<script src="/assets/cockpit/js/controllers.js?v=<?=Cana_Util::gitVersion()?>"></script>
|
||||||
|
|||||||
@ -59,8 +59,19 @@
|
|||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<li class="li-input" ng-class="{'error':form.driverName.$invalid}">
|
<li class="li-input" ng-class="{'error':form.driverName.$invalid}">
|
||||||
|
<div class="label">Payment Type</div>
|
||||||
|
<div class="input">
|
||||||
|
|
||||||
|
<select ng-model="order.pay_type">
|
||||||
|
<option value="card">Card</option>
|
||||||
|
<option value="cash">Cash</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
<li class="li-input" ng-class="{'error':form.driverName.$invalid}" ng-show="order.pay_type=='card'">
|
||||||
<div class="label">Card Number</div>
|
<div class="label">Card Number</div>
|
||||||
<div class="input">
|
<div class="input">
|
||||||
<input type="text" name="name" ng-model="card.number" required="" placeholder="0000-0000-0000-0000" ng-minlength="5" ng-maxlength="80" class="ng-pristine ng-valid-maxlength ng-valid-minlength ng-valid ng-valid-required">
|
<input type="text" name="name" ng-model="card.number" required="" placeholder="0000-0000-0000-0000" ng-minlength="5" ng-maxlength="80" class="ng-pristine ng-valid-maxlength ng-valid-minlength ng-valid ng-valid-required">
|
||||||
@ -69,12 +80,12 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<li class="li-input" ng-class="{'error':form.driverName.$invalid}">
|
<li class="li-input" ng-class="{'error':form.driverName.$invalid}" ng-show="order.pay_type=='card'">
|
||||||
<div class="label">Card Expiration</div>
|
<div class="label">Card Expiration</div>
|
||||||
<div class="input">
|
<div class="input">
|
||||||
|
|
||||||
<select ng-model="card.month" ng-options="month.value as month.label for month in card._months()" class=""></select>
|
<select ng-model="card.month" ng-options="month.value as month.label for month in card._months()" class=""></select>
|
||||||
<select ng-model="order.year" ng-options="year.value as year.label for year in card._years()" class=""></select>
|
<select ng-model="card.year" ng-options="year.value as year.label for year in card._years()" class=""></select>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li class="li-input" ng-show="!isSubmitting"><button class="button orange" ng-click="submit();">Submit New Order</button></li>
|
<li class="li-input" ng-show="!isSubmitting"><button class="button orange" ng-click="submit();">Submit New Order</button></li>
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
NGApp.controller('DriversOrderCtrl', function ( $scope, DriverOrdersService ) {
|
NGApp.controller('DriversOrderCtrl', function ( $scope, DriverOrdersService ) {
|
||||||
|
|
||||||
$scope.ready = false;
|
$scope.ready = false;
|
||||||
|
|||||||
@ -7,12 +7,41 @@ NGApp.controller('RestaurantOrderView', function ($scope, $http, $routeParams) {
|
|||||||
NGApp.controller('RestaurantOrderNew', function ($scope, $http, MainNavigationService, AccountService) {
|
NGApp.controller('RestaurantOrderNew', function ($scope, $http, MainNavigationService, AccountService) {
|
||||||
|
|
||||||
$scope.isSubmitting = false;
|
$scope.isSubmitting = false;
|
||||||
$scope.order = {};
|
$scope.order = {
|
||||||
|
name: 'MR TEST',
|
||||||
|
pay_type: 'card',
|
||||||
|
delivery_type: 'delivery'
|
||||||
|
};
|
||||||
|
$scope.card = {
|
||||||
|
number: '4111111111111111',
|
||||||
|
month: '1',
|
||||||
|
year: '2015'
|
||||||
|
};
|
||||||
|
|
||||||
|
App.config.processor = {
|
||||||
|
type: 'balanced'
|
||||||
|
};
|
||||||
|
|
||||||
$scope.submit = function() {
|
$scope.submit = function() {
|
||||||
$scope.isSubmitting = true;
|
$scope.isSubmitting = true;
|
||||||
$scope.order.restaurant = AccountService.restaurant;
|
$scope.order.restaurant = AccountService.restaurant;
|
||||||
|
|
||||||
|
App.tokenizeCard({
|
||||||
|
name: $scope.order.name,
|
||||||
|
number: $scope.card.number,
|
||||||
|
expiration_month: $scope.card.month,
|
||||||
|
expiration_year: $scope.card.year,
|
||||||
|
security_code: null
|
||||||
|
|
||||||
|
}, function(status) {
|
||||||
|
if (!status.status) {
|
||||||
|
alert(status.error);
|
||||||
|
}
|
||||||
|
$scope.isSubmitting = false;
|
||||||
|
console.debug(status);
|
||||||
|
|
||||||
|
$scope.order.card = status;
|
||||||
|
|
||||||
$http({
|
$http({
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url: '/api/order',
|
url: '/api/order',
|
||||||
@ -29,6 +58,10 @@ NGApp.controller('RestaurantOrderNew', function ($scope, $http, MainNavigationSe
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.card = {};
|
$scope.card = {};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user