Conversation
|
|
||
| Download the contents and extract to your WordPress plugin folder. Activate. | ||
| Download the contents and extract to your WordPress plugin folder. | ||
| Open the composer from the plugin directory and run the command "composer require globalpayments/php-sdk". Activate. |
There was a problem hiding this comment.
We need to ship a copy of the SDK within the plugin itself. WordPress doesn't use / require composer on its own, and the plugin installation process does not have the option for calling composer scripts.
| @@ -439,21 +440,21 @@ protected function getCartDiscountTotal() | |||
| } | |||
|
|
|||
| protected function giftCardService() | |||
There was a problem hiding this comment.
Let's rename this to giftCardServiceConfig
| { | ||
| $config = new ServicesConfig(); | ||
| $config->secretApiKey = $this->secret_key; | ||
| $config->serviceUrl = ($this->enableCryptoUrl) ? |
There was a problem hiding this comment.
We can scrap the enableCryptoUrl property and only use https://api2.heartlandportico.com and https://cert.api2.heartlandportico.com
| $config->secretApiKey = $this->secret_key; | ||
| $config->serviceUrl = ($this->enableCryptoUrl) ? | ||
| 'https://cert.api2-c.heartlandportico.com/' : | ||
| 'https://cert.api2.heartlandportico.com'; |
There was a problem hiding this comment.
This method needs to handle the different URLs for production and sandbox/certification.
| { | ||
| // includes | ||
| require_once 'includes/Hps.php'; | ||
| //require_once 'includes/Hps.php'; |
There was a problem hiding this comment.
Once the SDK is pulled into the plugin, we need to set up an autoloader and require it here in order to load the SDK at runtime.
| $config->developerId = '002914'; | ||
| $config->serviceUrl = ($this->enableCryptoUrl) ? | ||
| 'https://cert.api2-c.heartlandportico.com/' : | ||
| 'https://cert.api2.heartlandportico.com'; |
There was a problem hiding this comment.
This method needs to handle the different URLs for production and sandbox/certification.
| $tokenval = $response->token; | ||
|
|
||
| if ($response->tokenData->responseCode == '0') { | ||
| if ($response->token == '0') { |
There was a problem hiding this comment.
This expression needs to be updated to check for a non-empty value. The token property will contain the token value, not the tokenization response code.
| $chargeService = $this->parent->getCreditService(); | ||
| $this->parent->getCreditService(); | ||
| $transaction = new Transaction(); | ||
| $chargeService = $transaction->fromId($transactionId); |
There was a problem hiding this comment.
Transaction::fromId is a static method. We should not be calling it in this fashion.
| $chargeService = $this->parent->getCreditService(); | ||
| $this->parent->getCreditService(); | ||
| $transaction = new Transaction(); | ||
| $chargeService = $transaction->fromId($transactionId); |
There was a problem hiding this comment.
Transaction::fromId is a static method. We should not be calling it in this fashion.
| $path = dirname(plugin_dir_path(__FILE__)); | ||
| include $path . '/'.basename(__DIR__).'/vendor/autoload.php'; | ||
|
|
||
|
|
There was a problem hiding this comment.
This should remain where Hps.php is required.
| ## Usage | ||
|
|
||
| Download the contents and extract to your WordPress plugin folder. Activate. | ||
| Download the contents and extract to your WordPress plugin folder. |
There was a problem hiding this comment.
They still need to activate the plugin in order to have Heartland as a payment gateway option.
| foreach ($processed_cards as $card_id => $card) { | ||
| try { | ||
| $response = $this->giftCardService()->void($card->transaction_id) | ||
| $response = $this->giftCardServiceConfig()->void($card->transaction_id) |
There was a problem hiding this comment.
Has this been tested yet? It seems an error would be thrown since void doesn't exist on ServicesConfig
| $transactionId = $this->getOrderTransactionId($order); | ||
| $transaction = $this->getCreditService()->get($transactionId)->execute(); | ||
| return $transaction->transactionStatus == 'A'; | ||
| $refundservice = $this->getCreditService(); |
There was a problem hiding this comment.
$refundservice doesn't seem to be used here.
| return $transaction->transactionStatus == 'A'; | ||
| $refundservice = $this->getCreditService(); | ||
| $reportingService = new ReportingService(); | ||
| $transactions = $reportingService->transactionDetail($transactionId)->execute(); |
There was a problem hiding this comment.
ReportingService::transactionDetail is a static method. It shouldn't be called as an instance method.
updated the code to use the latest php-sdk and updated the readme file regarding the sdk download with composer code. Need to remove " includes" folder from location heartland-woocommerce-plugin/classes/