Skip to content

Commit

Permalink
OctopusDeploy release: 10.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
securesubmit-buildmaster committed Oct 10, 2023
1 parent 6fd8c15 commit 2999d31
Show file tree
Hide file tree
Showing 17 changed files with 467 additions and 101 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@

# Changelog

## Latest Version
## Latest Version - v10.1.1 (10/10/2023)
#### Enhancements:
- [GP-API] Add a new alternative payment method, ALIPAY
- [GP-ECOM] Limit what card types to accept for payment or storage (HPP & API)
* https://developer.globalpay.com/hpp/card-blocking
* https://developer.globalpay.com/api/card-blocking

## v10.1.0 (09/21/2023)
#### Enhancements:
- [Verifone] P400: added initial Meet-In-The-Cloud connectivity support for this device
- [GP-API]: Upload Merchant Documentation - https://developer.globalpay.com/api/merchants
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>10.1.0</releaseNumber>
<releaseNumber>10.1.1</releaseNumber>
</xml>
39 changes: 32 additions & 7 deletions src/Builders/AuthorizationBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
namespace GlobalPayments\Api\Builders;

use GlobalPayments\Api\ServicesContainer;
use GlobalPayments\Api\Entities\{
Address,
use GlobalPayments\Api\Entities\{Address,
BlockedCardType,
Customer,
AutoSubstantiation,
EcommerceInfo,
Expand All @@ -16,25 +16,24 @@
DccRateData,
DecisionManager,
Transaction};
use GlobalPayments\Api\Entities\Enums\{
AddressType,
use GlobalPayments\Api\Entities\Enums\{AddressType,
AliasAction,
BNPLShippingMethod,
EmvFallbackCondition,
EmvLastChipRead,
InquiryType,
FraudFilterMode,
MerchantCategory,
PaymentMethodUsageMode,
PhoneNumberType,
RemittanceReferenceType,
RecurringSequence,
RecurringType,
TransactionModifier,
TransactionType
};
TransactionType};
use GlobalPayments\Api\PaymentMethods\{BankPayment, BNPL, EBTCardData, GiftCard, TransactionReference};
use GlobalPayments\Api\PaymentMethods\Interfaces\IPaymentMethod;
use GlobalPayments\Api\Entities\Exceptions\ArgumentException;
use GlobalPayments\Api\Entities\Exceptions\{ArgumentException,BuilderException};

class AuthorizationBuilder extends TransactionBuilder
{
Expand Down Expand Up @@ -506,6 +505,11 @@ class AuthorizationBuilder extends TransactionBuilder
/** @var boolean */
public $maskedDataResponse;

public BlockedCardType $cardTypesBlocking;

/** @var MerchantCategory */
public string $merchantCategory;

/**
* {@inheritdoc}
*
Expand Down Expand Up @@ -1512,4 +1516,25 @@ public function withMaskedDataResponse($value)

return $this;
}

public function withBlockedCardType(BlockedCardType $cardTypesBlocking) : AuthorizationBuilder
{
$vars = get_object_vars($cardTypesBlocking);
if (empty(array_filter($vars))) {
$array = explode('\\', get_class($cardTypesBlocking));
throw new BuilderException(sprintf('No properties set on the %s object', end($array)));
}
$this->cardTypesBlocking = $cardTypesBlocking;

return $this;
}

/**
* @param MerchantCategory $merchantCategory
*/
public function withMerchantCategory($merchantCategory) : AuthorizationBuilder
{
$this->merchantCategory = $merchantCategory;
return $this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ private function createFromAuthorizationBuilder($builder, GpApiConfig $config)
$requestBody['convenience_amount'] = StringUtils::toNumeric($builder->convenienceAmount);
$requestBody['cashback_amount'] = StringUtils::toNumeric($builder->cashBackAmount);
$requestBody['ip_address'] = $builder->customerIpAddress;
$requestBody['merchant_category'] = $builder->merchantCategory ?? null;
$requestBody['payment_method'] = $this->createPaymentMethodParam($builder, $config);
$requestBody['risk_assessment'] = !empty($builder->fraudFilter) ? [$this->mapFraudManagement()] : null;
if (!empty($builder->paymentLinkId)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use DOMDocument;
use GlobalPayments\Api\Builders\AuthorizationBuilder;
use GlobalPayments\Api\Builders\BaseBuilder;
use GlobalPayments\Api\Entities\BlockedCardType;
use GlobalPayments\Api\Entities\Enums\AlternativePaymentType;
use GlobalPayments\Api\Entities\Enums\CvnPresenceIndicator;
use GlobalPayments\Api\Entities\Enums\DccProcessor;
Expand Down Expand Up @@ -247,6 +248,23 @@ public function buildRequest(BaseBuilder $builder, $config)
$this->maskedValues = ProtectSensitiveData::hideValue('card.cvn.number', $card->cvn ?? '');
}
$request->appendChild($cardElement);
if (!empty($builder->cardTypesBlocking)) {
$cardTypes = $builder->cardTypesBlocking;
$cardTypeBlock = $xml->createElement("blockcard");
if (isset($cardTypes->commercialcredit)) {
$cardTypeBlock->appendChild($xml->createElement("commercialcredit", $cardTypes->commercialcredit));
}
if (isset($cardTypes->commercialdebit)) {
$cardTypeBlock->appendChild($xml->createElement("commercialdebit", $cardTypes->commercialdebit));
}
if (isset($cardTypes->consumercredit)) {
$cardTypeBlock->appendChild($xml->createElement("consumercredit", $cardTypes->consumercredit));
}
if (isset($cardTypes->consumerdebit)) {
$cardTypeBlock->appendChild($xml->createElement("consumerdebit", $cardTypes->consumerdebit));
}
$request->appendChild($cardTypeBlock);
}
}
// issueno
$hash = '';
Expand Down
11 changes: 11 additions & 0 deletions src/Entities/BlockedCardType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace GlobalPayments\Api\Entities;

class BlockedCardType
{
public bool $consumerdebit;
public bool $consumercredit;
public bool $commercialcredit;
public bool $commercialdebit;
}
1 change: 1 addition & 0 deletions src/Entities/Enums/AlternativePaymentType.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,5 @@ class AlternativePaymentType extends Enum
const TEST_PAY = 'testpay';
const PAYPAL = 'paypal';
const PAYBYBANKAPP = 'paybybankapp';
const ALIPAY = 'alipay';
}
13 changes: 13 additions & 0 deletions src/Entities/Enums/BlockCardType.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 BlockCardType extends Enum
{
const CONSUMER_CREDIT = 'consumercredit';
const CONSUMER_DEBIT = 'consumerdebit';
const COMMERCIAL_DEBIT = 'commercialdebit';
const COMMERCIAL_CREDIT = 'commercialcredit';
}
16 changes: 16 additions & 0 deletions src/Entities/Enums/MerchantCategory.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 MerchantCategory extends Enum
{
const HOTEL = 'HOTEL';
const AIRLINE = 'AIRLINE';
const RETAIL = 'RETAIL';
const TOP_UP = 'TOP_UP';
const PLAYER = 'PLAYER';
const CD_KEY = 'CD_KEY';
const OTHER = 'OTHER';
}
5 changes: 5 additions & 0 deletions src/Entities/HostedPaymentData.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace GlobalPayments\Api\Entities;

use GlobalPayments\Api\Entities\Enums\AlternativePaymentType;
use GlobalPayments\Api\Entities\Enums\BlockCardType;
use GlobalPayments\Api\PaymentMethods\BankPayment;

/**
Expand Down Expand Up @@ -128,6 +129,9 @@ class HostedPaymentData
/** @var boolean */
public $enableExemptionOptimization;

/** @var array<BlockCardType> */
public array $blockCardTypes;

/**
* Instantiates a new `HostedPaymentData` object.
*
Expand All @@ -136,5 +140,6 @@ class HostedPaymentData
public function __construct()
{
$this->supplementaryData = [];
$this->blockCardTypes = [];
}
}
6 changes: 5 additions & 1 deletion src/Gateways/GpEcomConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ public function serializeRequest(AuthorizationBuilder $builder)
if ($builder->amount !== null) {
$this->setSerializeData('AMOUNT', $amount);
}

$this->setSerializeData('CURRENCY', $builder->currency);
$this->setSerializeData('TIMESTAMP', $timestamp);

Expand Down Expand Up @@ -301,9 +302,12 @@ public function serializeRequest(AuthorizationBuilder $builder)
$this->setSerializeData('HPP_TX_STATUS_URL', $hostedPaymentData->transactionStatusUrl);
}
if (!empty($hostedPaymentData->presetPaymentMethods)) {
$this->setSerializeData('PM_METHODS', implode( '|', $hostedPaymentData->presetPaymentMethods));
$this->setSerializeData('PM_METHODS', implode('|', $hostedPaymentData->presetPaymentMethods));
}
// end APMs Fields
if (!empty($hostedPaymentData->blockCardTypes)) {
$this->setSerializeData('BLOCK_CARD_TYPE', implode('|', $hostedPaymentData->blockCardTypes));
}
} elseif (isset($builder->customerId)) {
$this->setSerializeData('CUST_NUM', $builder->customerId);
}
Expand Down
9 changes: 8 additions & 1 deletion src/Mapping/GpApiMapping.php
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,14 @@ public static function mapResponseAPM($response)
$paymentMethodApm = $response->payment_method->apm;
$apm->redirectUrl = !empty($response->payment_method->redirect_url) ?
$response->payment_method->redirect_url : ($paymentMethodApm->redirect_url ?? null);
$apm->providerName = $paymentMethodApm->provider;
if (is_string($paymentMethodApm->provider)) {
$apm->providerName = $paymentMethodApm->provider;
} elseif (is_object($paymentMethodApm->provider)) {
$apm->providerName = strtolower($paymentMethodApm->provider->name) ?? null;
$apm->providerReference = $paymentMethodApm->provider->merchant_identifier ?? null;
$apm->timeCreatedReference = $paymentMethodApm->provider->time_created_reference ?? null;
}

$apm->accountHolderName = $paymentMethodApm->provider_payer_name ?? null;
$apm->ack = $paymentMethodApm->ack ?? null;
$apm->sessionToken = !empty($paymentMethodApm->session_token) ? $paymentMethodApm->session_token : null;
Expand Down
Loading

0 comments on commit 2999d31

Please sign in to comment.