Skip to content

Commit

Permalink
OctopusDeploy release: 3.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
securesubmit-buildmaster committed Mar 22, 2022
1 parent 11ee864 commit 8e4567b
Show file tree
Hide file tree
Showing 29 changed files with 795 additions and 73 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,22 @@


## Latest version
#### Enhancements:
- add "MOBILE_SDK" source in the 3DS2 flow initiate step (GP-API)
- Adjust a CP Sale (GP-API)
- Search [POST] for a Payment Method (GP-API)
- Stored Payment Methods - POST Search (GP-API)
- Get a Document associated with a Dispute (GP-API)


## v3.0.2 (02/17/2022)
#### Enhancements:

- use "IN_APP" entry_mode when creating a transaction with digital wallets (GP-API)
- add new unit tests for dcc and others

## v3.0.1 (01/27/2022)

#### Enhancements:
- Add fingerprint feature (GP-API)
- Add Payment Link Id in the request for authorize (GP-API)
- Add new unit tests on DCC CNP (GP-API)
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.2</releaseNumber>
<releaseNumber>3.0.3</releaseNumber>
</xml>
10 changes: 9 additions & 1 deletion src/Builders/ManagementBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ class ManagementBuilder extends TransactionBuilder
/** @var DccRateData */
public $dccRateData;

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

/**
* {@inheritdoc}
*
Expand Down Expand Up @@ -566,10 +569,15 @@ public function withDynamicDescriptor($dynamicDescriptor)
public function withBankTransferData($eCheck)
{
$this->bankTransferDetails = $eCheck;

return $this;
}

public function withTagData($value)
{
$this->tagData = $value;
return $this;
}

/**
* Set the request dccRateData
*
Expand Down
11 changes: 11 additions & 0 deletions src/Builders/Secure3dBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use GlobalPayments\Api\Entities\Enums\DecoupledFlowRequest;
use GlobalPayments\Api\Entities\Enums\StoredCredentialInitiator;
use GlobalPayments\Api\Entities\Enums\WhiteListStatus;
use GlobalPayments\Api\Entities\MobileData;
use GlobalPayments\Api\Entities\StoredCredential;
use GlobalPayments\Api\Gateways\GpApiConnector;
use GlobalPayments\Api\ServicesContainer;
Expand Down Expand Up @@ -194,6 +195,9 @@ class Secure3dBuilder extends BaseBuilder
*/
public $enableExemptionOptimization;

/** @var MobileData */
public $mobileData;

/**
* @var StoredCredential
*/
Expand Down Expand Up @@ -1333,6 +1337,13 @@ public function withEnableExemptionOptimization($value)
return $this;
}

/** @return Secure3dBuilder */
public function withMobileData($value)
{
$this->mobileData = $value;
return $this;
}

/**
* @throws ApiException
* @return ThreeDSecure */
Expand Down
11 changes: 5 additions & 6 deletions src/Entities/DisputeDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@

class DisputeDocument
{
/**
* @var string
*/
/** @var string */
public $id;

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

/**
* @var string;
*/
/** @var string */
public $b64_content;
}
8 changes: 8 additions & 0 deletions src/Entities/Enums/StoredCredentialType.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,12 @@ class StoredCredentialType extends Enum
const SUBSCRIPTION = 'SUBSCRIPTION';
const MAINTAIN_PAYMENT_METHOD = 'MAINTAIN_PAYMENT_METHOD';
const MAINTAIN_PAYMENT_VERIFICATION = 'MAINTAIN_PAYMENT_VERIFICATION';
const ADD_PAYMENT_METHOD = 'ADD_PAYMENT_METHOD';
const SPLIT_OR_DELAYED_SHIPMENT = 'SPLIT_OR_DELAYED_SHIPMENT';
const TOP_UP = 'TOP_UP';
const MAIL_ORDER = 'MAIL_ORDER';
const TELEPHONE_ORDER = 'TELEPHONE_ORDER';
const WHITELIST_STATUS_CHECK = 'WHITELIST_STATUS_CHECK';
const OTHER_PAYMENT = 'OTHER_PAYMENT';
const BILLING_AGREEMENT = 'BILLING_AGREEMENT';
}
1 change: 0 additions & 1 deletion src/Entities/Enums/TransactionType.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ class TransactionType extends Enum
const VERIFY_ENROLLED = 16777216; //1 << 24
const VERIFY_SIGNATURE = 33554432; // 1 << 25
const TOKEN_DELETE = 67108864; // 1 << 26
const VERIFY_AUTHENTICATION = 134217728; // 1 << 27
const INITIATE_AUTHENTICATION = 268435456; // 1 << 28
const DATA_COLLECT = 536870912; // 1 << 29
const PRE_AUTH_COMPLETION = 1073741824; // 1 << 30
Expand Down
12 changes: 12 additions & 0 deletions src/Entities/GpApi/GpApiManagementRequestBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,18 @@ public function buildRequest(BaseBuilder $builder, $config)
];
}
break;
case TransactionType::EDIT:
$endpoint = GpApiRequest::TRANSACTION_ENDPOINT . '/' . $builder->paymentMethod->transactionId .
'/adjustment';
$verb = 'POST';
$payload = [
'amount' => StringUtils::toNumeric($builder->amount),
'gratuity_amount' => StringUtils::toNumeric($builder->gratuity),
'payment_method' => [
'card' => ['tag' => $builder->tagData]
]
];
break;
default:
return null;
}
Expand Down
24 changes: 22 additions & 2 deletions src/Entities/GpApi/GpApiReportRequestBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use GlobalPayments\Api\Builders\TransactionReportBuilder;
use GlobalPayments\Api\Entities\Enums\ReportType;
use GlobalPayments\Api\Entities\IRequestBuilder;
use GlobalPayments\Api\PaymentMethods\CreditCardData;
use GlobalPayments\Api\ServiceConfigs\Gateways\GpApiConfig;
use GlobalPayments\Api\Utils\StringUtils;

