| 1 | <?php |
||
| 2 | |||
| 3 | namespace ByTIC\Payments\Stripe; |
||
| 4 | |||
| 5 | use ByTIC\Payments\Gateways\Providers\AbstractGateway\Form as AbstractForm; |
||
| 6 | use ByTIC\Payments\Models\Methods\Types\CreditCards; |
||
| 7 | |||
| 8 | /** |
||
| 9 | * Class Form |
||
| 10 | * @package ByTIC\Payments\Stripe |
||
| 11 | */ |
||
| 12 | class Form extends AbstractForm |
||
| 13 | { |
||
| 14 | public function initElements() |
||
| 15 | { |
||
| 16 | parent::initElements(); |
||
| 17 | $this->initElementSandbox(); |
||
| 18 | |||
| 19 | $this->addInput('apiKey', 'apiKey', false); |
||
| 20 | $this->addInput('publicKey', 'publicKey', false); |
||
| 21 | } |
||
| 22 | |||
| 23 | public function getDataFromModel() |
||
| 24 | { |
||
| 25 | $type = $this->getForm()->getModel()->getType(); |
||
| 26 | if ($type instanceof CreditCards) { |
||
|
0 ignored issues
–
show
introduced
by
Loading history...
|
|||
| 27 | $type->getGateway(); |
||
| 28 | } |
||
| 29 | parent::getDataFromModel(); |
||
| 30 | } |
||
| 31 | |||
| 32 | /** |
||
| 33 | * @return bool |
||
| 34 | */ |
||
| 35 | public function process() |
||
| 36 | { |
||
| 37 | parent::process(); |
||
| 38 | |||
| 39 | $model = $this->getForm()->getModel(); |
||
| 40 | $options = $model->getPaymentGatewayOptions(); |
||
| 41 | $model->setPaymentGatewayOptions($options); |
||
| 42 | $model->saveRecord(); |
||
| 43 | |||
| 44 | return $options; |
||
|
0 ignored issues
–
show
|
|||
| 45 | } |
||
| 46 | } |
||
| 47 |