0 => 'Non', | 0 => 'Non', | ||||
1 => 'Oui', | 1 => 'Oui', | ||||
], []); ?> | ], []); ?> | ||||
<?= $form->field($model, 'option_online_payment_minimum_amount') | |||||
->hint('Valeur par défaut si non défini : '.Producer::ONLINE_PAYMENT_MINIMUM_AMOUNT_DEFAULT.' €') | |||||
->textInput(); ?> | |||||
<?= $form->field($model, 'option_stripe_mode_test')->dropDownList([ | <?= $form->field($model, 'option_stripe_mode_test')->dropDownList([ | ||||
0 => 'Non', | 0 => 'Non', | ||||
1 => 'Oui' | 1 => 'Oui' |
var $secret_key_payplug; | var $secret_key_payplug; | ||||
const ONLINE_PAYMENT_MINIMUM_AMOUNT_DEFAULT = 25; | |||||
/** | /** | ||||
* @inheritdoc | * @inheritdoc | ||||
*/ | */ | ||||
'order_deadline_sunday', | 'order_deadline_sunday', | ||||
'id_tax_rate_default', | 'id_tax_rate_default', | ||||
'document_quotation_duration', | 'document_quotation_duration', | ||||
'option_dashboard_number_distributions' | |||||
'option_dashboard_number_distributions', | |||||
'option_online_payment_minimum_amount' | |||||
], | ], | ||||
'integer' | 'integer' | ||||
], | ], | ||||
'option_export_evoliz' => 'Activer l\'export vers Evoliz', | 'option_export_evoliz' => 'Activer l\'export vers Evoliz', | ||||
'latest_version_opendistrib' => 'Dernière version d\'Opendistrib', | 'latest_version_opendistrib' => 'Dernière version d\'Opendistrib', | ||||
'option_csv_separator' => 'Séparateur de colonnes (CSV)', | 'option_csv_separator' => 'Séparateur de colonnes (CSV)', | ||||
'option_display_message_new_opendistrib_version' => 'Afficher les messages de mise à jour du logiciel Opendistrib' | |||||
'option_display_message_new_opendistrib_version' => 'Afficher les messages de mise à jour du logiciel Opendistrib', | |||||
'option_online_payment_minimum_amount' => 'Paiement en ligne : montant minimum' | |||||
]; | ]; | ||||
} | } | ||||
$this->latest_version_opendistrib = array_values($versionsArray)[0]; | $this->latest_version_opendistrib = array_values($versionsArray)[0]; | ||||
$this->save(); | $this->save(); | ||||
} | } | ||||
public function getOnlinePaymentMinimumAmount() | |||||
{ | |||||
$onlinePaymentMinimumAmount = self::getConfig('option_online_payment_minimum_amount'); | |||||
if(!$onlinePaymentMinimumAmount) { | |||||
$onlinePaymentMinimumAmount = self::ONLINE_PAYMENT_MINIMUM_AMOUNT_DEFAULT; | |||||
} | |||||
return $onlinePaymentMinimumAmount; | |||||
} | |||||
} | } | ||||
<?php | |||||
use yii\db\Migration; | |||||
use yii\db\Schema; | |||||
/** | |||||
* Class m221115_085843_producer_add_option_online_payment_minimum_amount | |||||
*/ | |||||
class m221115_085843_producer_add_option_online_payment_minimum_amount extends Migration | |||||
{ | |||||
/** | |||||
* {@inheritdoc} | |||||
*/ | |||||
public function safeUp() | |||||
{ | |||||
$this->addColumn('producer', 'option_online_payment_minimum_amount', Schema::TYPE_INTEGER); | |||||
} | |||||
/** | |||||
* {@inheritdoc} | |||||
*/ | |||||
public function safeDown() | |||||
{ | |||||
$this->dropColumn('producer', 'option_online_payment_minimum_amount'); | |||||
} | |||||
} |
{ | { | ||||
return [ | return [ | ||||
[['amount'], 'required'], | [['amount'], 'required'], | ||||
[['amount'], 'double', 'min' => 25], | |||||
[['amount'], 'double', 'min' => Producer::getOnlinePaymentMinimumAmount()], | |||||
]; | ]; | ||||
} | } | ||||
'template' => '{label}<div class="input-group input-group-lg">{input}<span class="input-group-addon"><span class="glyphicon glyphicon-euro"></span></span></div>{hint}', | 'template' => '{label}<div class="input-group input-group-lg">{input}<span class="input-group-addon"><span class="glyphicon glyphicon-euro"></span></span></div>{hint}', | ||||
]) | ]) | ||||
->label('Quel montant souhaitez-vous créditer ?') | ->label('Quel montant souhaitez-vous créditer ?') | ||||
->hint('Montant minimum : 25 €'); ?> | |||||
->hint('Montant minimum : '.Producer::getOnlinePaymentMinimumAmount().' €'); ?> | |||||
<div class="form-group"> | <div class="form-group"> | ||||
<?= Html::submitButton('<span class="glyphicon glyphicon-lock"></span> Payer', ['class' => 'btn btn-primary'] | <?= Html::submitButton('<span class="glyphicon glyphicon-lock"></span> Payer', ['class' => 'btn btn-primary'] |