Skip to content

Commit

Permalink
OctopusDeploy release: 6.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
securesubmit-buildmaster committed Feb 16, 2023
1 parent 676658c commit 7c8b781
Show file tree
Hide file tree
Showing 35 changed files with 478 additions and 324 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@

## Latest Version
#### Enhancements:
- GP-API: Create open banking transactions
- GPI Transactions: Reporting tests refacto

## v6.1.2 (02/13/2023)
#### Enhancements:
- GP-API: BNPL unit tests update

## v6.1.1 (02/09/2023)
Expand All @@ -16,6 +21,7 @@
#### Enhancements:
- GP-API: add risk assessment feature
- Refacto the Secure3DBuilder
- GP-API: update CTP transaction request

## v6.0.6 (01/26/2023)
#### Enhancements:
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.2</releaseNumber>
<releaseNumber>6.1.3</releaseNumber>
</xml>
23 changes: 12 additions & 11 deletions src/Builders/AuthorizationBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,18 @@
HostedPaymentData,
PhoneNumber,
StoredCredential,
Transaction
};
OrderDetails,
DccRateData,
DecisionManager,
Transaction};
use GlobalPayments\Api\Entities\Enums\{
AddressType,
AliasAction,
BNPLShippingMethod,
DccRateData,
DecisionManager,
EmvFallbackCondition,
EmvLastChipRead,
InquiryType,
FraudFilterMode,
OrderDetails,
PaymentMethodUsageMode,
PhoneNumberType,
RemittanceReferenceType,
Expand All @@ -33,12 +32,7 @@
TransactionModifier,
TransactionType
};
use GlobalPayments\Api\PaymentMethods\{
BNPL,
EBTCardData,
GiftCard,
TransactionReference
};
use GlobalPayments\Api\PaymentMethods\{BankPayment, BNPL, EBTCardData, GiftCard, TransactionReference};
use GlobalPayments\Api\PaymentMethods\Interfaces\IPaymentMethod;
use GlobalPayments\Api\Entities\Exceptions\ArgumentException;

Expand Down Expand Up @@ -545,6 +539,13 @@ public function execute($configName = 'default')
parent::execute($configName);

$client = ServicesContainer::instance()->getClient($configName);
if ($client->supportsOpenBanking() && $this->paymentMethod instanceof BankPayment) {
$obClient = ServicesContainer::instance()->getOpenBanking($configName);
if (get_class($obClient) != get_class($client)) {
return $obClient->processOpenBanking($this);
}
}

return $client->processAuthorization($this);
}

