Skip to content

Commit

Permalink
basic changes
Browse files Browse the repository at this point in the history
  • Loading branch information
indpurvesh committed Feb 6, 2022
1 parent 2b8a554 commit b2a689b
Show file tree
Hide file tree
Showing 21 changed files with 6,871 additions and 108 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

/node_modules
package-lock.json
15 changes: 7 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,20 @@
],
"type" : "avored-module",
"require" : {
"php" : ">=7.1.3",
"avored/module-installer" : "1.*",
"avored/ecommerce" : "2.*"
"php": "^7.2",
"avored/module-installer" : "1.*"
},
"autoload" : {
"psr-4" : {
"AvoRed\\CashOnDelivery\\" : "src/"
}
},
"homepage" : "https://www.avored.com",
"homepage" : "https://avored.com",
"support" : {
"email" : "[email protected]",
"issues" : "https://www.avored.com/discussion",
"forum" : "https://www.avored.com/discussion",
"wiki" : "https://www.avored.com/docs",
"source" : "https://www.github.com/avored/cash-on-delivery"
"issues" : "https://avored.com/discussion",
"forum" : "https://avored.com/discussion",
"wiki" : "https://avored.com/docs",
"source" : "https://github.com/avored/banner"
}
}
1 change: 1 addition & 0 deletions dist/js/cash-on-delivery.js

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

3 changes: 3 additions & 0 deletions dist/mix-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"/vendor/avored/js/cash-on-delivery.js": "/vendor/avored/js/cash-on-delivery.js"
}
1 change: 1 addition & 0 deletions dist/vendor/avored/js/cash-on-delivery.js

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

17 changes: 17 additions & 0 deletions 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 --https --key ~/.config/valet/Certificates/laravel-ecommerce.test.key --cert ~/.config/valet/Certificates/laravel-ecommerce.test.crt --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"
}
}
8 changes: 3 additions & 5 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
# AvoRed Cash on Delivery Payment Module
# AvoRed Cash On Delivery Payment Module

### Installation

composer require avored/cash-on-delivery
composer require avored/cash-on-delivery

php artisan migrate

### How to Use


Go to Admin=>Configuration=>Payment=>Enabled Cash on Delivery
5 changes: 0 additions & 5 deletions register.yaml

This file was deleted.

5 changes: 5 additions & 0 deletions register.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name: avored cash-on-delivery
identifier: avored-cash-on-delivery
status: active
description: avored cash-on-delivery Module
namespace: AvoRed\CashOnDelivery\
31 changes: 31 additions & 0 deletions resources/components/AvoRedCashOnDelivery.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<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
}
window.EventBus.$emit('selectedPaymentIdentifier', identifier)
}
},
mounted() {
var app = this
var eventBus = window.EventBus
eventBus.$on('placeOrderBefore', function() {
if (app.selectedCashOnDeliveryPaymentOption) {
eventBus.$emit('placeOrderAfter')
}
})
}
}
</script>
28 changes: 28 additions & 0 deletions resources/components/CashOnDeliveryConfig.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<template>
<div>

<avored-select
field-name="a_cash_on_delivery_status"
:options="options"
:init-value="data.a_cash_on_delivery_status"
></avored-select>
</div>
</template>

<script>
export default {
name: 'cash-on-delivery-config',
props: ['data', 'options'],
data () {
return {
status: false
}
},
methods: {
},
mounted() {
}
}
</script>
4 changes: 4 additions & 0 deletions resources/js/cash-on-delivery.js
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)
})
8 changes: 8 additions & 0 deletions resources/lang/en/cash-on-delivery.php
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'
];
9 changes: 0 additions & 9 deletions resources/lang/en/fixed-rate.php

This file was deleted.

12 changes: 0 additions & 12 deletions resources/views/cash-on-delivery.blade.php

This file was deleted.

10 changes: 10 additions & 0 deletions resources/views/index.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<button
class="flex items-center justify-between w-full bg-white rounded-md border-2 border-blue-500 p-4 focus:outline-none">
<label class="flex items-center">
<input type="radio" checked class="form-radio h-5 w-5 text-blue-600" />
<span class="ml-2 text-sm text-gray-700">
Cash on Delivery
</span>
</label>
<span class="text-gray-600 text-sm"></span>
</button>
17 changes: 17 additions & 0 deletions resources/views/system/configuration/payment-card.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@php
$data = collect();
$data->put('a_cash_on_delivery_status', $repository->getValueByCode('a_cash_on_delivery_status'));
$options = collect();
$options->put('ENABLED', 'Enabled');
$options->put('DISABLED', 'Disabled');
@endphp

<cash-on-delivery-config
:options="{{ json_encode($options) }}"
:data="{{ $data }}"
></cash-on-delivery-config>

@push('scripts')
<script src="{{ asset('vendor/avored/js/cash-on-delivery.js') }}"></script>
@endpush
66 changes: 29 additions & 37 deletions src/Payment/CashOnDelivery.php → src/CashOnDelivery.php
Original file line number Diff line number Diff line change
@@ -1,37 +1,32 @@
<?php
namespace AvoRed\CashOnDelivery;

namespace AvoRed\CashOnDelivery\Payment;

use AvoRed\Framework\Payment\Payment as AbstractPayment;
use AvoRed\Framework\Payment\Contracts\Payment as PaymentContract;
use AvoRed\Framework\Models\Database\Configuration;

class CashOnDelivery extends AbstractPayment implements PaymentContract
class CashOnDelivery
{

const CONFIG_KEY = 'payment_cash_on_delivery_enabled';

/**
* Identifier for this Payment options.
*
* @var string
*/
protected $identifier = 'cash-on-delivery';
protected $identifier = 'a-cash-on-delivery';

/**
* Title for this Payment options.
*
* @var string
*/
protected $name = 'Cash On Delivery';

/**
* Payment options View Path.
*
* @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,17 +36,17 @@ public function identifier()
{
return $this->identifier;
}

public function enable()
{
$isEnabled = Configuration::getConfiguration(self::CONFIG_KEY);
if (null === $isEnabled || false == $isEnabled) {
return false;
}

return true;
}


public function process()
{
//
}

/**
* Get Title for this Payment Option.
*
Expand All @@ -61,36 +56,33 @@ public function name()
{
return $this->name;
}

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

/**
* Payment Option View Data.
*
* return Array
* Render Payment Option
* return String
*/
public function with()
public function render()
{
return [];
return view($this->view())->with($this->with());
}

/*
* Process Payment Calculation


/**
* Payment Option View Data.
*
* return Array
*/
public function process($orderData, $cartProducts, $request)
public function with()
{
//EXECUTE API here if any??

return true;
return ['payment' => $this];
}
}

Loading

0 comments on commit b2a689b

Please sign in to comment.