Skip to content

Commit

Permalink
OctopusDeploy release: 2.3.5
Browse files Browse the repository at this point in the history
  • Loading branch information
securesubmit-buildmaster committed Jul 8, 2021
1 parent ca2167b commit 5c63eb0
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/Entities/Enums/IsoCountries.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ class IsoCountries
["name" => "Nauru", "numeric" => "520", "alpha2" => "NR", "alpha3" => "NRU"],
["name" => "Nepal", "numeric" => "524", "alpha2" => "NP", "alpha3" => "NPL"],
["name" => "Netherlands", "numeric" => "528", "alpha2" => "NL", "alpha3" => "NLD"],
["name" => "Netherlands Antilles", "numeric" => "530", "alpha2" => "AN", "alpha3" => "ANT"],
["name" => "New Caledonia", "numeric" => "540", "alpha2" => "NC", "alpha3" => "NCL"],
["name" => "New Zealand", "numeric" => "554", "alpha2" => "NZ", "alpha3" => "NZL"],
["name" => "Nicaragua", "numeric" => "558", "alpha2" => "NI", "alpha3" => "NIC"],
Expand Down
13 changes: 7 additions & 6 deletions src/Gateways/Gp3DSProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use GlobalPayments\Api\PaymentMethods\CreditCardData;
use GlobalPayments\Api\PaymentMethods\RecurringPaymentMethod;
use GlobalPayments\Api\Utils\GenerationUtils;
use GlobalPayments\Api\Utils\StringUtils;

class Gp3DSProvider extends RestGateway implements ISecure3dProvider
{
Expand Down Expand Up @@ -239,15 +240,15 @@ public function processSecure3d(Secure3dBuilder $builder)
// home phone
if (!empty($builder->getHomeNumber())) {
$request['payer']['home_phone'] = [];
$request['payer']['home_phone'] = $this->maybeSetKey($request['payer']['home_phone'], 'country_code', $builder->getHomeCountryCode());
$request['payer']['home_phone'] = $this->maybeSetKey($request['payer']['home_phone'], 'subscriber_number', $builder->getHomeNumber());
$request['payer']['home_phone'] = $this->maybeSetKey($request['payer']['home_phone'], 'country_code', StringUtils::validateToNumber($builder->getHomeCountryCode()));
$request['payer']['home_phone'] = $this->maybeSetKey($request['payer']['home_phone'], 'subscriber_number', StringUtils::validateToNumber($builder->getHomeNumber()));
}

// work phone
if (!empty($builder->getWorkNumber())) {
$request['payer']['work_phone'] = [];
$request['payer']['work_phone'] = $this->maybeSetKey($request['payer']['work_phone'], 'country_code', $builder->getWorkCountryCode());
$request['payer']['work_phone'] = $this->maybeSetKey($request['payer']['work_phone'], 'subscriber_number', $builder->getWorkNumber());
$request['payer']['work_phone'] = $this->maybeSetKey($request['payer']['work_phone'], 'country_code', StringUtils::validateToNumber($builder->getWorkCountryCode()));
$request['payer']['work_phone'] = $this->maybeSetKey($request['payer']['work_phone'], 'subscriber_number', StringUtils::validateToNumber($builder->getWorkNumber()));
}

// payer login data
Expand Down Expand Up @@ -291,8 +292,8 @@ public function processSecure3d(Secure3dBuilder $builder)
// mobile phone
if (!empty($builder->getMobileNumber())) {
$request['payer']['mobile_phone'] = [];
$request['payer']['mobile_phone'] = $this->maybeSetKey($request['payer']['mobile_phone'], 'country_code', $builder->getMobileCountryCode());
$request['payer']['mobile_phone'] = $this->maybeSetKey($request['payer']['mobile_phone'], 'subscriber_number', $builder->getMobileNumber());
$request['payer']['mobile_phone'] = $this->maybeSetKey($request['payer']['mobile_phone'], 'country_code', StringUtils::validateToNumber($builder->getMobileCountryCode()));
$request['payer']['mobile_phone'] = $this->maybeSetKey($request['payer']['mobile_phone'], 'subscriber_number', StringUtils::validateToNumber($builder->getMobileNumber()));
}

// browser_data
Expand Down
12 changes: 12 additions & 0 deletions src/Utils/StringUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,16 @@ public static function toAmount($str)

return $str / 100;
}

