Added some config for payment method additional information

This commit is contained in:
jitendra 2020-09-01 17:45:02 +05:30
parent 88801561a7
commit ef3cdc8deb
17 changed files with 120 additions and 11 deletions

View File

@ -1349,7 +1349,9 @@ return [
'store-name' => 'اسم المتجر',
'vat-number' => 'ظريبه الشراء',
'contact-number' => 'رقم الاتصال',
'bank-details' => 'التفاصيل المصرفية'
'bank-details' => 'التفاصيل المصرفية',
'mailing-address' => 'Send Check to',
'instructions' => 'Instructions'
]
]
];

View File

@ -1339,7 +1339,9 @@ return [
'store-name' => 'Geschäftsname',
'vat-number' => 'Umsatzsteuer-Identifikationsnummer',
'contact-number' => 'Kontakt Nummer',
'bank-details' => 'Bankdaten'
'bank-details' => 'Bankdaten',
'mailing-address' => 'Send Check to',
'instructions' => 'Instructions'
],
],
];

View File

@ -1362,7 +1362,9 @@ return [
'store-name' => 'Store Name',
'vat-number' => 'Vat Number',
'contact-number' => 'Contact Number',
'bank-details' => 'Bank Details'
'bank-details' => 'Bank Details',
'mailing-address' => 'Send Check to',
'instructions' => 'Instructions'
]
]
];

View File

@ -1314,7 +1314,9 @@ return [
'store-name' => 'Nombre de la tienda',
'vat-number' => 'Número de valor agregado',
'contact-number' => 'Número de contacto',
'bank-details' => 'Detalles del banco'
'bank-details' => 'Detalles del banco',
'mailing-address' => 'Send Check to',
'instructions' => 'Instructions'
]
]
];

View File

@ -1358,7 +1358,9 @@ return [
'store-name' => 'نام فروشگاه',
'vat-number' => 'شماره Vat',
'contact-number' => 'شماره تماس',
'bank-details' => 'اطلاعات دقیق بانکی'
'bank-details' => 'اطلاعات دقیق بانکی',
'mailing-address' => 'Send Check to',
'instructions' => 'Instructions'
]
]
];

View File

@ -1363,7 +1363,9 @@ return [
'store-name' => 'Nome del negozio',
'vat-number' => 'Partita IVA',
'contact-number' => 'Numero di contatto',
'bank-details' => 'Coordinate bancarie'
'bank-details' => 'Coordinate bancarie',
'mailing-address' => 'Send Check to',
'instructions' => 'Instructions'
]
]
];

View File

@ -1358,7 +1358,9 @@ return [
'store-name' => 'Winkel naam',
'vat-number' => 'Btw-nummer',
'contact-number' => 'Contact nummer',
'bank-details' => 'Bankgegevens'
'bank-details' => 'Bankgegevens',
'mailing-address' => 'Send Check to',
'instructions' => 'Instructions'
]
]
];

View File

@ -1347,7 +1347,9 @@ return [
'store-name' => 'Nazwa sklepu',
'vat-number' => 'Numer VAT',
'contact-number' => 'Numer kontaktowy',
'bank-details' => 'Dane bankowe'
'bank-details' => 'Dane bankowe',
'mailing-address' => 'Send Check to',
'instructions' => 'Instructions'
]
]
];

View File

@ -1361,7 +1361,9 @@ return [
'store-name' => 'Nome da loja',
'vat-number' => 'Número de IVA',
'contact-number' => 'Número de contato',
'bank-details' => 'Detalhes bancários'
'bank-details' => 'Detalhes bancários',
'mailing-address' => 'Send Check to',
'instructions' => 'Instructions'
]
]
];

View File

@ -1344,7 +1344,9 @@ return [
'store-name' => 'Dükkan adı',
'vat-number' => 'KDV Numarası',
'contact-number' => 'İletişim numarası',
'bank-details' => 'Banka detayları'
'bank-details' => 'Banka detayları',
'mailing-address' => 'Send Check to',
'instructions' => 'Instructions'
]
]
];

View File

@ -34,6 +34,12 @@ return [
'validation' => 'required',
'channel_based' => false,
'locale_based' => true,
], [
'name' => 'instructions',
'title' => 'admin::app.admin.system.instructions',
'type' => 'textarea',
'channel_based' => false,
'locale_based' => true,
], [
'name' => 'sort',
'title' => 'admin::app.admin.system.sort_order',
@ -80,6 +86,12 @@ return [
'validation' => 'required',
'channel_based' => false,
'locale_based' => true,
], [
'name' => 'mailing_address',
'title' => 'admin::app.admin.system.mailing-address',
'type' => 'textarea',
'channel_based' => false,
'locale_based' => true,
], [
'name' => 'sort',
'title' => 'admin::app.admin.system.sort_order',

View File

@ -68,4 +68,17 @@ class Payment
return $payment->getRedirectUrl();
}
/**
* Returns payment method additional information
*
* @param string $code
* @return array
*/
public static function getAdditionalDetails($code)
{
$paymentMethodClass = app(Config::get('paymentmethods.' . $code . '.class'));
return $paymentMethodClass->getAdditionalDetails();
}
}

View File

@ -15,4 +15,23 @@ class MoneyTransfer extends Payment
{
}
/**
* Returns payment method additional information
*
* @return array
*/
public function getAdditionalDetails()
{
if (! $this->getConfigData('mailing_address')
|| $this->getConfigData('mailing_address') == ''
) {
return [];
}
return [
'title' => trans('admin::app.admin.system.mailing-address'),
'value' => $this->getConfigData('mailing_address'),
];
}
}

View File

@ -121,4 +121,23 @@ abstract class Payment
{
return $this->getConfigData('sort');
}
/**
* Returns payment method additional information
*
* @return array
*/
public function getAdditionalDetails()
{
if (! $this->getConfigData('instructions')
|| $this->getConfigData('instructions') == ''
) {
return [];
}
return [
'title' => trans('admin::app.admin.system.instructions'),
'value' => $this->getConfigData('instructions'),
];
}
}

View File

@ -2830,6 +2830,23 @@ section.cart {
.control-info {
margin-left: 28px;
}
.instructions {
margin-top: 10px;
margin-left: 30px;
label {
font-weight: 600;
font-size: 14px;
}
p {
margin: 0;
font-size: 14px;
color: #777777;
font-style: italic;
}
}
}
.address-summary {

View File

@ -26,6 +26,15 @@
<div class="line-two mt-5">
<span class="method-summary">{{ __($payment['description']) }}</span>
</div>
<?php $additionalDetails = \Webkul\Payment\Payment::getAdditionalDetails($payment['method']); ?>
@if (! empty($additionalDetails))
<div class="instructions" v-show="payment.method == '{{$payment['method']}}'">
<label>{{ $additionalDetails['title'] }}</label>
<p>{{ $additionalDetails['value'] }}</p>
</div>
@endif
</div>
{!! view_render_event('bagisto.shop.checkout.payment-method.after', ['payment' => $payment]) !!}

View File

@ -1,4 +1,4 @@
{!! view_render_event('bagisto.shop.products.view.product-add.after', ['product' => $product]) !!}
{!! view_render_event('bagisto.shop.products.view.product-add.before', ['product' => $product]) !!}
<div class="add-to-buttons">
@include ('shop::products.add-to-cart', ['product' => $product])