Skip to content

Commit

Permalink
Update DNS Merchant regular expression length (#267)
Browse files Browse the repository at this point in the history
  • Loading branch information
armando-rodriguez-cko authored Aug 28, 2024
1 parent 637444a commit e155afc
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

[![build-status](https://github.com/checkout/checkout-sdk-php/workflows/build-release/badge.svg)](https://github.com/checkout/checkout-sdk-php/actions/workflows/build-release.yml)
[![GitHub release](https://img.shields.io/github/release/checkout/checkout-sdk-php.svg)](https://GitHub.com/checkout/checkout-sdk-php/releases/)
[![Latest Stable Version](http://poser.pugx.org/checkout/checkout-sdk-php/v)](https://packagist.org/packages/checkout/checkout-sdk-php)
[![Latest Stable Version](https://poser.pugx.org/checkout/checkout-sdk-php/v)](https://packagist.org/packages/checkout/checkout-sdk-php)

[![GitHub license](https://img.shields.io/github/license/checkout/checkout-sdk-php.svg)](https://github.com/checkout/checkout-sdk-php/blob/master/LICENSE.md)

Expand Down Expand Up @@ -49,9 +49,9 @@
This SDK can be used with two different pair of API keys provided by Checkout. However, using different API keys imply using specific API features. Please find in the table below the types of keys that can be used within this SDK.

| Account System | Public Key (example) | Secret Key (example) |
|----------------|-----------------------------------------| --------------------------------------- |
| Default | pk_pkhpdtvabcf7hdgpwnbhw7r2uic | sk_m73dzypy7cf3gf5d2xr4k7sxo4e |
| Previous | pk_g650ff27-7c42-4ce1-ae90-5691a188ee7b | sk_gk3517a8-3z01-45fq-b4bd-4282384b0a64 |
|----------------|-----------------------------------------|-----------------------------------------|
| Default | pk_zyxwabcde123pqrstu876vwxyt | sk_abcdef98765mnopqr4321ghijk |
| Previous | pk_f3456789-ab12-cd34-ef56-7890ghijklmn | sk_hijklmn0-1234-5678-abcd-efgh98765432 |

Note: sandbox keys have a `sbox_` or `test_` identifier, for Default and Previous accounts respectively.

Expand Down
2 changes: 1 addition & 1 deletion lib/Checkout/EnvironmentSubdomain.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ private function addSubdomainToApiUrlEnvironment($environment, $subdomain)
$apiUrl = $environment->getBaseUri();
$newEnvironment = $apiUrl;

$regex = '/^[0-9a-z]{8,11}$/';
$regex = '/^[0-9a-z]+$/';
if (preg_match($regex, $subdomain)) {
$urlParts = parse_url($apiUrl);
$newHost = $subdomain . '.' . $urlParts['host'];
Expand Down
15 changes: 9 additions & 6 deletions test/Checkout/Tests/CheckoutConfigurationTests.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,10 @@ public function testShouldCreateConfigurationWithBadSubdomain($subdomain, $expec
public function validSubdomainProvider()
{
return [
["123dmain", "https://123dmain.api.sandbox.checkout.com/"],
["123domain", "https://123domain.api.sandbox.checkout.com/"],
["1234domain", "https://1234domain.api.sandbox.checkout.com/"],
["a", "https://a.api.sandbox.checkout.com/"],
["ab", "https://ab.api.sandbox.checkout.com/"],
["abc", "https://abc.api.sandbox.checkout.com/"],
["abc1", "https://abc1.api.sandbox.checkout.com/"],
["12345domain", "https://12345domain.api.sandbox.checkout.com/"],
];
}
Expand All @@ -87,9 +88,11 @@ public function invalidSubdomainProvider()
{
return [
["", "https://api.sandbox.checkout.com/"],
["123", "https://api.sandbox.checkout.com/"],
["123bad", "https://api.sandbox.checkout.com/"],
["12345domainBad", "https://api.sandbox.checkout.com/"],
[" ", "https://api.sandbox.checkout.com/"],
[" ", "https://api.sandbox.checkout.com/"],
[" - ", "https://api.sandbox.checkout.com/"],
["a b", "https://api.sandbox.checkout.com/"],
["ab c1.", "https://api.sandbox.checkout.com/"],
];
}
}

0 comments on commit e155afc

Please sign in to comment.