| 1 |
<?php |
| 2 |
/** |
| 3 |
* Payment fields for seQura payment gateway. |
| 4 |
* |
| 5 |
* @package SeQura/WC |
| 6 |
* @var string $args The arguments. Must contain: |
| 7 |
* - description: string |
| 8 |
* - payment_methods: array<string, mixed> |
| 9 |
*/ |
| 10 |
|
| 11 |
use SeQura\WC\Dto\Payment_Method_Data; |
| 12 |
|
| 13 |
defined( 'WPINC' ) || die; |
| 14 |
if ( ! isset( $args['description'], $args['payment_methods'] ) ) { |
| 15 |
return; |
| 16 |
} |
| 17 |
?> |
| 18 |
|
| 19 |
<span class="sequra-block__description"><?php echo wp_kses_post( wpautop( wptexturize( $args['description'] ) ) ); ?></span> |
| 20 |
<?php |
| 21 |
foreach ( (array) $args['payment_methods'] as $key => $pm ) : |
| 22 |
/** |
| 23 |
* Dto |
| 24 |
* |
| 25 |
* @var Payment_Method_Data $dto |
| 26 |
*/ |
| 27 |
$dto = Payment_Method_Data::from_array( $pm ); |
| 28 |
if ( ! $dto || ! $dto->is_valid() ) { |
| 29 |
continue; |
| 30 |
} |
| 31 |
|
| 32 |
$input_id = "sequra_payment_method_{$key}"; |
| 33 |
?> |
| 34 |
<div class="sequra-payment-method"> |
| 35 |
<input type="radio" name="sequra_payment_method_data" value="<?php echo esc_attr( $dto->encode() ); ?>" id="<?php echo esc_attr( $input_id ); ?>" class="sequra-payment-method__input wc-block-components-radio-control__input" /> |
| 36 |
<label for="<?php echo esc_attr( $input_id ); ?>"> |
| 37 |
<div class="sequra-payment-method__description"> |
| 38 |
<span class="sequra-payment-method__name" style="width:100%"><?php echo esc_html( $pm['title'] ); ?></span> |
| 39 |
<span class="sequra-payment-method__claim" style="width:100%"><?php echo esc_html( $pm['claim'] ); ?></span> |
| 40 |
<?php if ( ! empty( $pm['costDescription'] ) ) : ?> |
| 41 |
<span class="sequra-payment-method__cost-desc" style="width:100%"><?php echo esc_html( $pm['costDescription'] ); ?></span> |
| 42 |
<?php endif; ?> |
| 43 |
</div> |
| 44 |
<?php if ( ! empty( $pm['icon'] ) ) : ?> |
| 45 |
<img src="data:image/svg+xml;base64,<?php echo esc_attr( base64_encode( $pm['icon'] ) ); ?>" height="40px" loading="lazy" alt="<?php echo esc_attr( $pm['title'] ); ?>" class="sequra-payment-method__icon" /> |
| 46 |
<?php endif; ?> |
| 47 |
</label> |
| 48 |
</div> |
| 49 |
<?php endforeach; ?> |
| 50 |
|