| 1 |
<?php declare( strict_types=1 ); |
| 2 |
|
| 3 |
namespace MultiSafepay\WooCommerce\PaymentMethods\Base; |
| 4 |
|
| 5 |
use MultiSafepay\Api\PaymentMethods\PaymentMethod; |
| 6 |
use MultiSafepay\WooCommerce\Services\PaymentMethodService; |
| 7 |
|
| 8 |
/** |
| 9 |
* Class BaseGiftCardPaymentMethod |
| 10 |
* |
| 11 |
* @package MultiSafepay\WooCommerce\PaymentMethods\Base |
| 12 |
*/ |
| 13 |
class BaseBrandedPaymentMethod extends BasePaymentMethod { |
| 14 |
|
| 15 |
/** |
| 16 |
* @var array |
| 17 |
*/ |
| 18 |
protected $brand; |
| 19 |
|
| 20 |
/** |
| 21 |
* @param PaymentMethod $payment_method |
| 22 |
* @param array $brand |
| 23 |
*/ |
| 24 |
public function __construct( PaymentMethod $payment_method, array $brand ) { |
| 25 |
$this->brand = $brand; |
| 26 |
parent::__construct( $payment_method ); |
| 27 |
} |
| 28 |
|
| 29 |
/** |
| 30 |
* @return string |
| 31 |
*/ |
| 32 |
public function get_payment_method_gateway_code(): string { |
| 33 |
return $this->payment_method->getId(); |
| 34 |
} |
| 35 |
|
| 36 |
/** |
| 37 |
* @return string |
| 38 |
*/ |
| 39 |
public function get_payment_method_title(): string { |
| 40 |
return $this->brand['name']; |
| 41 |
} |
| 42 |
|
| 43 |
/** |
| 44 |
* @return string |
| 45 |
*/ |
| 46 |
public function get_payment_method_icon(): string { |
| 47 |
return $this->brand['icon_urls']['large']; |
| 48 |
} |
| 49 |
|
| 50 |
/** |
| 51 |
* @return string |
| 52 |
*/ |
| 53 |
public function get_payment_method_id(): string { |
| 54 |
return PaymentMethodService::get_legacy_woocommerce_payment_gateway_ids( $this->brand['id'] ); |
| 55 |
} |
| 56 |
|
| 57 |
|
| 58 |
} |
| 59 |
|