/**
* Strip all non-numeric characters
*
* @param string $value
*
* @return mixed
*/
public static function validateToNumber($value)
{
return preg_replace("/[^0-9]/", "", $value);
}
}
38 changes: 38 additions & 0 deletions test/Integration/Gateways/RealexConnector/HppTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -757,4 +757,42 @@ public function testSupplementaryDataWithTwoValuesSerialized()
$expectedJson = '{"MERCHANT_ID":"MerchantId","ACCOUNT":"internet","ORDER_ID":"GTI5Yxb0SumL_TkDMCAxQA","AMOUNT":"1999","CURRENCY":"EUR","TIMESTAMP":"20170725154824","AUTO_SETTLE_FLAG":"1","COMMENT1":"Mobile Channel","CUST_NUM":"a028774f-beff-47bc-bd6e-ed7e04f5d758a028774f-btefa","OFFER_SAVE_CARD":"1","PAYER_EXIST":"0","PROD_ID":"a0b38df5-b23c-4d82-88fe-2e9c47438972-b23c-4d82-88f","VAR_REF":"My Legal Entity","HPP_LANG":"GB","MERCHANT_RESPONSE_URL":"https:\/\/www.example.com\/response","HPP_VERSION":"2","RANDOM_KEY1":"VALUE_1","RANDOM_KEY2":"VALUE_2","SHA1HASH":"7116c49826367c6513efdc0cc81e243b8095d78f"}';
$this->assertEquals($json, $expectedJson);
}

public function testNetherlandsAntillesCountry()
{
$config = new GpEcomConfig();
$config->merchantId = "MerchantId";
$config->accountId = "internet";
$config->sharedSecret = "secret";
$config->serviceUrl = "https://pay.sandbox.realexpayments.com/pay";

$config->hostedPaymentConfig = new HostedPaymentConfig();
$config->hostedPaymentConfig->language = "GB";
$config->hostedPaymentConfig->responseUrl = "https://www.example.com/response";
$config->hostedPaymentConfig->version = HppVersion::VERSION_2;
$config->gatewayProvider = GatewayProvider::GP_ECOM;

$service = new HostedService($config);

// billing address
$billingAddress = new Address();
$billingAddress->streetAddress1 = 'Flat 123';
$billingAddress->streetAddress2 = 'House 456';
$billingAddress->postalCode = "50001";
$billingAddress->country = "AN";

$hostedPaymentData = new HostedPaymentData();
$hostedPaymentData->customerNumber = 'a028774f-beff-47bc-bd6e-ed7e04f5d758a028774f-btefa';
$hostedPaymentData->productId = 'a0b38df5-b23c-4d82-88fe-2e9c47438972-b23c-4d82-88f';

$json = $service->charge(19.99)
->withCurrency("EUR")
->withHostedPaymentData($hostedPaymentData)
->withAddress($billingAddress, AddressType::BILLING)
->serialize();

$response = json_decode($json, true);
$this->assertEquals('AN', $response['BILLING_CO']);
$this->assertEquals('530', $response['HPP_BILLING_COUNTRY']);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@ public function testFullCycle_v2()
->withBrowserData($this->browserData)
->withMethodUrlCompletion(MethodUrlCompletion::NO)
->withChallengeRequestIndicator(ChallengeRequestIndicator::NO_PREFERENCE)
->withMobileNumber('+44','11 33 44 44')
->withHomeNumber('44', '12444555')
->withWorkNumber('+44','345 6667')
->execute();
$this->assertNotNull($initAuth);

Expand Down

0 comments on commit 5c63eb0

Please sign in to comment.