Skip to content

Commit

Permalink
OctopusDeploy release: 6.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
securesubmit-buildmaster committed Feb 9, 2023
1 parent 065b210 commit 4738c30
Show file tree
Hide file tree
Showing 5 changed files with 137 additions and 55 deletions.
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@

# Changelog

## Latest version
## Latest Version
#### Bug Fixes:
- Portico Gateway: fix DigitalPaymentToken handling

## v6.0.6 (02/02/2023)
#### Enhancements:
- GP-API: add risk assessment feature
- Refacto the Secure3DBuilder

## v6.0.6 (02/26/2023)
## v6.0.6 (01/26/2023)
#### Enhancements:
- GPI Transactions : added support for credit, ach & reporting transactions
- GP-API: add to generateXGPSignature to GenerationUtils
Expand Down
2 changes: 1 addition & 1 deletion metadata.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<xml>
<releaseNumber>6.1.0</releaseNumber>
<releaseNumber>6.1.1</releaseNumber>
</xml>
9 changes: 2 additions & 7 deletions src/Gateways/PorticoConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -2341,11 +2341,7 @@ protected function hydrateThreeDSecureData(DOMDocument $xml, BaseBuilder $builde
private function hydrateWalletData(DOMDocument $xml, BaseBuilder $builder, $block1, $cardData)
{
//wallet data
if (
$builder->paymentMethod->mobileType == MobilePaymentMethodType::APPLEPAY
|| $builder->paymentMethod->mobileType == MobilePaymentMethodType::GOOGLEPAY
&& $this->isAppleOrGooglePay($builder->paymentMethod->paymentSource)
) {
if ($this->isAppleOrGooglePay($builder->paymentMethod->paymentSource)) {
$walletData = $xml->createElement('WalletData');

if (!empty($builder->paymentMethod->threeDSecure->cavv)) {
Expand All @@ -2357,8 +2353,7 @@ private function hydrateWalletData(DOMDocument $xml, BaseBuilder $builder, $bloc
if (!empty($builder->paymentMethod->paymentSource)) {
$walletData->appendChild($xml->createElement('PaymentSource', $builder->paymentMethod->paymentSource));
}

if ($builder->paymentMethod->mobileType) {
if (!empty($builder->paymentMethod->token)) {
$token = $this->toFormatToken($builder->paymentMethod->token);
$walletData->appendChild($xml->createElement('DigitalPaymentToken', $token));
$block1->removeChild($cardData);
Expand Down
97 changes: 52 additions & 45 deletions src/PaymentMethods/Credit.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,29 @@

namespace GlobalPayments\Api\PaymentMethods;

use GlobalPayments\Api\Builders\AuthorizationBuilder;
use GlobalPayments\Api\Builders\ManagementBuilder;
use GlobalPayments\Api\Entities\DccRateData;
use GlobalPayments\Api\Entities\Enums\EntryMethod;
use GlobalPayments\Api\Entities\Enums\ManualEntryMethod;
use GlobalPayments\Api\Entities\Enums\PaymentMethodUsageMode;
use GlobalPayments\Api\Entities\ThreeDSecure;
use GlobalPayments\Api\Entities\Enums\PaymentMethodType;
use GlobalPayments\Api\Entities\Enums\TransactionType;
use GlobalPayments\Api\Entities\Exceptions\ApiException;
use GlobalPayments\Api\Builders\{AuthorizationBuilder, ManagementBuilder};
use GlobalPayments\Api\Entities\{DccRateData, ThreeDSecure};
use GlobalPayments\Api\Entities\Enums\{
EntryMethod,
ManualEntryMethod,
PaymentMethodType,
PaymentMethodUsageMode,
TransactionType
};
use GlobalPayments\Api\Entities\Exceptions\BuilderException;
use GlobalPayments\Api\PaymentMethods\Interfaces\IAuthable;
use GlobalPayments\Api\PaymentMethods\Interfaces\IBalanceable;
use GlobalPayments\Api\PaymentMethods\Interfaces\IChargable;
use GlobalPayments\Api\PaymentMethods\Interfaces\IEncryptable;
use GlobalPayments\Api\PaymentMethods\Interfaces\IPaymentMethod;
use GlobalPayments\Api\PaymentMethods\Interfaces\IPrePayable;
use GlobalPayments\Api\PaymentMethods\Interfaces\IRefundable;
use GlobalPayments\Api\PaymentMethods\Interfaces\IReversable;
use GlobalPayments\Api\PaymentMethods\Interfaces\ISecure3d;
use GlobalPayments\Api\PaymentMethods\Interfaces\ITokenizable;
use GlobalPayments\Api\PaymentMethods\Interfaces\IVerifyable;
use GlobalPayments\Api\PaymentMethods\Interfaces\{
IAuthable,
IPaymentMethod,
IEncryptable,
ITokenizable,
IChargable,
IRefundable,
IReversable,
IVerifyable,
IPrePayable,
IBalanceable,
ISecure3d
};

abstract class Credit implements
IPaymentMethod,
Expand All @@ -38,22 +39,10 @@ abstract class Credit implements
IBalanceable,
ISecure3d
{
public $encryptionData;
public $paymentMethodType = PaymentMethodType::CREDIT;

/**
* The token value representing the card.
*
* For `TransactionModifier.Encrypted_Mobile` transactions, this value is the
* encrypted payload from the mobile payment scheme.
*/
public $token;

/**
* The type of mobile device used in `TransactionModifier.Encrypted_Mobile`
* transactions.
* The card type of the manual entry data.
*/
public $mobileType;
public $cardType;

/**
* The authentication value use to verify the validity of the digit wallet transaction.
Expand All @@ -69,24 +58,42 @@ abstract class Credit implements
*/
public $eci;

public $encryptionData;

/** @var EntryMethod|ManualEntryMethod */
public $entryMethod;

/** @var bool */
public $isFleet;

/**
* The type of mobile device used in `TransactionModifier.Encrypted_Mobile`
* transactions.
*/
public $mobileType;

public $paymentMethodType = PaymentMethodType::CREDIT;


// maybe change the name of the below var


/** @var PaymentDataSourceType */
public $paymentSource;

/**
* Secure 3d Data attached to the card
* @var ThreeDSecure
*/
public $threeDSecure;

/**
* The card type of the manual entry data.
* The token value representing the card.
*
* For `TransactionModifier.Encrypted_Mobile` transactions, this value is the
* encrypted payload from the mobile payment scheme.
*/
public $cardType;

/** @var bool */
public $isFleet;

/** @var EntryMethod|ManualEntryMethod */
public $entryMethod;

/** @return boolean */
public $token;

/**
* Authorizes the payment method
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2054,4 +2054,80 @@ public function testEcomWithWalletDataMobileType()
$this->assertEquals(true, $response != null);
$this->assertEquals('00', $response->responseCode);
}

// can use this to generate a token: https://gpay-test.azurewebsites.net/
// use MID 777703754644
public function testGooglePay() : void
{
$walletConfig = new PorticoConfig();
$walletConfig->secretApiKey = 'skapi_cert_MVq4BQC5n3AAgd4M1Cvph2ud3CGaIclCgC7H_KxZaQ';
ServicesContainer::configureService($walletConfig, 'GooglePay');

$card = new CreditCardData();
$card->paymentSource = PaymentDataSourceType::GOOGLEPAYAPP;
$card->token = '{"signature":"MEUCIDiJ2XhsweojddWc6VNuK+aq9JvT3M1kfQGOCiQEiYdVAiEA+o6f5VcMxbTABBCAmq9gMEA8KAzhfhJf4qAMh9sxRK0\u003d","protocolVersion":"ECv1","signedMessage":"{\"encryptedMessage\":\"nOdfmUk8qjQKUmJJzve9V7fTD3uu1tzsFWD9iM2rNoneCHLEhsgbK1CGpMuB4kpNIFlbcCTFbmwPqriE0W0Wr8iisPnUgDrBG7O7PnRImAzx83P0LnNgHHNs7V0Z4yqOZ9r22nI4wE6OEfNZutacluR4rHJQRd4WqcDeiqfbftmr97aOlZ5m/G/7/Fpqu4Caeicol8LuqIEtcwRFX3Qya2alJ4lrgb7eRSapZiOFjwt/4EyXaxsh8MmIOeDDyFybKliySIbAXdC+0LsrBgn9Jujgy7GRlWc94C8RZ8hy0U7IlCAD3NznEEQ9gkmq2h0/NH5Zz660cpp42GzCEwLe0Q3m8p6IvMct2xKm3IkuC1iJQthuakURalp16TdaealTU2NIaMh3ZD6X8KO0zaEBVkK4cmC1Aj0MDDheKMcjQvYoO47XPobYUE3qDhoZ6iPwCWSNVrA1EQ\\u003d\\u003d\",\"ephemeralPublicKey\":\"BLdiwg4jfHZehuzoeR3/sxKYWqU6nmsnheenjUPaw3v3M2In0HVVONotaNb566oZtHT5afvwtBZvd6VL6PSowqE\\u003d\",\"tag\":\"q/+hOdT+8mEkSMIRXeE6TlKG5t5o29jmCj7wsjO+lCg\\u003d\"}"}';

$response = $card->charge(10)
->withCurrency('USD')
->withInvoiceNumber('12345')
->withAllowDuplicates(true)
->execute('GooglePay');

$this->assertEquals(true, $response != null);
$this->assertEquals('00', $response->responseCode);
}

public function testMasterCardSuptSale() : void
{
$walletConfig = new PorticoConfig();
$walletConfig->secretApiKey = 'skapi_cert_MVq4BQC5n3AAgd4M1Cvph2ud3CGaIclCgC7H_KxZaQ';
ServicesContainer::configureService($walletConfig, 'GooglePay');

$card = new CreditCardData();
$card->token = $this->getMastercardToken('pkapi_cert_BxO8wdeBZaZfEBuP0b');

$response = $card->charge(10)
->withCurrency('USD')
->withInvoiceNumber('12345')
->withAllowDuplicates(true)
->execute('GooglePay');

$this->assertEquals(true, $response != null);
$this->assertEquals('00', $response->responseCode);
}

/**
*
* @param string $pubKey
* @return string
* @throws AssertionFailedError
*/
protected function getMastercardToken(string $pubKey) : string
{
$payload = array(
'object' => 'token',
'token_type' => 'supt',
'card' => array(
'number' => '5454545454545454',
'cvc' => '123',
'exp_month' => '12',
'exp_year' => '2023'
)
);
$url = 'https://cert.api2-c.heartlandportico.com/Hps.Exchange.PosGateway.Hpf.v1/api/token?api_key='
. $pubKey;
$options = array(
'http' => array(
'header' => "Content-Type: application/json\r\n",
'method' => 'POST',
'content' => json_encode($payload),
),
);
$context = stream_context_create($options);
$response = json_decode(file_get_contents($url, false, $context));
if (!$response || isset($response->error)) {
$this->fail('no single-use token obtained');
}
return $response->token_value;
}
}

0 comments on commit 4738c30

Please sign in to comment.