Expand All @@ -28,7 +29,7 @@ public static function canProcess($builder)
*/
public function buildRequest(BaseBuilder $builder, $config)
{
$queryParams = [];
$queryParams = $payload = null;
/**
* @var TransactionReportBuilder $builder
*/
Expand Down Expand Up @@ -102,6 +103,9 @@ public function buildRequest(BaseBuilder $builder, $config)
case ReportType::DISPUTE_DETAIL:
$endpoint = GpApiRequest::DISPUTES_ENDPOINT . '/' . $builder->searchBuilder->disputeId;
$verb = 'GET';
if ($builder->searchBuilder->disputeDocumentId) {
$endpoint .= '/documents/' . $builder->searchBuilder->disputeDocumentId;
}
break;
case ReportType::FIND_DISPUTES_PAGED:
$endpoint = GpApiRequest::DISPUTES_ENDPOINT;
Expand All @@ -121,6 +125,22 @@ public function buildRequest(BaseBuilder $builder, $config)
$queryParams = array_merge($queryParams, $this->getDisputesParams($builder));
break;
case ReportType::FIND_STORED_PAYMENT_METHODS_PAGED:
if ($builder->searchBuilder->paymentMethod instanceof CreditCardData) {
$endpoint = GpApiRequest::PAYMENT_METHODS_ENDPOINT . '/search';
$verb = 'POST';
$paymentMethod = $builder->searchBuilder->paymentMethod;
$card = [
'number' => $paymentMethod->number,
'expiry_month' => str_pad($paymentMethod->expMonth, 2, '0', STR_PAD_LEFT),
'expiry_year' => substr(str_pad($paymentMethod->expYear, 4, '0', STR_PAD_LEFT), 2, 2)
];
$payload = [
'account_name' => $config->accessTokenInfo->tokenizationAccountName,
'reference' => $builder->searchBuilder->referenceNumber,
'card' => !empty($card) ? $card : null
];
break;
}
$endpoint = GpApiRequest::PAYMENT_METHODS_ENDPOINT;
$verb = 'GET';
$this->addBasicParams($queryParams, $builder);
Expand Down Expand Up @@ -178,7 +198,7 @@ public function buildRequest(BaseBuilder $builder, $config)
return null;
}

return new GpApiRequest($endpoint, $verb, null, $queryParams);
return new GpApiRequest($endpoint, $verb, $payload, $queryParams);
}

public function addBasicParams(&$data, $builder)
Expand Down
51 changes: 40 additions & 11 deletions src/Entities/GpApi/GpApiSecure3DRequestBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@

use GlobalPayments\Api\Builders\BaseBuilder;
use GlobalPayments\Api\Builders\Secure3dBuilder;
use GlobalPayments\Api\Entities\Enums\AuthenticationSource;
use GlobalPayments\Api\Entities\Enums\GatewayProvider;
use GlobalPayments\Api\Entities\Enums\TransactionType;
use GlobalPayments\Api\Entities\GpApi\DTO\PaymentMethod;
use GlobalPayments\Api\Entities\IRequestBuilder;
use GlobalPayments\Api\Entities\StoredCredential;
use GlobalPayments\Api\Mapping\EnumMapping;
use GlobalPayments\Api\PaymentMethods\Interfaces\ICardData;
use GlobalPayments\Api\PaymentMethods\Interfaces\ITokenizable;
Expand Down Expand Up @@ -79,15 +81,8 @@ private function verifyEnrolled(Secure3dBuilder $builder, GpApiConfig $config)
'three_ds_method_return_url' => $config->methodNotificationUrl

];

if (!empty($builder->storedCredential)) {
$initiator = EnumMapping::mapStoredCredentialInitiator(GatewayProvider::GP_API, $builder->storedCredential->initiator);
$threeDS['initiator'] = !empty($initiator) ? $initiator : null;
$threeDS['stored_credential'] = [
'model' => strtoupper($builder->storedCredential->type),
'reason' => strtoupper($builder->storedCredential->reason),
'sequence' => strtoupper($builder->storedCredential->sequence)
];
$this->setStoreCredentialParam($builder->storedCredential, $threeDS);
}

