Skip to content

Commit

Permalink
OctopusDeploy release: 3.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
securesubmit-buildmaster committed Apr 21, 2022
1 parent 3f9e43e commit d7e63ea
Show file tree
Hide file tree
Showing 23 changed files with 292 additions and 130 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@

## Latest version
#### Enhancements:
- GP-API: Increment an Auth: increment the amount for an existing transaction.
- GP-API: Map multiCapture on the transaction response
- GP-API: Update unit tests
- Deprecate verifyEnrolled and verifySignature from CreditCardData

## v3.0.4 (04/12/2022)
#### Enhancements:
- UPA devices: add support for batch summary report, batch detail report, and open tab details report
- UPA devices: various modifications to account for latest UPA version's changes

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>3.0.4</releaseNumber>
<releaseNumber>3.0.5</releaseNumber>
</xml>
17 changes: 17 additions & 0 deletions src/Builders/ManagementBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use GlobalPayments\Api\Entities\Enums\TaxType;
use GlobalPayments\Api\Entities\Enums\TransactionModifier;
use GlobalPayments\Api\Entities\Enums\TransactionType;
use GlobalPayments\Api\Entities\Lodging;
use GlobalPayments\Api\Entities\Transaction;
use GlobalPayments\Api\PaymentMethods\CreditCardData;
use GlobalPayments\Api\PaymentMethods\ECheck;
Expand Down Expand Up @@ -185,6 +186,9 @@ class ManagementBuilder extends TransactionBuilder
/** @var DccRateData */
public $dccRateData;

/** @var Lodging */
public $lodging;

/** @var string */
public $tagData;

Expand Down Expand Up @@ -590,4 +594,17 @@ public function withDccRateData($value)
$this->dccRateData = $value;
return $this;
}

/**
* Set the lodging details
*
* @param Lodging $lodging
*
* @return $this
*/
public function withLodging($lodging)
{
$this->lodging = $lodging;
return $this;
}
}
16 changes: 16 additions & 0 deletions src/Entities/Enums/LodgingItemType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace GlobalPayments\Api\Entities\Enums;

use GlobalPayments\Api\Entities\Enum;

class LodgingItemType extends Enum
{
const RESTAURANT = 'RESTAURANT';
const GIFT_SHOP = 'GIFT_SHOP';
const MINI_BAR = 'MINI_BAR';
const PHONE = 'PHONE';
const LAUNDRY = 'LAUNDRY';
const OTHER = 'OTHER';
const NO_SHOW = 'NO_SHOW';
}
13 changes: 13 additions & 0 deletions src/Entities/Enums/PaymentMethodProgram.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace GlobalPayments\Api\Entities\Enums;

use GlobalPayments\Api\Entities\Enum;

class PaymentMethodProgram extends Enum
{
const ASSURED_RESERVATION = 'ASSURED_RESERVATION';
const CARD_DEPOSIT = 'CARD_DEPOSIT';
const PURCHASE = 'PURCHASE';
const OTHER = 'OTHER';
}
35 changes: 35 additions & 0 deletions src/Entities/GpApi/GpApiManagementRequestBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
use GlobalPayments\Api\Entities\Enums\TransactionType;
use GlobalPayments\Api\Entities\GpApi\DTO\Card;
use GlobalPayments\Api\Entities\IRequestBuilder;
use GlobalPayments\Api\Entities\Lodging;
use GlobalPayments\Api\Entities\LodgingItems;
use GlobalPayments\Api\Mapping\EnumMapping;
use GlobalPayments\Api\PaymentMethods\TransactionReference;
use GlobalPayments\Api\ServiceConfigs\Gateways\GpApiConfig;
Expand Down Expand Up @@ -129,6 +131,39 @@ public function buildRequest(BaseBuilder $builder, $config)
];
}
break;
case TransactionType::AUTH:
$endpoint = GpApiRequest::TRANSACTION_ENDPOINT . '/' . $builder->paymentMethod->transactionId . '/incremental';
$verb = 'POST';
$payload['amount'] = StringUtils::toNumeric($builder->amount);
if (!empty($builder->lodging)) {
/** @var Lodging $lodging */
$lodging = $builder->lodging;
if (!empty($lodging->items)) {
$lodgingItems = [];
/** @var LodgingItems $item */
foreach ($lodging->items as $item) {
$lodgingItems[] = [
'types' => $item->types,
'reference' => $item->reference,
'total_amount' => !empty($item->totalAmount) ? StringUtils::toNumeric($item->totalAmount) : null,
'payment_method_program_codes' => $item->paymentMethodProgramCodes
];
}
}

$payload['lodging'] = [
'booking_reference' => $lodging->bookingReference,
'duration_days' => $lodging->durationDays,
'date_checked_in' => !empty($lodging->dateCheckedIn) ?
(new \DateTime($lodging->dateCheckedIn))->format('Y-m-d') : null,
'date_checked_out' => !empty($lodging->dateCheckedOut) ?
(new \DateTime($lodging->dateCheckedOut))->format('Y-m-d') : null,
'daily_rate_amount' => !empty($lodging->dailyRateAmount) ?
StringUtils::toNumeric($lodging->dailyRateAmount) : null,
'lodging.charge_items' => !empty($lodgingItems) ? $lodgingItems : null
];
}
break;
case TransactionType::EDIT:
$endpoint = GpApiRequest::TRANSACTION_ENDPOINT . '/' . $builder->paymentMethod->transactionId .
'/adjustment';
Expand Down
3 changes: 2 additions & 1 deletion src/Entities/GpApi/GpApiSecure3DRequestBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ private function initiateAuthenticationData(Secure3dBuilder $builder, GpApiConfi
'source' => (string) $builder->authenticationSource,
'preference' => $builder->challengeRequestIndicator,
'message_version' => $builder->threeDSecure->messageVersion,
'message_category' => EnumMapping::mapMessageCategory(GatewayProvider::GP_API, $builder->messageCategory)
];