Expand Down
136 changes: 0 additions & 136 deletions src/Builders/BankPaymentBuilder.php

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use GlobalPayments\Api\Builders\BaseBuilder;
use GlobalPayments\Api\Entities\CustomerDocument;
use GlobalPayments\Api\Entities\EncryptionData;
use GlobalPayments\Api\Entities\Enums\BankPaymentType;
use GlobalPayments\Api\Entities\Enums\CardType;
use GlobalPayments\Api\Entities\Enums\Channel;
use GlobalPayments\Api\Entities\Enums\DigitalWalletTokenFormat;
Expand All @@ -16,6 +17,7 @@
use GlobalPayments\Api\Entities\Enums\CaptureMode;
use GlobalPayments\Api\Entities\Enums\PayLinkStatus;
use GlobalPayments\Api\Entities\Enums\PaymentEntryMode;
use GlobalPayments\Api\Entities\Enums\PaymentProvider;
use GlobalPayments\Api\Entities\Enums\PaymentType;
use GlobalPayments\Api\Entities\Enums\PhoneNumberType;
use GlobalPayments\Api\Entities\Enums\TransactionModifier;
Expand All @@ -28,7 +30,9 @@
use GlobalPayments\Api\Entities\PayLinkData;
use GlobalPayments\Api\Entities\PhoneNumber;
use GlobalPayments\Api\Entities\Product;
use GlobalPayments\Api\Gateways\OpenBankingProvider;
use GlobalPayments\Api\Mapping\EnumMapping;
use GlobalPayments\Api\PaymentMethods\BankPayment;
use GlobalPayments\Api\PaymentMethods\BNPL;
use GlobalPayments\Api\PaymentMethods\Credit;
use GlobalPayments\Api\PaymentMethods\CreditCardData;
Expand Down Expand Up @@ -223,12 +227,12 @@ private function createFromAuthorizationBuilder($builder, GpApiConfig $config)
}
if ($builder->paymentMethod instanceof AlternativePaymentMethod || $builder->paymentMethod instanceof BNPL) {
$this->setOrderInformation($builder, $requestBody);

$requestBody['notifications'] = [
'return_url' => $builder->paymentMethod->returnUrl,
'status_url' => $builder->paymentMethod->statusUpdateUrl,
'cancel_url' => $builder->paymentMethod->cancelUrl
];
}
if ($builder->paymentMethod instanceof AlternativePaymentMethod ||
$builder->paymentMethod instanceof BNPL ||
$builder->paymentMethod instanceof BankPayment
) {
$this->setNotificationUrls($requestBody);
}
if (!empty($builder->storedCredential)) {
$initiator = EnumMapping::mapStoredCredentialInitiator(GatewayProvider::GP_API, $builder->storedCredential->initiator);
Expand Down Expand Up @@ -373,7 +377,7 @@ private function getPhoneNumber($builder, $type)
*/
private function createPaymentMethodParam($builder, $config)
{
/** @var CreditCardData|CreditTrackData|DebitTrackData|ECheck|AlternativePaymentMethod|BNPL $paymentMethodContainer */
/** @var CreditCardData|CreditTrackData|DebitTrackData|ECheck|AlternativePaymentMethod|BNPL|BankPayment $paymentMethodContainer */
$paymentMethodContainer = $builder->paymentMethod;
$paymentMethod = new PaymentMethod();
$paymentMethod->entry_mode = $this->getEntryMode($builder, $config->channel);
Expand Down Expand Up @@ -452,7 +456,27 @@ private function createPaymentMethodParam($builder, $config)
'address_override_mode' => !empty($paymentMethodContainer->addressOverrideMode) ?
$paymentMethodContainer->addressOverrideMode : null
];

return $paymentMethod;
case BankPayment::class:
$paymentMethod->apm = [
'provider' => PaymentProvider::OPEN_BANKING,
'countries' => $paymentMethodContainer->countries ?? [],
];
$bankPaymentType = !empty($paymentMethodContainer->bankPaymentType) ?
$paymentMethodContainer->bankPaymentType : OpenBankingProvider::getBankPaymentType($builder->currency);
$paymentMethod->bank_transfer = [
'account_number' => $bankPaymentType == BankPaymentType::FASTERPAYMENTS ?
$paymentMethodContainer->accountNumber : '',
'iban' => $bankPaymentType == BankPaymentType::SEPA ? $paymentMethodContainer->iban : '',
'bank' => [
'code' => $paymentMethodContainer->sortCode,
'name' => $paymentMethodContainer->accountName
],
'remittance_reference' => [
'type' => $builder->remittanceReferenceType,
'value' => $builder->remittanceReferenceValue
]
];
return $paymentMethod;
case BNPL::class:
if (!empty($builder->customerData->firstName) && !empty($builder->customerData->lastName)) {
Expand Down Expand Up @@ -628,6 +652,15 @@ private function getCaptureMode(AuthorizationBuilder $builder)
return CaptureMode::AUTO;
}

private function setNotificationUrls(&$requestBody)
{
$requestBody['notifications'] = [
'return_url' => $this->builder->paymentMethod->returnUrl ?? null,
'status_url' => $this->builder->paymentMethod->statusUpdateUrl ?? null,
'cancel_url' => $this->builder->paymentMethod->cancelUrl ?? null
];
}

private function setOrderInformation($builder, &$requestBody)
{
$order['description'] = !empty($builder->orderDetails) ?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
use GlobalPayments\Api\Builders\ManagementBuilder;
use GlobalPayments\Api\Entities\DccRateData;
use GlobalPayments\Api\Entities\Enums\GatewayProvider;
use GlobalPayments\Api\Entities\Enums\PaymentMethodName;
use GlobalPayments\Api\Entities\Enums\PaymentMethodType;
use GlobalPayments\Api\Entities\Enums\TransactionType;
use GlobalPayments\Api\Entities\Exceptions\BuilderException;
use GlobalPayments\Api\Entities\GpApi\DTO\Card;
use GlobalPayments\Api\Entities\GpApi\GpApiRequest;
use GlobalPayments\Api\Entities\IRequestBuilder;
Expand All @@ -22,6 +24,10 @@

class GpApiManagementRequestBuilder implements IRequestBuilder
{
private static $allowedActions =[
PaymentMethodType::BANK_PAYMENT => []
];

/**
* @param $builder
* @return bool
Expand All @@ -44,6 +50,26 @@ public static function canProcess($builder)
public function buildRequest(BaseBuilder $builder, $config)
{
$payload = null;

if (!empty($builder->paymentMethod->paymentMethodType)) {
switch ($builder->paymentMethod->paymentMethodType) {
case PaymentMethodType::BANK_PAYMENT:
if (
!isset(self::$allowedActions[PaymentMethodType::BANK_PAYMENT]) ||
!in_array($builder->transactionType, self::$allowedActions[PaymentMethodType::BANK_PAYMENT])
) {
throw new BuilderException(
sprintf(
"The %s is not supported for %s",
$this->getTransactionTypeName($builder->transactionType), PaymentMethodName::BANK_PAYMENT
)
);
}
default:
break;
}
}

/**
* @var ManagementBuilder $builder
*/
Expand Down Expand Up @@ -244,4 +270,11 @@ private function getDccRate($dccRateData)
'id' => $dccRateData->dccId
];
}

private function getTransactionTypeName($transactionType)
{
$reflector = new \ReflectionClass(TransactionType::class);

return array_search($transactionType,$reflector->getConstants());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
use GlobalPayments\Api\Builders\TransactionReportBuilder;
use GlobalPayments\Api\Entities\Enums\GatewayProvider;
use GlobalPayments\Api\Entities\Enums\ReportType;
use GlobalPayments\Api\Entities\Enums\TransactionModifier;
use GlobalPayments\Api\Entities\Enums\TransactionType;
use GlobalPayments\Api\Entities\GpApi\GpApiRequest;
use GlobalPayments\Api\Entities\IRequestBuilder;
use GlobalPayments\Api\Mapping\EnumMapping;
Expand Down Expand Up @@ -88,7 +86,8 @@ public function buildRequest(BaseBuilder $builder, $config)
'risk_assessment_result' => EnumMapping::mapFraudFilterResult(
GatewayProvider::GP_API,
$builder->searchBuilder->riskAssessmentResult),
'risk_assessment_reason_code' => $builder->searchBuilder->riskAssessmentReasonCode
'risk_assessment_reason_code' => $builder->searchBuilder->riskAssessmentReasonCode,
'provider' => $builder->searchBuilder->paymentProvider,
];

$this->addBasicParams($queryParams, $builder);
Expand Down
Loading

0 comments on commit 7c8b781

Please sign in to comment.