return $threeDS;
Expand All @@ -99,8 +94,12 @@ private function initiateAuthenticationData(Secure3dBuilder $builder, GpApiConfi
$threeDS['three_ds'] = [
'source' => (string) $builder->authenticationSource,
'preference' => $builder->challengeRequestIndicator,
'message_version' => $builder->messageVersion
'message_version' => $builder->threeDSecure->messageVersion,
];

if (!empty($builder->storedCredential)) {
$this->setStoreCredentialParam($builder->storedCredential, $threeDS);
}
$threeDS['method_url_completion_status'] = (string) $builder->methodUrlCompletion;
$threeDS['merchant_contact_url'] = $config->merchantContactUrl;
$order = [
Expand All @@ -121,7 +120,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,
'transaction_type' => $builder->orderTransactionType
'category' => $builder->orderTransactionType
];

if (!empty($builder->shippingAddress)) {
Expand Down Expand Up @@ -190,7 +189,7 @@ private function initiateAuthenticationData(Secure3dBuilder $builder, GpApiConfi
'authentication_type' => (string) $builder->customerAuthenticationMethod
];

if (!empty($builder->browserData)) {
if (!empty($builder->browserData) && $builder->authenticationSource != AuthenticationSource::MOBILE_SDK) {
$threeDS['browser_data'] = [
'accept_header' => $builder->browserData->acceptHeader,
'color_depth' => (string) $builder->browserData->colorDepth,
Expand All @@ -205,6 +204,18 @@ private function initiateAuthenticationData(Secure3dBuilder $builder, GpApiConfi
'user_agent' => $builder->browserData->userAgent
];
}
if (!empty($builder->mobileData) && $builder->authenticationSource == AuthenticationSource::MOBILE_SDK) {
$threeDS['mobile_data'] = [
'encoded_data' => $builder->mobileData->encodedData,
'application_reference' => $builder->mobileData->applicationReference,
'sdk_interface' => $builder->mobileData->sdkInterface,
'sdk_ui_type' => EnumMapping::mapSdkUiType(GatewayProvider::GP_API, $builder->mobileData->sdkUiTypes),
'ephemeral_public_key' => json_decode($builder->mobileData->ephemeralPublicKey),
'maximum_timeout' => $builder->mobileData->maximumTimeout,
'reference_number' => $builder->mobileData->referenceNumber,
'sdk_trans_reference' => $builder->mobileData->sdkTransReference
];
}

return $threeDS;
}
Expand All @@ -228,4 +239,22 @@ private function setPaymentMethodParam($cardData)

return $paymentMethod;
}


/**
* Set the stored credential details in the request
*
* @param StoredCredential $storedCredential
* @param array $threeDS
*/
private function setStoreCredentialParam($storedCredential, &$threeDS)
{
$initiator = EnumMapping::mapStoredCredentialInitiator(GatewayProvider::GP_API, $storedCredential->initiator);
$threeDS['initiator'] = !empty($initiator) ? $initiator : null;
$threeDS['stored_credential'] = [
'model' => strtoupper($storedCredential->type),
'reason' => strtoupper($storedCredential->reason),
'sequence' => strtoupper($storedCredential->sequence)
];
}
}
32 changes: 32 additions & 0 deletions src/Entities/MobileData.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

namespace GlobalPayments\Api\Entities;

use GlobalPayments\Api\Entities\Enums\SdkInterface;
use GlobalPayments\Api\Entities\Enums\SdkUiType;

class MobileData
{
/** @var string */
public $encodedData;

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

/** @var SdkInterface */
public $sdkInterface;

/** @var array<SdkUiType> */
public $sdkUiTypes;

public $ephemeralPublicKey;

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

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

/** @var string */
public $sdkTransReference;
}
4 changes: 4 additions & 0 deletions src/Entities/Reporting/DisputeSummary.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@


use GlobalPayments\Api\Builders\ManagementBuilder;
use GlobalPayments\Api\Entities\DisputeDocument;
use GlobalPayments\Api\Entities\Enums\TransactionType;

class DisputeSummary
Expand Down Expand Up @@ -194,6 +195,9 @@ class DisputeSummary
*/
public $lastAdjustmentFunding;

/** @var array<DisputeDocument> */
public $documents;

/**
* @return ManagementBuilder
*/
Expand Down
1 change: 1 addition & 0 deletions src/Entities/Reporting/SearchCriteria.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class SearchCriteria extends Enum
const TRANSACTION_STATUS = 'transactionStatus';
const DISPUTE_STAGE = 'disputeStage';
const DISPUTE_STATUS = 'disputeStatus';
const DISPUTE_DOCUMENT_ID = 'disputeDocumentId';
const UNIQUE_DEVICE_ID = 'uniqueDeviceId';
const USER_NAME = 'username';
const CARDHOLDER_NAME = 'name';
Expand Down
3 changes: 3 additions & 0 deletions src/Entities/Reporting/SearchCriteriaBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,9 @@ class SearchCriteriaBuilder
*/
public $disputeStatus;

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

/**
* @var \DateTime
*/
Expand Down
Loading

0 comments on commit 8e4567b

Please sign in to comment.