Skip to content

Updation sdk with v3#164

Open
pkuma525 wants to merge 11 commits intomasterfrom
updation-sdk-with-v3
Open

Updation sdk with v3#164
pkuma525 wants to merge 11 commits intomasterfrom
updation-sdk-with-v3

Conversation

@pkuma525
Copy link
Copy Markdown
Collaborator

@pkuma525 pkuma525 commented Oct 1, 2019

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/

@pkuma525 pkuma525 requested a review from slogsdon October 1, 2019 06:24
Comment thread README.md Outdated

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.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

@@ -439,21 +440,21 @@ protected function getCartDiscountTotal()
}

protected function giftCardService()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's rename this to giftCardServiceConfig

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

{
$config = new ServicesConfig();
$config->secretApiKey = $this->secret_key;
$config->serviceUrl = ($this->enableCryptoUrl) ?
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can scrap the enableCryptoUrl property and only use https://api2.heartlandportico.com and https://cert.api2.heartlandportico.com

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

$config->secretApiKey = $this->secret_key;
$config->serviceUrl = ($this->enableCryptoUrl) ?
'https://cert.api2-c.heartlandportico.com/' :
'https://cert.api2.heartlandportico.com';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method needs to handle the different URLs for production and sandbox/certification.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

{
// includes
require_once 'includes/Hps.php';
//require_once 'includes/Hps.php';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

$config->developerId = '002914';
$config->serviceUrl = ($this->enableCryptoUrl) ?
'https://cert.api2-c.heartlandportico.com/' :
'https://cert.api2.heartlandportico.com';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method needs to handle the different URLs for production and sandbox/certification.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

$tokenval = $response->token;

if ($response->tokenData->responseCode == '0') {
if ($response->token == '0') {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

$chargeService = $this->parent->getCreditService();
$this->parent->getCreditService();
$transaction = new Transaction();
$chargeService = $transaction->fromId($transactionId);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Transaction::fromId is a static method. We should not be calling it in this fashion.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

$chargeService = $this->parent->getCreditService();
$this->parent->getCreditService();
$transaction = new Transaction();
$chargeService = $transaction->fromId($transactionId);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Transaction::fromId is a static method. We should not be calling it in this fashion.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

Comment thread gateway-securesubmit.php
$path = dirname(plugin_dir_path(__FILE__));
include $path . '/'.basename(__DIR__).'/vendor/autoload.php';


Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should remain where Hps.php is required.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

@pkuma525 pkuma525 requested a review from slogsdon October 11, 2019 14:30
Comment thread README.md Outdated
## Usage

Download the contents and extract to your WordPress plugin folder. Activate.
Download the contents and extract to your WordPress plugin folder.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They still need to activate the plugin in order to have Heartland as a payment gateway option.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

foreach ($processed_cards as $card_id => $card) {
try {
$response = $this->giftCardService()->void($card->transaction_id)
$response = $this->giftCardServiceConfig()->void($card->transaction_id)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has this been tested yet? It seems an error would be thrown since void doesn't exist on ServicesConfig

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

$transactionId = $this->getOrderTransactionId($order);
$transaction = $this->getCreditService()->get($transactionId)->execute();
return $transaction->transactionStatus == 'A';
$refundservice = $this->getCreditService();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$refundservice doesn't seem to be used here.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

return $transaction->transactionStatus == 'A';
$refundservice = $this->getCreditService();
$reportingService = new ReportingService();
$transactions = $reportingService->transactionDetail($transactionId)->execute();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ReportingService::transactionDetail is a static method. It shouldn't be called as an instance method.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

@pkuma525 pkuma525 requested a review from slogsdon November 12, 2019 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants