@@ -370,6 +370,10 @@ $this->addBreadcrumb($this->getTitle()) ; | |||
], []); ?> | |||
<?= $form->field($model, 'option_stripe_public_key')->textInput(); ?> | |||
<?= $form->field($model, 'option_stripe_mode_test')->dropDownList([ | |||
0 => 'Non', | |||
1 => 'Oui' | |||
], []); ?> | |||
<?= $form->field($model, 'option_stripe_private_key')->textInput(); ?> | |||
<?= $form->field($model, 'option_stripe_endpoint_secret')->textInput(); ?> | |||
</div> |
@@ -228,7 +228,8 @@ class Producer extends ActiveRecordCommon | |||
'option_export_display_product_reference', | |||
'option_allow_order_guest', | |||
'option_delivery', | |||
'option_display_export_grid' | |||
'option_display_export_grid', | |||
'option_stripe_mode_test' | |||
], | |||
'boolean' | |||
], | |||
@@ -308,6 +309,7 @@ class Producer extends ActiveRecordCommon | |||
'type' => 'Type de producteur', | |||
'credit_limit_reminder' => 'Seuil de crédit limite avant relance', | |||
'online_payment' => 'Activer le paiement en ligne (Stripe)', | |||
'option_stripe_mode_test' => 'Mode test', | |||
'option_stripe_public_key' => 'Clé publique', | |||
'option_stripe_private_key' => 'Clé secrète', | |||
'option_stripe_endpoint_secret' => 'Clé secrète (endpoint)', |
@@ -0,0 +1,41 @@ | |||
<?php | |||
use yii\db\Migration; | |||
use yii\db\Schema; | |||
/** | |||
* Class m210915_083421_add_option_stripe_mode_test | |||
*/ | |||
class m210915_083421_add_option_stripe_mode_test extends Migration | |||
{ | |||
/** | |||
* {@inheritdoc} | |||
*/ | |||
public function safeUp() | |||
{ | |||
$this->addColumn('producer', 'option_stripe_mode_test', Schema::TYPE_BOOLEAN.' DEFAULT 1'); | |||
} | |||
/** | |||
* {@inheritdoc} | |||
*/ | |||
public function safeDown() | |||
{ | |||
$this->dropColumn('producer', 'option_stripe_mode_test'); | |||
} | |||
/* | |||
// Use up()/down() to run migration code without a transaction. | |||
public function up() | |||
{ | |||
} | |||
public function down() | |||
{ | |||
echo "m210915_083421_add_option_stripe_mode_test cannot be reverted.\n"; | |||
return false; | |||
} | |||
*/ | |||
} |
@@ -117,7 +117,7 @@ class CreditController extends ProducerBaseController | |||
{ | |||
$producer = $this->getProducer(); | |||
if ($producer->online_payment) { | |||
if ($producer->online_payment || $producer->option_stripe_mode_test) { | |||
$creditForm = new CreditForm; | |||