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