Changeset 2249399
- Timestamp:
- 02/24/2020 03:48:31 PM (6 years ago)
- Location:
- cardgate
- Files:
-
- 2 deleted
- 3 edited
- 6 copied
-
tags/3.1.16 (copied) (copied from cardgate/trunk)
-
tags/3.1.16/cardgate-clientlib-php/src/Client.php (copied) (copied from cardgate/trunk/cardgate-clientlib-php/src/Client.php) (2 diffs)
-
tags/3.1.16/cardgate-clientlib-php/src/Customer.php (deleted)
-
tags/3.1.16/cardgate-clientlib-php/src/Method.php (copied) (copied from cardgate/trunk/cardgate-clientlib-php/src/Method.php)
-
tags/3.1.16/cardgate-clientlib-php/src/resource/Customers.php (deleted)
-
tags/3.1.16/cardgate.php (copied) (copied from cardgate/trunk/cardgate.php) (3 diffs)
-
tags/3.1.16/classes/WC_CardgateOnlineueberweisen.php (copied) (copied from cardgate/trunk/classes/WC_CardgateOnlineueberweisen.php)
-
tags/3.1.16/readme.txt (copied) (copied from cardgate/trunk/readme.txt) (2 diffs)
-
trunk/cardgate-clientlib-php/src/Client.php (modified) (2 diffs)
-
trunk/cardgate.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cardgate/tags/3.1.16/cardgate-clientlib-php/src/Client.php
r2178570 r2249399 36 36 * Client version. 37 37 */ 38 const CLIENT_VERSION = "1.1.1 2";38 const CLIENT_VERSION = "1.1.13"; 39 39 40 40 /** … … 383 383 * @api 384 384 */ 385 static public function pullConfig( $sToken_, $bTestmode_ = FALSE) {385 public function pullConfig( $sToken_ ) { 386 386 if ( ! is_string( $sToken_ ) ) { 387 387 throw new Exception( 'Client.Token.Invalid', 'invalid token for settings pull: ' . $sToken_ ); 388 388 } 389 390 389 $sResource = "pullconfig/{$sToken_}/"; 391 $sUrl = ( $bTestmode_ ? self::URL_STAGING : self::URL_PRODUCTION ) . $sResource; 392 393 $rCh = curl_init(); 394 curl_setopt( $rCh, CURLOPT_URL, $sUrl ); 395 curl_setopt( $rCh, CURLOPT_RETURNTRANSFER, 1 ); 396 curl_setopt( $rCh, CURLOPT_TIMEOUT, 60 ); 397 curl_setopt( $rCh, CURLOPT_HEADER, FALSE ); 398 curl_setopt( $rCh, CURLOPT_HTTPHEADER, [ 399 'Content-Type: application/json', 400 'Accept: application/json' 401 ] ); 402 if ( $bTestmode_ ) { 403 curl_setopt( $rCh, CURLOPT_SSL_VERIFYPEER, FALSE ); 404 curl_setopt( $rCh, CURLOPT_SSL_VERIFYHOST, 0 ); 405 } else { 406 curl_setopt( $rCh, CURLOPT_SSL_VERIFYPEER, TRUE ); // verify SSL peer 407 curl_setopt( $rCh, CURLOPT_SSL_VERIFYHOST, 2 ); // check for valid common name and verify host 408 } 409 410 if ( FALSE == ( $sResults = curl_exec( $rCh ) ) ) { 411 $sError = curl_error( $rCh ); 412 curl_close( $rCh ); 413 throw new Exception( 'Client.Request.Curl.Error', $sError ); 414 } else { 415 curl_close( $rCh ); 416 } 417 if ( NULL === ( $aResults = json_decode( $sResults, TRUE ) ) ) { 418 throw new Exception( 'Client.Request.JSON.Invalid', 'remote gave invalid JSON: ' . $sResults ); 419 } 420 if ( isset( $aResults['error'] ) ) { 421 throw new Exception( 'Client.Request.Remote.' . $aResults['error']['code'], $aResults['error']['message'] ); 422 } 423 424 return $aResults; 390 return $this->doRequest($sResource); 425 391 } 426 392 -
cardgate/tags/3.1.16/cardgate.php
r2178570 r2249399 7 7 * Text Domain: cardgate 8 8 * Domain Path: /i18n/languages 9 * Version: 3.1.1 59 * Version: 3.1.16 10 10 * Requires at least: 4.4 11 11 * Author: CardGate … … 41 41 add_action('admin_notices', array(&$this,'my_error_notice')); 42 42 } 43 44 // ////////////////////////////////////////////////45 43 46 44 /** … … 428 426 try { 429 427 require_once WP_PLUGIN_DIR . '/cardgate/cardgate-clientlib-php/init.php'; 428 $sVersion = ( $this->get_woocommerce_version() == '' ? 'unkown' : $this->get_woocommerce_version() ); 429 $sLanguage = substr( get_locale(), 0, 2 ); 430 430 $bIsTest = ($_REQUEST['testmode'] == 1 ? true : false); 431 $aResult = cardgate\api\Client::pullConfig($_REQUEST['token'], $bIsTest); 432 $aConfigData = $aResult['pullconfig']['content']; 433 update_option('cgp_mode', $aConfigData['testmode']); 434 update_option('cgp_siteid', $aConfigData['site_id']); 435 update_option('cgp_hashkey', $aConfigData['site_key']); 436 update_option('cgp_merchant_id', $aConfigData['merchant_id']); 437 update_option('cgp_merchant_api_key', $aConfigData['api_key']); 438 die($aConfigData['merchant'] . '.' . get_option('cgp_siteid') . '.200'); 431 $iMerchantId = (int)(get_option('cgp_merchant_id')== false ? 0 : get_option('cgp_merchant_id')); 432 $sMerchantApiKey = (get_option('cgp_merchant_api_key')== false ? 'initconfig' : get_option('cgp_merchant_api_key')); 433 $oCardGate = new cardgate\api\Client( $iMerchantId, $sMerchantApiKey, $bIsTest ); 434 $oCardGate->setIp( $_SERVER['REMOTE_ADDR'] ); 435 $oCardGate->setLanguage( $sLanguage ); 436 $oCardGate->version()->setPlatformName( 'Woocommerce' ); 437 $oCardGate->version()->setPlatformVersion( $sVersion ); 438 $oCardGate->version()->setPluginName( 'CardGate' ); 439 $oCardGate->version()->setPluginVersion( get_option( 'cardgate_version' ) ); 440 $aResult = $oCardGate->pullConfig($_REQUEST['token']); 441 if (isset($aResult['success']) && $aResult['success'] == 1){ 442 $aConfigData = $aResult['pullconfig']['content']; 443 update_option('cgp_mode', $aConfigData['testmode']); 444 update_option('cgp_siteid', $aConfigData['site_id']); 445 update_option('cgp_hashkey', $aConfigData['site_key']); 446 update_option('cgp_merchant_id', $aConfigData['merchant_id']); 447 update_option('cgp_merchant_api_key', $aConfigData['api_key']); 448 die ($aConfigData['merchant'] . '.' . get_option('cgp_siteid') . '.200'); 449 } else { 450 die('Token retrieval failed.'); 451 } 439 452 } catch (cardgate\api\Exception $oException_) { 440 453 die(htmlspecialchars($oException_->getMessage())); -
cardgate/tags/3.1.16/readme.txt
r2178570 r2249399 5 5 Requires at least: 4.2 6 6 Tested up to: 5.2 7 Stable tag: 3.1.1 57 Stable tag: 3.1.16 8 8 License: GPLv3 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 68 68 == Changelog == 69 69 70 = 3.1.16 = 71 * New pullConfig method implementation 72 70 73 = 3.1.15 = 71 74 * New payment method: OnlineÜberweisen -
cardgate/trunk/cardgate-clientlib-php/src/Client.php
r2178570 r2249399 36 36 * Client version. 37 37 */ 38 const CLIENT_VERSION = "1.1.1 2";38 const CLIENT_VERSION = "1.1.13"; 39 39 40 40 /** … … 383 383 * @api 384 384 */ 385 static public function pullConfig( $sToken_, $bTestmode_ = FALSE) {385 public function pullConfig( $sToken_ ) { 386 386 if ( ! is_string( $sToken_ ) ) { 387 387 throw new Exception( 'Client.Token.Invalid', 'invalid token for settings pull: ' . $sToken_ ); 388 388 } 389 390 389 $sResource = "pullconfig/{$sToken_}/"; 391 $sUrl = ( $bTestmode_ ? self::URL_STAGING : self::URL_PRODUCTION ) . $sResource; 392 393 $rCh = curl_init(); 394 curl_setopt( $rCh, CURLOPT_URL, $sUrl ); 395 curl_setopt( $rCh, CURLOPT_RETURNTRANSFER, 1 ); 396 curl_setopt( $rCh, CURLOPT_TIMEOUT, 60 ); 397 curl_setopt( $rCh, CURLOPT_HEADER, FALSE ); 398 curl_setopt( $rCh, CURLOPT_HTTPHEADER, [ 399 'Content-Type: application/json', 400 'Accept: application/json' 401 ] ); 402 if ( $bTestmode_ ) { 403 curl_setopt( $rCh, CURLOPT_SSL_VERIFYPEER, FALSE ); 404 curl_setopt( $rCh, CURLOPT_SSL_VERIFYHOST, 0 ); 405 } else { 406 curl_setopt( $rCh, CURLOPT_SSL_VERIFYPEER, TRUE ); // verify SSL peer 407 curl_setopt( $rCh, CURLOPT_SSL_VERIFYHOST, 2 ); // check for valid common name and verify host 408 } 409 410 if ( FALSE == ( $sResults = curl_exec( $rCh ) ) ) { 411 $sError = curl_error( $rCh ); 412 curl_close( $rCh ); 413 throw new Exception( 'Client.Request.Curl.Error', $sError ); 414 } else { 415 curl_close( $rCh ); 416 } 417 if ( NULL === ( $aResults = json_decode( $sResults, TRUE ) ) ) { 418 throw new Exception( 'Client.Request.JSON.Invalid', 'remote gave invalid JSON: ' . $sResults ); 419 } 420 if ( isset( $aResults['error'] ) ) { 421 throw new Exception( 'Client.Request.Remote.' . $aResults['error']['code'], $aResults['error']['message'] ); 422 } 423 424 return $aResults; 390 return $this->doRequest($sResource); 425 391 } 426 392 -
cardgate/trunk/cardgate.php
r2178570 r2249399 7 7 * Text Domain: cardgate 8 8 * Domain Path: /i18n/languages 9 * Version: 3.1.1 59 * Version: 3.1.16 10 10 * Requires at least: 4.4 11 11 * Author: CardGate … … 41 41 add_action('admin_notices', array(&$this,'my_error_notice')); 42 42 } 43 44 // ////////////////////////////////////////////////45 43 46 44 /** … … 428 426 try { 429 427 require_once WP_PLUGIN_DIR . '/cardgate/cardgate-clientlib-php/init.php'; 428 $sVersion = ( $this->get_woocommerce_version() == '' ? 'unkown' : $this->get_woocommerce_version() ); 429 $sLanguage = substr( get_locale(), 0, 2 ); 430 430 $bIsTest = ($_REQUEST['testmode'] == 1 ? true : false); 431 $aResult = cardgate\api\Client::pullConfig($_REQUEST['token'], $bIsTest); 432 $aConfigData = $aResult['pullconfig']['content']; 433 update_option('cgp_mode', $aConfigData['testmode']); 434 update_option('cgp_siteid', $aConfigData['site_id']); 435 update_option('cgp_hashkey', $aConfigData['site_key']); 436 update_option('cgp_merchant_id', $aConfigData['merchant_id']); 437 update_option('cgp_merchant_api_key', $aConfigData['api_key']); 438 die($aConfigData['merchant'] . '.' . get_option('cgp_siteid') . '.200'); 431 $iMerchantId = (int)(get_option('cgp_merchant_id')== false ? 0 : get_option('cgp_merchant_id')); 432 $sMerchantApiKey = (get_option('cgp_merchant_api_key')== false ? 'initconfig' : get_option('cgp_merchant_api_key')); 433 $oCardGate = new cardgate\api\Client( $iMerchantId, $sMerchantApiKey, $bIsTest ); 434 $oCardGate->setIp( $_SERVER['REMOTE_ADDR'] ); 435 $oCardGate->setLanguage( $sLanguage ); 436 $oCardGate->version()->setPlatformName( 'Woocommerce' ); 437 $oCardGate->version()->setPlatformVersion( $sVersion ); 438 $oCardGate->version()->setPluginName( 'CardGate' ); 439 $oCardGate->version()->setPluginVersion( get_option( 'cardgate_version' ) ); 440 $aResult = $oCardGate->pullConfig($_REQUEST['token']); 441 if (isset($aResult['success']) && $aResult['success'] == 1){ 442 $aConfigData = $aResult['pullconfig']['content']; 443 update_option('cgp_mode', $aConfigData['testmode']); 444 update_option('cgp_siteid', $aConfigData['site_id']); 445 update_option('cgp_hashkey', $aConfigData['site_key']); 446 update_option('cgp_merchant_id', $aConfigData['merchant_id']); 447 update_option('cgp_merchant_api_key', $aConfigData['api_key']); 448 die ($aConfigData['merchant'] . '.' . get_option('cgp_siteid') . '.200'); 449 } else { 450 die('Token retrieval failed.'); 451 } 439 452 } catch (cardgate\api\Exception $oException_) { 440 453 die(htmlspecialchars($oException_->getMessage())); -
cardgate/trunk/readme.txt
r2178570 r2249399 5 5 Requires at least: 4.2 6 6 Tested up to: 5.2 7 Stable tag: 3.1.1 57 Stable tag: 3.1.16 8 8 License: GPLv3 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 68 68 == Changelog == 69 69 70 = 3.1.16 = 71 * New pullConfig method implementation 72 70 73 = 3.1.15 = 71 74 * New payment method: OnlineÜberweisen
Note: See TracChangeset
for help on using the changeset viewer.