Clients
3 years ago
Handlers
3 years ago
HeartlandGiftCards
3 years ago
Requests
3 years ago
Traits
3 years ago
AbstractGateway.php
3 years ago
ApplePayGateway.php
3 years ago
GeniusGateway.php
3 years ago
GooglePayGateway.php
3 years ago
GpApiGateway.php
3 years ago
HeartlandGateway.php
3 years ago
TransitGateway.php
3 years ago
GeniusGateway.php
166 lines
| 1 | <?php |
| 2 | |
| 3 | namespace GlobalPayments\WooCommercePaymentGatewayProvider\Gateways; |
| 4 | |
| 5 | use GlobalPayments\Api\Entities\Enums\Environment; |
| 6 | use GlobalPayments\Api\Entities\Enums\GatewayProvider; |
| 7 | |
| 8 | defined( 'ABSPATH' ) || exit; |
| 9 | |
| 10 | class GeniusGateway extends AbstractGateway { |
| 11 | public $gateway_provider = GatewayProvider::GENIUS; |
| 12 | |
| 13 | /** |
| 14 | * Live Merchant location's Merchant Name |
| 15 | * |
| 16 | * @var string |
| 17 | */ |
| 18 | public $merchant_name; |
| 19 | |
| 20 | /** |
| 21 | * Live Merchant location's Site ID |
| 22 | * |
| 23 | * @var string |
| 24 | */ |
| 25 | public $merchant_site_id; |
| 26 | |
| 27 | /** |
| 28 | * Live Merchant location's Merchant Key |
| 29 | * |
| 30 | * @var string |
| 31 | */ |
| 32 | public $merchant_key; |
| 33 | |
| 34 | /** |
| 35 | * Live Merchant location's Web API Key |
| 36 | * |
| 37 | * @var string |
| 38 | */ |
| 39 | public $web_api_key; |
| 40 | |
| 41 | /** |
| 42 | * Sandbox Merchant location's Merchant Name |
| 43 | * |
| 44 | * @var string |
| 45 | */ |
| 46 | public $sandbox_merchant_name; |
| 47 | |
| 48 | /** |
| 49 | * Sandbox Merchant location's Site ID |
| 50 | * |
| 51 | * @var string |
| 52 | */ |
| 53 | public $sandbox_merchant_site_id; |
| 54 | |
| 55 | /** |
| 56 | * Sandbox Merchant location's Merchant Key |
| 57 | * |
| 58 | * @var string |
| 59 | */ |
| 60 | public $sandbox_merchant_key; |
| 61 | |
| 62 | /** |
| 63 | * Sandbox Merchant location's Web API Key |
| 64 | * |
| 65 | * @var string |
| 66 | */ |
| 67 | public $sandbox_web_api_key; |
| 68 | |
| 69 | /** |
| 70 | * Should live payments be accepted |
| 71 | * |
| 72 | * @var bool |
| 73 | */ |
| 74 | public $is_production; |
| 75 | |
| 76 | public function __construct( $is_provider = false ) { |
| 77 | parent::__construct( $is_provider ); |
| 78 | array_push( $this->supports, 'globalpayments_hosted_fields' ); |
| 79 | } |
| 80 | |
| 81 | public function configure_method_settings() { |
| 82 | $this->id = 'globalpayments_genius'; |
| 83 | $this->method_title = __( 'TSYS Genius', 'globalpayments-gateway-provider-for-woocommerce' ); |
| 84 | $this->method_description = __( 'Connect to the TSYS Genius gateway', 'globalpayments-gateway-provider-for-woocommerce' ); |
| 85 | } |
| 86 | |
| 87 | public function get_first_line_support_email() { |
| 88 | return 'securesubmitcert@e-hps.com'; |
| 89 | } |
| 90 | |
| 91 | public function get_gateway_form_fields() { |
| 92 | return array( |
| 93 | 'is_production' => array( |
| 94 | 'title' => __( 'Live Mode', 'globalpayments-gateway-provider-for-woocommerce' ), |
| 95 | 'type' => 'checkbox', |
| 96 | 'description' => __( 'Get your credentials from your TSYS Genius account.', 'globalpayments-gateway-provider-for-woocommerce' ), |
| 97 | 'default' => 'no', |
| 98 | ), |
| 99 | 'merchant_name' => array( |
| 100 | 'title' => __( 'Live Merchant Name', 'globalpayments-gateway-provider-for-woocommerce' ), |
| 101 | 'type' => 'text', |
| 102 | 'default' => '', |
| 103 | 'class' => 'live-toggle', |
| 104 | ), |
| 105 | 'merchant_site_id' => array( |
| 106 | 'title' => __( 'Live Merchant Site ID', 'globalpayments-gateway-provider-for-woocommerce' ), |
| 107 | 'type' => 'text', |
| 108 | 'default' => '', |
| 109 | 'class' => 'live-toggle', |
| 110 | ), |
| 111 | 'merchant_key' => array( |
| 112 | 'title' => __( 'Live Merchant Key', 'globalpayments-gateway-provider-for-woocommerce' ), |
| 113 | 'type' => 'password', |
| 114 | 'default' => '', |
| 115 | 'class' => 'live-toggle', |
| 116 | ), |
| 117 | 'web_api_key' => array( |
| 118 | 'title' => __( 'Live Web API Key', 'globalpayments-gateway-provider-for-woocommerce' ), |
| 119 | 'type' => 'password', |
| 120 | 'default' => '', |
| 121 | 'class' => 'live-toggle', |
| 122 | ), |
| 123 | 'sandbox_merchant_name' => array( |
| 124 | 'title' => __( 'Sandbox Merchant Name', 'globalpayments-gateway-provider-for-woocommerce' ), |
| 125 | 'type' => 'text', |
| 126 | 'default' => '', |
| 127 | 'class' => 'sandbox-toggle', |
| 128 | ), |
| 129 | 'sandbox_merchant_site_id' => array( |
| 130 | 'title' => __( 'Sandbox Merchant Site ID', 'globalpayments-gateway-provider-for-woocommerce' ), |
| 131 | 'type' => 'text', |
| 132 | 'default' => '', |
| 133 | 'class' => 'sandbox-toggle', |
| 134 | ), |
| 135 | 'sandbox_merchant_key' => array( |
| 136 | 'title' => __( 'Sandbox Merchant Key', 'globalpayments-gateway-provider-for-woocommerce' ), |
| 137 | 'type' => 'password', |
| 138 | 'default' => '', |
| 139 | 'class' => 'sandbox-toggle', |
| 140 | ), |
| 141 | 'sandbox_web_api_key' => array( |
| 142 | 'title' => __( 'Sandbox Web API Key', 'globalpayments-gateway-provider-for-woocommerce' ), |
| 143 | 'type' => 'password', |
| 144 | 'default' => '', |
| 145 | 'class' => 'sandbox-toggle', |
| 146 | ), |
| 147 | ); |
| 148 | } |
| 149 | |
| 150 | public function get_frontend_gateway_options() { |
| 151 | return array( |
| 152 | 'webApiKey' => $this->get_credential_setting( 'web_api_key' ), |
| 153 | 'env' => $this->is_production ? parent::ENVIRONMENT_PRODUCTION : parent::ENVIRONMENT_SANDBOX, |
| 154 | ); |
| 155 | } |
| 156 | |
| 157 | public function get_backend_gateway_options() { |
| 158 | return array( |
| 159 | 'merchantName' => $this->get_credential_setting( 'merchant_name' ), |
| 160 | 'merchantSiteId' => $this->get_credential_setting( 'merchant_site_id' ), |
| 161 | 'merchantKey' => $this->get_credential_setting( 'merchant_key' ), |
| 162 | 'environment' => $this->is_production ? Environment::PRODUCTION : Environment::TEST, |
| 163 | ); |
| 164 | } |
| 165 | } |
| 166 |