Skip to content

Commit

Permalink
Merge pull request #408 from avored/dev
Browse files Browse the repository at this point in the history
dev to master
  • Loading branch information
indpurvesh authored Nov 19, 2019
2 parents b65df2d + 8b4ad23 commit 796f27f
Show file tree
Hide file tree
Showing 103 changed files with 47,980 additions and 10,408 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
/public/storage
/storage/*.key
/vendor
/modules/avored/stripe
/modules/avored/pos
.env
.phpunit.result.cache
Homestead.json
Expand Down
11 changes: 11 additions & 0 deletions app/Http/Controllers/OrderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use AvoRed\Framework\Database\Contracts\OrderStatusModelInterface;
use AvoRed\Framework\Database\Contracts\OrderProductModelInterface;
use AvoRed\Framework\Database\Contracts\OrderProductAttributeModelInterface;
use AvoRed\Framework\Support\Facades\Payment;

class OrderController extends Controller
{
Expand Down Expand Up @@ -94,6 +95,7 @@ public function place(Request $request)
$this->user($request);
$this->shippingAddress($request);
$this->billingAddress($request);
$this->paymentOption();
$this->orderStatus();

$orderData = [
Expand Down Expand Up @@ -192,6 +194,15 @@ public function orderStatus()
$this->orderStatus = $this->oderStatusRepository->findDefault();
}

/**
* check and process payment option
*/
public function paymentOption()
{
$payment = Payment::get(request()->get('payment_option'));
$payment->process();
}