if (!empty($builder->storedCredential)) {
Expand All @@ -120,7 +121,7 @@ private function initiateAuthenticationData(Secure3dBuilder $builder, GpApiConfi
'preorder_availability_date' => !empty($builder->preOrderAvailabilityDate) ?
(new \DateTime($builder->preOrderAvailabilityDate))->format('Y-m-d') : null,
'reorder_indicator' => (string) $builder->reorderIndicator,
'category' => $builder->orderTransactionType
'transaction_type' => $builder->orderTransactionType
];

if (!empty($builder->shippingAddress)) {
Expand Down
24 changes: 24 additions & 0 deletions src/Entities/Lodging.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

namespace GlobalPayments\Api\Entities;

class Lodging
{
/** @var string */
public $bookingReference;

/** @var integer */
public $durationDays;

/** @var string */
public $dateCheckedIn;

/** @var string */
public $dateCheckedOut;

/** @var string */
public $dailyRateAmount;

/** @var array<LodgingItems> */
public $items;
}
18 changes: 18 additions & 0 deletions src/Entities/LodgingItems.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace GlobalPayments\Api\Entities;

class LodgingItems
{
/** @var array */
public $types;

/** @var string */
public $reference;

/** @var string */
public $totalAmount;

/** @var array */
public $paymentMethodProgramCodes;
}
4 changes: 2 additions & 2 deletions src/Entities/Transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -349,11 +349,11 @@ public static function fromClientTransactionId($clientTransactionId, $orderId =
*
* @param string|float $amount The additional amount to authorize
*
* @return AuthorizationBuilder
* @return ManagementBuilder
*/
public function additionalAuth($amount = null)
{
return (new AuthorizationBuilder(TransactionType::AUTH))
return (new ManagementBuilder(TransactionType::AUTH))
->withPaymentMethod($this->transactionReference)
->withAmount($amount);
}
Expand Down
16 changes: 16 additions & 0 deletions src/Mapping/EnumMapping.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use GlobalPayments\Api\Entities\Enums\EmvLastChipRead;
use GlobalPayments\Api\Entities\Enums\EncyptedMobileType;
use GlobalPayments\Api\Entities\Enums\GatewayProvider;
use GlobalPayments\Api\Entities\Enums\MessageCategory;
use GlobalPayments\Api\Entities\Enums\SdkUiType;
use GlobalPayments\Api\Entities\Enums\StoredCredentialInitiator;

Expand Down Expand Up @@ -128,4 +129,19 @@ public static function mapSdkUiType($gateway, $value)
return null;
}
}

public static function mapMessageCategory($gateway, $value)
{
switch ($gateway) {
case GatewayProvider::GP_API:
switch ($value) {
case MessageCategory::PAYMENT_AUTHENTICATION:
return 'PAYMENT';
default:
return $value;
}
default:
return $value;
}
}
}
8 changes: 7 additions & 1 deletion src/Mapping/GpApiMapping.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
use GlobalPayments\Api\Entities\DisputeDocument;
use GlobalPayments\Api\Entities\DccRateData;
use GlobalPayments\Api\Entities\Enums\AuthenticationSource;
use GlobalPayments\Api\Entities\Enums\CaptureMode;
use GlobalPayments\Api\Entities\Enums\PaymentMethodName;
use GlobalPayments\Api\Entities\Enums\PaymentMethodType;
use GlobalPayments\Api\Entities\Enums\ReportType;
use GlobalPayments\Api\Entities\Enums\Secure3dStatus;
use GlobalPayments\Api\Entities\Enums\Secure3dVersion;
use GlobalPayments\Api\Entities\Enums\TransactionStatus;
use GlobalPayments\Api\Entities\Exceptions\ApiException;
use GlobalPayments\Api\Entities\GpApi\DTO\PaymentMethod;
use GlobalPayments\Api\Entities\GpApi\PagedResult;
Expand Down Expand Up @@ -43,9 +45,12 @@ public static function mapResponse($response)
return $transaction;
}
$transaction->transactionId = $response->id;
$transaction->responseMessage = $response->status;
$transaction->balanceAmount = !empty($response->amount) ? StringUtils::toAmount($response->amount) : null;
$transaction->authorizedAmount = ($response->status == TransactionStatus::PREAUTHORIZED && !empty($response->amount)) ?
StringUtils::toAmount($response->amount) : null;
$transaction->timestamp = !empty($response->time_created) ? $response->time_created : '';
$transaction->responseMessage = $response->status;