/**
* Successfull Page Display.
* @param \AvoRed\Framework\Database\Models\Order $order
Expand Down
7 changes: 6 additions & 1 deletion app/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace App;

use AvoRed\Framework\Database\Models\Address;
use Laravel\Passport\HasApiTokens;
use Laravel\Passport\ClientRepository;
use Illuminate\Notifications\Notifiable;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
Expand Down Expand Up @@ -55,4 +55,9 @@ public function getPassportClient()

return $client;
}

public function addresses()
{
return $this->hasMany(Address::class);
}
}
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"license": "MIT",
"require": {
"php": ">=7.2",
"avored/framework": "dev-dev",
"avored/framework": "^3.0",
"fideloper/proxy": "^4.0",
"laravel/framework": "^6.2",
"laravel/tinker": "^1.0"
Expand All @@ -20,7 +20,6 @@
"fzaninotto/faker": "^1.4",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^3.0",
"orchestra/testbench": "^4.2",
"phpunit/phpunit": "^8.0"
},
"config": {
Expand Down
6 changes: 3 additions & 3 deletions modules/avored/banner/src/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@ protected function registerBreadCrumb()
{
BreadcrumbFacade::make('admin.banner.index', function ($breadcrumb) {
$breadcrumb->label('Banner')
->parent('admin.dashboard');
->parent('admin.dashboard');
});

BreadcrumbFacade::make('admin.banner.create', function ($breadcrumb) {
$breadcrumb->label('Create')
->parent('admin.dashboard')
->parent('admin.banner.index');
->parent('admin.dashboard')
->parent('admin.banner.index');
});

BreadcrumbFacade::make('admin.banner.edit', function ($breadcrumb) {
Expand Down
1 change: 0 additions & 1 deletion modules/avored/banner/webpack.mix.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ let mix = require('laravel-mix')

mix.setPublicPath('dist')
.js('resources/js/banner.js', 'js/banner.js')
//.sass('resources/sass/field.scss', 'css')
3 changes: 3 additions & 0 deletions modules/avored/cash-on-delivery/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

/node_modules
package-lock.json
21 changes: 21 additions & 0 deletions modules/avored/cash-on-delivery/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 AvoRed E commerce

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
45 changes: 45 additions & 0 deletions modules/avored/cash-on-delivery/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"name" : "avored/cash-on-delivery",
"description" : "AvoRed Laravel E commerce - Cash On Delivery Module",
"keywords" : [
"framework",
"banner",
"cart",
"laravel",
"e commerce",
"laravel5",
"shop",
"shopping-cart",
"e-commerce",
"shopping cart",
"e commerce"
],
"license" : "MIT",
"authors" : [{
"name" : "Purvesh ",
"email" : "[email protected]"
}
],
"type" : "avored-module",
"require" : {
"php": "^7.2",
"avored/module-installer" : "1.*",
"avored/framework" : "~3.0"
},
"autoload" : {
"classmap" : [
"database/migrations"
],
"psr-4" : {
"AvoRed\\CashOnDelivery\\" : "src/"
}
},
"homepage" : "https://avored.com",
"support" : {
"email" : "[email protected]",
"issues" : "https://avored.com/discussion",
"forum" : "https://avored.com/discussion",
"wiki" : "https://avored.com/docs",
"source" : "https://github.com/avored/banner"
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions modules/avored/cash-on-delivery/dist/mix-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"/js/cash-on-delivery.js": "/js/cash-on-delivery.js"
}
17 changes: 17 additions & 0 deletions modules/avored/cash-on-delivery/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"dependencies": {
"cross-env": "^6.0.0",
"laravel-mix": "^4.1.4",
"vue": "^2.5.17"
}
}
9 changes: 9 additions & 0 deletions modules/avored/cash-on-delivery/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# AvoRed Cash On Delivery Payment Module

### Installation

composer require avored/cash-on-delivery

php artisan migrate

### How to Use
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<template>
<div>
<a-switch @change="handlePaymentChange($event, 'a-cash-on-delivery')">
</a-switch>
Cash On Delivery
</div>
</template>

<script>
export default {
name: 'avored-cash-on-delivery',
props: [],
data () {
return {
selectedCashOnDeliveryPaymentOption: false
}
},
methods: {
handlePaymentChange(checked, identifier) {
if (checked) {
this.selectedCashOnDeliveryPaymentOption = true
} else {
this.selectedCashOnDeliveryPaymentOption = false
}
EventBus.$emit('selectedPaymentIdentifier', identifier)
}
},
mounted() {
var app = this
var eventBus = EventBus
eventBus.$on('placeOrderBefore', function() {
if (app.selectedCashOnDeliveryPaymentOption) {
eventBus.$emit('placeOrderAfter')
}
})
}
}
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<template>
<div>
<a-form-item label="Status">
<a-select @change="statusChange" :default-value="data.a_cash_on_delivery_status">
<a-select-option value="true">Enabled</a-select-option>
<a-select-option value="false">Disabled</a-select-option>
</a-select>
</a-form-item>
<input type="hidden" name="a_cash_on_delivery_status" v-model="status" />
</div>
</template>

<script>
export default {
name: 'cash-on-delivery-config',
props: ['data'],
data () {
return {
status: false
}
},
methods: {
statusChange(val) {
this.status = val
}
},
mounted() {
}
}
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
AvoRed.initialize((Vue) => {
Vue.component('avored-cash-on-delivery', require('../components/AvoRedCashOnDelivery.vue').default)
Vue.component('cash-on-delivery-config', require('../components/CashOnDeliveryConfig.vue').default)
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

return [
'config-title' => 'Cash On Delivery',
'enabled' => 'Enabled',
'disabled' => 'Disabled',
'status' => 'Status'
];
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<avored-cash-on-delivery>
</avored-cash-on-delivery>
@push('scripts')
<script src="{{ asset('avored-admin/js/cash-on-delivery.js') }}"></script>
@endpush
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@php
$data = collect();
$data->put('a_cash_on_delivery_status', $repository->getValueByCode('a_cash_on_delivery_status'))
@endphp

<cash-on-delivery-config :data="{{ $data }}"></cash-on-delivery-config>

@push('scripts')
<script src="{{ asset('avored-admin/js/cash-on-delivery.js') }}"></script>
@endpush
22 changes: 18 additions & 4 deletions modules/avored/cash-on-delivery/src/CashOnDelivery.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class CashOnDelivery
*
* @var string
*/
protected $identifier = 'cash-on-delivery';
protected $identifier = 'a-cash-on-delivery';

/**
* Title for this Payment options.
Expand All @@ -25,7 +25,7 @@ class CashOnDelivery
*
* @var string
*/
protected $view = 'avored-cash-on-delivery::cash-on-delivery';
protected $view = 'a-cash-on-delivery::index';

/**
* Get Identifier for this Payment options.
Expand All @@ -41,6 +41,11 @@ public function enable()
{
return true;
}

public function process()
{
//
}

/**
* Get Title for this Payment Option.
Expand All @@ -54,13 +59,22 @@ public function name()

/**
* Payment Option View Path.
*
* return String
*/
public function view()
{
return $this->view;
}

/**
* Render Payment Option
* return String
*/
public function render()
{
return view($this->view())->with($this->with());
}


/**
* Payment Option View Data.
Expand All @@ -69,6 +83,6 @@ public function view()
*/
public function with()
{
return [];
return ['payment' => $this];
}
}
Loading

0 comments on commit 796f27f

Please sign in to comment.