$transaction->referenceNumber = !empty($response->reference) ? $response->reference : null;
$batchSummary = new BatchSummary();
$batchSummary->batchReference = !empty($response->batch_id) ? $response->batch_id : null;
Expand Down Expand Up @@ -105,6 +110,7 @@ public static function mapResponse($response)
}

$transaction->dccRateData = self::mapDccInfo($response);
$transaction->multiCapture = (!empty($response->capture_mode) && $response->capture_mode == CaptureMode::MULTIPLE);

return $transaction;
}
Expand Down
2 changes: 2 additions & 0 deletions src/PaymentMethods/CreditCardData.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ public function hasInAppPaymentData()
* Verify whether the cardholder is enrolled in 3DS
*
* @return bool
* @deprecated verifyEnrolled is deprecated. Please use Secure3dService::checkEnrollment
*/
public function verifyEnrolled($amount, $currency, $orderId = null)
{
Expand Down Expand Up @@ -156,6 +157,7 @@ public function verifyEnrolled($amount, $currency, $orderId = null)

/**
* @return bool
* @deprecated verifySignature is deprecated. Please use Secure3dService::getAuthenticationData
*/
public function verifySignature($authorizationResponse, $merchantData = null, $amount = null, $currency = null, $orderId = null)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<?php


namespace Gateways\GpApiConnector;

use GlobalPayments\Api\Builders\ManagementBuilder;
use GlobalPayments\Api\Entities\Address;
use GlobalPayments\Api\Entities\Customer;
use GlobalPayments\Api\Entities\Enums\Environment;
use GlobalPayments\Api\Entities\Enums\LodgingItemType;
use GlobalPayments\Api\Entities\Enums\ManualEntryMethod;
use GlobalPayments\Api\Entities\Enums\Channel;
use GlobalPayments\Api\Entities\Enums\PaymentMethodProgram;
use GlobalPayments\Api\Entities\Enums\PaymentMethodUsageMode;
use GlobalPayments\Api\Entities\Enums\StoredCredentialInitiator;
use GlobalPayments\Api\Entities\Enums\StoredCredentialReason;
Expand All @@ -18,6 +19,8 @@
use GlobalPayments\Api\Entities\Enums\TransactionType;
use GlobalPayments\Api\Entities\Exceptions\ApiException;
use GlobalPayments\Api\Entities\Exceptions\GatewayException;
use GlobalPayments\Api\Entities\Lodging;
use GlobalPayments\Api\Entities\LodgingItems;
use GlobalPayments\Api\Entities\StoredCredential;
use GlobalPayments\Api\Entities\Transaction;
use GlobalPayments\Api\PaymentMethods\CreditCardData;
Expand Down Expand Up @@ -1260,13 +1263,12 @@ public function testCreditAuthorizationWithPaymentLinkId()
$this->assertNotNull($transaction);
$this->assertEquals('SUCCESS', $transaction->responseCode);
$this->assertEquals(TransactionStatus::PREAUTHORIZED, $transaction->responseMessage);
}
}

public function testVerifyTokenizedPaymentMethodWithFingerprint()
{
$customer = new Customer();
$customer->deviceFingerPrint = "ALWAYS";
// process an auto-capture authorization
$response = $this->card->tokenize()
->withCustomerData($customer)
->execute();
Expand Down
Loading

0 comments on commit d7e63ea

Please sign in to comment.