diff --git a/.github/Makefile b/.github/Makefile index 179e2ec80e..04fe1c8b1e 100644 --- a/.github/Makefile +++ b/.github/Makefile @@ -60,8 +60,8 @@ flush: enable-express: bin/magento module:enable Adyen_ExpressCheckout bin/magento setup:upgrade - bin/magento config:set payment/adyen_express/show_google_pay_on "1,2,3" - bin/magento config:set payment/adyen_express/show_apple_pay_on "1,2,3" + bin/magento config:set payment/adyen_googlepay/express_show_on "1,2,3" + bin/magento config:set payment/adyen_applepay/express_show_on "1,2,3" bin/magento cache:clean # Full plugin setup diff --git a/.github/docker-compose.e2e.yml b/.github/docker-compose.e2e.yml index e0842a2bdd..f5f51a8663 100644 --- a/.github/docker-compose.e2e.yml +++ b/.github/docker-compose.e2e.yml @@ -1,7 +1,7 @@ version: '3' services: playwright: - image: mcr.microsoft.com/playwright:v1.40.1 + image: mcr.microsoft.com/playwright:v1.47.2 shm_size: 1gb ipc: host cap_add: diff --git a/.github/docker-compose.yml b/.github/docker-compose.yml index 9552773508..21c4b69c98 100644 --- a/.github/docker-compose.yml +++ b/.github/docker-compose.yml @@ -12,7 +12,7 @@ services: MARIADB_USER: magento MARIADB_PASSWORD: magento elastic: - image: elasticsearch:7.17.13 + image: elasticsearch:7.17.23 container_name: elasticsearch networks: - backend diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index d5144210b2..f064369e94 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -1,14 +1,9 @@ name: "CodeQL" on: - push: - branches: [ "develop", "develop-6", "develop-7", "develop-8", "main", "main-6", "main-7", "main-8" ] pull_request: - branches: [ "develop", "main" ] paths-ignore: - - 'view/base/web/js/*' - schedule: - - cron: "6 1 * * 0" + - 'view/base/web/js/**' jobs: analyze: diff --git a/.github/workflows/e2e-test-dispatch.yml b/.github/workflows/e2e-test-dispatch.yml index 2ff1d8d028..81a78c862d 100644 --- a/.github/workflows/e2e-test-dispatch.yml +++ b/.github/workflows/e2e-test-dispatch.yml @@ -11,7 +11,7 @@ on: expressBranch: description: "Express Checkout Repository Pipeline" required: true - default: "develop" + default: "main" testGroup: description: "Test group" required: true @@ -42,11 +42,11 @@ jobs: - uses: actions/checkout@v3 - name: Install Magento - run: docker-compose -f .github/docker-compose.yml run --rm web make magento + run: docker compose -f .github/docker-compose.yml run --rm web make magento - name: Start web server in background - run: docker-compose -f .github/docker-compose.yml up -d web - + run: docker compose -f .github/docker-compose.yml up -d web + - name: Setup permissions run: docker exec magento2-container make fs @@ -94,7 +94,7 @@ jobs: run: docker exec magento2-container make fs - name: Run E2E tests - run: docker-compose -f .github/docker-compose.e2e.yml run --rm playwright /e2e.sh ${{inputs.testGroup}} + run: docker compose -f .github/docker-compose.e2e.yml run --rm playwright /e2e.sh ${{inputs.testGroup}} env: INTEGRATION_TESTS_BRANCH: ${{inputs.testBranch}} MAGENTO_ADMIN_USERNAME: ${{secrets.MAGENTO_ADMIN_USERNAME}} diff --git a/.github/workflows/e2e-test-express-checkout.yml b/.github/workflows/e2e-test-express-checkout.yml index 91e505b3f3..48e9ff7220 100644 --- a/.github/workflows/e2e-test-express-checkout.yml +++ b/.github/workflows/e2e-test-express-checkout.yml @@ -4,16 +4,14 @@ run-name: Adyen Magento 2 Express Checkout Plugin E2E tests on: workflow_dispatch: pull_request: - types: [opened, synchronize] + branches: [main] + pull_request_target: branches: [main] jobs: build: - if: | - ${{ - github.event.pull_request.draft == false && - (github.actor != 'renovate[bot]' || github.actor != 'lgtm-com[bot]') - }} + if: (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository) || (github.event_name == 'workflow_dispatch') + environment: ${{ (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository) && 'external' || 'internal' }} runs-on: group: larger-runners labels: ubuntu-latest-8-cores @@ -32,10 +30,10 @@ jobs: - uses: actions/checkout@v3 - name: Install Magento - run: docker-compose -f .github/docker-compose.yml run --rm web make magento + run: docker compose -f .github/docker-compose.yml run --rm web make magento - name: Start web server in background - run: docker-compose -f .github/docker-compose.yml up -d web + run: docker compose -f .github/docker-compose.yml up -d web - name: Setup permissions run: docker exec magento2-container make fs @@ -59,7 +57,7 @@ jobs: run: docker exec magento2-container make fs - name: Run E2E tests - run: docker-compose -f .github/docker-compose.e2e.yml run --rm playwright /e2e.sh express-checkout + run: docker compose -f .github/docker-compose.e2e.yml run --rm playwright /e2e.sh express-checkout env: INTEGRATION_TESTS_BRANCH: develop MAGENTO_ADMIN_USERNAME: ${{secrets.MAGENTO_ADMIN_USERNAME}} diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index b3b2cee25f..09824636c3 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -1,11 +1,6 @@ name: Magento 2 E2E Pipeline run-name: Adyen Magento 2 Payment Plugin E2E tests - -on: - pull_request: - types: [opened, synchronize, ready_for_review] - pull_request_target: - types: [opened, synchronize, ready_for_review] +on: [pull_request, pull_request_target] jobs: build: @@ -29,10 +24,10 @@ jobs: - uses: actions/checkout@v3 - name: Install Magento - run: docker-compose -f .github/docker-compose.yml run --rm web make magento + run: docker compose -f .github/docker-compose.yml run --rm web make magento - name: Start web server in background - run: docker-compose -f .github/docker-compose.yml up -d web + run: docker compose -f .github/docker-compose.yml up -d web - name: Setup permissions run: docker exec magento2-container make fs @@ -72,7 +67,7 @@ jobs: run: docker exec magento2-container make fs - name: Run E2E tests - run: docker-compose -f .github/docker-compose.e2e.yml run --rm playwright /e2e.sh standard + run: docker compose -f .github/docker-compose.e2e.yml run --rm playwright /e2e.sh standard env: INTEGRATION_TESTS_BRANCH: develop MAGENTO_ADMIN_USERNAME: ${{secrets.MAGENTO_ADMIN_USERNAME}} diff --git a/.github/workflows/graphql-test.yml b/.github/workflows/graphql-test.yml index 2193cea742..0b7a25ab7d 100644 --- a/.github/workflows/graphql-test.yml +++ b/.github/workflows/graphql-test.yml @@ -25,10 +25,10 @@ jobs: - uses: actions/checkout@v3 - name: Install Magento - run: docker-compose -f .github/docker-compose.yml run --rm web make magento + run: docker compose -f .github/docker-compose.yml run --rm web make magento - name: Start web server in background - run: docker-compose -f .github/docker-compose.yml up -d web + run: docker compose -f .github/docker-compose.yml up -d web - name: Setup permissions run: docker exec magento2-container make fs diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 68772eef69..462312b479 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -4,12 +4,10 @@ on: pull_request: pull_request_target: workflow_dispatch: - push: - branches: [develop] jobs: build: - if: (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository) || (github.event_name == 'push') || (github.event_name == 'workflow_dispatch') + if: (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository) || (github.event_name == 'workflow_dispatch') environment: ${{ (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository) && 'external' || 'internal' }} runs-on: ubuntu-latest diff --git a/.github/workflows/marketplace-release.yml b/.github/workflows/marketplace-release.yml new file mode 100644 index 0000000000..47a503b466 --- /dev/null +++ b/.github/workflows/marketplace-release.yml @@ -0,0 +1,190 @@ +name: Marketplace Automation + +on: + workflow_dispatch: + release: + types: [published] + +jobs: + marketplace-automation: + runs-on: ubuntu-latest + # environment: internal + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Fetch the latest release + id: fetch_release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + # for test only + # response=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" "https://api.github.com/repos/${{ github.repository }}/releases/latest") + + # for live only + response=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" "https://api.github.com/repos/${{ github.repository }}/releases/tags/${{ github.ref_name }}") + + release_url=$(echo $response | jq -r '.zipball_url') + release_notes=$(echo $response | jq -r '.body') + release_tagname=$(echo $response | jq -r '.tag_name') + + # Remove 'v' prefix if it exists + if [[ $release_tagname == v* ]]; then + release_tagname=${release_tagname#v} + fi + + echo "LATEST_RELEASE_URL=$release_url" >> $GITHUB_OUTPUT + echo "RELEASE_NOTES<> $GITHUB_OUTPUT + echo "$release_notes" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + echo "TAG_NAME=$release_tagname" >> $GITHUB_OUTPUT + + echo "Latest Release URL: $release_url" + echo "Release Notes: $release_notes" + echo "Tag name: $release_tagname" + + - name: Download the latest release + run: | + curl -L ${{ steps.fetch_release.outputs.LATEST_RELEASE_URL }} -o source.zip + unzip source.zip + rm source.zip + + - name: Create Archive + uses: thedoctor0/zip-release@0.7.6 + with: + type: 'zip' + filename: 'adyen-magento2-main.zip' + exclusions: '*.git* *.DS_Store' + + - name: List files for verification + run: | + ls -la + + - name: Prepare the request payload + run: | + touch file-payload && \ + echo "--UNIQUE_BOUNDARY_TOKEN" > file-payload && \ + echo 'Content-Disposition: form-data; name="file[]"; filename="adyen-magento2-main.zip"' >> file-payload && \ + echo 'Content-Type: application/zip' >> file-payload && \ + echo '' >> file-payload && \ + cat adyen-magento2-main.zip >> file-payload && \ + echo '' >> file-payload && \ + echo "--UNIQUE_BOUNDARY_TOKEN--" >> file-payload + + - name: Get session token + id: get_session_token + env: + BASE_URL: ${{ secrets.ADOBE_EQP_API_URL }} + ADOBE_CLIENT_ID: ${{ secrets.ADOBE_CLIENT_ID }} + ADOBE_CLIENT_SECRET: ${{ secrets.ADOBE_CLIENT_SECRET }} + run: | + response=$(curl -X POST \ + -u "${ADOBE_CLIENT_ID}:${ADOBE_CLIENT_SECRET}" \ + -H 'Content-Type: application/json' \ + -d '{ "grant_type" : "session" }' \ + ${BASE_URL}/rest/v1/app/session/token) + + SESSION_TOKEN=$(echo $response | jq -r '.ust') + echo "SESSION_TOKEN=$SESSION_TOKEN" >> $GITHUB_OUTPUT + + echo "Session Token Response: $response" + + - name: Upload zip to adobe and get upload id + id: upload_and_fetch + env: + SESSION_TOKEN: ${{ steps.get_session_token.outputs.SESSION_TOKEN }} + BASE_URL: ${{ secrets.ADOBE_EQP_API_URL }} + run: | + # Upload the file + upload_response=$(curl -X POST \ + -H "Authorization: Bearer $SESSION_TOKEN" \ + -H 'Content-Type: multipart/form-data; boundary=UNIQUE_BOUNDARY_TOKEN' \ + --data-binary @file-payload \ + "${BASE_URL}/rest/v1/files/uploads") + + # Check if the upload was successful + if echo "$upload_response" | grep -q 'error'; then + echo "Upload failed: $upload_response" + exit 1 + else + echo "Upload successful: $upload_response" + fi + + # Extract upload ID from JSON response + upload_id=$(echo $upload_response | jq -r '.[0].file_upload_id') + + echo "Upload ID: $upload_id" + echo "FILE_UPLOAD_ID=$upload_id" >> $GITHUB_OUTPUT + + - name: Prepare JSON Payload + id: prepare_payload + env: + NEW_VERSION: ${{ steps.fetch_release.outputs.TAG_NAME }} + #NEW_VERSION: "11.0.11" + FILE_UPLOAD_ID: ${{ steps.upload_and_fetch.outputs.FILE_UPLOAD_ID }} + THIS_RELEASE_NOTES: ${{ steps.fetch_release.outputs.RELEASE_NOTES }} + run: | + # Read the JSON template and replace placeholders with actual values + cp .github/workflows/payload-template.json updated-payload.json + + # Replace placeholders with actual values + sed -i "s/VERSION/${NEW_VERSION}/g" updated-payload.json + sed -i "s/FILE_UPLOAD_ID/${FILE_UPLOAD_ID}/g" updated-payload.json + + # Step 1: Prepare the release notes + echo "$THIS_RELEASE_NOTES" > temp_release_notes.txt + + # Step 2: Remove specific line and emojis + sed -e '//d' \ + -e 's/💎//g' \ + -e 's/🖇️//g' \ + temp_release_notes.txt > cleaned_release_notes.txt + + # Step 3: Read the cleaned content into a variable + THIS_RELEASE_NOTES=$(cat cleaned_release_notes.txt) + + # Step 4: Update the JSON file with the cleaned release notes + jq --arg notes "$THIS_RELEASE_NOTES" '.[0].release_notes = $notes' updated-payload.json > updated-payload.tmp && mv updated-payload.tmp updated-payload.json + + # Step 5: Clean up temporary files + rm temp_release_notes.txt cleaned_release_notes.txt + + # Update the JSON payload with the release notes + # jq --arg notes "$THIS_RELEASE_NOTES" '.[0].release_notes = $notes' updated-payload.json > updated-payload.tmp && mv updated-payload.tmp updated-payload.json + + cat updated-payload.json + + - name: Submit the package + env: + SESSION_TOKEN: ${{ steps.get_session_token.outputs.SESSION_TOKEN }} + BASE_URL: ${{ secrets.ADOBE_EQP_API_URL }} + run: | + + # Sleep and wait for malware check to finish + sleep_duration=120 + sleep $sleep_duration + + # Make the POST request and capture the response + response_body=$(curl -s -X POST \ + -H "Authorization: Bearer $SESSION_TOKEN" \ + -H "Content-Type: application/json" \ + --data @updated-payload.json \ + "${BASE_URL}/rest/v1/products/packages") + + if [ -n "response_body" ]; then + echo "Response body: $response_body" # For debugging + + # Extract the "code" field from the JSON response + code=$(echo "$response_body" | jq -r '.[0].code // empty') + + if [ -n "$code" ]; then + echo "$code" + + if [ "$code" -eq 1321 ]; then + echo "The package is submitted as a draft and waiting for malware check." + fi + fi + else + echo "SUCCESS" + fi diff --git a/.github/workflows/mftf-test.yml b/.github/workflows/mftf-test.yml index d31b61ebdc..b6c1770733 100644 --- a/.github/workflows/mftf-test.yml +++ b/.github/workflows/mftf-test.yml @@ -3,9 +3,13 @@ on: workflow_dispatch: pull_request: branches: [main] + pull_request_target: + branches: [main] jobs: build: + if: (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository) + environment: ${{ (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository) && 'external' || 'internal' }} strategy: matrix: include: @@ -26,7 +30,7 @@ jobs: - uses: actions/checkout@v3 - name: Start services - run: docker-compose -f .github/docker-compose.yml -f .github/docker-compose.mftf.yml up -d + run: docker compose -f .github/docker-compose.yml -f .github/docker-compose.mftf.yml up -d # Temp solution to wait for install script to run - name: Sleep for 120 seconds diff --git a/.github/workflows/payload-template.json b/.github/workflows/payload-template.json new file mode 100644 index 0000000000..074bef10d8 --- /dev/null +++ b/.github/workflows/payload-template.json @@ -0,0 +1,34 @@ +[ + { + "action": { + "technical": "submit" + }, + "type": "extension", + "platform": "M2", + "version_compatibility": [ + { + "edition": "CE", + "versions": ["2.4"] + }, + { + "edition": "EE", + "versions": ["2.4"] + }, + { + "edition": "ECE", + "versions": ["2.4"] + } + ], + "name": "Adyen Payment Plugin", + "release_notes": "RELEASE_NOTES", + "version": "VERSION", + "artifact": { + "file_upload_id": "FILE_UPLOAD_ID" + }, + "categories": [ + "//Payments & Security//Payment Integration" + ], + "license_type": "apache", + "sku": "adyen/module-payment" + } +] diff --git a/.github/workflows/restapi-test.yml b/.github/workflows/restapi-test.yml index ee855613c0..3c04bb810a 100644 --- a/.github/workflows/restapi-test.yml +++ b/.github/workflows/restapi-test.yml @@ -25,10 +25,10 @@ jobs: - uses: actions/checkout@v3 - name: Install Magento - run: docker-compose -f .github/docker-compose.yml run --rm web make magento + run: docker compose -f .github/docker-compose.yml run --rm web make magento - name: Start web server in background - run: docker-compose -f .github/docker-compose.yml up -d web + run: docker compose -f .github/docker-compose.yml up -d web - name: Setup permissions run: docker exec magento2-container make fs diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f0494f9397..545d780e42 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,7 +3,7 @@ ### How to contribute step-by-step 1. Fork the `Adyen/adyen-magento2` repository. -2. Create a new branch from `develop` in your fork. This makes it easier for you to keep track of your changes. +2. Create a new branch from `main` in your fork. This makes it easier for you to keep track of your changes. 3. Make the desired changes to the code. * If you are adding new functionality or fixing a bug, we recommend you add unit tests that cover it. 4. Push the changes to your fork. diff --git a/Controller/Adminhtml/Configuration/DownloadApplePayCertificate.php b/Controller/Adminhtml/Configuration/DownloadApplePayCertificate.php index 574748bb43..5af0c4dcea 100644 --- a/Controller/Adminhtml/Configuration/DownloadApplePayCertificate.php +++ b/Controller/Adminhtml/Configuration/DownloadApplePayCertificate.php @@ -34,7 +34,7 @@ class DownloadApplePayCertificate extends Action const MAX_SIZE = 1000000; const MAX_RATIO = 5; const FILE_NAME = 'apple-developer-merchantid-domain-association'; - const APPLEPAY_CERTIFICATE_URL = 'https://docs.adyen.com/payment-methods/apple-pay/web-component/apple-developer-merchantid-domain-association.zip'; + const APPLEPAY_CERTIFICATE_URL = 'https://docs.adyen.com/payment-methods/apple-pay/web-component/apple-developer-merchantid-domain-association-2024.zip'; private $directoryList; private $fileIo; private $adyenLogger; diff --git a/Controller/Adminhtml/Configuration/MerchantAccounts.php b/Controller/Adminhtml/Configuration/MerchantAccounts.php index 2fbad6021c..3279f89aba 100644 --- a/Controller/Adminhtml/Configuration/MerchantAccounts.php +++ b/Controller/Adminhtml/Configuration/MerchantAccounts.php @@ -1,23 +1,10 @@ */ @@ -28,21 +15,28 @@ use Adyen\ConnectionException; use Adyen\Payment\Helper\ManagementHelper; use Magento\Backend\App\Action; +use Magento\Framework\Controller\Result\Json; use Magento\Framework\Controller\Result\JsonFactory; use Magento\Backend\App\Action\Context; +use Magento\Framework\Exception\NoSuchEntityException; class MerchantAccounts extends Action { /** * @var ManagementHelper */ - protected $managementHelper; + protected ManagementHelper $managementHelper; /** * @var JsonFactory */ - protected $resultJsonFactory; + protected JsonFactory $resultJsonFactory; + /** + * @param Context $context + * @param ManagementHelper $managementHelper + * @param JsonFactory $resultJsonFactory + */ public function __construct( Context $context, ManagementHelper $managementHelper, @@ -54,21 +48,27 @@ public function __construct( } /** - * @return \Magento\Framework\Controller\Result\Json + * @return Json + * @throws NoSuchEntityException */ - public function execute() + public function execute(): Json { $resultJson = $this->resultJsonFactory->create(); try { $apiKey = $this->getRequest()->getParam('apiKey', ''); $demoMode = (int) $this->getRequest()->getParam('demoMode'); - //Use the stored xapi key if the return value is encrypted chars only or it is empty, + // Use the stored xapi key if the return value is encrypted chars only or it is empty, if (!empty($apiKey) && preg_match('/^\*+$/', (string) $apiKey)) { $apiKey = ''; } - $managementApiService = $this->managementHelper->getManagementApiService($apiKey, $demoMode); - $response = $this->managementHelper->getMerchantAccountsAndClientKey($managementApiService); + $client = $this->managementHelper->getAdyenApiClient($apiKey, $demoMode); + $accountMerchantLevelApi = $this->managementHelper->getAccountMerchantLevelApi($client); + $myAPICredentialApi = $this->managementHelper->getMyAPICredentialApi($client); + $response = $this->managementHelper->getMerchantAccountsAndClientKey( + $accountMerchantLevelApi, + $myAPICredentialApi + ); $resultJson->setData($response); return $resultJson; @@ -83,4 +83,3 @@ public function execute() return $resultJson; } } - diff --git a/Controller/Adminhtml/Configuration/WebhookTest.php b/Controller/Adminhtml/Configuration/WebhookTest.php index 65861d2fff..10cacd93e4 100644 --- a/Controller/Adminhtml/Configuration/WebhookTest.php +++ b/Controller/Adminhtml/Configuration/WebhookTest.php @@ -16,10 +16,8 @@ use Adyen\Payment\Helper\ManagementHelper; use Magento\Backend\App\Action; use Magento\Backend\App\Action\Context; -use Magento\Framework\App\ResponseInterface; use Magento\Framework\Controller\Result\Json; use Magento\Framework\Controller\Result\JsonFactory; -use Magento\Framework\Controller\ResultInterface; use Magento\Framework\Exception\NoSuchEntityException; use Magento\Store\Model\StoreManager; @@ -28,27 +26,27 @@ class WebhookTest extends Action /** * @var ManagementHelper */ - private $managementApiHelper; + private ManagementHelper $managementApiHelper; /** * @var Config */ - protected $configHelper; + protected Config $configHelper; /** * @var JsonFactory */ - protected $resultJsonFactory; + protected JsonFactory $resultJsonFactory; /** * @var Context */ - protected $context; + protected Context $context; /** * @var StoreManager */ - protected $storeManager; + protected StoreManager $storeManager; /** * @param Context $context @@ -73,11 +71,11 @@ public function __construct( } /** - * @return ResponseInterface|Json|ResultInterface + * @return Json * @throws AdyenException * @throws NoSuchEntityException */ - public function execute() + public function execute(): Json { $storeId = $this->storeManager->getStore()->getId(); @@ -87,11 +85,11 @@ public function execute() $environment = $isDemoMode ? 'test' : 'live'; $apiKey = $this->configHelper->getApiKey($environment, $storeId); - $managementApiService = $this->managementApiHelper->getManagementApiService($apiKey, $isDemoMode); - $response = $this->managementApiHelper->webhookTest($merchantAccount, $webhookId, $managementApiService); - - $success = isset($response['data']) && - in_array('success', array_column($response['data'], 'status'), true); + $client = $this->managementApiHelper->getAdyenApiClient($apiKey, $isDemoMode); + $service =$this->managementApiHelper->getWebhooksMerchantLevelApi($client); + $response = $this->managementApiHelper->webhookTest($merchantAccount, $webhookId, $service); + $success = isset($response) && + in_array('success', array_column($response->getData(), 'status'), true); $resultJson = $this->resultJsonFactory->create(); $resultJson->setData([ diff --git a/Controller/Return/Index.php b/Controller/Return/Index.php index 9c424ff5ff..b68f4a3229 100755 --- a/Controller/Return/Index.php +++ b/Controller/Return/Index.php @@ -152,29 +152,24 @@ protected function validateRedirectResponse(array $redirectResponse): bool // Make paymentsDetails call to validate the payment $request["details"] = $redirectResponse; $paymentsDetailsResponse = $this->paymentsDetailsHelper->initiatePaymentDetails($order, $request); + + if ($this->isResponseAlreadyProcessed($order, $paymentsDetailsResponse)) { + $this->adyenLogger->addAdyenResult('Duplicate response detected. Skipping processing.'); + return true; + } } catch (Exception $e) { $paymentsDetailsResponse['error'] = $e->getMessage(); } - $result = false; + $result = $this->paymentResponseHandler->handlePaymentsDetailsResponse( + $paymentsDetailsResponse, + $order + ); - // Compare the merchant references - $merchantReference = $paymentsDetailsResponse['merchantReference'] ?? null; - if ($merchantReference) { - if ($order->getIncrementId() === $merchantReference) { - $this->order = $order; - $this->payment = $order->getPayment(); - $this->cleanUpRedirectAction(); - - $result = $this->paymentResponseHandler->handlePaymentsDetailsResponse( - $paymentsDetailsResponse, - $order - ); - } else { - $this->adyenLogger->error("Wrong merchantReference was set in the query or in the session"); - } - } else { - $this->adyenLogger->error("No merchantReference in the response"); + if ($result) { + $this->order = $order; + $this->payment = $order->getPayment(); + $this->cleanUpRedirectAction(); } return $result; @@ -200,6 +195,27 @@ private function getOrder(string $incrementId = null): Order return $order; } + private function isResponseAlreadyProcessed(Order $order, array $paymentsDetailsResponse): bool + { + $pspReference = $paymentsDetailsResponse['pspReference'] ?? null; + $merchantReference = $paymentsDetailsResponse['merchantReference'] ?? null; + + if (!$pspReference || !$merchantReference) { + return false; + } + + $history = $order->getStatusHistories(); + + foreach ($history as $status) { + $comment = $status->getComment(); + if (str_contains($comment, $pspReference) !== false) { + return true; + } + } + + return false; + } + /** * @return void * @throws Exception diff --git a/Cron/WebhookProcessor.php b/Cron/WebhookProcessor.php index f8353a3fd4..6ac491c10f 100755 --- a/Cron/WebhookProcessor.php +++ b/Cron/WebhookProcessor.php @@ -99,6 +99,8 @@ public function doProcessWebhook() // Loop through and process notifications. $count = 0; + $queued = 0; + /** @var Notification[] $notifications */ foreach ($notifications as $notification) { // ignore duplicate notification @@ -128,6 +130,7 @@ public function doProcessWebhook() if ($this->configHelper->useQueueProcessor()) { $this->notificationPublisher->execute($notification); + $queued++; $count++; } elseif ($this->webhookHelper->processNotification($notification)) { $count++; @@ -139,7 +142,8 @@ public function doProcessWebhook() "Cronjob updated %s notification(s)", $count ), [ 'pspReference' => $notification->getPspreference(), - 'merchantReference' => $notification->getMerchantReference() + 'merchantReference' => $notification->getMerchantReference(), + 'queued' => $queued ]); } } diff --git a/Gateway/Http/Client/TransactionCancel.php b/Gateway/Http/Client/TransactionCancel.php index 49ae63440f..707412d06d 100644 --- a/Gateway/Http/Client/TransactionCancel.php +++ b/Gateway/Http/Client/TransactionCancel.php @@ -13,16 +13,29 @@ use Adyen\AdyenException; use Adyen\Client; +use Adyen\Model\Checkout\PaymentCancelRequest; use Adyen\Payment\Helper\Data; use Adyen\Payment\Helper\Idempotency; +use Magento\Framework\Exception\NoSuchEntityException; use Magento\Payment\Gateway\Http\ClientInterface; use Magento\Payment\Gateway\Http\TransferInterface; class TransactionCancel implements ClientInterface { + /** + * @var Data + */ private Data $adyenHelper; + + /** + * @var Idempotency + */ private Idempotency $idempotencyHelper; + /** + * @param Data $adyenHelper + * @param Idempotency $idempotencyHelper + */ public function __construct( Data $adyenHelper, Idempotency $idempotencyHelper @@ -31,34 +44,47 @@ public function __construct( $this->idempotencyHelper = $idempotencyHelper; } + /** + * @param TransferInterface $transferObject + * @return array + * @throws AdyenException + * @throws NoSuchEntityException + */ public function placeRequest(TransferInterface $transferObject): array { - $request = $transferObject->getBody(); + $requests = $transferObject->getBody(); $headers = $transferObject->getHeaders(); $clientConfig = $transferObject->getClientConfig(); + $client = $this->adyenHelper->initializeAdyenClientWithClientConfig($clientConfig); - $service = $this->adyenHelper->createAdyenCheckoutService($client); - $response = []; + $service = $this->adyenHelper->initializeModificationsApi($client); + $responseData = []; - foreach ($request as $requests) { + foreach ($requests as $request) { $idempotencyKey = $this->idempotencyHelper->generateIdempotencyKey( - $requests, + $request, $headers['idempotencyExtraData'] ?? null ); $requestOptions['idempotencyKey'] = $idempotencyKey; $requestOptions['headers'] = $this->adyenHelper->buildRequestHeaders(); - $this->adyenHelper->logRequest($requests, Client::API_CHECKOUT_VERSION, '/cancels'); + $this->adyenHelper->logRequest($request, Client::API_CHECKOUT_VERSION, '/cancels'); + $request['applicationInfo'] = $this->adyenHelper->buildApplicationInfo($client); + $paymentCancelRequest = new PaymentCancelRequest($request); + try { - $responses = $service->cancels($requests, $requestOptions); + $response = $service->cancelAuthorisedPaymentByPspReference( + $request['paymentPspReference'], + $paymentCancelRequest, + $requestOptions + ); + $responseData = $response->toArray(); + $this->adyenHelper->logResponse($responseData); } catch (AdyenException $e) { - $response['error'] = $e->getMessage(); + $responseData['error'] = $e->getMessage(); + $this->adyenHelper->logAdyenException($e); } - $this->adyenHelper->logResponse($responses); - - $response = $responses; } - return $response; + return $responseData; } - } diff --git a/Gateway/Http/Client/TransactionCapture.php b/Gateway/Http/Client/TransactionCapture.php index ea1f7c2b58..ad699a9ba6 100644 --- a/Gateway/Http/Client/TransactionCapture.php +++ b/Gateway/Http/Client/TransactionCapture.php @@ -13,11 +13,14 @@ use Adyen\AdyenException; use Adyen\Client; +use Adyen\Model\Checkout\PaymentCaptureRequest; use Adyen\Payment\Api\Data\OrderPaymentInterface; use Adyen\Payment\Helper\Data; use Adyen\Payment\Helper\Idempotency; use Adyen\Payment\Helper\Requests; use Adyen\Payment\Logger\AdyenLogger; +use Adyen\Service\Checkout\ModificationsApi; +use Magento\Framework\Exception\NoSuchEntityException; use Magento\Payment\Gateway\Http\ClientInterface; use Magento\Payment\Gateway\Http\TransferInterface; @@ -29,10 +32,26 @@ class TransactionCapture implements ClientInterface const ORIGINAL_REFERENCE = 'paymentPspReference'; const CAPTURE_RECEIVED = 'received'; + /** + * @var Data + */ private Data $adyenHelper; + + /** + * @var AdyenLogger + */ private AdyenLogger $adyenLogger; + + /** + * @var Idempotency + */ private Idempotency $idempotencyHelper; + /** + * @param Data $adyenHelper + * @param AdyenLogger $adyenLogger + * @param Idempotency $idempotencyHelper + */ public function __construct( Data $adyenHelper, AdyenLogger $adyenLogger, @@ -43,43 +62,70 @@ public function __construct( $this->idempotencyHelper = $idempotencyHelper; } + /** + * @param TransferInterface $transferObject + * @return array + * @throws AdyenException + * @throws NoSuchEntityException + */ public function placeRequest(TransferInterface $transferObject): array { $request = $transferObject->getBody(); $headers = $transferObject->getHeaders(); $clientConfig = $transferObject->getClientConfig(); + $client = $this->adyenHelper->initializeAdyenClientWithClientConfig($clientConfig); - $service = $this->adyenHelper->createAdyenCheckoutService($client); + $service = $this->adyenHelper->initializeModificationsApi($client); $requestOptions['headers'] = $this->adyenHelper->buildRequestHeaders(); + $request['applicationInfo'] = $this->adyenHelper->buildApplicationInfo($client); if (array_key_exists(self::MULTIPLE_AUTHORIZATIONS, $request)) { return $this->placeMultipleCaptureRequests($service, $request, $requestOptions); } - else { - $idempotencyKey = $this->idempotencyHelper->generateIdempotencyKey( - $request, - $headers['idempotencyExtraData'] ?? null - ); - $requestOptions['idempotencyKey'] = $idempotencyKey; - } + + $idempotencyKey = $this->idempotencyHelper->generateIdempotencyKey( + $request, + $headers['idempotencyExtraData'] ?? null + ); + $requestOptions['idempotencyKey'] = $idempotencyKey; $this->adyenHelper->logRequest($request, Client::API_CHECKOUT_VERSION, '/captures'); + $paymentCaptureRequest = new PaymentCaptureRequest($request); + $responseData = []; try { - $response = $service->captures($request, $requestOptions); - $response = $this->copyParamsToResponse($response, $request); + $response = $service->captureAuthorisedPayment( + $request['paymentPspReference'], + $paymentCaptureRequest, + $requestOptions + ); + + $responseData = $response->toArray(); + $responseData = $this->copyParamsToResponse($responseData, $request); + $this->adyenHelper->logResponse($responseData); } catch (AdyenException $e) { - $response['error'] = $e->getMessage(); + $this->adyenHelper->logAdyenException($e); + $responseData['error'] = $e->getMessage(); } - $this->adyenHelper->logResponse($response); - return $response; + return $responseData; } - private function placeMultipleCaptureRequests($service, $requestContainer, $requestOptions): array - { + /** + * @param ModificationsApi $service + * @param array $requestContainer + * @param array $requestOptions + * @return array + */ + private function placeMultipleCaptureRequests( + ModificationsApi $service, + array $requestContainer, + array $requestOptions + ): array { $response = []; + $applicationInfo = $requestContainer['applicationInfo']; + foreach ($requestContainer[self::MULTIPLE_AUTHORIZATIONS] as $request) { $idempotencyKeyExtraData = $request['idempotencyExtraData']; unset($request['idempotencyExtraData']); @@ -92,7 +138,15 @@ private function placeMultipleCaptureRequests($service, $requestContainer, $requ try { // Copy merchant account from parent array to every request array $request[Requests::MERCHANT_ACCOUNT] = $requestContainer[Requests::MERCHANT_ACCOUNT]; - $singleResponse = $service->captures($request, $requestOptions); + $request['applicationInfo'] = $applicationInfo; + $paymentCaptureRequest = new PaymentCaptureRequest($request); + $singleResponseObj = $service->captureAuthorisedPayment( + $request['paymentPspReference'], + $paymentCaptureRequest, + $requestOptions + ); + + $singleResponse = $singleResponseObj->toArray(); $singleResponse[self::FORMATTED_CAPTURE_AMOUNT] = $request['amount']['currency'] . ' ' . $this->adyenHelper->originalAmount( $request['amount']['value'], @@ -101,9 +155,7 @@ private function placeMultipleCaptureRequests($service, $requestContainer, $requ $singleResponse = $this->copyParamsToResponse($singleResponse, $request); $response[self::MULTIPLE_AUTHORIZATIONS][] = $singleResponse; } catch (AdyenException $e) { - $pspReference = isset($request[OrderPaymentInterface::PSPREFRENCE]) ? - $request[OrderPaymentInterface::PSPREFRENCE] : - 'pspReference not set'; + $pspReference = $request[OrderPaymentInterface::PSPREFRENCE] ?? 'pspReference not set'; $message = sprintf( 'Exception occurred when attempting to capture multiple authorizations. @@ -120,6 +172,11 @@ private function placeMultipleCaptureRequests($service, $requestContainer, $requ return $response; } + /** + * @param array $response + * @param array $request + * @return array + */ private function copyParamsToResponse(array $response, array $request): array { $response[self::CAPTURE_AMOUNT] = $request['amount']['value']; diff --git a/Gateway/Http/Client/TransactionDonate.php b/Gateway/Http/Client/TransactionDonate.php index 7475993fc9..094ea18703 100644 --- a/Gateway/Http/Client/TransactionDonate.php +++ b/Gateway/Http/Client/TransactionDonate.php @@ -14,18 +14,37 @@ use Adyen\AdyenException; use Adyen\Client; +use Adyen\Model\Checkout\DonationPaymentRequest; use Adyen\Payment\Helper\Data; use Adyen\Payment\Helper\Idempotency; -use Adyen\Service\Checkout; +use Adyen\Service\Checkout\DonationsApi; +use Magento\Framework\Exception\NoSuchEntityException; use Magento\Payment\Gateway\Http\ClientInterface; use Magento\Payment\Gateway\Http\TransferInterface; class TransactionDonate implements ClientInterface { + /** + * @var Client + */ private Client $client; + + /** + * @var Data + */ private Data $adyenHelper; + + /** + * @var Idempotency + */ private Idempotency $idempotencyHelper; + /** + * @param Data $adyenHelper + * @param Idempotency $idempotencyHelper + * @throws AdyenException + * @throws NoSuchEntityException + */ public function __construct( Data $adyenHelper, Idempotency $idempotencyHelper @@ -37,15 +56,16 @@ public function __construct( } /** - * @inheritDoc + * @param TransferInterface $transferObject + * @return array * @throws AdyenException */ - public function placeRequest(TransferInterface $transferObject) + public function placeRequest(TransferInterface $transferObject): array { $request = $transferObject->getBody(); $headers = $transferObject->getHeaders(); - $service = new Checkout($this->client); + $service = new DonationsApi($this->client); $idempotencyKey = $this->idempotencyHelper->generateIdempotencyKey( $request, @@ -54,10 +74,12 @@ public function placeRequest(TransferInterface $transferObject) $requestOptions['idempotencyKey'] = $idempotencyKey; $requestOptions['headers'] = $this->adyenHelper->buildRequestHeaders(); + $request['applicationInfo'] = $this->adyenHelper->buildApplicationInfo($this->client); $this->adyenHelper->logRequest($request, Client::API_CHECKOUT_VERSION, 'donations'); try { - $response = $service->donations($request, $requestOptions); + $responseObj = $service->donations(new DonationPaymentRequest($request), $requestOptions); + $response = $responseObj->toArray(); } catch (AdyenException $e) { $response = ['error' => $e->getMessage()]; } diff --git a/Gateway/Http/Client/TransactionPayment.php b/Gateway/Http/Client/TransactionPayment.php index d5aa8019b9..1e4cb800b9 100644 --- a/Gateway/Http/Client/TransactionPayment.php +++ b/Gateway/Http/Client/TransactionPayment.php @@ -13,7 +13,9 @@ use Adyen\AdyenException; use Adyen\Client; -use Adyen\Payment\Gateway\Request\HeaderDataBuilder; +use Adyen\ConnectionException; +use Adyen\Model\Checkout\PaymentRequest; +use Adyen\Model\Checkout\PaymentResponse as CheckoutPaymentResponse; use Adyen\Payment\Helper\Data; use Adyen\Payment\Helper\GiftcardPayment; use Adyen\Payment\Helper\Idempotency; @@ -21,23 +23,61 @@ use Adyen\Payment\Model\PaymentResponse; use Adyen\Payment\Model\PaymentResponseFactory; use Adyen\Payment\Model\ResourceModel\PaymentResponse as PaymentResponseResourceModel; -use Adyen\Service\Checkout; +use Adyen\Service\Checkout\PaymentsApi; +use Magento\Framework\Exception\AlreadyExistsException; +use Magento\Framework\Exception\NoSuchEntityException; use Magento\Payment\Gateway\Http\ClientInterface; use Magento\Payment\Gateway\Http\TransferInterface; use Magento\Store\Model\StoreManagerInterface; class TransactionPayment implements ClientInterface { + /** + * @var Data + */ private Data $adyenHelper; + + /** + * @var PaymentResponseFactory + */ private PaymentResponseFactory $paymentResponseFactory; + + /** + * @var PaymentResponseResourceModel + */ private PaymentResponseResourceModel $paymentResponseResourceModel; + + /** + * @var Idempotency + */ private Idempotency $idempotencyHelper; + + /** + * @var OrdersApi + */ private OrdersApi $orderApiHelper; + + /** + * @var StoreManagerInterface + */ private StoreManagerInterface $storeManager; + + /** + * @var GiftcardPayment + */ private GiftcardPayment $giftcardPaymentHelper; private ?int $remainingOrderAmount; + /** + * @param Data $adyenHelper + * @param PaymentResponseFactory $paymentResponseFactory + * @param PaymentResponseResourceModel $paymentResponseResourceModel + * @param Idempotency $idempotencyHelper + * @param OrdersApi $orderApiHelper + * @param StoreManagerInterface $storeManager + * @param GiftcardPayment $giftcardPaymentHelper + */ public function __construct( Data $adyenHelper, PaymentResponseFactory $paymentResponseFactory, @@ -57,63 +97,93 @@ public function __construct( $this->remainingOrderAmount = null; } + /** + * @param TransferInterface $transferObject + * @return array + * @throws AdyenException + * @throws AlreadyExistsException + * @throws ConnectionException + * @throws NoSuchEntityException + */ public function placeRequest(TransferInterface $transferObject): array { - $request = $transferObject->getBody(); + $requestData = $transferObject->getBody(); $headers = $transferObject->getHeaders(); $clientConfig = $transferObject->getClientConfig(); - $this->remainingOrderAmount = $request['amount']['value']; + $this->remainingOrderAmount = $requestData['amount']['value']; // If the payments call is already done return the request - if (!empty($request['resultCode'])) { + if (!empty($requestData['resultCode'])) { //Initiate has already a response - return $request; + return $requestData; } $client = $this->adyenHelper->initializeAdyenClientWithClientConfig($clientConfig); - $service = $this->adyenHelper->createAdyenCheckoutService($client); + $service = $this->adyenHelper->initializePaymentsApi($client); + $responseCollection = []; + $responseCollection['hasOnlyGiftCards'] = false; try { - list($request, $giftcardResponse) = $this->processGiftcards($request, $service); - if (isset($giftcardResponse) && $this->remainingOrderAmount === 0) { - return $giftcardResponse; + list($requestData, $giftcardResponseCollection) = $this->processGiftcards($requestData, $service); + + /** @var array $responseCollection */ + if (!empty($giftcardResponseCollection)) { + $responseCollection = array_merge($responseCollection, $giftcardResponseCollection); + + if ($this->remainingOrderAmount === 0) { + $responseCollection['hasOnlyGiftCards'] = true; + return $responseCollection; + } } + $requestData['applicationInfo'] = $this->adyenHelper->buildApplicationInfo($client); + $paymentRequest = new PaymentRequest($requestData); + $idempotencyKey = $this->idempotencyHelper->generateIdempotencyKey( - $request, + $requestData, $headers['idempotencyExtraData'] ?? null ); $requestOptions['idempotencyKey'] = $idempotencyKey; $requestOptions['headers'] = $headers; - - $this->adyenHelper->logRequest($request, Client::API_CHECKOUT_VERSION, '/payments'); - $response = $service->payments($request, $requestOptions); + $this->adyenHelper->logRequest($requestData, Client::API_CHECKOUT_VERSION, '/payments'); + $response = $service->payments($paymentRequest, $requestOptions); // Store the /payments response in the database in case it is needed in order to finish the payment /** @var PaymentResponse $paymentResponse */ $paymentResponse = $this->paymentResponseFactory->create(); - $paymentResponse->setResponse(json_encode($response)); - $paymentResponse->setResultCode($response['resultCode']); - $paymentResponse->setMerchantReference($request["reference"]); - + $paymentResponse->setResponse((string)$response); + $paymentResponse->setResultCode($response->getResultCode()); + $paymentResponse->setMerchantReference($requestData["reference"]); $this->paymentResponseResourceModel->save($paymentResponse); + $responseData = $response->toArray(); + $responseCollection[] = $responseData; + + $this->adyenHelper->logResponse($responseData); } catch (AdyenException $e) { - $response['error'] = $e->getMessage(); - $response['errorCode'] = $e->getAdyenErrorCode(); + $this->adyenHelper->logAdyenException($e); } - $this->adyenHelper->logResponse($response); - return $response; + return $responseCollection; } + /** + * @param array $request + * @param PaymentsApi $service + * @param array $redeemedGiftcards + * @param array $ordersResponse + * @return array + * @throws AdyenException + * @throws AlreadyExistsException + */ private function handleGiftcardPayments( array $request, - Checkout $service, + PaymentsApi $service, array $redeemedGiftcards, array $ordersResponse ): array { - $response = []; + + $giftCardResponseCollection = []; foreach ($redeemedGiftcards as $giftcard) { $stateData = json_decode($giftcard['state_data'], true); @@ -141,25 +211,33 @@ private function handleGiftcardPayments( '/payments' ); - $response = $service->payments($giftcardPaymentRequest); - - $this->adyenHelper->logResponse($response); + $response = $service->payments(new PaymentRequest($giftcardPaymentRequest)); /** @var PaymentResponse $paymentResponse */ $paymentResponse = $this->paymentResponseFactory->create(); $paymentResponse->setResponse(json_encode($response)); $paymentResponse->setResultCode($response['resultCode']); $paymentResponse->setMerchantReference($request["reference"]); - $this->paymentResponseResourceModel->save($paymentResponse); $this->remainingOrderAmount -= $deductedAmount; + $responseArray = $response->toArray(); + $giftCardResponseCollection[] = $responseArray; + $this->adyenHelper->logResponse($responseArray); } - return $response; + return $giftCardResponseCollection; } - public function processGiftcards(array $request, Checkout $service): array + /** + * @param array $request + * @param PaymentsApi $service + * @return array + * @throws AdyenException + * @throws AlreadyExistsException + * @throws NoSuchEntityException + */ + public function processGiftcards(array $request, PaymentsApi $service): array { if (isset($request['giftcardRequestParameters'])) { $redeemedGiftcards = $request['giftcardRequestParameters']; @@ -172,7 +250,7 @@ public function processGiftcards(array $request, Checkout $service): array $this->storeManager->getStore()->getId() ); - $giftcardResponse = $this->handleGiftcardPayments($request, $service, $redeemedGiftcards, $ordersResponse); + $giftcardResponseCollection = $this->handleGiftcardPayments($request, $service, $redeemedGiftcards, $ordersResponse); $request['amount']['value'] = $this->remainingOrderAmount; $request['order'] = [ @@ -180,8 +258,9 @@ public function processGiftcards(array $request, Checkout $service): array 'orderData' => $ordersResponse['orderData'] ]; } else { - $giftcardResponse = null; + $giftcardResponseCollection = []; } - return array($request, $giftcardResponse); + + return array($request, $giftcardResponseCollection); } } diff --git a/Gateway/Http/Client/TransactionPaymentLinks.php b/Gateway/Http/Client/TransactionPaymentLinks.php index e3e71d13aa..c43d5d81bf 100644 --- a/Gateway/Http/Client/TransactionPaymentLinks.php +++ b/Gateway/Http/Client/TransactionPaymentLinks.php @@ -13,16 +13,30 @@ use Adyen\AdyenException; use Adyen\Client; +use Adyen\Model\Checkout\PaymentLinkRequest; use Adyen\Payment\Helper\Data; use Adyen\Payment\Helper\Idempotency; +use Adyen\Service\Checkout\PaymentLinksApi; +use Magento\Framework\Exception\NoSuchEntityException; use Magento\Payment\Gateway\Http\ClientInterface; use Magento\Payment\Gateway\Http\TransferInterface; class TransactionPaymentLinks implements ClientInterface { + /** + * @var Data + */ private Data $adyenHelper; + + /** + * @var Idempotency + */ private Idempotency $idempotencyHelper; + /** + * @param Data $adyenHelper + * @param Idempotency $idempotencyHelper + */ public function __construct( Data $adyenHelper, Idempotency $idempotencyHelper @@ -31,6 +45,12 @@ public function __construct( $this->idempotencyHelper = $idempotencyHelper; } + /** + * @param TransferInterface $transferObject + * @return array + * @throws AdyenException + * @throws NoSuchEntityException + */ public function placeRequest(TransferInterface $transferObject): array { $request = $transferObject->getBody(); @@ -38,11 +58,11 @@ public function placeRequest(TransferInterface $transferObject): array $clientConfig = $transferObject->getClientConfig(); $client = $this->adyenHelper->initializeAdyenClientWithClientConfig($clientConfig); - $service = $this->adyenHelper->createAdyenCheckoutService($client); + $service = new PaymentLinksApi($client); // If the payment links call is already done return the request if (!empty($request['resultCode'])) { - //Initiate has already a response + // Initiate has already a response return $request; } @@ -53,10 +73,12 @@ public function placeRequest(TransferInterface $transferObject): array $requestOptions['idempotencyKey'] = $idempotencyKey; $requestOptions['headers'] = $this->adyenHelper->buildRequestHeaders(); + $request['applicationInfo'] = $this->adyenHelper->buildApplicationInfo($client); $this->adyenHelper->logRequest($request, Client::API_CHECKOUT_VERSION, '/paymentLinks'); try { - $response = $service->paymentLinks($request, $requestOptions); + $responseObj = $service->paymentLinks(new PaymentLinkRequest($request), $requestOptions); + $response = $responseObj->toArray(); } catch (AdyenException $e) { $response['error'] = $e->getMessage(); } diff --git a/Gateway/Http/Client/TransactionRefund.php b/Gateway/Http/Client/TransactionRefund.php index c67b95503e..3484c030d0 100644 --- a/Gateway/Http/Client/TransactionRefund.php +++ b/Gateway/Http/Client/TransactionRefund.php @@ -13,8 +13,10 @@ use Adyen\AdyenException; use Adyen\Client; +use Adyen\Model\Checkout\PaymentRefundRequest; use Adyen\Payment\Helper\Data; use Adyen\Payment\Helper\Idempotency; +use Magento\Framework\Exception\NoSuchEntityException; use Magento\Payment\Gateway\Http\TransferInterface; /** @@ -22,9 +24,20 @@ */ class TransactionRefund implements TransactionRefundInterface { + /** + * @var Data + */ private Data $adyenHelper; + + /** + * @var Idempotency + */ private Idempotency $idempotencyHelper; + /** + * @param Data $adyenHelper + * @param Idempotency $idempotencyHelper + */ public function __construct( Data $adyenHelper, Idempotency $idempotencyHelper @@ -33,37 +46,52 @@ public function __construct( $this->idempotencyHelper = $idempotencyHelper; } + /** + * @param TransferInterface $transferObject + * @return array + * @throws AdyenException + * @throws NoSuchEntityException + */ public function placeRequest(TransferInterface $transferObject): array { $requests = $transferObject->getBody(); $headers = $transferObject->getHeaders(); $clientConfig = $transferObject->getClientConfig(); + $client = $this->adyenHelper->initializeAdyenClientWithClientConfig($clientConfig); - $service = $this->adyenHelper->createAdyenCheckoutService($client); + $service = $this->adyenHelper->initializeModificationsApi($client); + $responses = []; foreach ($requests as $request) { + $responseData = []; $idempotencyKey = $this->idempotencyHelper->generateIdempotencyKey( $request, $headers['idempotencyExtraData'] ?? null ); $requestOptions['idempotencyKey'] = $idempotencyKey; $requestOptions['headers'] = $this->adyenHelper->buildRequestHeaders(); - $this->adyenHelper->logRequest($request, Client::API_CHECKOUT_VERSION, '/refunds'); + $request['applicationInfo'] = $this->adyenHelper->buildApplicationInfo($client); + $paymentRefundRequest = new PaymentRefundRequest($request); + try { - $response = $service->refunds($request, $requestOptions); + $response = $service->refundCapturedPayment( + $request['paymentPspReference'], + $paymentRefundRequest, + $requestOptions + ); + $responseData = $response->toArray(); // Add amount original reference and amount information to response - $response[self::REFUND_AMOUNT] = $request['amount']['value']; - $response[self::REFUND_CURRENCY] = $request['amount']['currency']; - $response[self::ORIGINAL_REFERENCE] = $request['paymentPspReference']; + $responseData[self::REFUND_AMOUNT] = $request['amount']['value']; + $responseData[self::REFUND_CURRENCY] = $request['amount']['currency']; + $responseData[self::ORIGINAL_REFERENCE] = $request['paymentPspReference']; + $this->adyenHelper->logResponse($responseData); } catch (AdyenException $e) { - $response = ['error' => $e->getMessage()]; + $this->adyenHelper->logAdyenException($e); } + $responses[] = $responseData; } - $this->adyenHelper->logResponse($response); - $responses[] = $response; - return $responses; } } diff --git a/Gateway/Request/HeaderDataBuilder.php b/Gateway/Request/HeaderDataBuilder.php index e01494e7ac..66cd1aa703 100644 --- a/Gateway/Request/HeaderDataBuilder.php +++ b/Gateway/Request/HeaderDataBuilder.php @@ -18,7 +18,7 @@ class HeaderDataBuilder implements BuilderInterface { - const FRONTENDTYPE = 'frontendType'; + const FRONTENDTYPE = 'external-platform-frontendtype'; const FRONTENDTYPE_HEADLESS = 'headless'; /** diff --git a/Gateway/Request/RecurringVaultDataBuilder.php b/Gateway/Request/RecurringVaultDataBuilder.php index 95a0df6e1a..1e9a32426a 100644 --- a/Gateway/Request/RecurringVaultDataBuilder.php +++ b/Gateway/Request/RecurringVaultDataBuilder.php @@ -59,9 +59,11 @@ public function build(array $buildSubject): array /* * allow3DS flag is required to trigger the native 3DS challenge. * Otherwise, shopper will be redirected to the issuer for challenge. + * Due to new VISA compliance requirements, holderName is added to the payments call */ if ($paymentMethod->getCode() === AdyenCcConfigProvider::CC_VAULT_CODE) { $requestBody['additionalData']['allow3DS2'] = true; + $requestBody['paymentMethod']['holderName'] = $details['cardHolderName'] ?? null; } /** diff --git a/Gateway/Response/CheckoutPaymentCommentHistoryHandler.php b/Gateway/Response/CheckoutPaymentCommentHistoryHandler.php index 18a50ff362..1fc333259b 100644 --- a/Gateway/Response/CheckoutPaymentCommentHistoryHandler.php +++ b/Gateway/Response/CheckoutPaymentCommentHistoryHandler.php @@ -11,51 +11,37 @@ namespace Adyen\Payment\Gateway\Response; +use Magento\Payment\Gateway\Helper\SubjectReader; use Magento\Payment\Gateway\Response\HandlerInterface; class CheckoutPaymentCommentHistoryHandler implements HandlerInterface { /** * @param array $handlingSubject - * @param array $response + * @param array $responseCollection * @return $this */ - public function handle(array $handlingSubject, array $response) + public function handle(array $handlingSubject, array $responseCollection): self { - $readPayment = \Magento\Payment\Gateway\Helper\SubjectReader::readPayment($handlingSubject); - + $readPayment = SubjectReader::readPayment($handlingSubject); $payment = $readPayment->getPayment(); - $comment = __("Adyen Result response:"); - if (isset($response['resultCode'])) { - $responseCode = $response['resultCode']; - } else { - // try to get response from response key (used for modifications - if (isset($response['response'])) { - $responseCode = $response['response']; - } else { - $responseCode = ""; - } - } - - if (isset($response['pspReference'])) { - $pspReference = $response['pspReference']; - } else { - $pspReference = ""; - } + foreach ($responseCollection as $response) { + $responseCode = $response['resultCode'] ?? $response['response'] ?? ''; - if ($responseCode) { - $comment .= '
' . __('authResult:') . ' ' . $responseCode; - $payment->getOrder()->setAdyenResulturlEventCode($responseCode); - } + if (!empty($responseCode)) { + $comment .= '
' . __('authResult:') . ' ' . $responseCode; + $payment->getOrder()->setAdyenResulturlEventCode($responseCode); + } - if ($pspReference) { - $comment .= '
' . __('pspReference:') . ' ' . $pspReference; + if (isset($response['pspReference'])) { + $comment .= '
' . __('pspReference:') . ' ' . $response['pspReference']; + } + $comment .= '
'; } $payment->getOrder()->addStatusHistoryComment($comment, $payment->getOrder()->getStatus()); - return $this; } } diff --git a/Gateway/Response/CheckoutPaymentsDetailsHandler.php b/Gateway/Response/CheckoutPaymentsDetailsHandler.php index 370b4fca98..d9183c6115 100644 --- a/Gateway/Response/CheckoutPaymentsDetailsHandler.php +++ b/Gateway/Response/CheckoutPaymentsDetailsHandler.php @@ -32,7 +32,7 @@ public function __construct( * This is being used for all checkout methods (adyen hpp payment method) * */ - public function handle(array $handlingSubject, array $response) + public function handle(array $handlingSubject, array $responseCollection) { $paymentDataObject = SubjectReader::readPayment($handlingSubject); @@ -48,6 +48,9 @@ public function handle(array $handlingSubject, array $response) $payment->getOrder()->setCanSendNewEmailFlag(false); } + // for partial payments, non-giftcard payments will always be the last element in the collection + // for non-partial, there is only one response in the collection + $response = end($responseCollection); if (!empty($response['pspReference'])) { // set pspReference as transactionId $payment->setCcTransId($response['pspReference']); @@ -57,7 +60,7 @@ public function handle(array $handlingSubject, array $response) $payment->setTransactionId($response['pspReference']); } - // do not close transaction so you can do a cancel() and void + // do not close transaction, so you can do a cancel() and void $payment->setIsTransactionClosed(false); $payment->setShouldCloseParentTransaction(false); } diff --git a/Gateway/Response/VaultDetailsHandler.php b/Gateway/Response/VaultDetailsHandler.php index 3ae2fa368f..7b34b5ae5b 100644 --- a/Gateway/Response/VaultDetailsHandler.php +++ b/Gateway/Response/VaultDetailsHandler.php @@ -35,13 +35,16 @@ public function __construct(Vault $vaultHelper) /** * @param array $handlingSubject - * @param array $response + * @param array $responseCollection * @return void - * @throws LocalizedException */ - public function handle(array $handlingSubject, array $response): void + public function handle(array $handlingSubject, array $responseCollection): void { - if (empty($response['additionalData'])) { + // for (non-) partial payments, the non-giftcard payment is always last. + $response = end($responseCollection); + + // payments without additional data or only giftcards should be ignored. + if (empty($response['additionalData']) || $responseCollection['hasOnlyGiftCards']) { return; } diff --git a/Gateway/Validator/CheckoutResponseValidator.php b/Gateway/Validator/CheckoutResponseValidator.php index e639089138..102177dfd6 100644 --- a/Gateway/Validator/CheckoutResponseValidator.php +++ b/Gateway/Validator/CheckoutResponseValidator.php @@ -57,82 +57,119 @@ public function __construct( * @param array $validationSubject * @return ResultInterface */ - public function validate(array $validationSubject) + public function validate(array $validationSubject): ResultInterface { - $response = SubjectReader::readResponse($validationSubject); - $paymentDataObjectInterface = SubjectReader::readPayment($validationSubject); + // Extract all the payment responses + $responseCollection = $validationSubject['response']; + unset($validationSubject['response']); + // Assign the remaining items to $commandSubject + $commandSubject = $validationSubject; + + if (empty($responseCollection)) { + throw new ValidatorException(__("No responses were provided")); + } + + // hasOnlyGiftCards is needed later but cannot be processed as a response + unset($responseCollection['hasOnlyGiftCards']); + foreach ($responseCollection as $thisResponse) { + $responseSubject = array_merge($commandSubject, ['response' => $thisResponse]); + $this->validateResponse($responseSubject); + } + + return $this->createResult(true); + } + + /** + * @throws ValidatorException + */ + private function validateResponse($responseSubject): void + { + $response = SubjectReader::readResponse($responseSubject); + $paymentDataObjectInterface = SubjectReader::readPayment($responseSubject); $payment = $paymentDataObjectInterface->getPayment(); $payment->setAdditionalInformation('3dActive', false); - $isValid = true; - $errorMessages = []; // validate result - if (!empty($response['resultCode'])) { - $resultCode = $response['resultCode']; - $payment->setAdditionalInformation('resultCode', $resultCode); - - if (!empty($response['action'])) { - $payment->setAdditionalInformation('action', $response['action']); - } - - if (!empty($response['additionalData'])) { - $payment->setAdditionalInformation('additionalData', $response['additionalData']); - } - - if (!empty($response['pspReference'])) { - $payment->setAdditionalInformation('pspReference', $response['pspReference']); - } - - if (!empty($response['details'])) { - $payment->setAdditionalInformation('details', $response['details']); - } - - if (!empty($response['donationToken'])) { - $payment->setAdditionalInformation('donationToken', $response['donationToken']); - } - - switch ($resultCode) { - case "Authorised": - case "Received": - // Save cc_type if available in the response - if (!empty($response['additionalData']['paymentMethod'])) { - $ccType = $this->adyenHelper->getMagentoCreditCartType( - $response['additionalData']['paymentMethod'] - ); - $payment->setAdditionalInformation('cc_type', $ccType); - $payment->setCcType($ccType); - } - break; - case "IdentifyShopper": - case "ChallengeShopper": - case "PresentToShopper": - case 'Pending': - case "RedirectShopper": - // nothing extra - break; - case "Refused": - $errorMsg = __('The payment is REFUSED.'); - // this will result the specific error - throw new ValidatorException($errorMsg); - default: - $errorMsg = __('Error with payment method please select different payment method.'); - throw new ValidatorException($errorMsg); - } - } else { - if (!empty($response['error'])) { - $this->adyenLogger->error($response['error']); - } + if (empty($response['resultCode'])) { + $this->handleEmptyResultCode($response); + } - if (!empty($response['errorCode']) && !empty($response['error']) && in_array($response['errorCode'], self::ALLOWED_ERROR_CODES, true)) { - $errorMsg = __($response['error']); - } else { - $errorMsg = __('Error with payment method, please select a different payment method.'); - } + $this->validateResult($response, $payment); + } + + /** + * @throws ValidatorException + */ + private function validateResult($response, $payment) + { + $resultCode = $response['resultCode']; + $payment->setAdditionalInformation('resultCode', $resultCode); + + if (!empty($response['action'])) { + $payment->setAdditionalInformation('action', $response['action']); + } - throw new ValidatorException($errorMsg); + if (!empty($response['additionalData'])) { + $payment->setAdditionalInformation('additionalData', $response['additionalData']); + } + + if (!empty($response['pspReference'])) { + $payment->setAdditionalInformation('pspReference', $response['pspReference']); + } + + if (!empty($response['details'])) { + $payment->setAdditionalInformation('details', $response['details']); + } + + if (!empty($response['donationToken'])) { + $payment->setAdditionalInformation('donationToken', $response['donationToken']); + } + + switch ($resultCode) { + case "Authorised": + case "Received": + // Save cc_type if available in the response + if (!empty($response['additionalData']['paymentMethod'])) { + $ccType = $this->adyenHelper->getMagentoCreditCartType( + $response['additionalData']['paymentMethod'] + ); + $payment->setAdditionalInformation('cc_type', $ccType); + $payment->setCcType($ccType); + } + break; + case "IdentifyShopper": + case "ChallengeShopper": + case "PresentToShopper": + case 'Pending': + case "RedirectShopper": + // nothing extra + break; + case "Refused": + $errorMsg = __('The payment is REFUSED.'); + // this will result the specific error + throw new ValidatorException($errorMsg); + default: + $errorMsg = __('Error with payment method please select different payment method.'); + throw new ValidatorException($errorMsg); + } + } + + /** + * @throws ValidatorException + */ + private function handleEmptyResultCode($response): never + { + if (!empty($response['error'])) { + $this->adyenLogger->error($response['error']); + } + + if (!empty($response['errorCode']) && !empty($response['error']) && in_array($response['errorCode'], self::ALLOWED_ERROR_CODES, true)) { + $errorMsg = __($response['error']); + } else { + $errorMsg = __('Error with payment method, please select a different payment method.'); } - return $this->createResult($isValid, $errorMessages); + throw new ValidatorException($errorMsg); } } diff --git a/Helper/Data.php b/Helper/Data.php index 81a41e5772..3b82731973 100755 --- a/Helper/Data.php +++ b/Helper/Data.php @@ -14,25 +14,32 @@ use Adyen\AdyenException; use Adyen\Client; use Adyen\Environment; +use Adyen\Model\Checkout\ApplicationInfo; +use Adyen\Model\Checkout\CommonField; +use Adyen\Model\Checkout\UtilityRequest; +use Adyen\Payment\Helper\Config as ConfigHelper; use Adyen\Payment\Gateway\Request\HeaderDataBuilder; use Adyen\Service\Checkout; use Adyen\Payment\Logger\AdyenLogger; use Adyen\Payment\Model\Config\Source\RenderMode; use Adyen\Payment\Model\RecurringType; use Adyen\Payment\Model\ResourceModel\Notification\CollectionFactory as NotificationCollectionFactory; -use Adyen\Payment\Helper\Config as ConfigHelper; use Adyen\Payment\Observer\AdyenPaymentMethodDataAssignObserver; -use Adyen\Service\CheckoutUtility; +use Adyen\Service\Checkout\ModificationsApi; +use Adyen\Service\Checkout\OrdersApi; +use Adyen\Service\Checkout\PaymentsApi; +use Adyen\Service\Checkout\UtilityApi; use Adyen\Service\PosPayment; use Adyen\Service\Recurring; +use Adyen\Service\RecurringApi; use DateTime; use Exception; use Magento\Backend\Helper\Data as BackendHelper; use Magento\Directory\Model\Config\Source\Country; use Magento\Framework\App\CacheInterface; +use Magento\Framework\App\Cache\Type\Config as ConfigCache; use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Framework\App\Helper\AbstractHelper; -use Magento\Framework\App\Cache\Type\Config as ConfigCache; use Magento\Framework\App\Helper\Context; use Magento\Framework\App\ObjectManager; use Magento\Framework\App\ProductMetadataInterface; @@ -1181,6 +1188,30 @@ public function buildRequestHeaders($payment = null) return $headers; } + public function buildApplicationInfo(Client $client) :ApplicationInfo + { + $applicationInfo = new ApplicationInfo(); + + $adyenLibrary['name'] = $client->getLibraryName(); // deprecated but no alternative was given. + $adyenLibrary['version'] = $client->getLibraryVersion(); // deprecated but no alternative was given. + + $applicationInfo->setAdyenLibrary(new CommonField($adyenLibrary)); + + if ($adyenPaymentSource = $client->getConfig()->getAdyenPaymentSource()) { + $applicationInfo->setAdyenPaymentSource(new CommonField($adyenPaymentSource)); + } + + if ($externalPlatform = $client->getConfig()->getExternalPlatform()) { + $applicationInfo->setExternalPlatform($externalPlatform); + } + + if ($merchantApplication = $client->getConfig()->getMerchantApplication()) { + $applicationInfo->setMerchantApplication(new CommonField($merchantApplication)); + } + + return $applicationInfo; + } + /** * @throws AdyenException * @throws NoSuchEntityException @@ -1197,6 +1228,26 @@ public function initializeAdyenClientWithClientConfig(array $clientConfig): Clie return $this->initializeAdyenClient($storeId, null, $motoMerchantAccount); } + public function initializePaymentsApi(Client $client):PaymentsApi + { + return new PaymentsApi($client); + } + + public function initializeModificationsApi(Client $client):ModificationsApi + { + return new ModificationsApi($client); + } + + public function initializeRecurringApi(Client $client):RecurringApi + { + return new RecurringApi($client); + } + + public function initializeOrdersApi(Client $client): OrdersApi + { + return new OrdersApi($client); + } + /** * @param Client $client * @return PosPayment @@ -1281,8 +1332,9 @@ private function getOriginKeyForOrigin($origin, $storeId = null) $client = $this->initializeAdyenClient($storeId); try { - $service = $this->createAdyenCheckoutUtilityService($client); - $response = $service->originKeys($params); + $service = new UtilityApi($client); + $responseObj = $service->originKeys(new UtilityRequest($params)); + $response = json_decode(json_encode($responseObj->jsonSerialize()), true); } catch (Exception $e) { $this->adyenLogger->error($e->getMessage()); } @@ -1318,16 +1370,6 @@ public function getCheckoutEnvironment($storeId = null) } } - /** - * @param Client $client - * @return CheckoutUtility - * @throws AdyenException - */ - private function createAdyenCheckoutUtilityService($client) - { - return new CheckoutUtility($client); - } - /** * Method can be used by interceptors to provide the customer ID in a different way. * @@ -1376,6 +1418,7 @@ public function isHppVaultEnabled($storeId = null) * @return Checkout * @throws AdyenException * @throws NoSuchEntityException + * @deprecared use `initializePaymentsApi`, or `initializeModificationsApi` based on your case */ public function createAdyenCheckoutService(Client $client = null): Checkout { @@ -1390,6 +1433,7 @@ public function createAdyenCheckoutService(Client $client = null): Checkout * @param $client * @return Recurring * @throws AdyenException + * @deprecared use `initializeRecurringApi()` */ public function createAdyenRecurringService($client) { @@ -1516,6 +1560,14 @@ public function logResponse(array $response) $this->adyenLogger->info('Response from Adyen API', $context); } + public function logAdyenException(AdyenException $e) + { + $responseArray = []; + $responseArray['error'] = $e->getMessage(); + $responseArray['errorCode'] = $e->getAdyenErrorCode(); + $this->logResponse($responseArray); + } + private function filterReferences(array $data): array { return array_filter($data, function($value, $key) { diff --git a/Helper/ManagementHelper.php b/Helper/ManagementHelper.php index b745f1a486..2baa4059c3 100644 --- a/Helper/ManagementHelper.php +++ b/Helper/ManagementHelper.php @@ -16,8 +16,15 @@ */ use Adyen\AdyenException; -use Adyen\ConnectionException; -use Adyen\Service\Management; +use Adyen\Client; +use Adyen\Model\Management\CreateAllowedOriginRequest; +use Adyen\Model\Management\CreateMerchantWebhookRequest; +use Adyen\Model\Management\TestWebhookRequest; +use Adyen\Model\Management\TestWebhookResponse; +use Adyen\Model\Management\UpdateMerchantWebhookRequest; +use Adyen\Service\Management\AccountMerchantLevelApi; +use Adyen\Service\Management\MyAPICredentialApi; +use Adyen\Service\Management\WebhooksMerchantLevelApi; use Magento\Framework\Exception\NoSuchEntityException; use Magento\Framework\Message\ManagerInterface; use Magento\Store\Model\StoreManager; @@ -29,32 +36,30 @@ class ManagementHelper /** * @var Data */ - private $dataHelper; + private Data $dataHelper; /** * @var StoreManager */ - private $storeManager; + private StoreManager $storeManager; /** * @var Config */ - private $configHelper; + private Config $configHelper; /** * @var EncryptorInterface */ - private $encryptor; + private EncryptorInterface $encryptor; /** - * Logging instance - * * @var AdyenLogger */ - private $adyenLogger; + private AdyenLogger $adyenLogger; /** * @var ManagerInterface */ - protected $messageManager; + protected ManagerInterface $messageManager; /** * ManagementHelper constructor. @@ -66,12 +71,12 @@ class ManagementHelper * @param ManagerInterface $messageManager */ public function __construct( - StoreManager $storeManager, + StoreManager $storeManager, EncryptorInterface $encryptor, - Data $dataHelper, - Config $configHelper, - AdyenLogger $adyenLogger, - ManagerInterface $messageManager + Data $dataHelper, + Config $configHelper, + AdyenLogger $adyenLogger, + ManagerInterface $messageManager ) { $this->dataHelper = $dataHelper; $this->storeManager = $storeManager; @@ -82,18 +87,23 @@ public function __construct( } /** - * @param Management $managementApiService + * @param AccountMerchantLevelApi $accountMerchantLevelApi + * @param MyAPICredentialApi $myAPICredentialApi * @return array - * @throws AdyenException | ConnectionException + * @throws AdyenException * @throws NoSuchEntityException */ - public function getMerchantAccountsAndClientKey(Management $managementApiService): array - { + public function getMerchantAccountsAndClientKey( + AccountMerchantLevelApi $accountMerchantLevelApi, + MyAPICredentialApi $myAPICredentialApi + ): array { $merchantAccounts = []; $page = 1; $pageSize = 100; - //get the merchant accounts using get /merchants. - $responseMerchants = $managementApiService->merchantAccount->list(["pageSize" => $pageSize]); + $responseMerchantsObj = $accountMerchantLevelApi->listMerchantAccounts( + ['queryParams' => ['pageSize' => $pageSize]] + ); + $responseMerchants = $responseMerchantsObj->toArray(); while (count($merchantAccounts) < $responseMerchants['itemsTotal']) { foreach ($responseMerchants['data'] as $merchantAccount) { $defaultDC = array_filter($merchantAccount['dataCenters'], function ($dc) { @@ -107,12 +117,15 @@ public function getMerchantAccountsAndClientKey(Management $managementApiService } ++$page; if (isset($responseMerchants['_links']['next'])) { - $responseMerchants = $managementApiService->merchantAccount->list( - ["pageSize" => $pageSize, "pageNumber" => $page] + $responseMerchantsObj = $accountMerchantLevelApi->listMerchantAccounts( + ['queryParams' => ["pageSize" => $pageSize, "pageNumber" => $page]] ); + $responseMerchants = $responseMerchantsObj->toArray(); } } - $responseMe = $managementApiService->me->retrieve(); + + $responseMeObj = $myAPICredentialApi->getApiCredentialDetails(); + $responseMe = $responseMeObj->toArray(); $currentMerchantAccount = $this->configHelper->getMerchantAccount($this->storeManager->getStore()->getId()); @@ -129,18 +142,18 @@ public function getMerchantAccountsAndClientKey(Management $managementApiService * @param string $password * @param string $url * @param bool $demoMode - * @param Management $managementApiService + * @param WebhooksMerchantLevelApi $service * @return string|null * @throws AdyenException * @throws NoSuchEntityException */ public function setupWebhookCredentials( - string $merchantId, - string $username, - string $password, - string $url, - bool $demoMode, - Management $managementApiService + string $merchantId, + string $username, + string $password, + string $url, + bool $demoMode, + WebhooksMerchantLevelApi $service ): ?string { $params = [ 'url' => $url, @@ -176,8 +189,9 @@ public function setupWebhookCredentials( // Try to reuse saved webhookId if merchant account is the same. if (!empty($webhookId) && $merchantId === $savedMerchantAccount) { try { - $response = $managementApiService->merchantWebhooks->update($merchantId, $webhookId, $params); - } catch (AdyenException $exception){ + $updateRequest = new UpdateMerchantWebhookRequest($params); + $response = $service->updateWebhook($merchantId, $webhookId, $updateRequest); + } catch (AdyenException $exception) { $this->adyenLogger->error($exception->getMessage()); } } @@ -186,9 +200,9 @@ public function setupWebhookCredentials( if (!isset($response) || empty($webhookId)) { try { $params['type'] = 'standard'; - $response = $managementApiService->merchantWebhooks->create($merchantId, $params); + $response = $service->setUpWebhook($merchantId, new CreateMerchantWebhookRequest($params)); // save webhook_id to configuration - $webhookId = $response['id']; + $webhookId = $response->getId(); $this->configHelper->setConfigData($webhookId, 'webhook_id', Config::XML_ADYEN_ABSTRACT_PREFIX); } catch (\Exception $exception) { $this->adyenLogger->error($exception->getMessage()); @@ -198,8 +212,8 @@ public function setupWebhookCredentials( if (!empty($webhookId)) { try { // generate hmac key and save - $response = $managementApiService->merchantWebhooks->generateHmac($merchantId, $webhookId); - $hmacKey = $response['hmacKey']; + $response = $service->generateHmacKey($merchantId, $webhookId); + $hmacKey = $response->getHmacKey(); $hmac = $this->encryptor->encrypt($hmacKey); $mode = $demoMode ? 'test' : 'live'; $this->configHelper->setConfigData($hmac, 'notification_hmac_key_' . $mode, Config::XML_ADYEN_ABSTRACT_PREFIX); @@ -217,66 +231,60 @@ public function setupWebhookCredentials( } /** - * @param Management $managementApiService + * @param MyAPICredentialApi $service * @return array * @throws AdyenException */ - public function getAllowedOrigins(Management $managementApiService): array + public function getAllowedOrigins(MyAPICredentialApi $service): array { - $response = $managementApiService->allowedOrigins->list(); + $responseObj = $service->getAllowedOrigins(); + $response = $responseObj->toArray(); return !empty($response) ? array_column($response['data'], 'domain') : []; } /** - * @param Management $managementApiService + * @param MyAPICredentialApi $service * @param string $domain * @return void * @throws AdyenException */ - public function saveAllowedOrigin(Management $managementApiService, string $domain): void + public function saveAllowedOrigin(MyAPICredentialApi $service, string $domain): void { - $managementApiService->allowedOrigins->create(['domain' => $domain]); + $service->addAllowedOrigin(new CreateAllowedOriginRequest(['domain' => $domain])); } /** * @param string $merchantId * @param string $webhookId - * @param Management $managementApiService - * @return mixed|string + * @param WebhooksMerchantLevelApi $service + * @return TestWebhookResponse|null */ - public function webhookTest(string $merchantId, string $webhookId, Management $managementApiService) - { - $params = [ - 'types' => [ - 'AUTHORISATION' - ] - ]; - + public function webhookTest( + string $merchantId, + string $webhookId, + WebhooksMerchantLevelApi $service + ): ?TestWebhookResponse { + $testWebhookRequest = new TestWebhookRequest(['types' => ['AUTHORISATION']]); + $response = null; try { - $response = $managementApiService->merchantWebhooks->test($merchantId, $webhookId, $params); - - $this->adyenLogger->info( - sprintf( 'response from webhook test %s', - json_encode($response)) - ); - - return $response; + $response = $service->testWebhook($merchantId, $webhookId, $testWebhookRequest); + $this->adyenLogger->info(sprintf('response from webhook test %s', $response)); } catch (AdyenException $exception) { $this->adyenLogger->error($exception->getMessage()); - - return $exception->getMessage(); } + + return $response; } /** * @param string $apiKey * @param bool $demoMode - * @return Management + * @return Client * @throws AdyenException * @throws NoSuchEntityException */ - public function getManagementApiService(string $apiKey, bool $demoMode): Management + public function getAdyenApiClient(string $apiKey, bool $demoMode): Client { $environment = $demoMode ? 'test' : 'live'; $storeId = $this->storeManager->getStore()->getId(); @@ -286,8 +294,40 @@ public function getManagementApiService(string $apiKey, bool $demoMode): Managem $apiKey = $this->configHelper->getApiKey($environment); } - $client = $this->dataHelper->initializeAdyenClient($storeId, $apiKey, null, $environment === 'test'); + return $this->dataHelper->initializeAdyenClient( + $storeId, $apiKey, + null, + $environment === 'test' + ); + } + + /** + * @param Client $client + * @return AccountMerchantLevelApi + * @throws AdyenException + */ + public function getAccountMerchantLevelApi(Client $client): AccountMerchantLevelApi + { + return new AccountMerchantLevelApi($client); + } + + /** + * @param Client $client + * @return MyAPICredentialApi + * @throws AdyenException + */ + public function getMyAPICredentialApi(Client $client): MyAPICredentialApi + { + return new MyAPICredentialApi($client); + } - return new Management($client); + /** + * @param Client $client + * @return WebhooksMerchantLevelApi + * @throws AdyenException + */ + public function getWebhooksMerchantLevelApi(Client $client): WebhooksMerchantLevelApi + { + return new WebhooksMerchantLevelApi($client); } } diff --git a/Helper/OpenInvoice.php b/Helper/OpenInvoice.php index fad9152c18..85558ad24f 100644 --- a/Helper/OpenInvoice.php +++ b/Helper/OpenInvoice.php @@ -127,7 +127,7 @@ protected function getImageUrl($item): string $product = $item->getProduct(); $imageUrl = ""; - if ($image = $product->getSmallImage()) { + if ($product && $image = $product->getSmallImage()) { $imageUrl = $this->imageHelper->init($product, 'product_page_image_small') ->setImageFile($image) ->getUrl(); @@ -187,14 +187,14 @@ protected function formatLineItem(AdyenAmountCurrency $itemAmountCurrency, $item $product = $item->getProduct(); return [ - 'id' => $product->getId(), + 'id' => $product ? $product->getId() : $item->getProductId(), 'amountExcludingTax' => $formattedPriceExcludingTax, 'amountIncludingTax' => $formattedPriceIncludingTax, 'taxAmount' => $formattedTaxAmount, 'description' => $item->getName(), 'quantity' => (int) ($qty ?? $item->getQty()), 'taxPercentage' => $formattedTaxPercentage, - 'productUrl' => $product->getUrlModel()->getUrl($product), + 'productUrl' => $product ? $product->getUrlModel()->getUrl($product) : '', 'imageUrl' => $this->getImageUrl($item) ]; } diff --git a/Helper/OrdersApi.php b/Helper/OrdersApi.php index ee438a47cb..f173468263 100644 --- a/Helper/OrdersApi.php +++ b/Helper/OrdersApi.php @@ -12,17 +12,34 @@ namespace Adyen\Payment\Helper; use Adyen\AdyenException; +use Adyen\Model\Checkout\CreateOrderRequest; use Adyen\Client; -use Adyen\ConnectionException; use Adyen\Payment\Logger\AdyenLogger; +use Adyen\Service\Checkout\OrdersApi as CheckoutOrdersApi; use Magento\Framework\Exception\NoSuchEntityException; class OrdersApi { + /** + * @var Config + */ private Config $configHelper; + + /** + * @var Data + */ private Data $adyenHelper; + + /** + * @var AdyenLogger + */ private AdyenLogger $adyenLogger; + /** + * @param Config $configHelper + * @param Data $adyenHelper + * @param AdyenLogger $adyenLogger + */ public function __construct( Config $configHelper, Data $adyenHelper, @@ -40,7 +57,6 @@ public function __construct( * @param string $merchantReference * @return array * @throws AdyenException - * @throws ConnectionException * @throws NoSuchEntityException */ public function createOrder(string $merchantReference, int $amount, string $currency, string $storeId): array @@ -48,12 +64,13 @@ public function createOrder(string $merchantReference, int $amount, string $curr $request = $this->buildOrdersRequest($amount, $currency, $merchantReference, $storeId); $client = $this->adyenHelper->initializeAdyenClient($storeId); - $checkoutService = $this->adyenHelper->createAdyenCheckoutService($client); + $checkoutService = new CheckoutOrdersApi($client); try { $this->adyenHelper->logRequest($request, Client::API_CHECKOUT_VERSION, '/orders'); - $response = $checkoutService->orders($request); - } catch (ConnectionException $e) { + $responseObj = $checkoutService->orders(new CreateOrderRequest($request)); + $response = $responseObj->toArray(); + } catch (AdyenException $e) { $this->adyenLogger->error( "Connection to the endpoint failed. Check the Adyen Live endpoint prefix configuration." ); diff --git a/Helper/PaymentMethods.php b/Helper/PaymentMethods.php index ed0638a728..8e5d42387d 100644 --- a/Helper/PaymentMethods.php +++ b/Helper/PaymentMethods.php @@ -15,6 +15,7 @@ use Adyen\Client; use Adyen\ConnectionException; use Adyen\Payment\Helper\Util\PaymentMethodUtil; +use Adyen\Model\Checkout\PaymentMethodsRequest; use Adyen\Payment\Logger\AdyenLogger; use Adyen\Payment\Model\Notification; use Adyen\Payment\Model\Ui\Adminhtml\AdyenMotoConfigProvider; @@ -26,6 +27,7 @@ use Magento\Framework\App\Helper\Context; use Magento\Framework\App\RequestInterface; use Magento\Framework\Exception\LocalizedException; +use Magento\Framework\Exception\NoSuchEntityException; use Magento\Framework\Locale\ResolverInterface; use Magento\Framework\Serialize\SerializerInterface; use Magento\Framework\View\Asset\Repository; @@ -35,8 +37,11 @@ use Magento\Payment\Helper\Data as MagentoDataHelper; use Magento\Payment\Model\MethodInterface; use Magento\Quote\Api\CartRepositoryInterface; +use Magento\Quote\Api\Data\CartInterface; +use Magento\Quote\Model\Quote; use Magento\Sales\Model\Order; use Adyen\Payment\Helper\Data as AdyenDataHelper; +use Magento\Sales\Model\Order\Payment; use Magento\Store\Model\ScopeInterface; use Magento\Store\Model\Store; use Magento\Vault\Api\PaymentTokenRepositoryInterface; @@ -70,25 +75,116 @@ class PaymentMethods extends AbstractHelper AdyenMotoConfigProvider::CODE ]; + /** + * @var CartRepositoryInterface + */ protected CartRepositoryInterface $quoteRepository; + + /** + * @var ScopeConfigInterface + */ protected ScopeConfigInterface $config; + + /** + * @var Data + */ protected Data $adyenHelper; + + /** + * @var MagentoDataHelper + */ private MagentoDataHelper $dataHelper; + + /** + * @var ResolverInterface + */ protected ResolverInterface $localeResolver; + + /** + * @var AdyenLogger + */ protected AdyenLogger $adyenLogger; + + /** + * @var Data + */ protected Data $adyenDataHelper; + + /** + * @var Repository + */ protected Repository $assetRepo; + + /** + * @var RequestInterface + */ protected RequestInterface $request; + + /** + * @var Source + */ protected Source $assetSource; + + /** + * @var DesignInterface + */ protected DesignInterface $design; + + /** + * @var ThemeProviderInterface + */ protected ThemeProviderInterface $themeProvider; - protected \Magento\Quote\Model\Quote $quote; + + /** + * @var CartInterface + */ + protected CartInterface $quote; + + /** + * @var ChargedCurrency + */ private ChargedCurrency $chargedCurrency; + + /** + * @var Config + */ private Config $configHelper; + + /** + * @var SerializerInterface + */ private SerializerInterface $serializer; + + /** + * @var PaymentTokenRepositoryInterface + */ private PaymentTokenRepositoryInterface $paymentTokenRepository; + + /** + * @var SearchCriteriaBuilder + */ private SearchCriteriaBuilder $searchCriteriaBuilder; + /** + * @param Context $context + * @param CartRepositoryInterface $quoteRepository + * @param ScopeConfigInterface $config + * @param Data $adyenHelper + * @param ResolverInterface $localeResolver + * @param AdyenLogger $adyenLogger + * @param Repository $assetRepo + * @param RequestInterface $request + * @param Source $assetSource + * @param DesignInterface $design + * @param ThemeProviderInterface $themeProvider + * @param ChargedCurrency $chargedCurrency + * @param Config $configHelper + * @param MagentoDataHelper $dataHelper + * @param SerializerInterface $serializer + * @param Data $adyenDataHelper + * @param PaymentTokenRepositoryInterface $paymentTokenRepository + * @param SearchCriteriaBuilder $searchCriteriaBuilder + */ public function __construct( Context $context, CartRepositoryInterface $quoteRepository, @@ -129,6 +225,15 @@ public function __construct( $this->searchCriteriaBuilder = $searchCriteriaBuilder; } + /** + * @param int $quoteId + * @param string|null $country + * @param string|null $shopperLocale + * @return string + * @throws AdyenException + * @throws LocalizedException + * @throws NoSuchEntityException + */ public function getPaymentMethods(int $quoteId, ?string $country = null, ?string $shopperLocale = null): string { // get quote from quoteId @@ -143,11 +248,18 @@ public function getPaymentMethods(int $quoteId, ?string $country = null, ?string return $this->fetchPaymentMethods($country, $shopperLocale); } + /** + * @param string $methodCode + * @return bool + */ public function isAdyenPayment(string $methodCode): bool { return in_array($methodCode, $this->getAdyenPaymentMethods(), true); } + /** + * @return array + */ public function getAdyenPaymentMethods() : array { $paymentMethods = $this->dataHelper->getPaymentMethodList(); @@ -163,8 +275,17 @@ function ($key) { return array_keys($filtered); } - public function togglePaymentMethodsActivation(?bool $isActive =null, string $scope = ScopeConfigInterface::SCOPE_TYPE_DEFAULT, int $scopeId = 0): array - { + /** + * @param bool|null $isActive + * @param string $scope + * @param int $scopeId + * @return array + */ + public function togglePaymentMethodsActivation( + ?bool $isActive = null, + string $scope = ScopeConfigInterface::SCOPE_TYPE_DEFAULT, + int $scopeId = 0 + ): array { $enabledPaymentMethods = []; if (is_null($isActive)) { @@ -191,7 +312,7 @@ public function togglePaymentMethodsActivation(?bool $isActive =null, string $sc * @param int $scopeId * @return void */ - public function removePaymentMethodsActivation(string $scope, int $scopeId) : void + public function removePaymentMethodsActivation(string $scope, int $scopeId): void { foreach ($this->getAdyenPaymentMethods() as $paymentMethod) { @@ -203,6 +324,14 @@ public function removePaymentMethodsActivation(string $scope, int $scopeId) : vo } } + /** + * @param string|null $country + * @param string|null $shopperLocale + * @return string + * @throws AdyenException + * @throws LocalizedException + * @throws NoSuchEntityException + */ protected function fetchPaymentMethods(?string $country = null, ?string $shopperLocale = null): string { $quote = $this->getQuote(); @@ -240,7 +369,13 @@ protected function fetchPaymentMethods(?string $country = null, ?string $shopper return json_encode($response); } - protected function filterStoredPaymentMethods($allowMultistoreTokens, $responseData, $customerId) + /** + * @param $allowMultistoreTokens + * @param $responseData + * @param $customerId + * @return mixed + */ + protected function filterStoredPaymentMethods($allowMultistoreTokens, $responseData, $customerId): mixed { if (!$allowMultistoreTokens && isset($responseData['storedPaymentMethods'])) { $searchCriteria = $this->searchCriteriaBuilder @@ -264,6 +399,10 @@ function ($method) use ($gatewayTokens) { return $responseData; } + /** + * @return float + * @throws AdyenException + */ protected function getCurrentPaymentAmount(): float { $total = $this->chargedCurrency->getQuoteAmountCurrency($this->getQuote())->getAmount(); @@ -291,6 +430,10 @@ protected function getCurrentPaymentAmount(): float throw new AdyenException($exceptionMessage); } + /** + * @param Store $store + * @return string + */ protected function getCurrentCountryCode(Store $store): string { $quote = $this->getQuote(); @@ -314,17 +457,25 @@ protected function getCurrentCountryCode(Store $store): string return ""; } + /** + * @param array $requestParams + * @param Store $store + * @return array + * @throws AdyenException + * @throws NoSuchEntityException + */ protected function getPaymentMethodsResponse(array $requestParams, Store $store): array { // initialize the adyen client $client = $this->adyenHelper->initializeAdyenClient($store->getId()); // initialize service - $service = $this->adyenHelper->createAdyenCheckoutService($client); + $service =$this->adyenHelper->initializePaymentsApi($client); try { $this->adyenHelper->logRequest($requestParams, Client::API_CHECKOUT_VERSION, '/paymentMethods'); - $responseData = $service->paymentMethods($requestParams); + $response = $service->paymentMethods(new PaymentMethodsRequest($requestParams)); + $responseData = $response->toArray(); } catch (AdyenException $e) { $this->adyenLogger->error( "The Payment methods response is empty check your Adyen configuration in Magento." @@ -343,26 +494,45 @@ protected function getPaymentMethodsResponse(array $requestParams, Store $store) return $responseData; } - protected function getQuote(): \Magento\Quote\Model\Quote + /** + * @return CartInterface + */ + protected function getQuote(): CartInterface { return $this->quote; } - protected function setQuote(\Magento\Quote\Model\Quote $quote): void + /** + * @param CartInterface $quote + * @return void + */ + protected function setQuote(CartInterface $quote): void { $this->quote = $quote; } + /** + * @return string|null + */ protected function getCurrentShopperReference(): ?string { $customerId = $this->getQuote()->getCustomerId(); return $customerId ? (string)$customerId : null; } + /** + * @param $merchantAccount + * @param Store $store + * @param Quote $quote + * @param string|null $shopperLocale + * @param string|null $country + * @return array + * @throws AdyenException + */ protected function getPaymentMethodsRequest( $merchantAccount, Store $store, - \Magento\Quote\Model\Quote $quote, + Quote $quote, ?string $shopperLocale = null, ?string $country = null ): array { @@ -398,6 +568,12 @@ protected function getPaymentMethodsRequest( return $paymentMethodRequest; } + /** + * @param array $paymentMethods + * @param array $paymentMethodsExtraDetails + * @return array + * @throws LocalizedException + */ protected function showLogosPaymentMethods(array $paymentMethods, array $paymentMethodsExtraDetails): array { if (!$this->adyenHelper->showLogos()) { @@ -445,6 +621,12 @@ protected function showLogosPaymentMethods(array $paymentMethods, array $payment return $paymentMethodsExtraDetails; } + /** + * @param array $paymentMethods + * @param array $paymentMethodsExtraDetails + * @return array + * @throws AdyenException + */ protected function addExtraConfigurationToPaymentMethods( array $paymentMethods, array $paymentMethodsExtraDetails @@ -468,16 +650,29 @@ protected function addExtraConfigurationToPaymentMethods( return $paymentMethodsExtraDetails; } + /** + * @param MethodInterface $paymentMethodInstance + * @return bool + */ public function isWalletPaymentMethod(MethodInterface $paymentMethodInstance): bool { return boolval($paymentMethodInstance->getConfigData('is_wallet')); } + /** + * @param MethodInterface $paymentMethodInstance + * @return bool + */ public function isAlternativePaymentMethod(MethodInterface $paymentMethodInstance): bool { return $paymentMethodInstance->getConfigData('group') === self::ADYEN_GROUP_ALTERNATIVE_PAYMENT_METHODS; } + /** + * @param MethodInterface $paymentMethodInstance + * @return string + * @throws AdyenException + */ public function getAlternativePaymentMethodTxVariant(MethodInterface $paymentMethodInstance): string { if (!$this->isAlternativePaymentMethod($paymentMethodInstance)) { @@ -487,16 +682,28 @@ public function getAlternativePaymentMethodTxVariant(MethodInterface $paymentMet return str_replace('adyen_', '', $paymentMethodInstance->getCode()); } + /** + * @param MethodInterface $paymentMethodInstance + * @return bool + */ public function paymentMethodSupportsRecurring(MethodInterface $paymentMethodInstance): bool { return boolval($paymentMethodInstance->getConfigData('supports_recurring')); } + /** + * @param Payment $payment + * @param string $method + * @return bool + */ public function checkPaymentMethod(Order\Payment $payment, string $method): bool { return $payment->getMethod() === $method; } + /** + * @return array + */ public function getCcAvailableTypes(): array { $types = []; @@ -514,6 +721,9 @@ public function getCcAvailableTypes(): array return $types; } + /** + * @return array + */ public function getCcAvailableTypesByAlt(): array { $types = []; @@ -531,6 +741,11 @@ public function getCcAvailableTypesByAlt(): array return $types; } + /** + * @param Order $order + * @param string $notificationPaymentMethod + * @return bool + */ public function isAutoCapture(Order $order, string $notificationPaymentMethod): bool { // validate if payment methods allows manual capture @@ -698,6 +913,13 @@ public function isAutoCapture(Order $order, string $notificationPaymentMethod): } } + /** + * @param Order $order + * @param Notification $notification + * @return bool + * @throws AdyenException + * @throws LocalizedException + */ public function compareOrderAndWebhookPaymentMethods(Order $order, Notification $notification): bool { $paymentMethodInstance = $order->getPayment()->getMethodInstance(); @@ -722,6 +944,10 @@ public function compareOrderAndWebhookPaymentMethods(Order $order, Notification return false; } + /** + * @param string $paymentMethod + * @return bool + */ public function isBankTransfer(string $paymentMethod): bool { if (strlen($paymentMethod) >= 12 && substr($paymentMethod, 0, 12) == "bankTransfer") { @@ -732,6 +958,12 @@ public function isBankTransfer(string $paymentMethod): bool return $isBankTransfer; } + /** + * @param Order $order + * @param Notification $notification + * @param string $status + * @return string|null + */ public function getBoletoStatus(Order $order, Notification $notification, string $status): ?string { $additionalData = !empty($notification->getAdditionalData()) ? $this->serializer->unserialize( diff --git a/Helper/PaymentResponseHandler.php b/Helper/PaymentResponseHandler.php index 6c11537a98..dd5950ff6c 100644 --- a/Helper/PaymentResponseHandler.php +++ b/Helper/PaymentResponseHandler.php @@ -20,6 +20,7 @@ use Magento\Sales\Model\Order\Status\HistoryFactory; use Magento\Sales\Model\OrderRepository; use Magento\Sales\Model\ResourceModel\Order; +use Magento\Sales\Model\Order as OrderModel; class PaymentResponseHandler { @@ -139,6 +140,10 @@ public function handlePaymentsDetailsResponse( return false; } + if(!$this->isValidMerchantReference($paymentsDetailsResponse, $order)){ + return false; + } + $this->adyenLogger->addAdyenResult('Updating the order'); $payment = $order->getPayment(); @@ -169,8 +174,9 @@ public function handlePaymentsDetailsResponse( $paymentMethod ); - if (!empty($paymentsDetailsResponse['resultCode'])) { - $payment->setAdditionalInformation('resultCode', $paymentsDetailsResponse['resultCode']); + $resultCode = $paymentsDetailsResponse['resultCode']; + if (!empty($resultCode)) { + $payment->setAdditionalInformation('resultCode', $resultCode); } if (!empty($paymentsDetailsResponse['action'])) { @@ -197,7 +203,7 @@ public function handlePaymentsDetailsResponse( $this->vaultHelper->handlePaymentResponseRecurringDetails($payment, $paymentsDetailsResponse); // If the response is valid, update the order status. - if (!in_array($paymentsDetailsResponse['resultCode'], PaymentResponseHandler::ACTION_REQUIRED_STATUSES)) { + if (!in_array($resultCode, PaymentResponseHandler::ACTION_REQUIRED_STATUSES) && $order->getState() === OrderModel::STATE_PENDING_PAYMENT) { /* * Change order state from pending_payment to new and expect authorisation webhook * if no additional action is required according to /paymentsDetails response. @@ -214,7 +220,7 @@ public function handlePaymentsDetailsResponse( $this->adyenLogger->error(__('Error cleaning the payment state data: %s', $exception->getMessage())); } - switch ($paymentsDetailsResponse['resultCode']) { + switch ($resultCode) { case self::AUTHORISED: if (!empty($paymentsDetailsResponse['pspReference'])) { // set pspReference as transactionId @@ -290,7 +296,7 @@ public function handlePaymentsDetailsResponse( $this->adyenLogger->error( sprintf("Payment details call failed for action, resultCode is %s Raw API responds: %s. Cancel or Hold the order on OFFER_CLOSED notification.", - $paymentsDetailsResponse['resultCode'], + $resultCode, json_encode($paymentsDetailsResponse) )); @@ -312,4 +318,27 @@ public function handlePaymentsDetailsResponse( return $result; } + + /** + * Validate whether the merchant reference is present in the response and belongs to the current order. + * + * @param array $paymentsDetailsResponse + * @param OrderInterface $order + * @return bool + */ + private function isValidMerchantReference(array $paymentsDetailsResponse, OrderInterface $order): bool + { + $merchantReference = $paymentsDetailsResponse['merchantReference'] ?? null; + if (!$merchantReference) { + $this->adyenLogger->error("No merchantReference in the response"); + return false; + } + + if ($order->getIncrementId() !== $merchantReference) { + $this->adyenLogger->error("Wrong merchantReference was set in the query or in the session"); + return false; + } + + return true; + } } diff --git a/Helper/PaymentsDetails.php b/Helper/PaymentsDetails.php index 279708403d..db54ba2ef4 100644 --- a/Helper/PaymentsDetails.php +++ b/Helper/PaymentsDetails.php @@ -12,6 +12,7 @@ namespace Adyen\Payment\Helper; use Adyen\AdyenException; +use Adyen\Model\Checkout\PaymentDetailsRequest; use Adyen\Payment\Helper\Util\DataArrayValidator; use Adyen\Payment\Logger\AdyenLogger; use Magento\Checkout\Model\Session; @@ -33,11 +34,32 @@ class PaymentsDetails 'merchantReference' ]; + /** + * @var Session + */ private Session $checkoutSession; + + /** + * @var Data + */ private Data $adyenHelper; + + /** + * @var AdyenLogger + */ private AdyenLogger $adyenLogger; + + /** + * @var Idempotency + */ private Idempotency $idempotencyHelper; + /** + * @param Session $checkoutSession + * @param Data $adyenHelper + * @param AdyenLogger $adyenLogger + * @param Idempotency $idempotencyHelper + */ public function __construct( Session $checkoutSession, Data $adyenHelper, @@ -58,15 +80,15 @@ public function __construct( public function initiatePaymentDetails(OrderInterface $order, array $payload): array { $request = $this->cleanUpPaymentDetailsPayload($payload); - try { $client = $this->adyenHelper->initializeAdyenClient($order->getStoreId()); - $service = $this->adyenHelper->createAdyenCheckoutService($client); + $service = $this->adyenHelper->initializePaymentsApi($client); $requestOptions['idempotencyKey'] = $this->idempotencyHelper->generateIdempotencyKey($request); $requestOptions['headers'] = $this->adyenHelper->buildRequestHeaders(); - $response = $service->paymentsDetails($request, $requestOptions); + $paymentDetailsObj = $service->paymentsDetails(new PaymentDetailsRequest($request), $requestOptions); + $response = $paymentDetailsObj->toArray(); } catch (AdyenException $e) { $this->adyenLogger->error("Payment details call failed: " . $e->getMessage()); $this->checkoutSession->restoreQuote(); @@ -77,6 +99,10 @@ public function initiatePaymentDetails(OrderInterface $order, array $payload): a return $response; } + /** + * @param array $payload + * @return array + */ private function cleanUpPaymentDetailsPayload(array $payload): array { $payload = DataArrayValidator::getArrayOnlyWithApprovedKeys( diff --git a/Helper/Vault.php b/Helper/Vault.php index 6058e0b40d..8360da3999 100644 --- a/Helper/Vault.php +++ b/Helper/Vault.php @@ -173,7 +173,7 @@ public function getAdyenTokenType(PaymentTokenInterface $paymentToken): ?string return null; } - public function createVaultToken(OrderPaymentInterface $payment, string $detailReference): PaymentTokenInterface + public function createVaultToken(OrderPaymentInterface $payment, string $detailReference, ?string $cardHolderName = null): PaymentTokenInterface { $paymentMethodInstance = $payment->getMethodInstance(); $paymentMethodCode = $paymentMethodInstance->getCode(); @@ -211,6 +211,11 @@ public function createVaultToken(OrderPaymentInterface $payment, string $detailR 'maskedCC' => $additionalData['cardSummary'], 'expirationDate' => $additionalData['expiryDate'] ]; + + if ($cardHolderName !== null) { + $details['cardHolderName'] = $cardHolderName; + } + $paymentToken->setExpiresAt($this->getExpirationDate($additionalData['expiryDate'])); } elseif ($paymentMethodCode === PaymentMethods::ADYEN_CC || $paymentMethodCode === AdyenPosCloudConfigProvider::CODE) { @@ -220,6 +225,9 @@ public function createVaultToken(OrderPaymentInterface $payment, string $detailR 'maskedCC' => $additionalData['cardSummary'], 'expirationDate' => $additionalData['expiryDate'] ]; + if ($cardHolderName !== null) { + $details['cardHolderName'] = $cardHolderName; + } $paymentToken->setExpiresAt($this->getExpirationDate($additionalData['expiryDate'])); } elseif ($this->paymentMethodsHelper->isAlternativePaymentMethod($paymentMethodInstance)) { $paymentToken->setType(PaymentTokenFactoryInterface::TOKEN_TYPE_ACCOUNT); @@ -293,9 +301,11 @@ public function handlePaymentResponseRecurringDetails(Payment $payment, array $r if ($this->hasRecurringDetailReference($response) && $isRecurringEnabled) { try { + $cardHolderName = $response['additionalData']['cardHolderName'] ?? null; $paymentToken = $this->createVaultToken( $payment, - $response['additionalData'][self::RECURRING_DETAIL_REFERENCE] + $response['additionalData'][self::RECURRING_DETAIL_REFERENCE], + $cardHolderName ); $extensionAttributes = $this->getExtensionAttributes($payment); $extensionAttributes->setVaultPaymentToken($paymentToken); diff --git a/Helper/Webhook/OfferClosedWebhookHandler.php b/Helper/Webhook/OfferClosedWebhookHandler.php index ca9f8a796e..9695736d72 100644 --- a/Helper/Webhook/OfferClosedWebhookHandler.php +++ b/Helper/Webhook/OfferClosedWebhookHandler.php @@ -105,7 +105,10 @@ public function handleWebhook(MagentoOrder $order, Notification $notification, s } // Move the order from PAYMENT_REVIEW to NEW, so that it can be cancelled - if (!$order->canCancel() && $this->configHelper->getNotificationsCanCancel($order->getStoreId())) { + if (!$order->isCanceled() + && !$order->canCancel() + && $this->configHelper->getNotificationsCanCancel($order->getStoreId()) + ) { $order->setState(MagentoOrder::STATE_NEW); } diff --git a/Model/Api/AdyenPaymentMethodsBalance.php b/Model/Api/AdyenPaymentMethodsBalance.php index 71ec7af5cc..fc60a820e7 100644 --- a/Model/Api/AdyenPaymentMethodsBalance.php +++ b/Model/Api/AdyenPaymentMethodsBalance.php @@ -13,10 +13,12 @@ namespace Adyen\Payment\Model\Api; use Adyen\AdyenException; +use Adyen\Model\Checkout\BalanceCheckRequest; use Adyen\Payment\Api\AdyenPaymentMethodsBalanceInterface; use Adyen\Payment\Helper\Config; use Adyen\Payment\Helper\Data; use Adyen\Payment\Logger\AdyenLogger; +use Magento\Framework\Exception\NoSuchEntityException; use Magento\Framework\Serialize\Serializer\Json; use Magento\Store\Model\StoreManager; @@ -24,12 +26,38 @@ class AdyenPaymentMethodsBalance implements AdyenPaymentMethodsBalanceInterface { const FAILED_RESULT_CODE = 'Failed'; + /** + * @var Json + */ private Json $jsonSerializer; + + /** + * @var StoreManager + */ private StoreManager $storeManager; + + /** + * @var Config + */ private Config $config; + + /** + * @var Data + */ private Data $adyenHelper; + + /** + * @var AdyenLogger + */ private AdyenLogger $adyenLogger; + /** + * @param Json $jsonSerializer + * @param StoreManager $storeManager + * @param Config $config + * @param Data $adyenHelper + * @param AdyenLogger $adyenLogger + */ public function __construct( Json $jsonSerializer, StoreManager $storeManager, @@ -44,6 +72,12 @@ public function __construct( $this->adyenLogger = $adyenLogger; } + /** + * @param string $payload + * @return string + * @throws AdyenException + * @throws NoSuchEntityException + */ public function getBalance(string $payload): string { $payload = $this->jsonSerializer->unserialize($payload); @@ -53,17 +87,16 @@ public function getBalance(string $payload): string try { $client = $this->adyenHelper->initializeAdyenClient($storeId); - $service = $this->adyenHelper->createAdyenCheckoutService($client); - - $response = $service->paymentMethodsBalance($payload); + $service = $this->adyenHelper->initializeOrdersApi($client); + $response = $service->getBalanceOfGiftCard(new BalanceCheckRequest($payload)); - if ($response['resultCode'] === self::FAILED_RESULT_CODE) { + if ($response->getResultCode() === self::FAILED_RESULT_CODE) { // Balance endpoint doesn't send HTTP status 422 for invalid PIN, manual handling required. $errorMessage = $response['additionalData']['acquirerResponseCode'] ?? 'Unknown error!'; throw new AdyenException($errorMessage); } - return json_encode($response); + return json_encode($response->jsonSerialize()); } catch (AdyenException $e) { $this->adyenLogger->error( sprintf("An error occurred during balance check! %s", $e->getMessage()) diff --git a/Model/Api/PaymentRequest.php b/Model/Api/PaymentRequest.php index 63c27f2df3..4978f894ab 100755 --- a/Model/Api/PaymentRequest.php +++ b/Model/Api/PaymentRequest.php @@ -12,6 +12,9 @@ namespace Adyen\Payment\Model\Api; use Adyen\AdyenException; +use Adyen\Model\Checkout\PaymentDetailsRequest; +use Adyen\Model\Recurring\DisableRequest; +use Adyen\Model\Recurring\RecurringDetailsRequest; use Adyen\Payment\Helper\Config; use Adyen\Payment\Helper\Data; use Adyen\Payment\Logger\AdyenLogger; @@ -27,16 +30,34 @@ class PaymentRequest extends DataObject { + /** + * @var EncryptorInterface + */ protected EncryptorInterface $encryptor; + /** + * @var Data + */ protected Data $adyenHelper; + /** + * @var AdyenLogger + */ protected AdyenLogger $adyenLogger; + /** + * @var Config + */ protected Config $configHelper; + /** + * @var RecurringType + */ protected RecurringType $recurringType; + /** + * @var State + */ protected State $appState; /** @@ -44,6 +65,7 @@ class PaymentRequest extends DataObject * @param EncryptorInterface $encryptor * @param Data $adyenHelper * @param AdyenLogger $adyenLogger + * @param Config $configHelper * @param RecurringType $recurringType * @param array $data */ @@ -70,7 +92,7 @@ public function __construct( * @throws LocalizedException * @throws NoSuchEntityException */ - public function authorise3d(Payment $payment): mixed + public function authorise3d(Payment $payment): array { $order = $payment->getOrder(); $storeId = $order->getStoreId(); @@ -102,13 +124,13 @@ public function authorise3d(Payment $payment): mixed try { $client = $this->adyenHelper->initializeAdyenClient($storeId); - $service = $this->adyenHelper->createAdyenCheckoutService($client); - $result = $service->paymentsDetails($request); + $service = $this->adyenHelper->initializePaymentsApi($client); + $response = $service->paymentsDetails(new PaymentDetailsRequest($request)); } catch (AdyenException $e) { throw new LocalizedException(__('3D secure failed')); } - return $result; + return $response->toArray(); } /** @@ -179,10 +201,10 @@ public function listRecurringContractByType(string $shopperReference, int $store // call lib $client = $this->adyenHelper->initializeAdyenClient($storeId); - $service = $this->adyenHelper->createAdyenRecurringService($client); - $result = $service->listRecurringDetails($request); + $service = $this->adyenHelper->initializeRecurringApi($client); + $response = $service->listRecurringDetails(new RecurringDetailsRequest($request)); - return $result; + return (array)$response->jsonSerialize(); } /** @@ -209,10 +231,11 @@ public function disableRecurringContract( // call lib $client = $this->adyenHelper->initializeAdyenClient($storeId); - $service = $this->adyenHelper->createAdyenRecurringService($client); + $service = $this->adyenHelper->initializeRecurringApi($client); try { - $result = $service->disable($request); + $response = $service->disable(new DisableRequest($request)); + $result = (array) $response->jsonSerialize(); } catch (Exception $e) { $this->adyenLogger->info($e->getMessage()); } diff --git a/Model/Config/Adminhtml/WebhookTest.php b/Model/Config/Adminhtml/WebhookTest.php index e21a3e750a..1a26b30ea2 100644 --- a/Model/Config/Adminhtml/WebhookTest.php +++ b/Model/Config/Adminhtml/WebhookTest.php @@ -55,7 +55,7 @@ protected function _getElementHtml(AbstractElement $element) public function getAjaxUrl() { - return $this->getUrl('adyen/configuration/webhooktest'); + return $this->getUrl('adyen/configuration/webhookTest'); } public function getButtonHtml() diff --git a/Model/Config/Backend/AutoConfiguration.php b/Model/Config/Backend/AutoConfiguration.php index 9aeff89194..19794788f9 100644 --- a/Model/Config/Backend/AutoConfiguration.php +++ b/Model/Config/Backend/AutoConfiguration.php @@ -11,12 +11,14 @@ namespace Adyen\Payment\Model\Config\Backend; +use Adyen\AdyenException; use Adyen\Payment\Helper\BaseUrlHelper; use Adyen\Payment\Helper\ManagementHelper; use Magento\Framework\App\Cache\TypeListInterface; use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Framework\App\Config\Value; use Magento\Framework\Data\Collection\AbstractDb; +use Magento\Framework\Exception\NoSuchEntityException; use Magento\Framework\Model\Context; use Magento\Framework\Model\ResourceModel\AbstractResource; use Magento\Framework\Registry; @@ -27,16 +29,30 @@ class AutoConfiguration extends Value /** * @var ManagementHelper */ - private $managementApiHelper; + private ManagementHelper $managementApiHelper; + /** * @var UrlInterface */ - private $url; + private UrlInterface $url; + /** * @var BaseUrlHelper */ - private $baseUrlHelper; + private BaseUrlHelper $baseUrlHelper; + /** + * @param Context $context + * @param Registry $registry + * @param ScopeConfigInterface $config + * @param TypeListInterface $cacheTypeList + * @param ManagementHelper $managementApiHelper + * @param UrlInterface $url + * @param BaseUrlHelper $baseUrlHelper + * @param AbstractResource|null $resource + * @param AbstractDb|null $resourceCollection + * @param array $data + */ public function __construct( Context $context, Registry $registry, @@ -55,23 +71,37 @@ public function __construct( $this->baseUrlHelper = $baseUrlHelper; } - public function beforeSave() + /** + * @return AutoConfiguration + * @throws AdyenException + * @throws NoSuchEntityException + */ + public function beforeSave(): AutoConfiguration { if ('auto' === $this->getValue()) { - $demoMode = (int)$this->getFieldsetDataValue('demo_mode'); - $environment = $demoMode ? 'test' : 'live'; + $this->saveAllowedOrigins(); + } + return parent::beforeSave(); + } - $apiKey = $this->getFieldsetDataValue('api_key_' . $environment); + /** + * @return void + * @throws AdyenException + * @throws NoSuchEntityException + */ + private function saveAllowedOrigins(): void + { + $demoMode = (int)$this->getFieldsetDataValue('demo_mode'); + $environment = $demoMode ? 'test' : 'live'; - $managementApiService = $this->managementApiHelper->getManagementApiService($apiKey, $demoMode); - $configuredOrigins = $this->managementApiHelper->getAllowedOrigins($managementApiService); + $apiKey = $this->getFieldsetDataValue('api_key_' . $environment); + $client = $this->managementApiHelper->getAdyenApiClient($apiKey, $demoMode); + $service = $this->managementApiHelper->getMyAPICredentialApi($client); + $configuredOrigins = $this->managementApiHelper->getAllowedOrigins($service); - $domain = $this->baseUrlHelper->getDomainFromUrl($this->url->getBaseUrl()); - if (!in_array($domain, $configuredOrigins)) { - $managementApiService = $this->managementApiHelper->getManagementApiService($apiKey, $demoMode); - $this->managementApiHelper->saveAllowedOrigin($managementApiService, $domain); - } + $domain = $this->baseUrlHelper->getDomainFromUrl($this->url->getBaseUrl()); + if (!in_array($domain, $configuredOrigins)) { + $this->managementApiHelper->saveAllowedOrigin($service, $domain); } - return parent::beforeSave(); } } diff --git a/Model/Config/Backend/WebhookCredentials.php b/Model/Config/Backend/WebhookCredentials.php index 77f0d9e951..8a3ca5b515 100644 --- a/Model/Config/Backend/WebhookCredentials.php +++ b/Model/Config/Backend/WebhookCredentials.php @@ -10,12 +10,15 @@ namespace Adyen\Payment\Model\Config\Backend; +use Adyen\AdyenException; use Adyen\Payment\Helper\Config; use Adyen\Payment\Helper\ManagementHelper; +use Adyen\Service\Management\WebhooksMerchantLevelApi; use Magento\Framework\App\Cache\TypeListInterface; use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Framework\App\Config\Value; use Magento\Framework\Data\Collection\AbstractDb; +use Magento\Framework\Exception\NoSuchEntityException; use Magento\Framework\Model\Context; use Magento\Framework\Model\ResourceModel\AbstractResource; use Magento\Framework\Registry; @@ -26,17 +29,30 @@ class WebhookCredentials extends Value /** * @var ManagementHelper */ - private $managementApiHelper; + private ManagementHelper $managementApiHelper; + /** * @var Config */ - private $configHelper; + private Config $configHelper; /** * @var UrlInterface */ - private $url; + private UrlInterface $url; + /** + * @param Context $context + * @param Registry $registry + * @param ScopeConfigInterface $config + * @param TypeListInterface $cacheTypeList + * @param ManagementHelper $managementApiHelper + * @param Config $configHelper + * @param UrlInterface $url + * @param AbstractResource|null $resource + * @param AbstractDb|null $resourceCollection + * @param array $data + */ public function __construct( Context $context, Registry $registry, @@ -55,7 +71,12 @@ public function __construct( parent::__construct($context, $registry, $config, $cacheTypeList, $resource, $resourceCollection, $data); } - public function beforeSave() + /** + * @return WebhookCredentials + * @throws AdyenException + * @throws NoSuchEntityException + */ + public function beforeSave(): WebhookCredentials { if ($this->getFieldsetDataValue('configuration_mode') === 'auto' && $this->getFieldsetDataValue('create_new_webhook') === '1') { @@ -72,15 +93,16 @@ public function beforeSave() $apiKey = $this->configHelper->getApiKey($environment); } $merchantAccount = $this->getFieldsetDataValue('merchant_account_auto'); + $client = $this->managementApiHelper->getAdyenApiClient($apiKey, $isDemoMode); + $service = new WebhooksMerchantLevelApi($client); - $managementApiService = $this->managementApiHelper->getManagementApiService($apiKey, $isDemoMode); $this->managementApiHelper->setupWebhookCredentials( $merchantAccount, $username, $password, $webhookUrl, $isDemoMode, - $managementApiService + $service ); } diff --git a/Model/Method/TxVariant.php b/Model/Method/TxVariant.php index ead1a234a0..8ef4370c96 100644 --- a/Model/Method/TxVariant.php +++ b/Model/Method/TxVariant.php @@ -14,7 +14,7 @@ class TxVariant { - private ?string $card; + private ?string $card = null; private string $paymentMethod; public function __construct(string $txVariant) diff --git a/Model/Queue/Notification/Publisher.php b/Model/Queue/Notification/Publisher.php index b8eef3588c..263b72f932 100644 --- a/Model/Queue/Notification/Publisher.php +++ b/Model/Queue/Notification/Publisher.php @@ -3,29 +3,43 @@ namespace Adyen\Payment\Model\Queue\Notification; use Adyen\Payment\Api\Data\NotificationInterface; +use Adyen\Payment\Model\ResourceModel\Notification; +use Exception; use Magento\Framework\MessageQueue\PublisherInterface; class Publisher { - private const TOPIC_NAME = "adyen.notification"; + public const TOPIC_NAME = "adyen.notification"; /** @var PublisherInterface $publisher */ private $publisher; + /** @var Notification $notificationResource */ + private $notificationResource; + /** * @param PublisherInterface $publisher + * @param Notification $notificationResource */ - public function __construct(PublisherInterface $publisher) - { + public function __construct( + PublisherInterface $publisher, + Notification $notificationResource + ) { $this->publisher = $publisher; + $this->notificationResource = $notificationResource; } /** * @param NotificationInterface $notification * @return void + * @throws Exception */ public function execute(NotificationInterface $notification): void { + // Set processing=true to skip adding duplicate queue entries + $notification->setProcessing(true); + $this->notificationResource->save($notification); + $this->publisher->publish(self::TOPIC_NAME, $notification); } } diff --git a/Model/Resolver/StoreConfig/StoreLocale.php b/Model/Resolver/StoreConfig/StoreLocale.php new file mode 100644 index 0000000000..f7e0ecf9f6 --- /dev/null +++ b/Model/Resolver/StoreConfig/StoreLocale.php @@ -0,0 +1,51 @@ + + */ +declare(strict_types=1); + +namespace Adyen\Payment\Model\Resolver\StoreConfig; + +use Adyen\Payment\Helper\Data; +use Magento\Framework\GraphQl\Config\Element\Field; +use Magento\Framework\GraphQl\Query\ResolverInterface; +use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; +use Magento\GraphQl\Model\Query\Context; +use Magento\Store\Api\Data\StoreInterface; + +class StoreLocale implements ResolverInterface +{ + protected Data $adyenHelper; + + /** + * @param \Adyen\Payment\Helper\Data $adyenHelper + */ + public function __construct( + Data $adyenHelper + ) { + $this->adyenHelper = $adyenHelper; + } + + /** + * @param Context $context + * @inheritDoc + */ + public function resolve( + Field $field, + $context, + ResolveInfo $info, + array $value = null, + array $args = null + ): ?string { + /** @var StoreInterface $store */ + $store = $context->getExtensionAttributes()->getStore(); + return $this->adyenHelper->getStoreLocale((int)$store->getId()); + } +} diff --git a/Model/Ui/AdyenGenericConfigProvider.php b/Model/Ui/AdyenGenericConfigProvider.php index b5e6dc627d..bc6690ff6b 100644 --- a/Model/Ui/AdyenGenericConfigProvider.php +++ b/Model/Ui/AdyenGenericConfigProvider.php @@ -32,12 +32,12 @@ class AdyenGenericConfigProvider implements ConfigProviderInterface * This data member will be passed to the js frontend. It will be used to map the method code (adyen_ideal) to the * corresponding txVariant (ideal). The txVariant will then be used to instantiate the component */ - private array $txVariants; + protected array $txVariants; /** * These payment methods have a custom method render file. This array has been used in the adyen-method.js * file to push correct payment method renderer. */ - private array $customMethodRenderers; + protected array $customMethodRenderers; public function __construct( Data $adyenHelper, diff --git a/Plugin/PaymentVaultDeleteToken.php b/Plugin/PaymentVaultDeleteToken.php index 1f08e433a8..6657f815d6 100644 --- a/Plugin/PaymentVaultDeleteToken.php +++ b/Plugin/PaymentVaultDeleteToken.php @@ -3,7 +3,7 @@ * * Adyen Payment module (https://www.adyen.com/) * - * Copyright (c) 2023 Adyen N.V. (https://www.adyen.com/) + * Copyright (c) 2024 Adyen N.V. (https://www.adyen.com/) * See LICENSE.txt for license details. * * Author: Adyen @@ -12,6 +12,7 @@ namespace Adyen\Payment\Plugin; use Adyen\AdyenException; +use Adyen\Model\Recurring\DisableRequest; use Adyen\Client; use Adyen\Payment\Helper\Data; use Adyen\Payment\Helper\Requests; @@ -24,12 +25,38 @@ class PaymentVaultDeleteToken { + /** + * @var StoreManagerInterface + */ protected StoreManagerInterface $storeManager; + + /** + * @var Data + */ protected Data $dataHelper; + + /** + * @var AdyenLogger + */ protected AdyenLogger $adyenLogger; + + /** + * @var Requests + */ protected Requests $requestsHelper; + + /** + * @var Vault + */ protected Vault $vaultHelper; + /** + * @param StoreManagerInterface $storeManager + * @param Data $dataHelper + * @param AdyenLogger $adyenLogger + * @param Requests $requestsHelper + * @param Vault $vaultHelper + */ public function __construct( StoreManagerInterface $storeManager, Data $dataHelper, @@ -60,15 +87,18 @@ public function beforeDelete(PaymentTokenRepositoryInterface $subject, PaymentTo try { $client = $this->dataHelper->initializeAdyenClient($storeId); - $recurringService = $this->dataHelper->createAdyenRecurringService($client); + $recurringService = $this->dataHelper->initializeRecurringApi($client); $this->dataHelper->logRequest( $request, Client::API_RECURRING_VERSION, sprintf("/pal/servlet/Recurring/%s/disable", Client::API_RECURRING_VERSION) ); - $response = $recurringService->disable($request); - $this->dataHelper->logResponse($response); + + $response = $recurringService->disable(new DisableRequest($request)); + + $responseData = $response->toArray(); + $this->dataHelper->logResponse($responseData); } catch (AdyenException $e) { $this->adyenLogger->error(sprintf( 'Error while attempting to disable token with id %s: %s', diff --git a/README.md b/README.md index 5dafa1880d..0c64e125b3 100644 --- a/README.md +++ b/README.md @@ -33,10 +33,10 @@ We provide three levels of support: The schedule for the current maintained branches is: -| Plugin Major Version | Release Date | Level 1 Support ends | Level 2 Support ends | Level 3 Support ends | -| :----- |:--------------| :----- |:---------------------| :----- | -| Version 8 | November 2021 | January 2024 | May 2024 | January 2025 | -| Version 9 | October 2023 | October 2024 | April 2025 | October 2025 | +| Plugin Major Version | Release Date | Level 1 Support ends | Level 2 Support ends | Level 3 Support ends | +| :----- |:--------------|:---------------------|:---------------------|:---------------------| +| Version 8 | November 2021 | January 2024 | May 2024 | January 2025 | +| Version 9 | October 2023 | December 2025 | May 2026 | December 2026 | Or, visualised as a calendar: @@ -49,9 +49,7 @@ gantt Level 2 :l82, after l81, 2024-05-30 Level 3 :l83, after l82, 2025-01-31 section Version 9 - Level 1 :l91, 2023-09-15, 2024-09-30 - Level 2 :l92, after l91, 2025-03-31 - Level 3 :l93, after l92, 2025-09-30 + Level 1 :active, l91, 2023-09-15, until l92 ``` ## Contributing diff --git a/Test/Unit/AbstractAdyenTestCase.php b/Test/Unit/AbstractAdyenTestCase.php index fd316888ef..17f5a57a95 100644 --- a/Test/Unit/AbstractAdyenTestCase.php +++ b/Test/Unit/AbstractAdyenTestCase.php @@ -45,6 +45,12 @@ protected function createMockWithMethods(string $originalClassName, array $exist /** * Mock a class dynamically generated by Magento. In future additionalMethods have to be split * similar to createMockWithMethods since setMethods is deprecated + * + * @psalm-template RealInstanceType of object + * + * @psalm-param class-string $originalClassName + * + * @psalm-return MockObject&RealInstanceType */ protected function createGeneratedMock(string $originalClassName, array $additionalMethods = []): MockObject { diff --git a/Test/Unit/Controller/Adminhtml/Configuration/MerchantAccountsTest.php b/Test/Unit/Controller/Adminhtml/Configuration/MerchantAccountsTest.php new file mode 100644 index 0000000000..37b7a83795 --- /dev/null +++ b/Test/Unit/Controller/Adminhtml/Configuration/MerchantAccountsTest.php @@ -0,0 +1,64 @@ +createMock(RequestInterface::class); + $requestMock->expects($this->exactly(2)) + ->method('getParam') + ->withConsecutive(['apiKey', ''], ['demoMode']) + ->willReturnOnConsecutiveCalls($apiKey, $demoMode); + + $contextMock = $this->createConfiguredMock(Context::class, + [ + 'getRequest' => $requestMock + ] + ); + + $accountMerchantLevelApiMock = $this->createMock(AccountMerchantLevelApi::class); + $myAPICredentialApiMock = $this->createMock(MyAPICredentialApi::class); + $managementHelperMock = $this->createConfiguredMock(ManagementHelper::class,[ + 'getAccountMerchantLevelApi' => $accountMerchantLevelApiMock, + 'getMyAPICredentialApi' => $myAPICredentialApiMock, + 'getMerchantAccountsAndClientKey' => [ + 'merchantAccounts' => [], + 'clientKey' => '123', + 'currentMerchantAccount' => 'MerchantAccount1' + ] + ]); + + $result = $this->createConfiguredMock(Json::class, []); + $resultJsonFactoryMock = $this->createConfiguredMock(JsonFactory::class, [ + 'create' => $result + ]); + + $result->expects($this->once())->method('setData')->with([ + 'merchantAccounts' => [], + 'clientKey' => '123', + 'currentMerchantAccount' => 'MerchantAccount1' + ]); + + $merchantAccountsController = new MerchantAccounts( + $contextMock, + $managementHelperMock, + $resultJsonFactoryMock + ); + + $merchantAccountsController->execute(); + } +} diff --git a/Test/Unit/Controller/Adminhtml/Configuration/WebhookTestTest.php b/Test/Unit/Controller/Adminhtml/Configuration/WebhookTestTest.php new file mode 100644 index 0000000000..ec9b7ec47d --- /dev/null +++ b/Test/Unit/Controller/Adminhtml/Configuration/WebhookTestTest.php @@ -0,0 +1,78 @@ +contextMock = $this->createMock(Context::class); + $this->managementHelper = $this->createMock(ManagementHelper::class); + $this->resultJsonFactoryMock = $this->createMock(JsonFactory::class); + $this->storeManagerMock = $this->createMock(StoreManager::class); + $this->configHelperMock = $this->createMock(Config::class); + + $objectManager = new ObjectManager($this); + $this->webhookTestController = $objectManager->getObject( + WebhookTest::class, + [ + 'context' => $this->contextMock, + 'managementApiHelper' => $this->managementHelper, + 'resultJsonFactory' => $this->resultJsonFactoryMock, + 'storeManager' => $this->storeManagerMock, + 'configHelper' => $this->configHelperMock + ] + ); + } + + public function testExecuteSuccess() + { + // Arrange + $storeId = 1; + $merchantAccount = 'TestMerchantAccount'; + $webhookId = 'TestWebhookId'; + $isDemoMode = true; + $apiKey = 'TestApiKey'; + $response = ['success' => true]; + + $store = $this->createMock(Store::class); + $this->storeManagerMock->method('getStore')->willReturn($store); + $this->configHelperMock->method('getMerchantAccount')->willReturn($merchantAccount); + $this->configHelperMock->method('getWebhookId')->willReturn($webhookId); + $this->configHelperMock->method('isDemoMode')->willReturn($isDemoMode); + $this->configHelperMock->method('getApiKey')->willReturn($apiKey); + $client = $this->createMock(Client::class); + $service = $this->createConfiguredMock(WebhooksMerchantLevelApi::class, [ + 'testWebhook' => new TestWebhookResponse(['status'=>'success']) + ]); + $this->managementHelper->method('getAdyenApiClient')->willReturn($client); + $this->managementHelper->method('getWebhooksMerchantLevelApi')->willReturn($service); + $resultJsonMock = $this->createMock(\Magento\Framework\Controller\Result\Json::class); + $resultJsonMock->expects($this->once())->method('setData')->willReturn($resultJsonMock); + $this->resultJsonFactoryMock->method('create')->willReturn($resultJsonMock); + // Act + $result = $this->webhookTestController->execute(); + // Assert + $this->assertSame($resultJsonMock, $result); + } +} diff --git a/Test/Unit/Controller/Return/IndexTest.php b/Test/Unit/Controller/Return/IndexTest.php index 6b91a1e8f8..a1184f1000 100644 --- a/Test/Unit/Controller/Return/IndexTest.php +++ b/Test/Unit/Controller/Return/IndexTest.php @@ -31,6 +31,7 @@ use Magento\Sales\Model\OrderFactory; use Magento\Store\Api\Data\StoreInterface; use Magento\Store\Model\StoreManagerInterface; +use Magento\Sales\Model\ResourceModel\Order\Status\History\Collection as OrderStatusHistoryCollection; class IndexTest extends AbstractAdyenTestCase { @@ -127,105 +128,35 @@ private static function testDataProvider(): array ], 'paymentsDetailsResponse' => [ 'merchantReference' => PHP_INT_MAX, - 'resultCode' => 'Authorised' + 'resultCode' => 'Authorised', + 'pspReference' => 'PSP123456789' ], - 'responseHandlerResult' => true, + 'responseHandlerResult' => true, 'returnPath' => 'checkout/onepage/success', 'orderId' => PHP_INT_MAX, - 'expectedException' => null - ], - [ - 'redirectResponse' => [ - 'merchantReference' => PHP_INT_MAX, - 'redirectResult' => 'ABCDEFG123456789' - ], - 'paymentsDetailsResponse' => [ - 'merchantReference' => PHP_INT_MAX, - 'resultCode' => 'Authorised' - ], - 'responseHandlerResult' => true, - 'returnPath' => 'multishipping/checkout/success', - 'orderId' => PHP_INT_MAX, 'expectedException' => null, - 'multishipping' => true + 'multishipping' => false, + 'orderStatusHistory' => ['Payment received'], + 'isDuplicate' => false ], [ 'redirectResponse' => [ + 'merchantReference' => 'ORDER123', 'redirectResult' => 'ABCDEFG123456789' ], 'paymentsDetailsResponse' => [ - 'merchantReference' => PHP_INT_MAX, - 'resultCode' => 'Authorised' + 'merchantReference' => 'ORDER123', + 'resultCode' => 'Authorised', + 'pspReference' => 'PSP123456789' ], - 'responseHandlerResult' => true, + 'responseHandlerResult' => true, 'returnPath' => 'checkout/onepage/success', - 'orderId' => PHP_INT_MAX, - 'expectedException' => null - ], - [ - 'redirectResponse' => [ - 'merchantReference' => PHP_INT_MIN, - 'redirectResult' => 'ABCDEFG123456789' - ], - 'paymentsDetailsResponse' => [ - 'merchantReference' => PHP_INT_MAX, - 'resultCode' => 'Authorised' - ], - 'responseHandlerResult' => false, - 'returnPath' => null, - 'orderId' => null, - 'expectedException' => LocalizedException::class - ], - [ - 'redirectResponse' => [ - 'merchantReference' => PHP_INT_MAX, - 'redirectResult' => 'ABCDEFG123456789' - ], - 'paymentsDetailsResponse' => [], - 'responseHandlerResult' => false, - 'returnPath' => '/checkout/cart', - 'orderId' => PHP_INT_MAX, - 'expectedException' => null - ], - [ - 'redirectResponse' => [ - 'merchantReference' => PHP_INT_MIN, - 'redirectResult' => 'ABCDEFG123456789' - ], - 'paymentsDetailsResponse' => [ - 'merchantReference' => PHP_INT_MAX, - 'resultCode' => 'Authorised' - ], - 'responseHandlerResult' => false, - 'returnPath' => '/checkout/cart', - 'orderId' => PHP_INT_MIN, - 'expectedException' => null - ], - [ - 'redirectResponse' => [ - 'merchantReference' => PHP_INT_MIN, - 'redirectResult' => 'ABCDEFG123456789' - ], - 'paymentsDetailsResponse' => [ - 'merchantReference' => null, - 'resultCode' => null - ], - 'responseHandlerResult' => false, - 'returnPath' => '/checkout/cart', - 'orderId' => PHP_INT_MIN, - 'expectedException' => null + 'orderId' => 'ORDER123', + 'expectedException' => null, + 'multishipping' => false, + 'orderStatusHistory' => ['PSP reference: PSP123456789'], + 'isDuplicate' => true ], - [ - 'redirectResponse' => null, - 'paymentsDetailsResponse' => [ - 'merchantReference' => null, - 'resultCode' => null - ], - 'responseHandlerResult' => false, - 'returnPath' => '/checkout/cart', - 'orderId' => PHP_INT_MIN, - 'expectedException' => null - ] ]; } @@ -239,8 +170,20 @@ public function testExecute( $returnPath, $orderId, $expectedException, - $multishipping = false + $multishipping, + $orderStatusHistory, + $isDuplicate ) { + // Set up order status history + $orderStatusHistoryCollectionMock = $this->createMock(OrderStatusHistoryCollection::class); + $orderStatusHistoryCollectionMock->method('getIterator') + ->willReturn(new \ArrayIterator(array_map(function($comment) { + $statusHistoryMock = $this->createMock(Order\Status\History::class); + $statusHistoryMock->method('getComment')->willReturn($comment); + return $statusHistoryMock; + }, $orderStatusHistory))); + $this->orderEntityMock->method('getStatusHistories')->willReturn($orderStatusHistoryCollectionMock); + if ($expectedException) { $this->expectException($expectedException); } else { @@ -264,11 +207,27 @@ public function testExecute( $this->controllerRequestMock->method('getParams')->willReturn($redirectResponse); $this->orderEntityMock->method('getId')->willReturn($orderId); $this->orderEntityMock->method('getIncrementId')->willReturn($orderId); - $this->paymentResponseHandlerMock->method('handlePaymentsDetailsResponse') - ->willReturn($responseHandlerResult); $this->paymentsDetailsHelperMock->method('initiatePaymentDetails') ->willReturn($paymentsDetailsResponse); + if ($isDuplicate) { + $this->adyenLoggerMock->expects($this->exactly(2)) + ->method('addAdyenResult') + ->withConsecutive( + ['Processing redirect response'], + ['Duplicate response detected. Skipping processing.'] + ); + $this->paymentResponseHandlerMock->expects($this->never()) + ->method('handlePaymentsDetailsResponse'); + } else { + $this->adyenLoggerMock->expects($this->once()) + ->method('addAdyenResult') + ->with('Processing redirect response'); + $this->paymentResponseHandlerMock->expects($this->once()) + ->method('handlePaymentsDetailsResponse') + ->willReturn($responseHandlerResult); + } + $this->indexControllerMock->execute(); } } diff --git a/Test/Unit/Gateway/Http/Client/TransactionCancelTest.php b/Test/Unit/Gateway/Http/Client/TransactionCancelTest.php new file mode 100644 index 0000000000..f0fcbd35fd --- /dev/null +++ b/Test/Unit/Gateway/Http/Client/TransactionCancelTest.php @@ -0,0 +1,137 @@ +adyenHelperMock = $this->createMock(Data::class); + + $this->idempotencyHelperMock = $this->createMock(Idempotency::class); + $this->transferObjectMock = $this->createMock(TransferInterface::class); + $this->clientMock = $this->createMock(Client::class); + $this->checkoutServiceMock = $this->createMock(Checkout\ModificationsApi::class); + $this->transferObjectMock->method('getClientConfig')->willReturn([]); + $this->checkoutServiceMock + ->method('cancelAuthorisedPaymentByPspReference') + ->willReturn(new PaymentCancelResponse(['status' => 'received'])); + $this->transactionCancel = new TransactionCancel( + $this->adyenHelperMock, + $this->idempotencyHelperMock + ); + } + + public function testSuccessfulCancellation() + { + // Arrange + $requestBody = [ + [ + 'merchantAccount' => 'TestMerchantAccount', + 'originalReference' => 'TestOriginalReference', + 'paymentPspReference' => 'paymentPspReference' + ] + ]; + $this->transferObjectMock->method('getBody')->willReturn($requestBody); + $this->transferObjectMock->method('getHeaders')->willReturn([]); + $this->transferObjectMock->method('getClientConfig')->willReturn([]); + $this->adyenHelperMock->method('initializeAdyenClientWithClientConfig')->willReturn($this->clientMock); + $this->adyenHelperMock->method('initializeModificationsApi')->willReturn($this->checkoutServiceMock); + $this->adyenHelperMock->method('buildRequestHeaders')->willReturn(['x-api-key' => 'test_key']); + + $expectedResult = ['status' => 'received']; + + // Act + $result = $this->transactionCancel->placeRequest($this->transferObjectMock); + + // Assert + $this->assertEquals($expectedResult, $result); + } + + public function testCancellationWithAdyenApiException() + { + // Arrange + $requestBody = [ + [ + 'merchantAccount' => 'TestMerchantAccount', + 'originalReference' => 'TestOriginalReference', + 'paymentPspReference' => 'paymentPspReference' + ] + ]; + $this->transferObjectMock->method('getBody')->willReturn($requestBody); + + $this->adyenHelperMock->method('initializeAdyenClientWithClientConfig')->willReturn($this->clientMock); + $this->adyenHelperMock->method('initializeModificationsApi')->willReturn($this->checkoutServiceMock); + $this->adyenHelperMock->method('buildRequestHeaders')->willReturn(['x-api-key' => 'test_key']); + + // Simulate Adyen API exception + $this->checkoutServiceMock->method('cancelAuthorisedPaymentByPspReference')->willThrowException(new AdyenException('API exception')); + + // Act + $result = $this->transactionCancel->placeRequest($this->transferObjectMock); + + // Assert + $this->assertSame($result, ['error' => 'API exception']); + } + + public function testCancellationWithMultipleRequests() + { + // Arrange + $requestBody = [ + [ + 'merchantAccount' => 'TestMerchantAccount1', + 'originalReference' => 'TestOriginalReference1', + 'paymentPspReference' => 'paymentPspReference1' + ], + [ + 'merchantAccount' => 'TestMerchantAccount2', + 'originalReference' => 'TestOriginalReference2', + 'paymentPspReference' => 'paymentPspReference2' + ] + ]; + $this->transferObjectMock->method('getBody')->willReturn($requestBody); + $this->transferObjectMock->method('getHeaders')->willReturn([]); + $this->transferObjectMock->method('getClientConfig')->willReturn([]); + + $this->adyenHelperMock->method('initializeAdyenClientWithClientConfig')->willReturn($this->clientMock); + $this->adyenHelperMock->method('initializeModificationsApi')->willReturn($this->checkoutServiceMock); + $this->adyenHelperMock->method('buildRequestHeaders')->willReturn(['x-api-key' => 'test_key']); + + $expectedResults = ['status' => 'received']; + + // Act + $results = $this->transactionCancel->placeRequest($this->transferObjectMock); + + // Assert + $this->assertEquals($expectedResults, $results); + } + + public function testCancellationWithEmptyRequestArray() + { + // Arrange + $requestBody = []; + $this->transferObjectMock->method('getBody')->willReturn($requestBody); + + // Act + $result = $this->transactionCancel->placeRequest($this->transferObjectMock); + + // Assert + $this->assertEmpty($result); + } +} \ No newline at end of file diff --git a/Test/Unit/Gateway/Http/Client/TransactionCaptureTest.php b/Test/Unit/Gateway/Http/Client/TransactionCaptureTest.php index 4c161dda71..19348bed58 100644 --- a/Test/Unit/Gateway/Http/Client/TransactionCaptureTest.php +++ b/Test/Unit/Gateway/Http/Client/TransactionCaptureTest.php @@ -2,7 +2,12 @@ namespace Adyen\Payment\Test\Unit\Gateway\Http\Client; +use Adyen\Client; +use Adyen\Model\Checkout\ApplicationInfo; +use Adyen\Model\Checkout\PaymentCaptureRequest; +use Adyen\Model\Checkout\PaymentCaptureResponse; use Adyen\Payment\Gateway\Http\Client\TransactionCapture; +use Adyen\Payment\Model\Order\Payment; use Adyen\Payment\Test\Unit\AbstractAdyenTestCase; use Adyen\Service\Checkout; use Magento\Payment\Gateway\Http\TransferInterface; @@ -10,15 +15,14 @@ use Adyen\Payment\Logger\AdyenLogger; use Adyen\Payment\Helper\Data; use Adyen\AdyenException; -use PHPUnit\Framework\MockObject\MockObject; class TransactionCaptureTest extends AbstractAdyenTestCase { - private TransactionCapture $transactionCapture; - private TransferInterface|MockObject $transferObject; - private array $request; - private Data|MockObject $adyenHelper; - private Idempotency|MockObject $idempotencyHelper; + private $transactionCapture; + private $transferObject; + private $request; + private $adyenHelper; + private $idempotencyHelper; protected function setUp(): void { @@ -32,9 +36,13 @@ protected function setUp(): void $this->idempotencyHelper ); + $applicationInfo = $this->createMock(ApplicationInfo::class); + $this->adyenHelper->method('buildApplicationInfo')->willReturn($applicationInfo); + $this->request = [ 'amount' => ['value' => 100, 'currency' => 'USD'], - 'paymentPspReference' => 'testPspReference' + 'paymentPspReference' => 'testPspReference', + 'applicationInfo' => $applicationInfo, ]; $this->transferObject = $this->createConfiguredMock(TransferInterface::class, [ @@ -44,17 +52,16 @@ protected function setUp(): void ]); } - private function configureAdyenMocks(array $response = null, \Exception $exception = null) + private function configureAdyenMocks(array $response = null, \Exception $exception = null): void { - $adyenClient = $this->createMock(\Adyen\Client::class); - $adyenService = $this->createMock(Checkout::class); + $adyenClient = $this->createMock(Client::class); + $checkoutModificationsService = $this->createMock(Checkout\ModificationsApi::class); $expectedIdempotencyKey = 'generated_idempotency_key'; $this->adyenHelper->method('initializeAdyenClientWithClientConfig')->willReturn($adyenClient); - $this->adyenHelper->method('createAdyenCheckoutService')->willReturn($adyenService); + $this->adyenHelper->method('initializeModificationsApi')->willReturn($checkoutModificationsService); $this->adyenHelper->method('buildRequestHeaders')->willReturn([]); $this->adyenHelper->expects($this->once())->method('logRequest'); - $this->adyenHelper->expects($this->once())->method('logResponse'); $this->idempotencyHelper->expects($this->once()) ->method('generateIdempotencyKey') @@ -65,39 +72,39 @@ private function configureAdyenMocks(array $response = null, \Exception $excepti ->willReturn($expectedIdempotencyKey); if ($response) { - $adyenService->expects($this->once()) - ->method('captures') + $this->adyenHelper->expects($this->once())->method('logResponse'); + + $request = new PaymentCaptureRequest($this->request); + + $responseMock = $this->createMock(PaymentCaptureResponse::class); + $responseMock->method('toArray')->willReturn($response); + + $requestOptions['idempotencyKey'] = $expectedIdempotencyKey; + $requestOptions['headers'] = []; + + $checkoutModificationsService->expects($this->once()) + ->method('captureAuthorisedPayment') ->with( - $this->equalTo($this->request), - $this->callback(function ($requestOptions) use ($expectedIdempotencyKey) { - return isset($requestOptions['idempotencyKey']) && - $requestOptions['idempotencyKey'] === $expectedIdempotencyKey; - }) + $this->request['paymentPspReference'], + $request, + $requestOptions ) - ->willReturn($response); + ->willReturn($responseMock); } if ($exception) { - $adyenService->expects($this->once()) - ->method('captures') - ->with( - $this->equalTo($this->request), - $this->callback(function ($requestOptions) use ($expectedIdempotencyKey) { - return isset($requestOptions['idempotencyKey']) && - $requestOptions['idempotencyKey'] === $expectedIdempotencyKey; - }) - ) + $checkoutModificationsService->expects($this->once()) + ->method('captureAuthorisedPayment') ->willThrowException($exception); } - - return $adyenService; } public function testPlaceRequest() { $expectedResponse = [ 'capture_amount' => $this->request['amount']['value'], - 'paymentPspReference' => $this->request['paymentPspReference'] + 'paymentPspReference' => $this->request['paymentPspReference'], + 'applicationInfo' => $this->request['applicationInfo'], ]; $this->configureAdyenMocks($expectedResponse); diff --git a/Test/Unit/Gateway/Http/Client/TransactionPaymentTest.php b/Test/Unit/Gateway/Http/Client/TransactionPaymentTest.php index 5e97e1b388..492c65ebcd 100644 --- a/Test/Unit/Gateway/Http/Client/TransactionPaymentTest.php +++ b/Test/Unit/Gateway/Http/Client/TransactionPaymentTest.php @@ -11,10 +11,13 @@ namespace Adyen\Payment\Test\Unit\Gateway\Http\Client; +use Adyen\Model\Checkout\ApplicationInfo; +use Adyen\Model\Checkout\PaymentRequest; +use Adyen\Model\Checkout\PaymentResponse as CheckoutPaymentResponse; use Adyen\Payment\Api\Data\PaymentResponseInterface; use Adyen\Payment\Model\PaymentResponse; use Adyen\Payment\Test\Unit\AbstractAdyenTestCase; -use Adyen\Service\Checkout; +use Adyen\Service\Checkout\PaymentsApi; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; use Adyen\Payment\Helper\Data; use Adyen\Payment\Model\PaymentResponseFactory; @@ -22,6 +25,7 @@ use Adyen\Payment\Helper\Idempotency; use Adyen\Payment\Helper\OrdersApi; use Adyen\Payment\Gateway\Http\Client\TransactionPayment; +use Magento\Store\Api\Data\StoreInterface; use Magento\Store\Model\StoreManagerInterface; use Adyen\Payment\Helper\GiftcardPayment; use Magento\Payment\Gateway\Http\TransferInterface; @@ -55,6 +59,9 @@ protected function setUp(): void $this->paymentResponseFactoryMock = $this->createGeneratedMock(PaymentResponseFactory::class, ['create']); $this->paymentResponseFactoryMock->method('create')->willReturn($paymentResponseMock); + $this->applicationInfoMock = $this->createMock(ApplicationInfo::class); + $this->adyenHelperMock->method('buildApplicationInfo')->willReturn($this->applicationInfoMock); + $this->transactionPayment = $objectManager->getObject( TransactionPayment::class, [ @@ -82,7 +89,7 @@ public function testPlaceRequestWithResultCode() public function testPlaceRequestGeneratesIdempotencyKey() { - $requestBody = ['reference' => 'ABC12345', 'amount' => ['value' => 100]]; + $requestBody = ['reference' => 'ABC12345', 'amount' => ['value' => 100], 'applicationInfo' => $this->applicationInfoMock]; $transferObjectMock = $this->createConfiguredMock(TransferInterface::class, [ 'getBody' => $requestBody, 'getHeaders' => ['idempotencyExtraData' => ['someData']], @@ -93,17 +100,17 @@ public function testPlaceRequestGeneratesIdempotencyKey() $this->idempotencyHelperMock->expects($this->once()) ->method('generateIdempotencyKey') ->with( - $this->equalTo(['reference' => 'ABC12345', 'amount' => ['value' => 100]]), + $this->equalTo(['reference' => 'ABC12345', 'amount' => ['value' => 100], 'applicationInfo' => $this->applicationInfoMock]), $this->equalTo(['someData']) ) ->willReturn($expectedIdempotencyKey); - $mockedPaymentResponse = [ + $paymentResponse = new CheckoutPaymentResponse([ 'reference' => 'ABC12345', 'amount' => ['value' => 100], 'resultCode' => 'Authorised' - ]; - $serviceMock = $this->createMock(Checkout::class); + ]); + $serviceMock = $this->createMock(PaymentsApi::class); $serviceMock->expects($this->once()) ->method('payments') ->with( @@ -113,23 +120,23 @@ public function testPlaceRequestGeneratesIdempotencyKey() $requestOptions['idempotencyKey'] === $expectedIdempotencyKey; }) ) - ->willReturn($mockedPaymentResponse); + ->willReturn($paymentResponse); - $this->adyenHelperMock->method('createAdyenCheckoutService')->willReturn($serviceMock); + $this->adyenHelperMock->method('initializePaymentsApi')->willReturn($serviceMock); $response = $this->transactionPayment->placeRequest($transferObjectMock); - $this->assertArrayHasKey('resultCode', $response); - $this->assertEquals('Authorised', $response['resultCode']); + $this->assertArrayHasKey('resultCode', $response[0]); + $this->assertEquals('Authorised', $response[0]['resultCode']); } public function testRequestHeadersAreAddedToPaymentsCall() { - $requestBody = ['reference' => 'ABC12345', 'amount' => ['value' => 1000]]; + $requestBody = new PaymentRequest(['reference' => 'ABC12345', 'amount' => ['value' => 1000], 'applicationInfo' => $this->applicationInfoMock]); $expectedHeaders = ['header1' => 'value1', 'header2' => 'value2']; $transferObjectMock = $this->createConfiguredMock(TransferInterface::class, [ - 'getBody' => ['reference' => 'ABC12345', 'amount' => ['value' => 1000]], + 'getBody' => ['reference' => 'ABC12345', 'amount' => ['value' => 1000], 'applicationInfo' => $this->applicationInfoMock], 'getHeaders' => ['header1' => 'value1', 'header2' => 'value2'], 'getClientConfig' => [] ]); @@ -140,14 +147,13 @@ public function testRequestHeadersAreAddedToPaymentsCall() $actualHeaders = $this->adyenHelperMock->buildRequestHeaders(); - - $mockedPaymentResponse = [ + $paymentResponse = new CheckoutPaymentResponse([ 'reference' => 'ABC12345', 'amount' => ['value' => 100], 'resultCode' => 'Authorised' - ]; + ]); - $serviceMock = $this->createMock(Checkout::class); + $serviceMock = $this->createMock(PaymentsApi::class); $serviceMock->expects($this->once()) ->method('payments') ->with( @@ -156,14 +162,105 @@ public function testRequestHeadersAreAddedToPaymentsCall() return isset($requestOptions['headers']) && $requestOptions['headers'] === $expectedHeaders; }) ) - ->willReturn($mockedPaymentResponse); + ->willReturn($paymentResponse); - $this->adyenHelperMock->method('createAdyenCheckoutService')->willReturn($serviceMock); + $this->adyenHelperMock->method('initializePaymentsApi')->willReturn($serviceMock); $response = $this->transactionPayment->placeRequest($transferObjectMock); - $this->assertArrayHasKey('resultCode', $response); - $this->assertEquals('Authorised', $response['resultCode']); + $this->assertArrayHasKey('resultCode', $response[0]); + $this->assertEquals('Authorised', $response[0]['resultCode']); $this->assertEquals($expectedHeaders, $actualHeaders); } + + public function testProcessGiftCardsWithNoGiftCards() + { + $originalRequest = ['amount' => ['value' => 150, 'currency' => 'EUR']]; + $service = $this->createMock(PaymentsApi::class); + list($request, $giftcardResponse) = $this->transactionPayment->processGiftcards($originalRequest, $service); + + $this->assertEquals($request, $originalRequest); + $this->assertEmpty($giftcardResponse); + } + + public function testProcessGiftCardsWithGiftCards() + { + $orderData = [ + 'pspReference' => 'pspReference!23', + 'orderData' => 'orderData....' + ]; + + list($request, $giftCardResponseCollection) = $this->doMultipleGiftCardPayments($orderData); + + $this->assertEquals( + $request, + [ + 'reference' => '0000020', + 'amount' => [ + 'value' => 100, + 'currency' => 'EUR' + ], + 'order' => $orderData + ] + ); + } + + public function testProcessGiftCardReturnsMultipleGiftCardResponses() + { + $orderData = [ + 'pspReference' => 'pspReference!23', + 'orderData' => 'orderData....' + ]; + + list($request, $giftCardResponseCollection) = $this->doMultipleGiftCardPayments($orderData); + + // make sure processGiftcards response is an array + $this->assertIsArray($giftCardResponseCollection); + // make sure the size of response array is equal to the number of redeemed gift cards + $this->assertEquals(2, count($giftCardResponseCollection)); + } + + private function doMultipleGiftCardPayments($orderData) + { + $amount = 250; + $store = $this->createConfiguredMock(StoreInterface::class, [ + 'getId' => 12 + ]); + $this->storeManagerMock->method('getStore')->willReturn($store); + $originalRequest = [ + 'reference' => '0000020', + 'giftcardRequestParameters' => [ + [ + 'state_data' => '{"paymentMethod":{"type": "giftcard"}, "giftcard": {"balance": {"value": 100}, "currency": "EUR"}}'], + [ + 'state_data' => '{"paymentMethod":{"type": "giftcard"}, "giftcard": {"balance": {"value": 50}, "currency": "EUR"}}' + ] + ], + 'amount' => [ + 'value' => $amount, + 'currency' => 'EUR' + ] + ]; + $response = new CheckoutPaymentResponse(); + $response->setResultCode('Authorised'); + $response->setMerchantReference('PSPDMDM2222'); + $serviceMock = $this->createMock(PaymentsApi::class); + $serviceMock->expects($this->exactly(2)) + ->method('payments') + ->with( + $this->callback(function (PaymentRequest $detailsRequest) { + return true; + }), + )->willReturn($response); + $reflector = new \ReflectionProperty(TransactionPayment::class, 'remainingOrderAmount'); + $reflector->setAccessible(true); + $reflector->setValue($this->transactionPayment, $amount); + + $this->orderApiHelperMock + ->expects($this->once()) + ->method('createOrder') + ->willReturn($orderData); + + return $this->transactionPayment->processGiftcards($originalRequest, $serviceMock); + } } diff --git a/Test/Unit/Gateway/Http/Client/TransactionRefundTest.php b/Test/Unit/Gateway/Http/Client/TransactionRefundTest.php index d5499766ca..3d98825999 100644 --- a/Test/Unit/Gateway/Http/Client/TransactionRefundTest.php +++ b/Test/Unit/Gateway/Http/Client/TransactionRefundTest.php @@ -12,11 +12,13 @@ namespace Adyen\Payment\Test\Unit\Gateway\Http\Client; use Adyen\Client; +use Adyen\Model\Checkout\PaymentRefundRequest; +use Adyen\Model\Checkout\PaymentRefundResponse; use Adyen\Payment\Gateway\Http\Client\TransactionRefund; use Adyen\Payment\Helper\Data; use Adyen\Payment\Helper\Idempotency; use Adyen\Payment\Test\Unit\AbstractAdyenTestCase; -use Adyen\Service\Checkout; +use Adyen\Service\Checkout\ModificationsApi; use Magento\Payment\Gateway\Http\TransferInterface; use PHPUnit\Framework\MockObject\MockObject; @@ -63,11 +65,11 @@ public function testPlaceRequestIncludesHeadersInRequest() 'getClientConfig' => [] ]); - $checkoutServiceMock = $this->createMock(Checkout::class); + $serviceMock = $this->createMock(ModificationsApi::class); $adyenClientMock = $this->createMock(Client::class); $this->adyenHelperMock->method('initializeAdyenClientWithClientConfig')->willReturn($adyenClientMock); - $this->adyenHelperMock->method('createAdyenCheckoutService')->willReturn($checkoutServiceMock); + $this->adyenHelperMock->method('initializeModificationsApi')->willReturn($serviceMock); $this->adyenHelperMock->method('buildRequestHeaders')->willReturn(['custom-header' => 'value']); $this->idempotencyHelperMock->expects($this->once()) @@ -75,10 +77,15 @@ public function testPlaceRequestIncludesHeadersInRequest() ->with($requestBody, $headers['idempotencyExtraData']) ->willReturn('generated_idempotency_key'); - $checkoutServiceMock->expects($this->once()) - ->method('refunds') + $serviceMock->expects($this->once()) + ->method('refundCapturedPayment') ->with( - $this->equalTo($requestBody), + $this->equalTo($requestBody['paymentPspReference']), + $this->callback(function (PaymentRefundRequest $paymentRefundRequest) { + $amount = $paymentRefundRequest->getAmount(); + $this->assertEquals($amount,['value' => 1000, 'currency' => 'EUR']); + return true; + }), $this->callback(function ($requestOptions) { $this->assertArrayHasKey('idempotencyKey', $requestOptions); $this->assertArrayHasKey('headers', $requestOptions); @@ -87,7 +94,7 @@ public function testPlaceRequestIncludesHeadersInRequest() return true; }) ) - ->willReturn(['pspReference' => 'refund_psp_reference']); + ->willReturn(new PaymentRefundResponse(['pspReference' => 'refund_psp_reference'])); $responses = $this->transactionRefund->placeRequest($transferObjectMock); diff --git a/Test/Unit/Gateway/Response/CheckoutPaymentCommentHistoryHandlerTest.php b/Test/Unit/Gateway/Response/CheckoutPaymentCommentHistoryHandlerTest.php new file mode 100644 index 0000000000..fc6f90b549 --- /dev/null +++ b/Test/Unit/Gateway/Response/CheckoutPaymentCommentHistoryHandlerTest.php @@ -0,0 +1,122 @@ +checkoutPaymentCommentHistoryHandler = new CheckoutPaymentCommentHistoryHandler(); + + $orderAdapterMock = $this->createMock(OrderAdapterInterface::class); + $this->orderMock = $this->createMock(Order::class); + + $this->paymentMock = $this->createMock(Payment::class); + $this->paymentMock->method('getOrder')->willReturn($this->orderMock); + $this->paymentDataObject = new PaymentDataObject($orderAdapterMock, $this->paymentMock); + + $this->handlingSubject = [ + 'payment' => $this->paymentDataObject, + 'paymentAction' => "authorize", + 'stateObject' => null + ]; + } + public function testIfGeneralFlowIsHandledCorrectly() + { + // Prepare the sample response collection + $responseCollection = [ + 'hasOnlyGiftCards' => false, + 0 => [ + 'additionalData' => [], + 'amount' => [], + 'resultCode' => 'Authorised', + 'pspReference' => 'MDH54321', + 'paymentMethod' => [ + 'name' => 'giftcard', + 'type' => 'Givex', + ], + ], + 1 => [ + 'additionalData' => [], + 'amount' => [], + 'resultCode' => 'Authorised', + 'pspReference' => 'ABC12345', + 'paymentMethod' => [ + 'name' => 'card', + 'type' => 'CreditCard', + ], + ], + ]; + + // Set expectations for the mocked order object + $this->orderMock + ->expects($this->once()) + ->method('addStatusHistoryComment') + ->with( + $this->stringContains( + "authResult: Authorised
pspReference: MDH54321
" . + "
authResult: Authorised
pspReference: ABC12345
" + ), + $this->anything() + ); + + $this->checkoutPaymentCommentHistoryHandler->handle($this->handlingSubject, $responseCollection); + } + + public function testIfEmptyResponseCodeIsHandledCorrectly() + { + // Prepare a sample response collection without a resultCode + $responseCollection = [ + [ + 'pspReference' => '123456789' + ] + ]; + + // Set expectations for the mocked order object + $this->orderMock + ->expects($this->once()) + ->method('addStatusHistoryComment') + ->with( + $this->stringContains('pspReference: 123456789'), + $this->anything() + ); + + // Execute the handler + $this->checkoutPaymentCommentHistoryHandler->handle($this->handlingSubject, $responseCollection); + } + + public function testIfNoPspReferenceIsHandledCorrectly() + { + // Prepare a sample response collection without a pspReference + $responseCollection = [ + [ + 'resultCode' => 'Authorised' + ] + ]; + + // Set expectations for the mocked order object + $this->orderMock + ->expects($this->once()) + ->method('addStatusHistoryComment') + ->with( + $this->stringContains('authResult: Authorised'), + $this->anything() + ); + + // Execute the handler + $this->checkoutPaymentCommentHistoryHandler->handle($this->handlingSubject, $responseCollection); + } +} diff --git a/Test/Unit/Gateway/Response/CheckoutPaymentsDetailsHandlerTest.php b/Test/Unit/Gateway/Response/CheckoutPaymentsDetailsHandlerTest.php new file mode 100644 index 0000000000..fa7143dea3 --- /dev/null +++ b/Test/Unit/Gateway/Response/CheckoutPaymentsDetailsHandlerTest.php @@ -0,0 +1,171 @@ +adyenHelperMock = $this->createMock(Data::class); + $this->checkoutPaymentsDetailsHandler = new CheckoutPaymentsDetailsHandler($this->adyenHelperMock); + + $orderAdapterMock = $this->createMock(OrderAdapterInterface::class); + $this->orderMock = $this->createMock(Order::class); + + $this->paymentMock = $this->createMock(Payment::class); + $this->paymentMock->method('getOrder')->willReturn($this->orderMock); + $this->paymentDataObject = new PaymentDataObject($orderAdapterMock, $this->paymentMock); + + $this->handlingSubject = [ + 'payment' => $this->paymentDataObject, + 'paymentAction' => "authorize", + 'stateObject' => null + ]; + } + + public function testIfGeneralFlowIsHandledCorrectly() + { + // prepare Handler input. + $responseCollection = [ + 'hasOnlyGiftCards' => false, + 0 => [ + 'additionalData' => [], + 'amount' => [], + 'resultCode' => 'Authorised', + ] + ]; + + $this->paymentMock + ->expects($this->once()) + ->method('getMethod') + ->willReturn('any_method'); + + $this->orderMock + ->expects($this->once()) + ->method('setCanSendNewEmailFlag') + ->with(false); + + $this->applyGenericMockExpectations(); + + $this->checkoutPaymentsDetailsHandler->handle($this->handlingSubject, $responseCollection); + } + + public function testIfBoletoSendsAnEmail() + { + // prepare Handler input. + $responseCollection = [ + 'hasOnlyGiftCards' => false, + 0 => [ + 'additionalData' => [], + 'amount' => [], + 'resultCode' => 'Authorised', + 'pspReference' => 'ABC12345' + ] + ]; + + $this->paymentMock + ->expects($this->once()) + ->method('getMethod') + ->willReturn(CheckoutPaymentsDetailsHandler::ADYEN_BOLETO); + + // for boleto it should not call this function. + $this->orderMock + ->expects($this->never()) + ->method('setCanSendNewEmailFlag') + ->with(false); + + $this->applyGenericMockExpectations(); + + $this->checkoutPaymentsDetailsHandler->handle($this->handlingSubject, $responseCollection); + } + + public function testIfPartialPaymentHandlesLastPaymentResponse() + { + // prepare Handler input. + $responseCollection = [ + 'hasOnlyGiftCards' => false, + 0 => [ + 'additionalData' => [], + 'amount' => [], + 'resultCode' => 'Authorised', + 'pspReference' => 'ABC54321', + 'paymentMethod' => [ + 'name' => 'giftcard', + 'type' => 'Givex', + ] + ], + 1 => [ + 'additionalData' => [], + 'amount' => [], + 'resultCode' => 'Authorised', + 'pspReference' => 'ABC12345', + 'paymentMethod' => [ + 'name' => 'card', + 'type' => 'CreditCard', + ] + ] + ]; + + $this->paymentMock + ->expects($this->once()) + ->method('getMethod') + ->willReturn('any_method'); + + $this->orderMock + ->expects($this->once()) + ->method('setCanSendNewEmailFlag') + ->with(false); + + // validate whether the psp reference of the last payment method is used when setting these values. + $this->paymentMock + ->expects($this->once()) + ->method('setCcTransId') + ->with('ABC12345'); + + $this->paymentMock + ->expects($this->once()) + ->method('setLastTransId') + ->with('ABC12345'); + + $this->paymentMock + ->expects($this->once()) + ->method('setTransactionId') + ->with('ABC12345'); + + $this->applyGenericMockExpectations(); + + $this->checkoutPaymentsDetailsHandler->handle($this->handlingSubject, $responseCollection); + } + + private function applyGenericMockExpectations() : void + { + $this->paymentMock + ->expects($this->once()) + ->method('setIsTransactionPending') + ->with(true); + + $this->paymentMock + ->expects($this->once()) + ->method('setIsTransactionClosed') + ->with(false); + + $this->paymentMock + ->expects($this->once()) + ->method('setShouldCloseParentTransaction') + ->with(false); + } +} diff --git a/Test/Unit/Gateway/Response/VaultDetailsHandlerTest.php b/Test/Unit/Gateway/Response/VaultDetailsHandlerTest.php new file mode 100644 index 0000000000..206fdd275c --- /dev/null +++ b/Test/Unit/Gateway/Response/VaultDetailsHandlerTest.php @@ -0,0 +1,96 @@ +vaultHelperMock = $this->createMock(Vault::class); + $this->vaultDetailsHandler = new VaultDetailsHandler($this->vaultHelperMock); + + $orderAdapterMock = $this->createMock(OrderAdapterInterface::class); + $orderMock = $this->createMock(Order::class); + + $this->paymentMock = $this->createMock(Payment::class); + $this->paymentMock->method('getOrder')->willReturn($orderMock); + $this->paymentDataObject = new PaymentDataObject($orderAdapterMock, $this->paymentMock); + + $this->handlingSubject = [ + 'payment' => $this->paymentDataObject, + 'paymentAction' => "authorize", + 'stateObject' => null + ]; + } + + public function testIfGeneralFlowIsHandledCorrectly() + { + // prepare Handler input. + $responseCollection = [ + 'hasOnlyGiftCards' => false, + 0 => [ + 'additionalData' => ['someData' => 'value'], + 'amount' => [], + 'resultCode' => 'Authorised', + ] + ]; + + // Ensure the vaultHelper's method is called once with the correct arguments. + $this->vaultHelperMock + ->expects($this->once()) + ->method('handlePaymentResponseRecurringDetails') + ->with($this->paymentMock, $responseCollection[0]); + + $this->vaultDetailsHandler->handle($this->handlingSubject, $responseCollection); + } + + public function testIfPaymentsWithoutAdditionalDataAreIgnored() + { + // Prepare a responseCollection without additionalData + $responseCollection = [ + 'hasOnlyGiftCards' => false, + 0 => [ + 'additionalData' => [], + 'amount' => [], + 'resultCode' => 'Authorised', + ] + ]; + + // Ensure the vaultHelper's method is NOT called since additionalData is empty + $this->vaultHelperMock + ->expects($this->never()) + ->method('handlePaymentResponseRecurringDetails'); + + $this->vaultDetailsHandler->handle($this->handlingSubject, $responseCollection); + } + + public function testIfGiftCardOnlyPaymentsAreIgnored() + { + $responseCollection = [ + 'hasOnlyGiftCards' => true, + 'additionalData' => ['someData' => 'value'], + 'amount' => [], + 'resultCode' => 'Authorised', + ]; + + // Ensure the vaultHelper's method is NOT called since additionalData is empty + $this->vaultHelperMock + ->expects($this->never()) + ->method('handlePaymentResponseRecurringDetails'); + + $this->vaultDetailsHandler->handle($this->handlingSubject, $responseCollection); + } +} diff --git a/Test/Unit/Gateway/Validator/CheckoutResponseValidatorTest.php b/Test/Unit/Gateway/Validator/CheckoutResponseValidatorTest.php new file mode 100644 index 0000000000..5730c92cfe --- /dev/null +++ b/Test/Unit/Gateway/Validator/CheckoutResponseValidatorTest.php @@ -0,0 +1,259 @@ +adyenLoggerMock = $this->createMock(AdyenLogger::class); + $this->adyenHelperMock = $this->createMock(Data::class); + $this->resultFactoryMock = $this->getMockBuilder(ResultInterfaceFactory::class) + ->setMethods(['create']) + ->disableOriginalConstructor() + ->getMock(); + $orderAdapterMock = $this->createMock(OrderAdapterInterface::class); + $paymentMock = $this->createMock(Payment::class); + $this->paymentDataObject = new PaymentDataObject($orderAdapterMock, $paymentMock); + + $this->checkoutResponseValidator = new CheckoutResponseValidator( + $this->resultFactoryMock, + $this->adyenLoggerMock, + $this->adyenHelperMock + ); + } + + public function testIfValidationFailsWhenResponseIsEmpty() + { + $validationSubject = [ + 'payment' => [], + 'stateObject' => [], + 'response' => [] + ]; + + $this->expectException(ValidatorException::class); + $this->expectExceptionMessage("No responses were provided"); + + $this->checkoutResponseValidator->validate($validationSubject); + } + + public function testValidateSuccessWithAuthorisedResultCode() + { + $validationSubject = [ + 'payment' => $this->paymentDataObject, + 'stateObject' => [], + 'response' => [ + 0 => [ + 'additionalData' => [], + 'amount' => [], + 'resultCode' => 'Authorised', + 'pspReference' => 'ABC12345' + ] + ] + ]; + + $this->resultFactoryMock->expects($this->once()) + ->method('create') + ->with([ + 'isValid' => true, + 'failsDescription' => [], + 'errorCodes' => [] + ]) + ->willReturn(new Result(true)); + + $this->checkoutResponseValidator->validate($validationSubject); + } + public function testValidateThrowsExceptionForRefusedResultCode() + { + $validationSubject = [ + 'payment' => $this->paymentDataObject, + 'stateObject' => [], + 'response' => [ + 0 => [ + 'additionalData' => [], + 'amount' => [], + 'resultCode' => 'Refused', + 'pspReference' => 'ABC12345' + ] + ] + ]; + + $this->expectException(ValidatorException::class); + $this->expectExceptionMessage("The payment is REFUSED."); + + $this->checkoutResponseValidator->validate($validationSubject); + } + + public function testValidateThrowsExceptionForUnknownResultCode() + { + $validationSubject = [ + 'payment' => $this->paymentDataObject, + 'stateObject' => [], + 'response' => [ + 0 => [ + 'additionalData' => [], + 'amount' => [], + 'resultCode' => 'Some other result code', + 'pspReference' => 'ABC12345' + ] + ] + ]; + + $this->expectException(ValidatorException::class); + $this->expectExceptionMessage("Error with payment method please select different payment method."); + + $this->checkoutResponseValidator->validate($validationSubject); + } + + public function testValidateHandlesAllowedErrorCode() + { + $validationSubject = [ + 'payment' => $this->paymentDataObject, + 'stateObject' => [], + 'response' => [ + 0 => [ + 'additionalData' => [], + 'amount' => [], + 'resultCode' => '', + 'pspReference' => 'ABC12345', + 'errorCode' => '124', + 'error' => 'No result code present in response.' + ] + ] + ]; + + $this->expectException(ValidatorException::class); + $this->expectExceptionMessage("No result code present in response."); + + $this->checkoutResponseValidator->validate($validationSubject); + } + + public function testValidateForSuccessfulPartialPayments() + { + $validationSubject = [ + 'payment' => $this->paymentDataObject, + 'stateObject' => [], + 'response' => [ + 0 => [ + 'additionalData' => [], + 'amount' => [], + 'resultCode' => 'Authorised', + 'pspReference' => 'ABC12345', + 'paymentMethod' => [ + 'name' => 'giftcard', + 'type' => 'Givex', + ] + ], + 1 => [ + 'additionalData' => [], + 'amount' => [], + 'resultCode' => 'Authorised', + 'pspReference' => 'ABC12345', + 'paymentMethod' => [ + 'name' => 'card', + 'type' => 'CreditCard', + ] + ] + ] + ]; + + $this->resultFactoryMock->expects($this->once()) + ->method('create') + ->with([ + 'isValid' => true, + 'failsDescription' => [], + 'errorCodes' => [] + ]) + ->willReturn(new Result(true)); + + $this->checkoutResponseValidator->validate($validationSubject); + } + + + public function testValidateForFailedPartialPayments() + { + $validationSubject = [ + 'payment' => $this->paymentDataObject, + 'stateObject' => [], + 'response' => [ + 0 => [ + 'additionalData' => [], + 'amount' => [], + 'resultCode' => 'Authorised', + 'pspReference' => 'ABC12345', + 'paymentMethod' => [ + 'name' => 'Givex', + 'type' => 'giftcard', + ] + ], + 1 => [ + 'additionalData' => [], + 'amount' => [], + 'resultCode' => 'Refused', + 'pspReference' => 'ABC12345', + 'paymentMethod' => [ + 'name' => 'Cards', + 'type' => 'scheme', + ] + ] + ] + ]; + + $this->expectException(ValidatorException::class); + $this->expectExceptionMessage("The payment is REFUSED."); + + $this->checkoutResponseValidator->validate($validationSubject); + } + + public function testIfValidationSucceedsOnMiscellaneousResultCodes() + { + $resultCodes = [ + 'IdentifyShopper', + 'ChallengeShopper', + 'PresentToShopper', + 'Pending', + 'RedirectShopper' + ]; + + $this->resultFactoryMock->expects($this->exactly(count($resultCodes))) + ->method('create') + ->with([ + 'isValid' => true, + 'failsDescription' => [], + 'errorCodes' => [] + ]) + ->willReturn(new Result(true)); + + foreach ($resultCodes as $resultCode) { + $validationSubject = [ + 'payment' => $this->paymentDataObject, + 'stateObject' => [], + 'response' => [ + 0 => [ + 'additionalData' => [], + 'amount' => [], + 'resultCode' => $resultCode, + 'pspReference' => 'ABC12345' + ], + ] + ]; + + $this->checkoutResponseValidator->validate($validationSubject); + } + } +} diff --git a/Test/Unit/Helper/DataTest.php b/Test/Unit/Helper/DataTest.php index cb7a211375..ffb82e21cc 100755 --- a/Test/Unit/Helper/DataTest.php +++ b/Test/Unit/Helper/DataTest.php @@ -10,7 +10,11 @@ namespace Adyen\Payment\Test\Unit\Helper; +use Adyen\AdyenException; use Adyen\Client; +use Adyen\Config as AdyenConfig; +use Adyen\Model\Checkout\ApplicationInfo; +use Adyen\Model\Checkout\CommonField; use Adyen\Payment\Gateway\Request\HeaderDataBuilder; use Adyen\Payment\Helper\Config as ConfigHelper; use Adyen\Payment\Helper\Data; @@ -21,6 +25,10 @@ use Adyen\Payment\Model\ResourceModel\Notification\CollectionFactory as NotificationCollectionFactory; use Adyen\Payment\Observer\AdyenPaymentMethodDataAssignObserver; use Adyen\Payment\Test\Unit\AbstractAdyenTestCase; +use Adyen\Service\Checkout\ModificationsApi; +use Adyen\Service\Checkout\OrdersApi; +use Adyen\Service\Checkout\PaymentsApi; +use Adyen\Service\RecurringApi; use Magento\Backend\Helper\Data as BackendHelper; use Magento\Customer\Helper\Address; use Magento\Directory\Model\Config\Source\Country; @@ -41,16 +49,14 @@ use Magento\Sales\Api\OrderManagementInterface; use Magento\Sales\Model\Order\Payment; use Magento\Sales\Model\Order\Status\HistoryFactory; +use Magento\Store\Model\Store; use Magento\Store\Model\StoreManager; use Magento\Tax\Model\Calculation; use Magento\Tax\Model\Config; use Magento\Sales\Model\Order; -use Magento\Framework\View\Asset\File; use ReflectionClass; -use Adyen\Service\Recurring; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; - class DataTest extends AbstractAdyenTestCase { /** @@ -58,8 +64,42 @@ class DataTest extends AbstractAdyenTestCase */ private $dataHelper; + private $clientMock; + private $adyenLogger; + private $ccTypesAltData; + private $configHelper; + private $objectManager; + private $store; + private $encryptor; + private $dataStorage; + private $assetRepo; + private $assetSource; + private $taxConfig; + private $taxCalculation; + private $backendHelper; + private $storeManager; + private $cache; + private $localeResolver; + private $config; + private $componentRegistrar; + private $localeHelper; + private $orderManagement; + private $orderStatusHistoryFactory; + public function setUp(): void { + $this->clientMock = $this->createConfiguredMock(Client::class, [ + 'getConfig' => new AdyenConfig([ + 'environment' => 'test', + 'externalPlatform' => ['name' => 'test platform', 'version' => '1.2.3', 'integrator' => 'test integrator'], + 'merchantApplication' => ['name' => 'test merchant', 'version' => '1.2.3'], + 'adyenPaymentSource' => ['name' => 'test source', 'version' => '1.2.3'] + ]), + 'getLibraryName' => 'test library', + 'getLibraryVersion' => '1.2.3', + ] + ); + // Prepare mock data for ccTypesAltData $this->ccTypesAltData = [ 'VI' => ['code_alt' => 'VI', 'code' => 'VI'], @@ -71,9 +111,10 @@ public function setUp(): void 'demo_mode' => '1' ] ]); + $this->objectManager = new ObjectManager($this); $context = $this->createMock(Context::class); - $this->store = $this->createMock(\Magento\Store\Model\Store::class); + $this->store = $this->createMock(Store::class); $this->encryptor = $this->createMock(EncryptorInterface::class); $this->dataStorage = $this->createMock(DataInterface::class); $country = $this->createMock(Country::class); @@ -91,6 +132,7 @@ public function setUp(): void ]); $this->adyenLogger = $this->createMock(AdyenLogger::class); $this->storeManager = $this->createMock(StoreManager::class); + $this->storeManager->method('getStore')->willReturn($this->store); $this->cache = $this->createMock(CacheInterface::class); $this->localeResolver = $this->createMock(ResolverInterface::class); $this->config = $this->createMock(ScopeConfigInterface::class); @@ -1011,6 +1053,36 @@ public function testBuildRequestHeaders() $this->assertEquals($expectedHeaders, $headers); } + public function testBuildApplicationInfo() + { + $expectedApplicationInfo = new ApplicationInfo(); + + // These getters are deprecated but needed to mock the client + $expectedApplicationInfo->setAdyenLibrary(new CommonField([ + 'name' => $this->clientMock->getLibraryName(), + 'version' => $this->clientMock->getLibraryVersion() + ])); + + $expectedApplicationInfo->setAdyenPaymentSource(new CommonField( + $this->clientMock->getConfig()->getAdyenPaymentSource()) + ); + + $expectedApplicationInfo->setExternalPlatform( + $this->clientMock->getConfig()->getExternalPlatform() + ); + + $expectedApplicationInfo->setMerchantApplication(new CommonField( + $this->clientMock->getConfig()->getMerchantApplication()) + ); + + $applicationInfo = $this->dataHelper->buildApplicationInfo($this->clientMock); + + $this->assertEquals( + $expectedApplicationInfo, + $applicationInfo + ); + } + public function testBuildRequestHeadersWithNonNullFrontendType() { // Mock dependencies as needed @@ -1365,8 +1437,9 @@ public function testGetOrigin() { $storeId = 1; $expectedBaseUrl = 'https://example.com/'; + $stateMock = $this->createMock(State::class); - $storeMock = $this->createMock(\Magento\Store\Model\Store::class); + $objectManagerStub = $this->createMock(\Magento\Framework\App\ObjectManager::class); $objectManagerStub->method('get')->willReturnMap([ [State::class, $stateMock] @@ -1379,13 +1452,8 @@ public function testGetOrigin() ->with('payment_origin_url', $storeId) ->willReturn(''); - // Mock the store manager to return the store mock - $this->storeManager->expects($this->once()) - ->method('getStore') - ->willReturn($storeMock); - // Mock the store to return the expected base URL - $storeMock->expects($this->once()) + $this->store->expects($this->once()) ->method('getBaseUrl') ->with(UrlInterface::URL_TYPE_WEB) ->willReturn($expectedBaseUrl); @@ -1446,7 +1514,7 @@ public function testGetAdyenMerchantAccountForAdyenPaymentMethod() $merchantAccount = 'mock_merchant_account'; // Mock the store manager and config helper - $storeMock = $this->createMock(\Magento\Store\Model\Store::class); + $storeMock = $this->createMock(Store::class); $storeMock->expects($this->any()) ->method('getId') ->willReturn($storeId); @@ -1476,7 +1544,7 @@ public function testGetAdyenMerchantAccountForAdyenPosCloudPaymentMethod() $merchantAccountPos = 'mock_pos_merchant_account'; // Mock the store manager and config helper - $storeMock = $this->createMock(\Magento\Store\Model\Store::class); + $storeMock = $this->createMock(Store::class); $storeMock->expects($this->any()) ->method('getId') ->willReturn($storeId); @@ -1715,4 +1783,119 @@ public function testCreateOpenInvoiceLineShipping() $this->assertArrayHasKey('openinvoicedata.line1.itemId', $result); $this->assertEquals("shippingCost", $result['openinvoicedata.line1.itemId']); } + + /** + * @test + */ + public function getRecurringTypesShouldReturnAnArrayOfRecurringTypes() + { + $this->assertEquals([ + RecurringType::ONECLICK => 'ONECLICK', + RecurringType::ONECLICK_RECURRING => 'ONECLICK,RECURRING', + RecurringType::RECURRING => 'RECURRING' + ], $this->dataHelper->getRecurringTypes()); + } + + public function getCheckoutFrontendRegionsShouldReturnAnArray() + { + $this->assertEquals([ + 'eu' => 'Default (EU - Europe)', + 'au' => 'AU - Australasia', + 'us' => 'US - United States', + 'in' => 'IN - India' + ], $this->dataHelper->getRecurringTypes()); + } + + public function testGetClientKey() + { + $expectedValue = 'client_key_test_value'; + $storeId = 1; + + $this->configHelper->method('isDemoMode') + ->with($storeId) + ->willReturn(true); + + $this->configHelper->method('getAdyenAbstractConfigData') + ->with('client_key_test', $storeId) + ->willReturn($expectedValue); + + $key = $this->dataHelper->getClientKey(1); + $this->assertEquals($expectedValue, $key); + } + + public function testGetApiKey() + { + $apiKey = 'api_key_test_value'; + $expectedValue = 'api_key_test_decryted_value'; + $storeId = 1; + + $this->configHelper->method('isDemoMode') + ->with($storeId) + ->willReturn(true); + + $this->configHelper->method('getAdyenAbstractConfigData') + ->with('api_key_test', $storeId) + ->willReturn($apiKey); + + $this->encryptor->method('decrypt') + ->with($apiKey) + ->willReturn($expectedValue); + + $key = $this->dataHelper->getAPIKey(1); + $this->assertEquals($expectedValue, $key); + } + + public function testIsDemoMode() + { + $storeId = 1; + $this->configHelper->method('getAdyenAbstractConfigDataFlag') + ->with('demo_mode', $storeId) + ->willReturn(true); + + $value = $this->dataHelper->isDemoMode($storeId); + + $this->assertEquals(true, $value); + } + + public function testCaptureModes() + { + $this->assertSame( + [ + 'auto' => 'Immediate', + 'manual' => 'Manual' + ], + $this->dataHelper->getCaptureModes() + ); + } + + public function testInitializePaymentsApi() + { + $service = $this->dataHelper->initializePaymentsApi($this->clientMock); + $this->assertInstanceOf(PaymentsApi::class, $service); + } + + public function testInitializeModificationsApi() + { + $service = $this->dataHelper->initializeModificationsApi($this->clientMock); + $this->assertInstanceOf(ModificationsApi::class, $service); + } + + public function testInitializeRecurringApi() + { + $service = $this->dataHelper->initializeRecurringApi($this->clientMock); + $this->assertInstanceOf(RecurringApi::class, $service); + } + + public function testInitializeOrdersApi() + { + $service = $this->dataHelper->initializeOrdersApi($this->clientMock); + $this->assertInstanceOf(OrdersApi::class, $service); + } + + public function testLogAdyenException() + { + $this->store->method('getId')->willReturn(1); + $this->adyenLogger->expects($this->once())->method('info'); + $this->dataHelper->logAdyenException(new AdyenException('error message', 123)); + } } diff --git a/Test/Unit/Helper/ManagementHelperTest.php b/Test/Unit/Helper/ManagementHelperTest.php index 028d3a5772..9095f5f9d9 100644 --- a/Test/Unit/Helper/ManagementHelperTest.php +++ b/Test/Unit/Helper/ManagementHelperTest.php @@ -11,18 +11,25 @@ namespace Adyen\Payment\Test\Unit\Helper; +use Adyen\AdyenException; use Adyen\Client; use Adyen\Config as HttpClientConfig; use Adyen\Environment; +use Adyen\Model\Management\AllowedOrigin; +use Adyen\Model\Management\AllowedOriginsResponse; +use Adyen\Model\Management\GenerateHmacKeyResponse; +use Adyen\Model\Management\ListMerchantResponse; +use Adyen\Model\Management\MeApiCredential; +use Adyen\Model\Management\TestWebhookResponse; +use Adyen\Model\Management\Webhook; use Adyen\Payment\Helper\Config; use Adyen\Payment\Helper\Data; use Adyen\Payment\Helper\ManagementHelper; use Adyen\Payment\Logger\AdyenLogger; use Adyen\Payment\Test\Unit\AbstractAdyenTestCase; -use Adyen\Service\ResourceModel\Management\AllowedOrigins; -use Adyen\Service\ResourceModel\Management\Me; -use Adyen\Service\ResourceModel\Management\MerchantAccount; -use Adyen\Service\ResourceModel\Management\MerchantWebhooks; +use Adyen\Service\Management\AccountMerchantLevelApi; +use Adyen\Service\Management\MyAPICredentialApi; +use Adyen\Service\Management\WebhooksMerchantLevelApi; use Magento\Framework\Encryption\EncryptorInterface; use Magento\Framework\Message\ManagerInterface; use Magento\Store\Api\Data\StoreInterface; @@ -30,6 +37,16 @@ class ManagementHelperTest extends AbstractAdyenTestCase { + private Client $clientMock; + + public function setUp(): void + { + $this->clientMock = $this->createMock(Client::class); + $this->clientMock->expects($this->any()) + ->method('getConfig') + ->willReturn(new \Adyen\Config(['environment' => 'test'])); + } + public function testGetMerchantAccountsAndClientKey() { $merchantAccountListResponseJson = <<createConfiguredMock(StoreManager::class, [ 'getStore' => $this->createConfiguredMock(StoreInterface::class, [ @@ -169,17 +189,15 @@ public function testGetMerchantAccountsAndClientKey() ]); $managementHelper = $this->createManagementHelper($storeManagerMock, null, $dataHelperMock); - $managementApiService = $managementHelper->getManagementApiService("APIKEY", true); - - $managementApiService->merchantAccount = $this->createConfiguredMock(MerchantAccount::class, [ - 'list' => $merchantAccountListResponse + $accountMerchantLevelApi = $this->createConfiguredMock(AccountMerchantLevelApi::class, [ + 'listMerchantAccounts' => $merchantAccountListResponse ]); - $managementApiService->me = $this->createConfiguredMock(Me::class, [ - 'retrieve' => $meResponse + $myAPICredentialApi = $this->createConfiguredMock(MyAPICredentialApi::class, [ + 'getApiCredentialDetails' => $meResponse ]); - $result = $managementHelper->getMerchantAccountsAndClientKey($managementApiService); + $result = $managementHelper->getMerchantAccountsAndClientKey($accountMerchantLevelApi, $myAPICredentialApi); $this->assertArrayHasKey('currentMerchantAccount', $result); $this->assertEquals('test_abcdefg', $result['clientKey']); @@ -225,14 +243,10 @@ public function testSetupWebhookCredentialsSuccess() $configHelperMock ); - $managementApiService = $managementHelper->getManagementApiService("APIKEY", true); - $managementApiService->merchantWebhooks = $this->createConfiguredMock(MerchantWebhooks::class, [ - 'generateHmac' => [ - 'hmacKey' => "MOCK_HMAC_KEY" - ], - 'create' => [ - 'id' => 'WH-0123456789' - ] + + $service = $this->createConfiguredMock(WebhooksMerchantLevelApi::class, [ + 'setUpWebhook' => new Webhook(['id' => 'WH-0123456789']), + 'generateHmacKey' => new GenerateHmacKeyResponse(['hmacKey' => 'MOCK_HMAC_KEY']) ]); $result = $managementHelper->setupWebhookCredentials( @@ -241,12 +255,132 @@ public function testSetupWebhookCredentialsSuccess() $password, $url, $isDemoMode, - $managementApiService + $service ); $this->assertEquals('WH-0123456789', $result); } + public function testSetupWebhookCredentialsWithStoredWebhookSuccess() + { + $merchantId = 'MERCHANT_ID'; + $username = 'USERNAME'; + $password = 'PASSWORD'; + $url = 'https://www.test.store/webhook'; + $isDemoMode = true; + $webhookId = 'WH-000000000'; + + $storeManagerMock = $this->createConfiguredMock(StoreManager::class, [ + 'getStore' => $this->createConfiguredMock(StoreInterface::class, [ + 'getId' => 1 + ]) + ]); + + $encyptorMock = $this->createConfiguredMock(EncryptorInterface::class, [ + 'encrypt' => 'ENCRYPTED_VALUE' + ]); + + $dataHelperMock = $this->createConfiguredMock(Data::class, [ + 'initializeAdyenClient' => $this->createConfiguredMock(Client::class, [ + 'getConfig' => $this->createConfiguredMock(HttpClientConfig::class, [ + 'get' => Environment::TEST + ]) + ]) + ]); + + $configHelperMock = $this->createConfiguredMock(Config::class, [ + 'getWebhookId' => $webhookId, + 'getMerchantAccount' => $merchantId + ]); + + $adyenLogger = $this->createMock(AdyenLogger::class); + $adyenLogger->expects($this->never())->method('error'); + $managementHelper = $this->createManagementHelper( + $storeManagerMock, + $encyptorMock, + $dataHelperMock, + $configHelperMock, + $adyenLogger + ); + + $service = $this->createConfiguredMock(WebhooksMerchantLevelApi::class, [ + 'updateWebhook' => new Webhook(['id' => 'WH-0123456789']), + 'generateHmacKey' => new GenerateHmacKeyResponse(['hmacKey' => 'MOCK_HMAC_KEY']) + ]); + + $result = $managementHelper->setupWebhookCredentials( + $merchantId, + $username, + $password, + $url, + $isDemoMode, + $service + ); + + $this->assertEquals('WH-000000000', $result); + } + + + + public function testSetupWebhookCredentialsWithFaildGenerateHmacKey() + { + $merchantId = 'MERCHANT_ID'; + $username = 'USERNAME'; + $password = 'PASSWORD'; + $url = 'https://www.test.store/webhook'; + $isDemoMode = false; + $webhookId = 'WH-000000000'; + + $storeManagerMock = $this->createConfiguredMock(StoreManager::class, [ + 'getStore' => $this->createConfiguredMock(StoreInterface::class, [ + 'getId' => 1 + ]) + ]); + + $encyptorMock = $this->createConfiguredMock(EncryptorInterface::class, [ + 'encrypt' => 'ENCRYPTED_VALUE' + ]); + + $dataHelperMock = $this->createConfiguredMock(Data::class, [ + 'initializeAdyenClient' => $this->createConfiguredMock(Client::class, [ + 'getConfig' => $this->createConfiguredMock(HttpClientConfig::class, [ + 'get' => Environment::TEST + ]) + ]) + ]); + + $configHelperMock = $this->createConfiguredMock(Config::class, [ + 'getWebhookId' => $webhookId, + 'getMerchantAccount' => $merchantId + ]); + + $adyenLogger = $this->createMock(AdyenLogger::class); + $managementHelper = $this->createManagementHelper( + $storeManagerMock, + $encyptorMock, + $dataHelperMock, + $configHelperMock, + $adyenLogger + ); + + $service = $this->createConfiguredMock(WebhooksMerchantLevelApi::class, [ + 'updateWebhook' => new Webhook(['id' => 'WH-0123456789']) + ]); + $service->expects($this->once()) + ->method('generateHmacKey') + ->willThrowException(new \Exception('Some exception')); + + $this->expectException(\Exception::class); + $result = $managementHelper->setupWebhookCredentials( + $merchantId, + $username, + $password, + $url, + $isDemoMode, + $service + ); + } + public function testSetupWebhookCredentialsFailLive(): void { $merchantId = 'TestMerchantAccount'; @@ -286,21 +420,15 @@ public function testSetupWebhookCredentialsFailLive(): void $configHelperMock ); - $managementApiService = $managementHelper->getManagementApiService("APIKEY", true); - $managementApiService->merchantWebhooks = $this->createConfiguredMock(MerchantWebhooks::class, [ - 'generateHmac' => [ - 'hmacKey' => "MOCK_HMAC_KEY" - ], - 'create' => $this->throwException(new \Exception('Mock Service Exception')) - ]); - + $service = $this->createConfiguredMock(WebhooksMerchantLevelApi::class, []); + $service->expects($this->any())->method('setUpWebhook')->willThrowException(new \Exception('Mock Service Exception')); $resultWebhookId = $managementHelper->setupWebhookCredentials( $merchantId, $username, $password, $url, $isDemoMode, - $managementApiService + $service ); $this->assertEquals($webhookId, $resultWebhookId); @@ -352,10 +480,9 @@ public function testGetAllowedOrigins() null, $dataHelperMock ); - $managementApiService = $managementHelper->getManagementApiService("APIKEY", true); - $managementApiService->allowedOrigins = $this->createConfiguredMock(AllowedOrigins::class, [ - 'list' => json_decode($mockJsonResponse, true) + $myAPICredentialApi = $this->createConfiguredMock(MyAPICredentialApi::class, [ + 'getAllowedOrigins' => new AllowedOriginsResponse(json_decode($mockJsonResponse, true)) ]); $expectedArray = [ @@ -363,7 +490,7 @@ public function testGetAllowedOrigins() 'http://192.168.58.20' ]; - $result = $managementHelper->getAllowedOrigins($managementApiService); + $result = $managementHelper->getAllowedOrigins($myAPICredentialApi); $this->assertEquals($expectedArray, $result); } @@ -414,12 +541,12 @@ public function testWebhookTest() $configHelperMock ); - $managementApiService = $managementHelper->getManagementApiService("APIKEY", true); - $managementApiService->merchantWebhooks = $this->createConfiguredMock(MerchantWebhooks::class, [ - 'test' => json_decode($rawJsonResponse, true) + + $service = $this->createConfiguredMock(WebhooksMerchantLevelApi::class, [ + 'testWebhook' => new TestWebhookResponse(json_decode($rawJsonResponse, true)) ]); - $result = $managementHelper->webhookTest($merchantId, $webhookId, $managementApiService); + $result = $managementHelper->webhookTest($merchantId, $webhookId, $service); $success = isset($result['data']) && in_array('success', array_column($result['data'], 'status'), true); @@ -478,4 +605,67 @@ private function createManagementHelper( $messageManager ); } + + public function testSaveAllowedOrigin() + { + $helper = $this->createManagementHelper(); + $service = $this->createMock(MyAPICredentialApi::class); + $domian = 'DOMAIN'; + $service->expects($this->once())->method('addAllowedOrigin')->willReturn(new AllowedOrigin()); + $helper->saveAllowedOrigin($service, $domian); + } + + public function testWebhookTestFailure() + { + $webhookId = 'WH-000000000'; + $merchantId = 'MERCHANT_ID'; + $adyenLogger = $this->createMock(AdyenLogger::class); + $helper = $this->createManagementHelper(null,null,null,null,$adyenLogger); + $service = $this->createMock(WebhooksMerchantLevelApi::class); + $service->expects($this->once())->method('testWebhook')->willThrowException(new AdyenException()); + $adyenLogger->expects($this->never())->method('info'); + $adyenLogger->expects($this->once())->method('error'); + $helper->webhookTest($webhookId, $merchantId, $service); + } + + public function testGetAdyenApiClient() + { + $storeId = 1; + $apiKey = 'API_KEY'; + $storeManagerMock = $this->createConfiguredMock(StoreManager::class, [ + 'getStore' => $this->createConfiguredMock(StoreInterface::class, [ + 'getId' => $storeId + ]) + ]); + $configHelperMock = $this->createConfiguredMock(Config::class, [ + 'getApiKey' => $apiKey + ]); + $dataHelperMock = $this->createConfiguredMock(Data::class, [ + 'initializeAdyenClient' => $this->createConfiguredMock(Client::class,[]) + ]); + $helper = $this->createManagementHelper($storeManagerMock,null,$dataHelperMock, $configHelperMock); + $dataHelperMock + ->expects($this->once()) + ->method('initializeAdyenClient') + ->with($storeId, $apiKey); + $helper->getAdyenApiClient($apiKey, false); + } + + public function testGetAccountMerchantLevelApi() + { + $service = $this->createManagementHelper()->getAccountMerchantLevelApi($this->clientMock); + $this->assertInstanceOf(AccountMerchantLevelApi::class, $service); + } + + public function testGetMyAPICredentialApi() + { + $service = $this->createManagementHelper()->getMyAPICredentialApi($this->clientMock); + $this->assertInstanceOf(MyAPICredentialApi::class, $service); + } + + public function testWebhooksMerchantLevelApi() + { + $service = $this->createManagementHelper()->getWebhooksMerchantLevelApi($this->clientMock); + $this->assertInstanceOf(WebhooksMerchantLevelApi::class, $service); + } } diff --git a/Test/Unit/Helper/PaymentDetailsTest.php b/Test/Unit/Helper/PaymentDetailsTest.php index 7406661b46..f9ad6fd3e4 100644 --- a/Test/Unit/Helper/PaymentDetailsTest.php +++ b/Test/Unit/Helper/PaymentDetailsTest.php @@ -11,6 +11,8 @@ namespace Adyen\Payment\Test\Unit\Helper; use Adyen\AdyenException; +use Adyen\Model\Checkout\PaymentDetailsRequest; +use Adyen\Model\Checkout\PaymentDetailsResponse; use Adyen\Payment\Helper\PaymentsDetails; use Adyen\Payment\Test\Unit\AbstractAdyenTestCase; use Magento\Framework\Exception\ValidatorException; @@ -20,7 +22,7 @@ use Adyen\Payment\Logger\AdyenLogger; use Adyen\Payment\Helper\Idempotency; use Magento\Checkout\Model\Session; -use Adyen\Service\Checkout; +use Adyen\Service\Checkout\PaymentsApi; use Adyen\Client; class PaymentDetailsTest extends AbstractAdyenTestCase @@ -33,7 +35,7 @@ class PaymentDetailsTest extends AbstractAdyenTestCase private $orderMock; private $paymentMock; - private $checkoutServiceMock; + private $paymentsApiMock; private $adyenClientMock; protected function setUp(): void @@ -45,7 +47,7 @@ protected function setUp(): void $this->orderMock = $this->createMock(OrderInterface::class); $this->paymentMock = $this->createMock(Payment::class); - $this->checkoutServiceMock = $this->createMock(Checkout::class); + $this->paymentsApiMock = $this->createMock(PaymentsApi::class); $this->adyenClientMock = $this->createMock(Client::class); $this->orderMock->method('getPayment')->willReturn($this->paymentMock); @@ -53,7 +55,7 @@ protected function setUp(): void $this->paymentMock->method('getOrder')->willReturn($this->orderMock); $this->adyenHelperMock->method('initializeAdyenClient')->willReturn($this->adyenClientMock); - $this->adyenHelperMock->method('createAdyenCheckoutService')->willReturn($this->checkoutServiceMock); + $this->adyenHelperMock->method('initializePaymentsApi')->willReturn($this->paymentsApiMock); $this->paymentDetails = new PaymentsDetails( $this->checkoutSessionMock, @@ -65,9 +67,11 @@ protected function setUp(): void public function testInitiatePaymentDetailsSuccessfully() { + $serviceMock = $this->createMock(PaymentsApi::class); + $adyenClientMock = $this->createMock(Client::class); $payload = [ 'details' => [ - 'detail_key1' => 'some-details', + 'some_value' => 'some_details', 'merchantReference' => '00000000001' ], 'paymentData' => 'some_payment_data', @@ -79,7 +83,7 @@ public function testInitiatePaymentDetailsSuccessfully() 'headers' => ['headerKey' => 'headerValue'] ]; - $paymentDetailsResult = ['resultCode' => 'Authorised', 'action' => null, 'additionalData' => null]; + $paymentDetailsResult = ['resultCode' => 'Authorised']; $this->adyenHelperMock->method('buildRequestHeaders')->willReturn($requestOptions['headers']); $this->idempotencyHelperMock->method('generateIdempotencyKey')->willReturn($requestOptions['idempotencyKey']); @@ -88,10 +92,10 @@ public function testInitiatePaymentDetailsSuccessfully() $apiPayload = $payload; unset($apiPayload['details']['merchantReference']); - $this->checkoutServiceMock->expects($this->once()) + $this->paymentsApiMock->expects($this->once()) ->method('paymentsDetails') - ->with($apiPayload, $requestOptions) - ->willReturn($paymentDetailsResult); + ->with(new PaymentDetailsRequest($apiPayload), $requestOptions) + ->willReturn(new PaymentDetailsResponse($paymentDetailsResult)); $result = $this->paymentDetails->initiatePaymentDetails($this->orderMock, $payload); @@ -112,7 +116,7 @@ public function testInitiatePaymentDetailsFailure() 'threeDSAuthenticationOnly' => true, ]; - $this->checkoutServiceMock->method('paymentsDetails')->willThrowException(new AdyenException()); + $this->paymentsApiMock->method('paymentsDetails')->willThrowException(new AdyenException()); $this->adyenLoggerMock->expects($this->atLeastOnce())->method('error'); $this->checkoutSessionMock->expects($this->atLeastOnce())->method('restoreQuote'); diff --git a/Test/Unit/Helper/PaymentMethodsTest.php b/Test/Unit/Helper/PaymentMethodsTest.php index 1de373c4f7..3aa38586da 100644 --- a/Test/Unit/Helper/PaymentMethodsTest.php +++ b/Test/Unit/Helper/PaymentMethodsTest.php @@ -13,6 +13,7 @@ use Adyen\Client; use Adyen\ConnectionException; +use Adyen\Model\Checkout\PaymentMethodsResponse; use Adyen\Payment\Helper\ChargedCurrency; use Adyen\Payment\Helper\Config; use Adyen\Payment\Helper\Data as AdyenDataHelper; @@ -413,52 +414,13 @@ private function getPrivateMethod(string $className, string $methodName): Reflec return $method; } - public function testFetchPaymentMethodsWhenMerchantAccountEmpty() - { - $country = 'US'; - $shopperLocale = 'en_US'; - - // Invoke the private method - $fetchPaymentMethodsMethod = $this->getPrivateMethod( - PaymentMethods::class, - 'fetchPaymentMethods' - ); - - $storeId = 1; - - $this->storeMock->expects($this->any()) - ->method('getId') - ->willReturn($storeId); - - // Mock the getId method of the quote to return the quoteId - $this->quoteMock->expects($this->any()) - ->method('getStore') - ->willReturn($this->storeMock); - - $paymentMethodsHelper = $this->objectManager->getObject( - PaymentMethods::class, - [ - 'quote' => $this->quoteMock, - 'configHelper' => $this->configHelperMock, - ] - ); - - // Call the protected method with the necessary parameters - $result = $fetchPaymentMethodsMethod->invoke($paymentMethodsHelper, $country, $shopperLocale); - - // Assert the result - $this->assertIsString($result); // Ensure the result is a string - - $this->assertEquals(json_encode([]), $result); - } - public function testFetchPaymentMethodsWithEmptyResponseFromAdyenApi() { $quoteId = 1; $storeId = 1; $amountValue = 100; $adyenClientMock = $this->createMock(Client::class); - $checkoutServiceMock = $this->createMock(Checkout::class); + $checkoutServiceMock = $this->createMock(Checkout\PaymentsApi::class); // Setup test scenario $this->storeMock->expects($this->any()) ->method('getId') @@ -473,7 +435,7 @@ public function testFetchPaymentMethodsWithEmptyResponseFromAdyenApi() ->with('merchant_account', $storeId) // Ensure it's called with the expected parameters ->willReturn('mocked_merchant_account'); // Define the return value for the mocked method $this->adyenHelperMock->method('initializeAdyenClient')->willReturn($adyenClientMock); - $this->adyenHelperMock->method('createAdyenCheckoutService')->willReturn($checkoutServiceMock); + $this->adyenHelperMock->method('initializePaymentsApi')->willReturn($checkoutServiceMock); $this->amountCurrencyMock->method('getCurrencyCode')->willReturn('EUR'); $this->amountCurrencyMock->method('getAmount')->willReturn($amountValue); $this->chargedCurrencyMock->method('getQuoteAmountCurrency')->willReturn($this->amountCurrencyMock); @@ -524,7 +486,7 @@ public function testSuccessfulRetrievalOfPaymentMethods() ]; $adyenClientMock = $this->createMock(Client::class); - $checkoutServiceMock = $this->createMock(Checkout::class); + $checkoutServiceMock = $this->createMock(Checkout\PaymentsApi::class); $quoteId = 1; $storeId = 1; $amountValue = '100'; @@ -565,13 +527,15 @@ public function testSuccessfulRetrievalOfPaymentMethods() ->willReturn($paymentMethodsExtraDetails); $this->adyenHelperMock->method('initializeAdyenClient')->willReturn($adyenClientMock); + $this->adyenHelperMock->method('initializePaymentsApi')->willReturn($checkoutServiceMock); - $this->adyenHelperMock->method('createAdyenCheckoutService')->willReturn($checkoutServiceMock); + $responseMock = $this->createMock(PaymentMethodsResponse::class); + $responseMock->method('toArray')->willReturn($expectedResult); // Simulate successful API call $checkoutServiceMock->expects($this->once()) ->method('paymentMethods') - ->willReturn($expectedResult); + ->willReturn($responseMock); $this->storeMock->expects($this->any()) ->method('getId') @@ -587,14 +551,12 @@ public function testSuccessfulRetrievalOfPaymentMethods() ->with('merchant_account', $storeId) // Ensure it's called with the expected parameters ->willReturn('mocked_merchant_account'); // Define the return value for the mocked method - $this->amountCurrencyMock->method('getCurrencyCode')->willReturn('EUR'); $this->amountCurrencyMock->method('getAmount')->willReturn($amountValue); $this->chargedCurrencyMock->method('getQuoteAmountCurrency')->willReturn($this->amountCurrencyMock); $this->adyenHelperMock->expects($this->once()) - ->method('logResponse') - ->with($expectedResult); + ->method('logResponse'); $paymentMethods = $this->objectManager->getObject( PaymentMethods::class, @@ -1166,7 +1128,7 @@ public function testConnectionExceptionHandling(): void $this->storeMock->method('getId')->willReturn($storeId); $clientMock = $this->createMock(Client::class); - $checkoutServiceMock = $this->createMock(Checkout::class); + $checkoutServiceMock = $this->createMock(Checkout\PaymentsApi::class); $this->adyenHelperMock->expects($this->once()) ->method('initializeAdyenClient') @@ -1174,7 +1136,7 @@ public function testConnectionExceptionHandling(): void ->willReturn($clientMock); $this->adyenHelperMock - ->method('createAdyenCheckoutService') + ->method('initializePaymentsApi') ->with($clientMock) ->willReturn($checkoutServiceMock); diff --git a/Test/Unit/Helper/PaymentRequestTest.php b/Test/Unit/Helper/PaymentRequestTest.php index dbc965fdcf..cef3fa5826 100644 --- a/Test/Unit/Helper/PaymentRequestTest.php +++ b/Test/Unit/Helper/PaymentRequestTest.php @@ -12,12 +12,18 @@ namespace Adyen\Payment\Test\Unit\Helper; use Adyen\Client; +use Adyen\Model\Checkout\PaymentDetailsResponse; +use Adyen\Model\Recurring\DisableResult; +use Adyen\Model\Recurring\RecurringDetailsRequest; +use Adyen\Model\Recurring\RecurringDetailsResult; use Adyen\Payment\Helper\Config; use Adyen\Payment\Helper\Data; use Adyen\Payment\Model\Api\PaymentRequest; use Adyen\Payment\Test\Unit\AbstractAdyenTestCase; use Adyen\Service\Checkout; +use Adyen\Service\Checkout\PaymentsApi; use Adyen\Service\Recurring; +use Adyen\Service\RecurringApi; use Magento\Framework\Exception\LocalizedException; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; use Magento\Sales\Model\Order; @@ -55,14 +61,14 @@ public function testAuthorise3d() $paymentMock = $this->createMock(Payment::class); $paymentMock->method('getOrder')->willReturn($orderMock); - $checkoutServiceMock = $this->createMock(Checkout::class); - $checkoutServiceMock->method('paymentsDetails')->willReturn([]); + $paymentsApiMock = $this->createMock(PaymentsApi::class); + $paymentsApiMock->method('paymentsDetails')->willReturn(new PaymentDetailsResponse([])); $this->adyenHelper ->method('initializeAdyenClient') ->willReturn($this->createMock(Client::class)); - $this->adyenHelper->method('createAdyenCheckoutService')->willReturn($checkoutServiceMock); + $this->adyenHelper->method('initializePaymentsApi')->willReturn($paymentsApiMock); $result = $this->paymentRequest->authorise3d($paymentMock); $this->assertIsArray($result); @@ -70,13 +76,13 @@ public function testAuthorise3d() public function testListRecurringContractByType() { - $recurringServiceMock = $this->createMock(Recurring::class); - $recurringServiceMock->method('listRecurringDetails')->willReturn([]); + $recurringServiceMock = $this->createMock(RecurringApi::class); + $recurringServiceMock->method('listRecurringDetails')->willReturn(new RecurringDetailsResult([])); $this->adyenHelper ->method('initializeAdyenClient') ->willReturn($this->createMock(Client::class)); - $this->adyenHelper->method('createAdyenRecurringService')->willReturn($recurringServiceMock); + $this->adyenHelper->method('initializeRecurringApi')->willReturn($recurringServiceMock); $this->assertIsArray($this->paymentRequest->listRecurringContractByType('001', 1, 'CardOnFile')); } @@ -90,17 +96,15 @@ public function testDisableRecurringContract($response, $assert) $this->expectException(LocalizedException::class); } - $result = [ - 'response' => $response - ]; + $result = new DisableResult(['response' => $response]); - $recurringServiceMock = $this->createMock(Recurring::class); + $recurringServiceMock = $this->createMock(RecurringApi::class); $recurringServiceMock->method('disable')->willReturn($result); $this->adyenHelper ->method('initializeAdyenClient') ->willReturn($this->createMock(Client::class)); - $this->adyenHelper->method('createAdyenRecurringService')->willReturn($recurringServiceMock); + $this->adyenHelper->method('initializeRecurringApi')->willReturn($recurringServiceMock); $apiResponse = $this->paymentRequest->disableRecurringContract('TOKEN_PLACEHOLDER', '001', 1); diff --git a/Test/Unit/Helper/PaymentResponseHandlerTest.php b/Test/Unit/Helper/PaymentResponseHandlerTest.php index 8a5b0fc76d..6f88669d5e 100644 --- a/Test/Unit/Helper/PaymentResponseHandlerTest.php +++ b/Test/Unit/Helper/PaymentResponseHandlerTest.php @@ -72,6 +72,7 @@ protected function setUp(): void $this->orderMock->method('getQuoteId')->willReturn(1); $this->orderMock->method('getPayment')->willReturn($this->paymentMock); $this->orderMock->method('getStatus')->willReturn('pending'); + $this->orderMock->method('getIncrementId')->willReturn('00123456'); $this->orderHelperMock->method('setStatusOrderCreation')->willReturn( $this->orderMock); @@ -117,7 +118,7 @@ public function testFormatPaymentResponseForFinalResultCodes($resultCode) $this->assertEquals($expectedResult, $result); } - private static function dataSourceForFormatPaymentResponseActionRequredPayments(): array + private static function dataSourceForFormatPaymentResponseActionRequiredPayments(): array { return [ ['resultCode' => PaymentResponseHandler::REDIRECT_SHOPPER, 'action' => ['type' => 'qrCode']], @@ -131,7 +132,7 @@ private static function dataSourceForFormatPaymentResponseActionRequredPayments( * @param $resultCode * @param $action * @return void - * @dataProvider dataSourceForFormatPaymentResponseActionRequredPayments + * @dataProvider dataSourceForFormatPaymentResponseActionRequiredPayments */ public function testFormatPaymentResponseForActionRequiredPayments($resultCode, $action) { @@ -239,7 +240,8 @@ public function testHandlePaymentsDetailsResponseAuthorised() 'details' => [ 'someData' => 'someValue' ], - 'donationToken' => 'XYZ123456789' + 'donationToken' => 'XYZ123456789', + 'merchantReference' => '00123456' ]; $this->quoteHelperMock->method('disableQuote')->willThrowException(new Exception()); @@ -281,7 +283,8 @@ public function testHandlePaymentsDetailsResponsePending($paymentMethodCode) 'pspReference' => 'ABC123456789', 'paymentMethod' => [ 'brand' => $paymentMethodCode - ] + ], + 'merchantReference' => '00123456' ]; $result = $this->paymentResponseHandler->handlePaymentsDetailsResponse( @@ -314,7 +317,8 @@ public function testHandlePaymentsDetailsResponseReceived($paymentMethodCode, $e 'pspReference' => 'ABC123456789', 'paymentMethod' => [ 'brand' => $paymentMethodCode - ] + ], + 'merchantReference' => '00123456' ]; $result = $this->paymentResponseHandler->handlePaymentsDetailsResponse( @@ -350,6 +354,7 @@ public function testHandlePaymentsDetailsResponseActionRequired($resultCode) 'paymentMethod' => [ 'brand' => 'ideal' ], + 'merchantReference' => '00123456', 'action' => [ 'actionData' => 'actionValue' ] @@ -388,6 +393,7 @@ public function testHandlePaymentsDetailsResponseCancelOrRefused($resultCode) 'paymentMethod' => [ 'brand' => 'ideal' ], + 'merchantReference' => '00123456', 'action' => [ 'actionData' => 'actionValue' ] @@ -431,4 +437,22 @@ public function testHandlePaymentsDetailsEmptyResponse() $this->assertFalse($result); } + + public function testHandlePaymentsDetailsResponseInvalidMerchantReference(){ + $paymentsDetailsResponse = [ + 'resultCode' => PaymentResponseHandler::AUTHORISED, + 'pspReference' => 'ABC123456789', + 'paymentMethod' => [ + 'brand' => 'ideal' + ], + 'merchantReference' => '00777777' + ]; + + $result = $this->paymentResponseHandler->handlePaymentsDetailsResponse( + $paymentsDetailsResponse, + $this->orderMock + ); + + $this->assertFalse($result); + } } diff --git a/Test/Unit/Model/Api/AdyenPaymentMethodsBalanceTest.php b/Test/Unit/Model/Api/AdyenPaymentMethodsBalanceTest.php new file mode 100644 index 0000000000..3f818965fe --- /dev/null +++ b/Test/Unit/Model/Api/AdyenPaymentMethodsBalanceTest.php @@ -0,0 +1,100 @@ +jsonSerializer = new Json(); + $this->storeManager = $this->createConfiguredMock( + StoreManager::class, + [ + 'getStore' => $this->createConfiguredMock( + Store::class, [ + 'getId' => 'StoreId' + ] + ), + ] + ); + $this->config = $this->createConfiguredMock(Config::class, [ + 'getMerchantAccount' => 'merchantAccount' + ]); + $this->response = new BalanceCheckResponse(); + $this->response->setResultCode('Success'); + $this->response->setBalance(new Amount(['currency'=> 'EUR', 'value'=> 400])); + $this->ordersApi = $this->createConfiguredMock(OrdersApi::class, [ + 'getBalanceOfGiftCard' => $this->response + ]); + $this->adyenHelper = $this->createConfiguredMock(Data::class, [ + 'initializeAdyenClient' => $this->createConfiguredMock(Client::class, []), + 'initializeOrdersApi' => $this->ordersApi + ]); + $this->adyenLogger = $this->createMock(AdyenLogger::class); + $this->merchantAccount = 'my-merchant-account'; + } + + public function testSuccessfulGetBalance() + { + $payload = '{"paymentMethod":{"type":"giftcard","brand":"genericgiftcard","encryptedCardNumber":"eyJhbGciOi......"},"amount":{"currency":"EUR","value":8361}}'; + $adyenPaymentMethodsBalance = new AdyenPaymentMethodsBalance( + $this->jsonSerializer, + $this->storeManager, + $this->config, + $this->adyenHelper, + $this->adyenLogger + ); + + $balance = $adyenPaymentMethodsBalance->getBalance($payload); + $this->assertEquals(json_encode($this->response->jsonSerialize()), $balance); + } + + public function testFailedGetBalance() + { + + $response = new BalanceCheckResponse(); + $response->setResultCode(AdyenPaymentMethodsBalance::FAILED_RESULT_CODE); + $ordersApi = $this->createConfiguredMock(OrdersApi::class, [ + 'getBalanceOfGiftCard' => $response + ]); + + $adyenHelper = $this->createConfiguredMock(Data::class, [ + 'initializeAdyenClient' => $this->createConfiguredMock(Client::class, []), + 'initializeOrdersApi' => $ordersApi + ]); + + $payload = '{"paymentMethod":{"type":"giftcard","brand":"genericgiftcard","encryptedCardNumber":"eyJhbGciOi......"},"amount":{"currency":"EUR","value":8361}}'; + $adyenPaymentMethodsBalance = new AdyenPaymentMethodsBalance( + $this->jsonSerializer, + $this->storeManager, + $this->config, + $adyenHelper, + $this->adyenLogger + ); + + $this->expectException(AdyenException::class); + $adyenPaymentMethodsBalance->getBalance($payload); + } +} diff --git a/Test/Unit/Model/Config/Backend/AutoConfigurationTest.php b/Test/Unit/Model/Config/Backend/AutoConfigurationTest.php new file mode 100644 index 0000000000..10af9c6977 --- /dev/null +++ b/Test/Unit/Model/Config/Backend/AutoConfigurationTest.php @@ -0,0 +1,64 @@ +contextMock = $this->createMock(Context::class); + $this->registryMock = $this->createMock(Registry::class); + $this->scopeConfigMock = $this->createMock(ScopeConfigInterface::class); + $this->typeListtMock = $this->createMock(TypeListInterface::class); + $this->managementHelperMock = $this->createMock(ManagementHelper::class); + + $this->urlMock = $this->createConfiguredMock(UrlInterface::class, [ + 'getBaseUrl' => 'my base url' + ]); + $this->baseUrlHelperMock = $this->createConfiguredMock(BaseUrlHelper::class, [ + 'getDomainFromUrl' => 'mydomain' + ]); + + $this->autoConfiguration = new AutoConfiguration( + $this->contextMock, + $this->registryMock, + $this->scopeConfigMock, + $this->typeListtMock, + $this->managementHelperMock, + $this->urlMock, + $this->baseUrlHelperMock, + null, + null, + [ + 'fieldset_data' => [ + 'demo_mode' => 1, + 'api_key_live' => '2', + 'api_key_test' => '2' + ] + ] + ); + } + + public function testSaveAllowedOrigins() + { + $this->managementHelperMock->expects($this->once())->method('saveAllowedOrigin'); + $this->invokeMethod($this->autoConfiguration, 'saveAllowedOrigins'); + } +} diff --git a/Test/Unit/Model/Queue/Notification/ConsumerTest.php b/Test/Unit/Model/Queue/Notification/ConsumerTest.php new file mode 100644 index 0000000000..de0995beb6 --- /dev/null +++ b/Test/Unit/Model/Queue/Notification/ConsumerTest.php @@ -0,0 +1,67 @@ +webhookMock = $this->createMock(Webhook::class); + $this->adyenLoggerMock = $this->createMock(AdyenLogger::class); + $this->notificationMock = $this->createMock(Notification::class); + $this->consumer = new Consumer($this->webhookMock, $this->adyenLoggerMock); + } + + /** + * @return void + * @throws Exception + */ + public function testExecute(): void + { + $this->webhookMock->expects($this->once()) + ->method('processNotification') + ->with($this->notificationMock) + ->willReturn(true); + + $this->assertTrue($this->consumer->execute($this->notificationMock)); + } + + /** + * @return void + * @throws Exception + */ + public function testExecuteThrowsException(): void + { + $this->webhookMock->expects($this->once()) + ->method('processNotification') + ->with($this->notificationMock) + ->willThrowException(new Exception()); + $this->adyenLoggerMock->expects($this->once())->method('addAdyenWarning'); + + $this->expectException(Exception::class); + $this->consumer->execute($this->notificationMock); + } +} diff --git a/Test/Unit/Model/Queue/Notification/PublisherTest.php b/Test/Unit/Model/Queue/Notification/PublisherTest.php new file mode 100644 index 0000000000..974367eed5 --- /dev/null +++ b/Test/Unit/Model/Queue/Notification/PublisherTest.php @@ -0,0 +1,31 @@ +createMock(PublisherInterface::class); + $notificationResourceMock = $this->createMock(NotificationResourceModel::class); + $notificationMock = $this->createMock(Notification::class); + + $notificationMock->expects($this->once())->method('setProcessing')->with(true); + $notificationResourceMock->expects($this->once())->method('save')->with($notificationMock); + $publisherMock->expects($this->once())->method('publish')->with(Publisher::TOPIC_NAME, $notificationMock); + + $publisher = new Publisher($publisherMock, $notificationResourceMock); + $publisher->execute($notificationMock); + } +} diff --git a/Test/Unit/Model/Resolver/GetAdyenPaymentMethodsBalanceTest.php b/Test/Unit/Model/Resolver/GetAdyenPaymentMethodsBalanceTest.php index 51002e8040..a77e6dd8dd 100644 --- a/Test/Unit/Model/Resolver/GetAdyenPaymentMethodsBalanceTest.php +++ b/Test/Unit/Model/Resolver/GetAdyenPaymentMethodsBalanceTest.php @@ -18,7 +18,6 @@ use PHPUnit\Framework\TestCase; use Magento\Framework\GraphQl\Exception\GraphQlInputException; use Adyen\Payment\Exception\GraphQlAdyenException; -use Magento\Framework\GraphQl\Query; class GetAdyenPaymentMethodsBalanceTest extends TestCase { diff --git a/Test/Unit/Model/Resolver/StoreConfig/StoreLocaleTest.php b/Test/Unit/Model/Resolver/StoreConfig/StoreLocaleTest.php new file mode 100644 index 0000000000..45c17388ea --- /dev/null +++ b/Test/Unit/Model/Resolver/StoreConfig/StoreLocaleTest.php @@ -0,0 +1,91 @@ + + */ +declare(strict_types=1); + +namespace Adyen\Payment\Test\Unit\Model\Resolver\StoreConfig; + +use Adyen\Payment\Helper\Data; +use Adyen\Payment\Model\Resolver\StoreConfig\StoreLocale; +use Adyen\Payment\Test\Unit\AbstractAdyenTestCase; +use Magento\Framework\GraphQl\Config\Element\Field; +use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; +use Magento\GraphQl\Model\Query\Context; +use Magento\GraphQl\Model\Query\ContextExtensionInterface; +use Magento\Store\Model\Store; +use PHPUnit\Framework\MockObject\MockObject; + +/** + * @coversDefaultClass \Adyen\Payment\Model\Resolver\StoreConfig\StoreLocale + */ +class StoreLocaleTest extends AbstractAdyenTestCase +{ + private MockObject&Context $contextMock; + private MockObject&Field $fieldMock; + private MockObject&ResolveInfo $infoMock; + private MockObject&Data $dataHelperMock; + private MockObject&ContextExtensionInterface $contextExtensionMock; + private StoreLocale $storeLocale; + + protected function setUp(): void + { + $this->contextExtensionMock = $this->createGeneratedMock( + ContextExtensionInterface::class, + ['getStore'] + ); + + $this->contextMock = $this->getMockBuilder(Context::class) + ->disableOriginalConstructor() + ->onlyMethods(['getExtensionAttributes']) + ->getMock(); + + $this->fieldMock = $this->createMock(Field::class); + $this->infoMock = $this->createMock(ResolveInfo::class); + + $this->dataHelperMock = $this->getMockBuilder(Data::class) + ->disableOriginalConstructor() + ->onlyMethods(['getStoreLocale']) + ->getMock(); + + $this->storeLocale = new StoreLocale($this->dataHelperMock); + } + + /** + * @return void + * @throws \Exception + * @covers ::resolve + */ + public function testGetStoreLocale(): void + { + $storeMock = $this->createConfiguredMock(Store::class, [ + 'getId' => 1, + ]); + + $this->contextExtensionMock + ->expects($this->once()) + ->method('getStore') + ->willReturn($storeMock); + + $this->contextMock + ->expects($this->once()) + ->method('getExtensionAttributes') + ->willReturn($this->contextExtensionMock); + + $this->dataHelperMock + ->expects($this->once()) + ->method('getStoreLocale') + ->willReturn('fr_FR'); + + $this->assertEquals( + 'fr_FR', + $this->storeLocale->resolve($this->fieldMock, $this->contextMock, $this->infoMock, [], []) + ); + } +} diff --git a/Test/Unit/Plugin/PaymentVaultDeleteTokenTest.php b/Test/Unit/Plugin/PaymentVaultDeleteTokenTest.php index 83180d0789..212052b79d 100644 --- a/Test/Unit/Plugin/PaymentVaultDeleteTokenTest.php +++ b/Test/Unit/Plugin/PaymentVaultDeleteTokenTest.php @@ -11,11 +11,13 @@ namespace Adyen\Payment\Test\Plugin; +use Adyen\Model\Recurring\DisableResult; use Adyen\Payment\Helper\Data; use Adyen\Payment\Logger\AdyenLogger; use Adyen\Payment\Plugin\PaymentVaultDeleteToken; use Adyen\Payment\Test\Unit\AbstractAdyenTestCase; use Adyen\Payment\Helper\Requests; +use Adyen\Service\RecurringApi; use Magento\Vault\Api\Data\PaymentTokenInterface; use Magento\Vault\Api\PaymentTokenRepositoryInterface; use Magento\Store\Model\StoreManagerInterface; @@ -64,11 +66,13 @@ public function testSuccessfullyDisableValidAdyenPaymentTokenBeforeDeletion() $this->vaultHelperMock->method('isAdyenPaymentCode')->willReturn(true); $clientMock = $this->createMock(Client::class); - $recurringServiceMock = $this->createMock(Recurring::class); + $recurringServiceMock = $this->createMock(RecurringApi::class); $this->dataHelperMock->method('initializeAdyenClient')->willReturn($clientMock); - $this->dataHelperMock->method('createAdyenRecurringService')->willReturn($recurringServiceMock); + $this->dataHelperMock->method('initializeRecurringApi')->willReturn($recurringServiceMock); - $recurringServiceMock->expects($this->once())->method('disable')->willReturn(['response' => 'success']); + $recurringServiceMock->expects($this->once()) + ->method('disable') + ->willReturn(new DisableResult(['response' => 'success'])); $this->paymentVaultDeleteToken = new PaymentVaultDeleteToken( $storeManagerMock, diff --git a/Test/api-functional/GraphQl/AdyenTest.php b/Test/api-functional/GraphQl/AdyenTest.php index f55465214c..e36ec02c9c 100644 --- a/Test/api-functional/GraphQl/AdyenTest.php +++ b/Test/api-functional/GraphQl/AdyenTest.php @@ -89,7 +89,7 @@ public function testAdyenPaymentStatus(): void { $methodCode = "adyen_ideal"; $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote'); - $stateData = '{\"paymentMethod\":{\"type\":\"ideal\",\"issuer\":\"1154\"}}'; + $stateData = '{\"paymentMethod\":{\"type\":\"ideal\"}}'; $adyenAdditionalData = ' , adyen_additional_data: { diff --git a/VERSION b/VERSION index 555763f7fd..31476ce156 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -9.5.2 +9.8.1 diff --git a/composer.json b/composer.json index 51129dacfc..6b22bf8296 100755 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "adyen/module-payment", "description": "Official Magento2 Plugin to connect to Payment Service Provider Adyen.", "type": "magento2-module", - "version": "9.5.2", + "version": "9.8.1", "license": "MIT", "repositories": [ { @@ -12,15 +12,16 @@ ], "require": { "php": ">=8.1", - "adyen/php-api-library": "^17.0.0", + "adyen/php-api-library": "^19.1.0", "adyen/php-webhook-module": "^1", "magento/framework": ">=103.0.4", "magento/module-vault": ">=101.2.4", "magento/module-multishipping": ">=100.4.4", + "magento/module-graph-ql": ">=100.4.4", "ext-json": "*" }, "require-dev": { - "phpunit/phpunit": "~9.6.0", + "phpunit/phpunit": "~9.6.1", "magento/magento-coding-standard": "*", "squizlabs/php_codesniffer": "~3.8.0" }, diff --git a/etc/adminhtml/system/adyen_capture_settings.xml b/etc/adminhtml/system/adyen_capture_settings.xml index 5d9605f08a..f528dfeb03 100755 --- a/etc/adminhtml/system/adyen_capture_settings.xml +++ b/etc/adminhtml/system/adyen_capture_settings.xml @@ -26,7 +26,7 @@ - Applicable for Klarna, Afterpay Touch, Ratepay, FacilyPay/Oney, Affirm, Clearpay, Zip and PayBright. Open invoice methods are set to manual capture by default. If you want auto capture, please contact magento@adyen.com. After approval, set this field to 'Immediate'. If you want to do a request capture on shipment, set this field to 'On shipment’. + Applicable for Klarna, Afterpay Touch, Ratepay, FacilyPay/Oney, Affirm, Clearpay, Zip and PayBright. Open invoice methods are set to manual capture by default. If you want auto capture, please contact support@adyen.com. After approval, set this field to 'Immediate'. If you want to do a request capture on shipment, set this field to 'On shipment’. Adyen\Payment\Model\Config\Source\OpenInvoiceCaptureMode payment/adyen_abstract/capture_for_openinvoice diff --git a/etc/adminhtml/system/adyen_initial_setup.xml b/etc/adminhtml/system/adyen_initial_setup.xml index 7c04401177..b722ac69d1 100755 --- a/etc/adminhtml/system/adyen_initial_setup.xml +++ b/etc/adminhtml/system/adyen_initial_setup.xml @@ -37,7 +37,7 @@ + showInStore="1"> 1 @@ -49,7 +49,7 @@ + showInStore="1"> 0 @@ -63,7 +63,7 @@ + showInStore="1"> 1 manual @@ -73,7 +73,7 @@ payment/adyen_abstract/client_key_test + showInStore="1"> 0 manual diff --git a/etc/adminhtml/system/adyen_online_checkout.xml b/etc/adminhtml/system/adyen_online_checkout.xml index b19e81b7fc..81f79bdf29 100644 --- a/etc/adminhtml/system/adyen_online_checkout.xml +++ b/etc/adminhtml/system/adyen_online_checkout.xml @@ -35,7 +35,7 @@ Magento\Config\Block\System\Config\Form\Fieldset - With headless integration, you can build your front end using Adyen’s pre-configured back end.
Learn more about headless integration

]]>
+ With headless integration, you can build your front end using Adyen’s pre-configured back end.
Learn more about headless integration

]]>
Only relevant if you process payments from an external URL different to that of Magento diff --git a/etc/adminhtml/system/adyen_testing_performance.xml b/etc/adminhtml/system/adyen_testing_performance.xml index dba8e46461..c384428841 100644 --- a/etc/adminhtml/system/adyen_testing_performance.xml +++ b/etc/adminhtml/system/adyen_testing_performance.xml @@ -42,7 +42,7 @@ Adyen\Payment\Model\Config\Source\NotificationProcessor payment/adyen_abstract/webhook_notification_processor - Use cron or queue (async) to process webhook notifications + Use cron or queue (async) to process webhook notifications. Queue performs better if you have AMQP service installed, like RabbitMQ. diff --git a/etc/config.xml b/etc/config.xml index 05ac6b76b3..c205ab519a 100755 --- a/etc/config.xml +++ b/etc/config.xml @@ -873,7 +873,7 @@ 0 AdyenPaymentDirectEbankingFacade - Sofort + Klarna Debit Risk 0 0 authorize @@ -893,7 +893,7 @@ adyen-alternative-payment-method - Stored Sofort + Stored Klarna Debit Risk AdyenPaymentDirectEbankingVaultFacade @@ -2093,6 +2093,120 @@ 0 adyen-alternative-payment-method + + 0 + AdyenPaymentOnlinebankingINFacade + Netbanking India + 0 + 0 + authorize + 1 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + adyen-alternative-payment-method + + + 0 + AdyenPaymentPaypoFacade + PayPo + 0 + 0 + authorize + 1 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + adyen-alternative-payment-method + + + 0 + AdyenPaymentWalletINFacade + Wallets in India + 0 + 0 + authorize + 1 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + adyen-alternative-payment-method + + + 0 + AdyenPaymentUpiFacade + UPI Payment Method India + 0 + 0 + authorize + 1 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + adyen-alternative-payment-method + + + 0 + AdyenPaymentDanaFacade + DANA + 0 + 0 + authorize + 1 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + adyen-alternative-payment-method + + + Stored DANA + AdyenPaymentDanaVaultFacade + diff --git a/etc/di.xml b/etc/di.xml index d2f8d90b06..7b4cdc5532 100755 --- a/etc/di.xml +++ b/etc/di.xml @@ -826,6 +826,7 @@ AdyenPaymentCommandManager AdyenPaymentCommandManager AdyenPaymentCommandManager + AdyenPaymentCommandManager @@ -4074,4 +4075,165 @@ adyen_ach_vault - + + + adyen_onlinebanking_IN + Magento\Payment\Block\Form + Adyen\Payment\Block\Info\PaymentMethodInfo + AdyenPaymentOnlinebankingINValueHandlerPool + AdyenPaymentValidatorPool + AdyenPaymentCommandPool + + + + + + AdyenPaymentOnlinebankingINConfigValueHandler + + + + + + AdyenPaymentOnlinebankingINConfig + + + + + adyen_onlinebanking_IN + + + + + adyen_paypo + Magento\Payment\Block\Form + Adyen\Payment\Block\Info\PaymentMethodInfo + AdyenPaymentPaypoValueHandlerPool + AdyenPaymentValidatorPool + AdyenPaymentCommandPool + + + + + + AdyenPaymentPaypoConfigValueHandler + + + + + + AdyenPaymentPaypoConfig + + + + + adyen_paypo + + + + + adyen_wallet_IN + Magento\Payment\Block\Form + Adyen\Payment\Block\Info\PaymentMethodInfo + AdyenPaymentWalletINValueHandlerPool + AdyenPaymentValidatorPool + AdyenPaymentCommandPool + + + + + + AdyenPaymentWalletINConfigValueHandler + + + + + + AdyenPaymentWalletINConfig + + + + + adyen_wallet_IN + + + + + adyen_upi + Magento\Payment\Block\Form + Adyen\Payment\Block\Info\PaymentMethodInfo + AdyenPaymentUpiValueHandlerPool + AdyenPaymentValidatorPool + AdyenPaymentCommandPool + + + + + + AdyenPaymentUpiConfigValueHandler + + + + + + AdyenPaymentUpiConfig + + + + + adyen_upi + + + + + adyen_dana + Magento\Payment\Block\Form + Adyen\Payment\Block\Info\PaymentMethodInfo + AdyenPaymentDanaValueHandlerPool + AdyenPaymentValidatorPool + AdyenPaymentCommandPool + + + + + + AdyenPaymentDanaConfigValueHandler + + + + + + AdyenPaymentDanaConfig + + + + + adyen_dana + + + + + adyen_dana_vault + AdyenPaymentDanaVaultConfig + AdyenPaymentDanaVaultValueHandlerPool + AdyenPaymentDanaFacade + AdyenPaymentCommandPool + + + + + + AdyenPaymentDanaVaultConfigValueHandler + + + + + + AdyenPaymentDanaVaultConfig + + + + + adyen_dana_vault + + + \ No newline at end of file diff --git a/etc/events.xml b/etc/events.xml index 6e1925845c..0a6acaf769 100644 --- a/etc/events.xml +++ b/etc/events.xml @@ -287,4 +287,19 @@ - + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/etc/frontend/di.xml b/etc/frontend/di.xml index 1bbc21afbf..f1ea6027d1 100755 --- a/etc/frontend/di.xml +++ b/etc/frontend/di.xml @@ -106,6 +106,11 @@ vipps bizum ach + wallet_IN + onlinebanking_IN + paypo + upi + dana Adyen_Payment/js/view/payment/method-renderer/adyen-cc-method @@ -150,6 +155,7 @@ Adyen\Payment\Model\Ui\PaymentMethodTokenUiComponentProvider Adyen\Payment\Model\Ui\PaymentMethodTokenUiComponentProvider Adyen\Payment\Model\Ui\PaymentMethodTokenUiComponentProvider + Adyen\Payment\Model\Ui\CardTokenUiComponentProvider diff --git a/etc/graphql/di.xml b/etc/graphql/di.xml index 2fb5e9e971..06b46a633f 100644 --- a/etc/graphql/di.xml +++ b/etc/graphql/di.xml @@ -87,6 +87,11 @@ Adyen\Payment\Model\Cart\Payment\AdditionalDataProvider\AdyenPm Adyen\Payment\Model\Cart\Payment\AdditionalDataProvider\AdyenPm Adyen\Payment\Model\Cart\Payment\AdditionalDataProvider\AdyenPm + Adyen\Payment\Model\Cart\Payment\AdditionalDataProvider\AdyenPm + Adyen\Payment\Model\Cart\Payment\AdditionalDataProvider\AdyenPm + Adyen\Payment\Model\Cart\Payment\AdditionalDataProvider\AdyenPm + Adyen\Payment\Model\Cart\Payment\AdditionalDataProvider\AdyenPm + Adyen\Payment\Model\Cart\Payment\AdditionalDataProvider\AdyenPm @@ -104,4 +109,4 @@ - + \ No newline at end of file diff --git a/etc/payment.xml b/etc/payment.xml index 25a807eabb..e1f64a6a2b 100755 --- a/etc/payment.xml +++ b/etc/payment.xml @@ -248,5 +248,20 @@ 1 + + 1 + + + 1 + + + 1 + + + 1 + + + 1 + \ No newline at end of file diff --git a/etc/queue_consumer.xml b/etc/queue_consumer.xml index cc75a47059..3fc53aa239 100644 --- a/etc/queue_consumer.xml +++ b/etc/queue_consumer.xml @@ -3,6 +3,5 @@ xsi:noNamespaceSchemaLocation="urn:magento:framework-message-queue:etc/consumer.xsd"> diff --git a/etc/queue_publisher.xml b/etc/queue_publisher.xml index 7fc9f88c8e..485ed39bf2 100644 --- a/etc/queue_publisher.xml +++ b/etc/queue_publisher.xml @@ -1,7 +1,5 @@ - - - + diff --git a/etc/queue_topology.xml b/etc/queue_topology.xml index c34b01f703..f12c9de92b 100644 --- a/etc/queue_topology.xml +++ b/etc/queue_topology.xml @@ -1,7 +1,7 @@ - + 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);\n}\n\n// BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`\n// so check `userAgent` even if `.v8` exists, but 0\nif (!version && userAgent) {\n match = userAgent.match(/Edge\\/(\\d+)/);\n if (!match || match[1] >= 74) {\n match = userAgent.match(/Chrome\\/(\\d+)/);\n if (match) version = +match[1];\n }\n}\n\nmodule.exports = version;\n","'use strict';\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar fails = require('../internals/fails');\nvar classof = require('../internals/classof-raw');\n\nvar $Object = Object;\nvar split = uncurryThis(''.split);\n\n// fallback for non-array-like ES3 and non-enumerable old V8 strings\nmodule.exports = fails(function () {\n // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346\n // eslint-disable-next-line no-prototype-builtins -- safe\n return !$Object('z').propertyIsEnumerable(0);\n}) ? function (it) {\n return classof(it) === 'String' ? split(it, '') : $Object(it);\n} : $Object;\n","'use strict';\n// we can't use just `it == null` since of `document.all` special case\n// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec\nmodule.exports = function (it) {\n return it === null || it === undefined;\n};\n","'use strict';\nvar isNullOrUndefined = require('../internals/is-null-or-undefined');\n\nvar $TypeError = TypeError;\n\n// `RequireObjectCoercible` abstract operation\n// https://tc39.es/ecma262/#sec-requireobjectcoercible\nmodule.exports = function (it) {\n if (isNullOrUndefined(it)) throw new $TypeError(\"Can't call method on \" + it);\n return it;\n};\n","'use strict';\n// toObject with fallback for non-array-like ES3 strings\nvar IndexedObject = require('../internals/indexed-object');\nvar requireObjectCoercible = require('../internals/require-object-coercible');\n\nmodule.exports = function (it) {\n return IndexedObject(requireObjectCoercible(it));\n};\n","'use strict';\nvar isCallable = require('../internals/is-callable');\nvar $documentAll = require('../internals/document-all');\n\nvar documentAll = $documentAll.all;\n\nmodule.exports = $documentAll.IS_HTMLDDA ? function (it) {\n return typeof it == 'object' ? it !== null : isCallable(it) || it === documentAll;\n} : function (it) {\n return typeof it == 'object' ? it !== null : isCallable(it);\n};\n","'use strict';\nmodule.exports = {};\n","'use strict';\nvar path = require('../internals/path');\nvar global = require('../internals/global');\nvar isCallable = require('../internals/is-callable');\n\nvar aFunction = function (variable) {\n return isCallable(variable) ? variable : undefined;\n};\n\nmodule.exports = function (namespace, method) {\n return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global[namespace])\n : path[namespace] && path[namespace][method] || global[namespace] && global[namespace][method];\n};\n","'use strict';\nvar uncurryThis = require('../internals/function-uncurry-this');\n\nmodule.exports = uncurryThis({}.isPrototypeOf);\n","'use strict';\nmodule.exports = typeof navigator != 'undefined' && String(navigator.userAgent) || '';\n","'use strict';\n/* eslint-disable es/no-symbol -- required for testing */\nvar V8_VERSION = require('../internals/engine-v8-version');\nvar fails = require('../internals/fails');\nvar global = require('../internals/global');\n\nvar $String = global.String;\n\n// eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing\nmodule.exports = !!Object.getOwnPropertySymbols && !fails(function () {\n var symbol = Symbol('symbol detection');\n // Chrome 38 Symbol has incorrect toString conversion\n // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances\n // nb: Do not call `String` directly to avoid this being optimized out to `symbol+''` which will,\n // of course, fail.\n return !$String(symbol) || !(Object(symbol) instanceof Symbol) ||\n // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances\n !Symbol.sham && V8_VERSION && V8_VERSION < 41;\n});\n","'use strict';\n/* eslint-disable es/no-symbol -- required for testing */\nvar NATIVE_SYMBOL = require('../internals/symbol-constructor-detection');\n\nmodule.exports = NATIVE_SYMBOL\n && !Symbol.sham\n && typeof Symbol.iterator == 'symbol';\n","'use strict';\nvar getBuiltIn = require('../internals/get-built-in');\nvar isCallable = require('../internals/is-callable');\nvar isPrototypeOf = require('../internals/object-is-prototype-of');\nvar USE_SYMBOL_AS_UID = require('../internals/use-symbol-as-uid');\n\nvar $Object = Object;\n\nmodule.exports = USE_SYMBOL_AS_UID ? function (it) {\n return typeof it == 'symbol';\n} : function (it) {\n var $Symbol = getBuiltIn('Symbol');\n return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, $Object(it));\n};\n","'use strict';\nvar $String = String;\n\nmodule.exports = function (argument) {\n try {\n return $String(argument);\n } catch (error) {\n return 'Object';\n }\n};\n","'use strict';\nvar isCallable = require('../internals/is-callable');\nvar tryToString = require('../internals/try-to-string');\n\nvar $TypeError = TypeError;\n\n// `Assert: IsCallable(argument) is true`\nmodule.exports = function (argument) {\n if (isCallable(argument)) return argument;\n throw new $TypeError(tryToString(argument) + ' is not a function');\n};\n","'use strict';\nvar aCallable = require('../internals/a-callable');\nvar isNullOrUndefined = require('../internals/is-null-or-undefined');\n\n// `GetMethod` abstract operation\n// https://tc39.es/ecma262/#sec-getmethod\nmodule.exports = function (V, P) {\n var func = V[P];\n return isNullOrUndefined(func) ? undefined : aCallable(func);\n};\n","'use strict';\nvar call = require('../internals/function-call');\nvar isCallable = require('../internals/is-callable');\nvar isObject = require('../internals/is-object');\n\nvar $TypeError = TypeError;\n\n// `OrdinaryToPrimitive` abstract operation\n// https://tc39.es/ecma262/#sec-ordinarytoprimitive\nmodule.exports = function (input, pref) {\n var fn, val;\n if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;\n if (isCallable(fn = input.valueOf) && !isObject(val = call(fn, input))) return val;\n if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;\n throw new $TypeError(\"Can't convert object to primitive value\");\n};\n","'use strict';\nvar global = require('../internals/global');\n\n// eslint-disable-next-line es/no-object-defineproperty -- safe\nvar defineProperty = Object.defineProperty;\n\nmodule.exports = function (key, value) {\n try {\n defineProperty(global, key, { value: value, configurable: true, writable: true });\n } catch (error) {\n global[key] = value;\n } return value;\n};\n","'use strict';\nvar global = require('../internals/global');\nvar defineGlobalProperty = require('../internals/define-global-property');\n\nvar SHARED = '__core-js_shared__';\nvar store = global[SHARED] || defineGlobalProperty(SHARED, {});\n\nmodule.exports = store;\n","'use strict';\nvar IS_PURE = require('../internals/is-pure');\nvar store = require('../internals/shared-store');\n\n(module.exports = function (key, value) {\n return store[key] || (store[key] = value !== undefined ? value : {});\n})('versions', []).push({\n version: '3.33.3',\n mode: IS_PURE ? 'pure' : 'global',\n copyright: '© 2014-2023 Denis Pushkarev (zloirock.ru)',\n license: 'https://github.com/zloirock/core-js/blob/v3.33.3/LICENSE',\n source: 'https://github.com/zloirock/core-js'\n});\n","'use strict';\nvar requireObjectCoercible = require('../internals/require-object-coercible');\n\nvar $Object = Object;\n\n// `ToObject` abstract operation\n// https://tc39.es/ecma262/#sec-toobject\nmodule.exports = function (argument) {\n return $Object(requireObjectCoercible(argument));\n};\n","'use strict';\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar toObject = require('../internals/to-object');\n\nvar hasOwnProperty = uncurryThis({}.hasOwnProperty);\n\n// `HasOwnProperty` abstract operation\n// https://tc39.es/ecma262/#sec-hasownproperty\n// eslint-disable-next-line es/no-object-hasown -- safe\nmodule.exports = Object.hasOwn || function hasOwn(it, key) {\n return hasOwnProperty(toObject(it), key);\n};\n","'use strict';\nvar uncurryThis = require('../internals/function-uncurry-this');\n\nvar id = 0;\nvar postfix = Math.random();\nvar toString = uncurryThis(1.0.toString);\n\nmodule.exports = function (key) {\n return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36);\n};\n","'use strict';\nvar global = require('../internals/global');\nvar shared = require('../internals/shared');\nvar hasOwn = require('../internals/has-own-property');\nvar uid = require('../internals/uid');\nvar NATIVE_SYMBOL = require('../internals/symbol-constructor-detection');\nvar USE_SYMBOL_AS_UID = require('../internals/use-symbol-as-uid');\n\nvar Symbol = global.Symbol;\nvar WellKnownSymbolsStore = shared('wks');\nvar createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol['for'] || Symbol : Symbol && Symbol.withoutSetter || uid;\n\nmodule.exports = function (name) {\n if (!hasOwn(WellKnownSymbolsStore, name)) {\n WellKnownSymbolsStore[name] = NATIVE_SYMBOL && hasOwn(Symbol, name)\n ? Symbol[name]\n : createWellKnownSymbol('Symbol.' + name);\n } return WellKnownSymbolsStore[name];\n};\n","'use strict';\nvar call = require('../internals/function-call');\nvar isObject = require('../internals/is-object');\nvar isSymbol = require('../internals/is-symbol');\nvar getMethod = require('../internals/get-method');\nvar ordinaryToPrimitive = require('../internals/ordinary-to-primitive');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar $TypeError = TypeError;\nvar TO_PRIMITIVE = wellKnownSymbol('toPrimitive');\n\n// `ToPrimitive` abstract operation\n// https://tc39.es/ecma262/#sec-toprimitive\nmodule.exports = function (input, pref) {\n if (!isObject(input) || isSymbol(input)) return input;\n var exoticToPrim = getMethod(input, TO_PRIMITIVE);\n var result;\n if (exoticToPrim) {\n if (pref === undefined) pref = 'default';\n result = call(exoticToPrim, input, pref);\n if (!isObject(result) || isSymbol(result)) return result;\n throw new $TypeError(\"Can't convert object to primitive value\");\n }\n if (pref === undefined) pref = 'number';\n return ordinaryToPrimitive(input, pref);\n};\n","'use strict';\nvar toPrimitive = require('../internals/to-primitive');\nvar isSymbol = require('../internals/is-symbol');\n\n// `ToPropertyKey` abstract operation\n// https://tc39.es/ecma262/#sec-topropertykey\nmodule.exports = function (argument) {\n var key = toPrimitive(argument, 'string');\n return isSymbol(key) ? key : key + '';\n};\n","'use strict';\nvar global = require('../internals/global');\nvar isObject = require('../internals/is-object');\n\nvar document = global.document;\n// typeof document.createElement is 'object' in old IE\nvar EXISTS = isObject(document) && isObject(document.createElement);\n\nmodule.exports = function (it) {\n return EXISTS ? document.createElement(it) : {};\n};\n","'use strict';\nvar DESCRIPTORS = require('../internals/descriptors');\nvar fails = require('../internals/fails');\nvar createElement = require('../internals/document-create-element');\n\n// Thanks to IE8 for its funny defineProperty\nmodule.exports = !DESCRIPTORS && !fails(function () {\n // eslint-disable-next-line es/no-object-defineproperty -- required for testing\n return Object.defineProperty(createElement('div'), 'a', {\n get: function () { return 7; }\n }).a !== 7;\n});\n","'use strict';\nvar DESCRIPTORS = require('../internals/descriptors');\nvar call = require('../internals/function-call');\nvar propertyIsEnumerableModule = require('../internals/object-property-is-enumerable');\nvar createPropertyDescriptor = require('../internals/create-property-descriptor');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar toPropertyKey = require('../internals/to-property-key');\nvar hasOwn = require('../internals/has-own-property');\nvar IE8_DOM_DEFINE = require('../internals/ie8-dom-define');\n\n// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe\nvar $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\n\n// `Object.getOwnPropertyDescriptor` method\n// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor\nexports.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {\n O = toIndexedObject(O);\n P = toPropertyKey(P);\n if (IE8_DOM_DEFINE) try {\n return $getOwnPropertyDescriptor(O, P);\n } catch (error) { /* empty */ }\n if (hasOwn(O, P)) return createPropertyDescriptor(!call(propertyIsEnumerableModule.f, O, P), O[P]);\n};\n","'use strict';\nvar fails = require('../internals/fails');\nvar isCallable = require('../internals/is-callable');\n\nvar replacement = /#|\\.prototype\\./;\n\nvar isForced = function (feature, detection) {\n var value = data[normalize(feature)];\n return value === POLYFILL ? true\n : value === NATIVE ? false\n : isCallable(detection) ? fails(detection)\n : !!detection;\n};\n\nvar normalize = isForced.normalize = function (string) {\n return String(string).replace(replacement, '.').toLowerCase();\n};\n\nvar data = isForced.data = {};\nvar NATIVE = isForced.NATIVE = 'N';\nvar POLYFILL = isForced.POLYFILL = 'P';\n\nmodule.exports = isForced;\n","'use strict';\nvar uncurryThis = require('../internals/function-uncurry-this-clause');\nvar aCallable = require('../internals/a-callable');\nvar NATIVE_BIND = require('../internals/function-bind-native');\n\nvar bind = uncurryThis(uncurryThis.bind);\n\n// optional / simple context binding\nmodule.exports = function (fn, that) {\n aCallable(fn);\n return that === undefined ? fn : NATIVE_BIND ? bind(fn, that) : function (/* ...args */) {\n return fn.apply(that, arguments);\n };\n};\n","'use strict';\nvar DESCRIPTORS = require('../internals/descriptors');\nvar fails = require('../internals/fails');\n\n// V8 ~ Chrome 36-\n// https://bugs.chromium.org/p/v8/issues/detail?id=3334\nmodule.exports = DESCRIPTORS && fails(function () {\n // eslint-disable-next-line es/no-object-defineproperty -- required for testing\n return Object.defineProperty(function () { /* empty */ }, 'prototype', {\n value: 42,\n writable: false\n }).prototype !== 42;\n});\n","'use strict';\nvar isObject = require('../internals/is-object');\n\nvar $String = String;\nvar $TypeError = TypeError;\n\n// `Assert: Type(argument) is Object`\nmodule.exports = function (argument) {\n if (isObject(argument)) return argument;\n throw new $TypeError($String(argument) + ' is not an object');\n};\n","'use strict';\nvar DESCRIPTORS = require('../internals/descriptors');\nvar IE8_DOM_DEFINE = require('../internals/ie8-dom-define');\nvar V8_PROTOTYPE_DEFINE_BUG = require('../internals/v8-prototype-define-bug');\nvar anObject = require('../internals/an-object');\nvar toPropertyKey = require('../internals/to-property-key');\n\nvar $TypeError = TypeError;\n// eslint-disable-next-line es/no-object-defineproperty -- safe\nvar $defineProperty = Object.defineProperty;\n// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe\nvar $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\nvar ENUMERABLE = 'enumerable';\nvar CONFIGURABLE = 'configurable';\nvar WRITABLE = 'writable';\n\n// `Object.defineProperty` method\n// https://tc39.es/ecma262/#sec-object.defineproperty\nexports.f = DESCRIPTORS ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P, Attributes) {\n anObject(O);\n P = toPropertyKey(P);\n anObject(Attributes);\n if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {\n var current = $getOwnPropertyDescriptor(O, P);\n if (current && current[WRITABLE]) {\n O[P] = Attributes.value;\n Attributes = {\n configurable: CONFIGURABLE in Attributes ? Attributes[CONFIGURABLE] : current[CONFIGURABLE],\n enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],\n writable: false\n };\n }\n } return $defineProperty(O, P, Attributes);\n} : $defineProperty : function defineProperty(O, P, Attributes) {\n anObject(O);\n P = toPropertyKey(P);\n anObject(Attributes);\n if (IE8_DOM_DEFINE) try {\n return $defineProperty(O, P, Attributes);\n } catch (error) { /* empty */ }\n if ('get' in Attributes || 'set' in Attributes) throw new $TypeError('Accessors not supported');\n if ('value' in Attributes) O[P] = Attributes.value;\n return O;\n};\n","'use strict';\nvar DESCRIPTORS = require('../internals/descriptors');\nvar definePropertyModule = require('../internals/object-define-property');\nvar createPropertyDescriptor = require('../internals/create-property-descriptor');\n\nmodule.exports = DESCRIPTORS ? function (object, key, value) {\n return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));\n} : function (object, key, value) {\n object[key] = value;\n return object;\n};\n","'use strict';\nvar global = require('../internals/global');\nvar apply = require('../internals/function-apply');\nvar uncurryThis = require('../internals/function-uncurry-this-clause');\nvar isCallable = require('../internals/is-callable');\nvar getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;\nvar isForced = require('../internals/is-forced');\nvar path = require('../internals/path');\nvar bind = require('../internals/function-bind-context');\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\nvar hasOwn = require('../internals/has-own-property');\n\nvar wrapConstructor = function (NativeConstructor) {\n var Wrapper = function (a, b, c) {\n if (this instanceof Wrapper) {\n switch (arguments.length) {\n case 0: return new NativeConstructor();\n case 1: return new NativeConstructor(a);\n case 2: return new NativeConstructor(a, b);\n } return new NativeConstructor(a, b, c);\n } return apply(NativeConstructor, this, arguments);\n };\n Wrapper.prototype = NativeConstructor.prototype;\n return Wrapper;\n};\n\n/*\n options.target - name of the target object\n options.global - target is the global object\n options.stat - export as static methods of target\n options.proto - export as prototype methods of target\n options.real - real prototype method for the `pure` version\n options.forced - export even if the native feature is available\n options.bind - bind methods to the target, required for the `pure` version\n options.wrap - wrap constructors to preventing global pollution, required for the `pure` version\n options.unsafe - use the simple assignment of property instead of delete + defineProperty\n options.sham - add a flag to not completely full polyfills\n options.enumerable - export as enumerable property\n options.dontCallGetSet - prevent calling a getter on target\n options.name - the .name of the function if it does not match the key\n*/\nmodule.exports = function (options, source) {\n var TARGET = options.target;\n var GLOBAL = options.global;\n var STATIC = options.stat;\n var PROTO = options.proto;\n\n var nativeSource = GLOBAL ? global : STATIC ? global[TARGET] : (global[TARGET] || {}).prototype;\n\n var target = GLOBAL ? path : path[TARGET] || createNonEnumerableProperty(path, TARGET, {})[TARGET];\n var targetPrototype = target.prototype;\n\n var FORCED, USE_NATIVE, VIRTUAL_PROTOTYPE;\n var key, sourceProperty, targetProperty, nativeProperty, resultProperty, descriptor;\n\n for (key in source) {\n FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);\n // contains in native\n USE_NATIVE = !FORCED && nativeSource && hasOwn(nativeSource, key);\n\n targetProperty = target[key];\n\n if (USE_NATIVE) if (options.dontCallGetSet) {\n descriptor = getOwnPropertyDescriptor(nativeSource, key);\n nativeProperty = descriptor && descriptor.value;\n } else nativeProperty = nativeSource[key];\n\n // export native or implementation\n sourceProperty = (USE_NATIVE && nativeProperty) ? nativeProperty : source[key];\n\n if (USE_NATIVE && typeof targetProperty == typeof sourceProperty) continue;\n\n // bind methods to global for calling from export context\n if (options.bind && USE_NATIVE) resultProperty = bind(sourceProperty, global);\n // wrap global constructors for prevent changes in this version\n else if (options.wrap && USE_NATIVE) resultProperty = wrapConstructor(sourceProperty);\n // make static versions for prototype methods\n else if (PROTO && isCallable(sourceProperty)) resultProperty = uncurryThis(sourceProperty);\n // default case\n else resultProperty = sourceProperty;\n\n // add a flag to not completely full polyfills\n if (options.sham || (sourceProperty && sourceProperty.sham) || (targetProperty && targetProperty.sham)) {\n createNonEnumerableProperty(resultProperty, 'sham', true);\n }\n\n createNonEnumerableProperty(target, key, resultProperty);\n\n if (PROTO) {\n VIRTUAL_PROTOTYPE = TARGET + 'Prototype';\n if (!hasOwn(path, VIRTUAL_PROTOTYPE)) {\n createNonEnumerableProperty(path, VIRTUAL_PROTOTYPE, {});\n }\n // export virtual prototype methods\n createNonEnumerableProperty(path[VIRTUAL_PROTOTYPE], key, sourceProperty);\n // export real prototype methods\n if (options.real && targetPrototype && (FORCED || !targetPrototype[key])) {\n createNonEnumerableProperty(targetPrototype, key, sourceProperty);\n }\n }\n }\n};\n","'use strict';\nvar shared = require('../internals/shared');\nvar uid = require('../internals/uid');\n\nvar keys = shared('keys');\n\nmodule.exports = function (key) {\n return keys[key] || (keys[key] = uid(key));\n};\n","'use strict';\nvar fails = require('../internals/fails');\n\nmodule.exports = !fails(function () {\n function F() { /* empty */ }\n F.prototype.constructor = null;\n // eslint-disable-next-line es/no-object-getprototypeof -- required for testing\n return Object.getPrototypeOf(new F()) !== F.prototype;\n});\n","'use strict';\nvar hasOwn = require('../internals/has-own-property');\nvar isCallable = require('../internals/is-callable');\nvar toObject = require('../internals/to-object');\nvar sharedKey = require('../internals/shared-key');\nvar CORRECT_PROTOTYPE_GETTER = require('../internals/correct-prototype-getter');\n\nvar IE_PROTO = sharedKey('IE_PROTO');\nvar $Object = Object;\nvar ObjectPrototype = $Object.prototype;\n\n// `Object.getPrototypeOf` method\n// https://tc39.es/ecma262/#sec-object.getprototypeof\n// eslint-disable-next-line es/no-object-getprototypeof -- safe\nmodule.exports = CORRECT_PROTOTYPE_GETTER ? $Object.getPrototypeOf : function (O) {\n var object = toObject(O);\n if (hasOwn(object, IE_PROTO)) return object[IE_PROTO];\n var constructor = object.constructor;\n if (isCallable(constructor) && object instanceof constructor) {\n return constructor.prototype;\n } return object instanceof $Object ? ObjectPrototype : null;\n};\n","'use strict';\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar aCallable = require('../internals/a-callable');\n\nmodule.exports = function (object, key, method) {\n try {\n // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe\n return uncurryThis(aCallable(Object.getOwnPropertyDescriptor(object, key)[method]));\n } catch (error) { /* empty */ }\n};\n","'use strict';\nvar isCallable = require('../internals/is-callable');\n\nvar $String = String;\nvar $TypeError = TypeError;\n\nmodule.exports = function (argument) {\n if (typeof argument == 'object' || isCallable(argument)) return argument;\n throw new $TypeError(\"Can't set \" + $String(argument) + ' as a prototype');\n};\n","'use strict';\n/* eslint-disable no-proto -- safe */\nvar uncurryThisAccessor = require('../internals/function-uncurry-this-accessor');\nvar anObject = require('../internals/an-object');\nvar aPossiblePrototype = require('../internals/a-possible-prototype');\n\n// `Object.setPrototypeOf` method\n// https://tc39.es/ecma262/#sec-object.setprototypeof\n// Works with __proto__ only. Old v8 can't work with null proto objects.\n// eslint-disable-next-line es/no-object-setprototypeof -- safe\nmodule.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () {\n var CORRECT_SETTER = false;\n var test = {};\n var setter;\n try {\n setter = uncurryThisAccessor(Object.prototype, '__proto__', 'set');\n setter(test, []);\n CORRECT_SETTER = test instanceof Array;\n } catch (error) { /* empty */ }\n return function setPrototypeOf(O, proto) {\n anObject(O);\n aPossiblePrototype(proto);\n if (CORRECT_SETTER) setter(O, proto);\n else O.__proto__ = proto;\n return O;\n };\n}() : undefined);\n","'use strict';\nvar ceil = Math.ceil;\nvar floor = Math.floor;\n\n// `Math.trunc` method\n// https://tc39.es/ecma262/#sec-math.trunc\n// eslint-disable-next-line es/no-math-trunc -- safe\nmodule.exports = Math.trunc || function trunc(x) {\n var n = +x;\n return (n > 0 ? floor : ceil)(n);\n};\n","'use strict';\nvar trunc = require('../internals/math-trunc');\n\n// `ToIntegerOrInfinity` abstract operation\n// https://tc39.es/ecma262/#sec-tointegerorinfinity\nmodule.exports = function (argument) {\n var number = +argument;\n // eslint-disable-next-line no-self-compare -- NaN check\n return number !== number || number === 0 ? 0 : trunc(number);\n};\n","'use strict';\nvar toIntegerOrInfinity = require('../internals/to-integer-or-infinity');\n\nvar max = Math.max;\nvar min = Math.min;\n\n// Helper for a popular repeating case of the spec:\n// Let integer be ? ToInteger(index).\n// If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).\nmodule.exports = function (index, length) {\n var integer = toIntegerOrInfinity(index);\n return integer < 0 ? max(integer + length, 0) : min(integer, length);\n};\n","'use strict';\nvar toIntegerOrInfinity = require('../internals/to-integer-or-infinity');\n\nvar min = Math.min;\n\n// `ToLength` abstract operation\n// https://tc39.es/ecma262/#sec-tolength\nmodule.exports = function (argument) {\n return argument > 0 ? min(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991\n};\n","'use strict';\nvar toLength = require('../internals/to-length');\n\n// `LengthOfArrayLike` abstract operation\n// https://tc39.es/ecma262/#sec-lengthofarraylike\nmodule.exports = function (obj) {\n return toLength(obj.length);\n};\n","'use strict';\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar toAbsoluteIndex = require('../internals/to-absolute-index');\nvar lengthOfArrayLike = require('../internals/length-of-array-like');\n\n// `Array.prototype.{ indexOf, includes }` methods implementation\nvar createMethod = function (IS_INCLUDES) {\n return function ($this, el, fromIndex) {\n var O = toIndexedObject($this);\n var length = lengthOfArrayLike(O);\n var index = toAbsoluteIndex(fromIndex, length);\n var value;\n // Array#includes uses SameValueZero equality algorithm\n // eslint-disable-next-line no-self-compare -- NaN check\n if (IS_INCLUDES && el !== el) while (length > index) {\n value = O[index++];\n // eslint-disable-next-line no-self-compare -- NaN check\n if (value !== value) return true;\n // Array#indexOf ignores holes, Array#includes - not\n } else for (;length > index; index++) {\n if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;\n } return !IS_INCLUDES && -1;\n };\n};\n\nmodule.exports = {\n // `Array.prototype.includes` method\n // https://tc39.es/ecma262/#sec-array.prototype.includes\n includes: createMethod(true),\n // `Array.prototype.indexOf` method\n // https://tc39.es/ecma262/#sec-array.prototype.indexof\n indexOf: createMethod(false)\n};\n","'use strict';\nmodule.exports = {};\n","'use strict';\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar hasOwn = require('../internals/has-own-property');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar indexOf = require('../internals/array-includes').indexOf;\nvar hiddenKeys = require('../internals/hidden-keys');\n\nvar push = uncurryThis([].push);\n\nmodule.exports = function (object, names) {\n var O = toIndexedObject(object);\n var i = 0;\n var result = [];\n var key;\n for (key in O) !hasOwn(hiddenKeys, key) && hasOwn(O, key) && push(result, key);\n // Don't enum bug & hidden keys\n while (names.length > i) if (hasOwn(O, key = names[i++])) {\n ~indexOf(result, key) || push(result, key);\n }\n return result;\n};\n","'use strict';\n// IE8- don't enum bug keys\nmodule.exports = [\n 'constructor',\n 'hasOwnProperty',\n 'isPrototypeOf',\n 'propertyIsEnumerable',\n 'toLocaleString',\n 'toString',\n 'valueOf'\n];\n","'use strict';\nvar internalObjectKeys = require('../internals/object-keys-internal');\nvar enumBugKeys = require('../internals/enum-bug-keys');\n\nvar hiddenKeys = enumBugKeys.concat('length', 'prototype');\n\n// `Object.getOwnPropertyNames` method\n// https://tc39.es/ecma262/#sec-object.getownpropertynames\n// eslint-disable-next-line es/no-object-getownpropertynames -- safe\nexports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {\n return internalObjectKeys(O, hiddenKeys);\n};\n","'use strict';\n// eslint-disable-next-line es/no-object-getownpropertysymbols -- safe\nexports.f = Object.getOwnPropertySymbols;\n","'use strict';\nvar getBuiltIn = require('../internals/get-built-in');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar getOwnPropertyNamesModule = require('../internals/object-get-own-property-names');\nvar getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols');\nvar anObject = require('../internals/an-object');\n\nvar concat = uncurryThis([].concat);\n\n// all object keys, includes non-enumerable and symbols\nmodule.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {\n var keys = getOwnPropertyNamesModule.f(anObject(it));\n var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;\n return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;\n};\n","'use strict';\nvar hasOwn = require('../internals/has-own-property');\nvar ownKeys = require('../internals/own-keys');\nvar getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor');\nvar definePropertyModule = require('../internals/object-define-property');\n\nmodule.exports = function (target, source, exceptions) {\n var keys = ownKeys(source);\n var defineProperty = definePropertyModule.f;\n var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n if (!hasOwn(target, key) && !(exceptions && hasOwn(exceptions, key))) {\n defineProperty(target, key, getOwnPropertyDescriptor(source, key));\n }\n }\n};\n","'use strict';\nvar internalObjectKeys = require('../internals/object-keys-internal');\nvar enumBugKeys = require('../internals/enum-bug-keys');\n\n// `Object.keys` method\n// https://tc39.es/ecma262/#sec-object.keys\n// eslint-disable-next-line es/no-object-keys -- safe\nmodule.exports = Object.keys || function keys(O) {\n return internalObjectKeys(O, enumBugKeys);\n};\n","'use strict';\nvar DESCRIPTORS = require('../internals/descriptors');\nvar V8_PROTOTYPE_DEFINE_BUG = require('../internals/v8-prototype-define-bug');\nvar definePropertyModule = require('../internals/object-define-property');\nvar anObject = require('../internals/an-object');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar objectKeys = require('../internals/object-keys');\n\n// `Object.defineProperties` method\n// https://tc39.es/ecma262/#sec-object.defineproperties\n// eslint-disable-next-line es/no-object-defineproperties -- safe\nexports.f = DESCRIPTORS && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {\n anObject(O);\n var props = toIndexedObject(Properties);\n var keys = objectKeys(Properties);\n var length = keys.length;\n var index = 0;\n var key;\n while (length > index) definePropertyModule.f(O, key = keys[index++], props[key]);\n return O;\n};\n","'use strict';\nvar getBuiltIn = require('../internals/get-built-in');\n\nmodule.exports = getBuiltIn('document', 'documentElement');\n","'use strict';\n/* global ActiveXObject -- old IE, WSH */\nvar anObject = require('../internals/an-object');\nvar definePropertiesModule = require('../internals/object-define-properties');\nvar enumBugKeys = require('../internals/enum-bug-keys');\nvar hiddenKeys = require('../internals/hidden-keys');\nvar html = require('../internals/html');\nvar documentCreateElement = require('../internals/document-create-element');\nvar sharedKey = require('../internals/shared-key');\n\nvar GT = '>';\nvar LT = '<';\nvar PROTOTYPE = 'prototype';\nvar SCRIPT = 'script';\nvar IE_PROTO = sharedKey('IE_PROTO');\n\nvar EmptyConstructor = function () { /* empty */ };\n\nvar scriptTag = function (content) {\n return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;\n};\n\n// Create object with fake `null` prototype: use ActiveX Object with cleared prototype\nvar NullProtoObjectViaActiveX = function (activeXDocument) {\n activeXDocument.write(scriptTag(''));\n activeXDocument.close();\n var temp = activeXDocument.parentWindow.Object;\n activeXDocument = null; // avoid memory leak\n return temp;\n};\n\n// Create object with fake `null` prototype: use iframe Object with cleared prototype\nvar NullProtoObjectViaIFrame = function () {\n // Thrash, waste and sodomy: IE GC bug\n var iframe = documentCreateElement('iframe');\n var JS = 'java' + SCRIPT + ':';\n var iframeDocument;\n iframe.style.display = 'none';\n html.appendChild(iframe);\n // https://github.com/zloirock/core-js/issues/475\n iframe.src = String(JS);\n iframeDocument = iframe.contentWindow.document;\n iframeDocument.open();\n iframeDocument.write(scriptTag('document.F=Object'));\n iframeDocument.close();\n return iframeDocument.F;\n};\n\n// Check for document.domain and active x support\n// No need to use active x approach when document.domain is not set\n// see https://github.com/es-shims/es5-shim/issues/150\n// variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346\n// avoid IE GC bug\nvar activeXDocument;\nvar NullProtoObject = function () {\n try {\n activeXDocument = new ActiveXObject('htmlfile');\n } catch (error) { /* ignore */ }\n NullProtoObject = typeof document != 'undefined'\n ? document.domain && activeXDocument\n ? NullProtoObjectViaActiveX(activeXDocument) // old IE\n : NullProtoObjectViaIFrame()\n : NullProtoObjectViaActiveX(activeXDocument); // WSH\n var length = enumBugKeys.length;\n while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];\n return NullProtoObject();\n};\n\nhiddenKeys[IE_PROTO] = true;\n\n// `Object.create` method\n// https://tc39.es/ecma262/#sec-object.create\n// eslint-disable-next-line es/no-object-create -- safe\nmodule.exports = Object.create || function create(O, Properties) {\n var result;\n if (O !== null) {\n EmptyConstructor[PROTOTYPE] = anObject(O);\n result = new EmptyConstructor();\n EmptyConstructor[PROTOTYPE] = null;\n // add \"__proto__\" for Object.getPrototypeOf polyfill\n result[IE_PROTO] = O;\n } else result = NullProtoObject();\n return Properties === undefined ? result : definePropertiesModule.f(result, Properties);\n};\n","'use strict';\nvar isObject = require('../internals/is-object');\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\n\n// `InstallErrorCause` abstract operation\n// https://tc39.es/proposal-error-cause/#sec-errorobjects-install-error-cause\nmodule.exports = function (O, options) {\n if (isObject(options) && 'cause' in options) {\n createNonEnumerableProperty(O, 'cause', options.cause);\n }\n};\n","'use strict';\nvar uncurryThis = require('../internals/function-uncurry-this');\n\nvar $Error = Error;\nvar replace = uncurryThis(''.replace);\n\nvar TEST = (function (arg) { return String(new $Error(arg).stack); })('zxcasd');\n// eslint-disable-next-line redos/no-vulnerable -- safe\nvar V8_OR_CHAKRA_STACK_ENTRY = /\\n\\s*at [^:]*:[^\\n]*/;\nvar IS_V8_OR_CHAKRA_STACK = V8_OR_CHAKRA_STACK_ENTRY.test(TEST);\n\nmodule.exports = function (stack, dropEntries) {\n if (IS_V8_OR_CHAKRA_STACK && typeof stack == 'string' && !$Error.prepareStackTrace) {\n while (dropEntries--) stack = replace(stack, V8_OR_CHAKRA_STACK_ENTRY, '');\n } return stack;\n};\n","'use strict';\nvar fails = require('../internals/fails');\nvar createPropertyDescriptor = require('../internals/create-property-descriptor');\n\nmodule.exports = !fails(function () {\n var error = new Error('a');\n if (!('stack' in error)) return true;\n // eslint-disable-next-line es/no-object-defineproperty -- safe\n Object.defineProperty(error, 'stack', createPropertyDescriptor(1, 7));\n return error.stack !== 7;\n});\n","'use strict';\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\nvar clearErrorStack = require('../internals/error-stack-clear');\nvar ERROR_STACK_INSTALLABLE = require('../internals/error-stack-installable');\n\n// non-standard V8\nvar captureStackTrace = Error.captureStackTrace;\n\nmodule.exports = function (error, C, stack, dropEntries) {\n if (ERROR_STACK_INSTALLABLE) {\n if (captureStackTrace) captureStackTrace(error, C);\n else createNonEnumerableProperty(error, 'stack', clearErrorStack(stack, dropEntries));\n }\n};\n","'use strict';\nmodule.exports = {};\n","'use strict';\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar Iterators = require('../internals/iterators');\n\nvar ITERATOR = wellKnownSymbol('iterator');\nvar ArrayPrototype = Array.prototype;\n\n// check on default Array iterator\nmodule.exports = function (it) {\n return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it);\n};\n","'use strict';\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar TO_STRING_TAG = wellKnownSymbol('toStringTag');\nvar test = {};\n\ntest[TO_STRING_TAG] = 'z';\n\nmodule.exports = String(test) === '[object z]';\n","'use strict';\nvar TO_STRING_TAG_SUPPORT = require('../internals/to-string-tag-support');\nvar isCallable = require('../internals/is-callable');\nvar classofRaw = require('../internals/classof-raw');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar TO_STRING_TAG = wellKnownSymbol('toStringTag');\nvar $Object = Object;\n\n// ES3 wrong here\nvar CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) === 'Arguments';\n\n// fallback for IE11 Script Access Denied error\nvar tryGet = function (it, key) {\n try {\n return it[key];\n } catch (error) { /* empty */ }\n};\n\n// getting tag from ES6+ `Object.prototype.toString`\nmodule.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {\n var O, tag, result;\n return it === undefined ? 'Undefined' : it === null ? 'Null'\n // @@toStringTag case\n : typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == 'string' ? tag\n // builtinTag case\n : CORRECT_ARGUMENTS ? classofRaw(O)\n // ES3 arguments fallback\n : (result = classofRaw(O)) === 'Object' && isCallable(O.callee) ? 'Arguments' : result;\n};\n","'use strict';\nvar classof = require('../internals/classof');\nvar getMethod = require('../internals/get-method');\nvar isNullOrUndefined = require('../internals/is-null-or-undefined');\nvar Iterators = require('../internals/iterators');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar ITERATOR = wellKnownSymbol('iterator');\n\nmodule.exports = function (it) {\n if (!isNullOrUndefined(it)) return getMethod(it, ITERATOR)\n || getMethod(it, '@@iterator')\n || Iterators[classof(it)];\n};\n","'use strict';\nvar call = require('../internals/function-call');\nvar aCallable = require('../internals/a-callable');\nvar anObject = require('../internals/an-object');\nvar tryToString = require('../internals/try-to-string');\nvar getIteratorMethod = require('../internals/get-iterator-method');\n\nvar $TypeError = TypeError;\n\nmodule.exports = function (argument, usingIterator) {\n var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator;\n if (aCallable(iteratorMethod)) return anObject(call(iteratorMethod, argument));\n throw new $TypeError(tryToString(argument) + ' is not iterable');\n};\n","'use strict';\nvar call = require('../internals/function-call');\nvar anObject = require('../internals/an-object');\nvar getMethod = require('../internals/get-method');\n\nmodule.exports = function (iterator, kind, value) {\n var innerResult, innerError;\n anObject(iterator);\n try {\n innerResult = getMethod(iterator, 'return');\n if (!innerResult) {\n if (kind === 'throw') throw value;\n return value;\n }\n innerResult = call(innerResult, iterator);\n } catch (error) {\n innerError = true;\n innerResult = error;\n }\n if (kind === 'throw') throw value;\n if (innerError) throw innerResult;\n anObject(innerResult);\n return value;\n};\n","'use strict';\nvar bind = require('../internals/function-bind-context');\nvar call = require('../internals/function-call');\nvar anObject = require('../internals/an-object');\nvar tryToString = require('../internals/try-to-string');\nvar isArrayIteratorMethod = require('../internals/is-array-iterator-method');\nvar lengthOfArrayLike = require('../internals/length-of-array-like');\nvar isPrototypeOf = require('../internals/object-is-prototype-of');\nvar getIterator = require('../internals/get-iterator');\nvar getIteratorMethod = require('../internals/get-iterator-method');\nvar iteratorClose = require('../internals/iterator-close');\n\nvar $TypeError = TypeError;\n\nvar Result = function (stopped, result) {\n this.stopped = stopped;\n this.result = result;\n};\n\nvar ResultPrototype = Result.prototype;\n\nmodule.exports = function (iterable, unboundFunction, options) {\n var that = options && options.that;\n var AS_ENTRIES = !!(options && options.AS_ENTRIES);\n var IS_RECORD = !!(options && options.IS_RECORD);\n var IS_ITERATOR = !!(options && options.IS_ITERATOR);\n var INTERRUPTED = !!(options && options.INTERRUPTED);\n var fn = bind(unboundFunction, that);\n var iterator, iterFn, index, length, result, next, step;\n\n var stop = function (condition) {\n if (iterator) iteratorClose(iterator, 'normal', condition);\n return new Result(true, condition);\n };\n\n var callFn = function (value) {\n if (AS_ENTRIES) {\n anObject(value);\n return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);\n } return INTERRUPTED ? fn(value, stop) : fn(value);\n };\n\n if (IS_RECORD) {\n iterator = iterable.iterator;\n } else if (IS_ITERATOR) {\n iterator = iterable;\n } else {\n iterFn = getIteratorMethod(iterable);\n if (!iterFn) throw new $TypeError(tryToString(iterable) + ' is not iterable');\n // optimisation for array iterators\n if (isArrayIteratorMethod(iterFn)) {\n for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {\n result = callFn(iterable[index]);\n if (result && isPrototypeOf(ResultPrototype, result)) return result;\n } return new Result(false);\n }\n iterator = getIterator(iterable, iterFn);\n }\n\n next = IS_RECORD ? iterable.next : iterator.next;\n while (!(step = call(next, iterator)).done) {\n try {\n result = callFn(step.value);\n } catch (error) {\n iteratorClose(iterator, 'throw', error);\n }\n if (typeof result == 'object' && result && isPrototypeOf(ResultPrototype, result)) return result;\n } return new Result(false);\n};\n","'use strict';\nvar classof = require('../internals/classof');\n\nvar $String = String;\n\nmodule.exports = function (argument) {\n if (classof(argument) === 'Symbol') throw new TypeError('Cannot convert a Symbol value to a string');\n return $String(argument);\n};\n","'use strict';\nvar toString = require('../internals/to-string');\n\nmodule.exports = function (argument, $default) {\n return argument === undefined ? arguments.length < 2 ? '' : $default : toString(argument);\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar isPrototypeOf = require('../internals/object-is-prototype-of');\nvar getPrototypeOf = require('../internals/object-get-prototype-of');\nvar setPrototypeOf = require('../internals/object-set-prototype-of');\nvar copyConstructorProperties = require('../internals/copy-constructor-properties');\nvar create = require('../internals/object-create');\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\nvar createPropertyDescriptor = require('../internals/create-property-descriptor');\nvar installErrorCause = require('../internals/install-error-cause');\nvar installErrorStack = require('../internals/error-stack-install');\nvar iterate = require('../internals/iterate');\nvar normalizeStringArgument = require('../internals/normalize-string-argument');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar TO_STRING_TAG = wellKnownSymbol('toStringTag');\nvar $Error = Error;\nvar push = [].push;\n\nvar $AggregateError = function AggregateError(errors, message /* , options */) {\n var isInstance = isPrototypeOf(AggregateErrorPrototype, this);\n var that;\n if (setPrototypeOf) {\n that = setPrototypeOf(new $Error(), isInstance ? getPrototypeOf(this) : AggregateErrorPrototype);\n } else {\n that = isInstance ? this : create(AggregateErrorPrototype);\n createNonEnumerableProperty(that, TO_STRING_TAG, 'Error');\n }\n if (message !== undefined) createNonEnumerableProperty(that, 'message', normalizeStringArgument(message));\n installErrorStack(that, $AggregateError, that.stack, 1);\n if (arguments.length > 2) installErrorCause(that, arguments[2]);\n var errorsArray = [];\n iterate(errors, push, { that: errorsArray });\n createNonEnumerableProperty(that, 'errors', errorsArray);\n return that;\n};\n\nif (setPrototypeOf) setPrototypeOf($AggregateError, $Error);\nelse copyConstructorProperties($AggregateError, $Error, { name: true });\n\nvar AggregateErrorPrototype = $AggregateError.prototype = create($Error.prototype, {\n constructor: createPropertyDescriptor(1, $AggregateError),\n message: createPropertyDescriptor(1, ''),\n name: createPropertyDescriptor(1, 'AggregateError')\n});\n\n// `AggregateError` constructor\n// https://tc39.es/ecma262/#sec-aggregate-error-constructor\n$({ global: true, constructor: true, arity: 2 }, {\n AggregateError: $AggregateError\n});\n","'use strict';\nvar NATIVE_WEAK_MAP = require('../internals/weak-map-basic-detection');\nvar global = require('../internals/global');\nvar isObject = require('../internals/is-object');\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\nvar hasOwn = require('../internals/has-own-property');\nvar shared = require('../internals/shared-store');\nvar sharedKey = require('../internals/shared-key');\nvar hiddenKeys = require('../internals/hidden-keys');\n\nvar OBJECT_ALREADY_INITIALIZED = 'Object already initialized';\nvar TypeError = global.TypeError;\nvar WeakMap = global.WeakMap;\nvar set, get, has;\n\nvar enforce = function (it) {\n return has(it) ? get(it) : set(it, {});\n};\n\nvar getterFor = function (TYPE) {\n return function (it) {\n var state;\n if (!isObject(it) || (state = get(it)).type !== TYPE) {\n throw new TypeError('Incompatible receiver, ' + TYPE + ' required');\n } return state;\n };\n};\n\nif (NATIVE_WEAK_MAP || shared.state) {\n var store = shared.state || (shared.state = new WeakMap());\n /* eslint-disable no-self-assign -- prototype methods protection */\n store.get = store.get;\n store.has = store.has;\n store.set = store.set;\n /* eslint-enable no-self-assign -- prototype methods protection */\n set = function (it, metadata) {\n if (store.has(it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);\n metadata.facade = it;\n store.set(it, metadata);\n return metadata;\n };\n get = function (it) {\n return store.get(it) || {};\n };\n has = function (it) {\n return store.has(it);\n };\n} else {\n var STATE = sharedKey('state');\n hiddenKeys[STATE] = true;\n set = function (it, metadata) {\n if (hasOwn(it, STATE)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);\n metadata.facade = it;\n createNonEnumerableProperty(it, STATE, metadata);\n return metadata;\n };\n get = function (it) {\n return hasOwn(it, STATE) ? it[STATE] : {};\n };\n has = function (it) {\n return hasOwn(it, STATE);\n };\n}\n\nmodule.exports = {\n set: set,\n get: get,\n has: has,\n enforce: enforce,\n getterFor: getterFor\n};\n","'use strict';\nvar global = require('../internals/global');\nvar isCallable = require('../internals/is-callable');\n\nvar WeakMap = global.WeakMap;\n\nmodule.exports = isCallable(WeakMap) && /native code/.test(String(WeakMap));\n","'use strict';\nvar fails = require('../internals/fails');\nvar isCallable = require('../internals/is-callable');\nvar isObject = require('../internals/is-object');\nvar create = require('../internals/object-create');\nvar getPrototypeOf = require('../internals/object-get-prototype-of');\nvar defineBuiltIn = require('../internals/define-built-in');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar IS_PURE = require('../internals/is-pure');\n\nvar ITERATOR = wellKnownSymbol('iterator');\nvar BUGGY_SAFARI_ITERATORS = false;\n\n// `%IteratorPrototype%` object\n// https://tc39.es/ecma262/#sec-%iteratorprototype%-object\nvar IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;\n\n/* eslint-disable es/no-array-prototype-keys -- safe */\nif ([].keys) {\n arrayIterator = [].keys();\n // Safari 8 has buggy iterators w/o `next`\n if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;\n else {\n PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator));\n if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype;\n }\n}\n\nvar NEW_ITERATOR_PROTOTYPE = !isObject(IteratorPrototype) || fails(function () {\n var test = {};\n // FF44- legacy iterators case\n return IteratorPrototype[ITERATOR].call(test) !== test;\n});\n\nif (NEW_ITERATOR_PROTOTYPE) IteratorPrototype = {};\nelse if (IS_PURE) IteratorPrototype = create(IteratorPrototype);\n\n// `%IteratorPrototype%[@@iterator]()` method\n// https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator\nif (!isCallable(IteratorPrototype[ITERATOR])) {\n defineBuiltIn(IteratorPrototype, ITERATOR, function () {\n return this;\n });\n}\n\nmodule.exports = {\n IteratorPrototype: IteratorPrototype,\n BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS\n};\n","'use strict';\nvar DESCRIPTORS = require('../internals/descriptors');\nvar hasOwn = require('../internals/has-own-property');\n\nvar FunctionPrototype = Function.prototype;\n// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe\nvar getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor;\n\nvar EXISTS = hasOwn(FunctionPrototype, 'name');\n// additional protection from minified / mangled / dropped function names\nvar PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';\nvar CONFIGURABLE = EXISTS && (!DESCRIPTORS || (DESCRIPTORS && getDescriptor(FunctionPrototype, 'name').configurable));\n\nmodule.exports = {\n EXISTS: EXISTS,\n PROPER: PROPER,\n CONFIGURABLE: CONFIGURABLE\n};\n","'use strict';\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\n\nmodule.exports = function (target, key, value, options) {\n if (options && options.enumerable) target[key] = value;\n else createNonEnumerableProperty(target, key, value);\n return target;\n};\n","'use strict';\nvar TO_STRING_TAG_SUPPORT = require('../internals/to-string-tag-support');\nvar classof = require('../internals/classof');\n\n// `Object.prototype.toString` method implementation\n// https://tc39.es/ecma262/#sec-object.prototype.tostring\nmodule.exports = TO_STRING_TAG_SUPPORT ? {}.toString : function toString() {\n return '[object ' + classof(this) + ']';\n};\n","'use strict';\nvar TO_STRING_TAG_SUPPORT = require('../internals/to-string-tag-support');\nvar defineProperty = require('../internals/object-define-property').f;\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\nvar hasOwn = require('../internals/has-own-property');\nvar toString = require('../internals/object-to-string');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar TO_STRING_TAG = wellKnownSymbol('toStringTag');\n\nmodule.exports = function (it, TAG, STATIC, SET_METHOD) {\n if (it) {\n var target = STATIC ? it : it.prototype;\n if (!hasOwn(target, TO_STRING_TAG)) {\n defineProperty(target, TO_STRING_TAG, { configurable: true, value: TAG });\n }\n if (SET_METHOD && !TO_STRING_TAG_SUPPORT) {\n createNonEnumerableProperty(target, 'toString', toString);\n }\n }\n};\n","'use strict';\nvar IteratorPrototype = require('../internals/iterators-core').IteratorPrototype;\nvar create = require('../internals/object-create');\nvar createPropertyDescriptor = require('../internals/create-property-descriptor');\nvar setToStringTag = require('../internals/set-to-string-tag');\nvar Iterators = require('../internals/iterators');\n\nvar returnThis = function () { return this; };\n\nmodule.exports = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) {\n var TO_STRING_TAG = NAME + ' Iterator';\n IteratorConstructor.prototype = create(IteratorPrototype, { next: createPropertyDescriptor(+!ENUMERABLE_NEXT, next) });\n setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true);\n Iterators[TO_STRING_TAG] = returnThis;\n return IteratorConstructor;\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar call = require('../internals/function-call');\nvar IS_PURE = require('../internals/is-pure');\nvar FunctionName = require('../internals/function-name');\nvar isCallable = require('../internals/is-callable');\nvar createIteratorConstructor = require('../internals/iterator-create-constructor');\nvar getPrototypeOf = require('../internals/object-get-prototype-of');\nvar setPrototypeOf = require('../internals/object-set-prototype-of');\nvar setToStringTag = require('../internals/set-to-string-tag');\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\nvar defineBuiltIn = require('../internals/define-built-in');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar Iterators = require('../internals/iterators');\nvar IteratorsCore = require('../internals/iterators-core');\n\nvar PROPER_FUNCTION_NAME = FunctionName.PROPER;\nvar CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE;\nvar IteratorPrototype = IteratorsCore.IteratorPrototype;\nvar BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;\nvar ITERATOR = wellKnownSymbol('iterator');\nvar KEYS = 'keys';\nvar VALUES = 'values';\nvar ENTRIES = 'entries';\n\nvar returnThis = function () { return this; };\n\nmodule.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {\n createIteratorConstructor(IteratorConstructor, NAME, next);\n\n var getIterationMethod = function (KIND) {\n if (KIND === DEFAULT && defaultIterator) return defaultIterator;\n if (!BUGGY_SAFARI_ITERATORS && KIND && KIND in IterablePrototype) return IterablePrototype[KIND];\n\n switch (KIND) {\n case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };\n case VALUES: return function values() { return new IteratorConstructor(this, KIND); };\n case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };\n }\n\n return function () { return new IteratorConstructor(this); };\n };\n\n var TO_STRING_TAG = NAME + ' Iterator';\n var INCORRECT_VALUES_NAME = false;\n var IterablePrototype = Iterable.prototype;\n var nativeIterator = IterablePrototype[ITERATOR]\n || IterablePrototype['@@iterator']\n || DEFAULT && IterablePrototype[DEFAULT];\n var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);\n var anyNativeIterator = NAME === 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;\n var CurrentIteratorPrototype, methods, KEY;\n\n // fix native\n if (anyNativeIterator) {\n CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()));\n if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {\n if (!IS_PURE && getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {\n if (setPrototypeOf) {\n setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);\n } else if (!isCallable(CurrentIteratorPrototype[ITERATOR])) {\n defineBuiltIn(CurrentIteratorPrototype, ITERATOR, returnThis);\n }\n }\n // Set @@toStringTag to native iterators\n setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true);\n if (IS_PURE) Iterators[TO_STRING_TAG] = returnThis;\n }\n }\n\n // fix Array.prototype.{ values, @@iterator }.name in V8 / FF\n if (PROPER_FUNCTION_NAME && DEFAULT === VALUES && nativeIterator && nativeIterator.name !== VALUES) {\n if (!IS_PURE && CONFIGURABLE_FUNCTION_NAME) {\n createNonEnumerableProperty(IterablePrototype, 'name', VALUES);\n } else {\n INCORRECT_VALUES_NAME = true;\n defaultIterator = function values() { return call(nativeIterator, this); };\n }\n }\n\n // export additional methods\n if (DEFAULT) {\n methods = {\n values: getIterationMethod(VALUES),\n keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),\n entries: getIterationMethod(ENTRIES)\n };\n if (FORCED) for (KEY in methods) {\n if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {\n defineBuiltIn(IterablePrototype, KEY, methods[KEY]);\n }\n } else $({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);\n }\n\n // define iterator\n if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) {\n defineBuiltIn(IterablePrototype, ITERATOR, defaultIterator, { name: DEFAULT });\n }\n Iterators[NAME] = defaultIterator;\n\n return methods;\n};\n","'use strict';\n// `CreateIterResultObject` abstract operation\n// https://tc39.es/ecma262/#sec-createiterresultobject\nmodule.exports = function (value, done) {\n return { value: value, done: done };\n};\n","'use strict';\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar addToUnscopables = require('../internals/add-to-unscopables');\nvar Iterators = require('../internals/iterators');\nvar InternalStateModule = require('../internals/internal-state');\nvar defineProperty = require('../internals/object-define-property').f;\nvar defineIterator = require('../internals/iterator-define');\nvar createIterResultObject = require('../internals/create-iter-result-object');\nvar IS_PURE = require('../internals/is-pure');\nvar DESCRIPTORS = require('../internals/descriptors');\n\nvar ARRAY_ITERATOR = 'Array Iterator';\nvar setInternalState = InternalStateModule.set;\nvar getInternalState = InternalStateModule.getterFor(ARRAY_ITERATOR);\n\n// `Array.prototype.entries` method\n// https://tc39.es/ecma262/#sec-array.prototype.entries\n// `Array.prototype.keys` method\n// https://tc39.es/ecma262/#sec-array.prototype.keys\n// `Array.prototype.values` method\n// https://tc39.es/ecma262/#sec-array.prototype.values\n// `Array.prototype[@@iterator]` method\n// https://tc39.es/ecma262/#sec-array.prototype-@@iterator\n// `CreateArrayIterator` internal method\n// https://tc39.es/ecma262/#sec-createarrayiterator\nmodule.exports = defineIterator(Array, 'Array', function (iterated, kind) {\n setInternalState(this, {\n type: ARRAY_ITERATOR,\n target: toIndexedObject(iterated), // target\n index: 0, // next index\n kind: kind // kind\n });\n// `%ArrayIteratorPrototype%.next` method\n// https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next\n}, function () {\n var state = getInternalState(this);\n var target = state.target;\n var index = state.index++;\n if (!target || index >= target.length) {\n state.target = undefined;\n return createIterResultObject(undefined, true);\n }\n switch (state.kind) {\n case 'keys': return createIterResultObject(index, false);\n case 'values': return createIterResultObject(target[index], false);\n } return createIterResultObject([index, target[index]], false);\n}, 'values');\n\n// argumentsList[@@iterator] is %ArrayProto_values%\n// https://tc39.es/ecma262/#sec-createunmappedargumentsobject\n// https://tc39.es/ecma262/#sec-createmappedargumentsobject\nvar values = Iterators.Arguments = Iterators.Array;\n\n// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables\naddToUnscopables('keys');\naddToUnscopables('values');\naddToUnscopables('entries');\n\n// V8 ~ Chrome 45- bug\nif (!IS_PURE && DESCRIPTORS && values.name !== 'values') try {\n defineProperty(values, 'name', { value: 'values' });\n} catch (error) { /* empty */ }\n","'use strict';\nmodule.exports = function () { /* empty */ };\n","'use strict';\nvar global = require('../internals/global');\nvar classof = require('../internals/classof-raw');\n\nmodule.exports = classof(global.process) === 'process';\n","'use strict';\nvar defineProperty = require('../internals/object-define-property');\n\nmodule.exports = function (target, name, descriptor) {\n return defineProperty.f(target, name, descriptor);\n};\n","'use strict';\nvar getBuiltIn = require('../internals/get-built-in');\nvar defineBuiltInAccessor = require('../internals/define-built-in-accessor');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar DESCRIPTORS = require('../internals/descriptors');\n\nvar SPECIES = wellKnownSymbol('species');\n\nmodule.exports = function (CONSTRUCTOR_NAME) {\n var Constructor = getBuiltIn(CONSTRUCTOR_NAME);\n\n if (DESCRIPTORS && Constructor && !Constructor[SPECIES]) {\n defineBuiltInAccessor(Constructor, SPECIES, {\n configurable: true,\n get: function () { return this; }\n });\n }\n};\n","'use strict';\nvar isPrototypeOf = require('../internals/object-is-prototype-of');\n\nvar $TypeError = TypeError;\n\nmodule.exports = function (it, Prototype) {\n if (isPrototypeOf(Prototype, it)) return it;\n throw new $TypeError('Incorrect invocation');\n};\n","'use strict';\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar isCallable = require('../internals/is-callable');\nvar store = require('../internals/shared-store');\n\nvar functionToString = uncurryThis(Function.toString);\n\n// this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper\nif (!isCallable(store.inspectSource)) {\n store.inspectSource = function (it) {\n return functionToString(it);\n };\n}\n\nmodule.exports = store.inspectSource;\n","'use strict';\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar fails = require('../internals/fails');\nvar isCallable = require('../internals/is-callable');\nvar classof = require('../internals/classof');\nvar getBuiltIn = require('../internals/get-built-in');\nvar inspectSource = require('../internals/inspect-source');\n\nvar noop = function () { /* empty */ };\nvar empty = [];\nvar construct = getBuiltIn('Reflect', 'construct');\nvar constructorRegExp = /^\\s*(?:class|function)\\b/;\nvar exec = uncurryThis(constructorRegExp.exec);\nvar INCORRECT_TO_STRING = !constructorRegExp.test(noop);\n\nvar isConstructorModern = function isConstructor(argument) {\n if (!isCallable(argument)) return false;\n try {\n construct(noop, empty, argument);\n return true;\n } catch (error) {\n return false;\n }\n};\n\nvar isConstructorLegacy = function isConstructor(argument) {\n if (!isCallable(argument)) return false;\n switch (classof(argument)) {\n case 'AsyncFunction':\n case 'GeneratorFunction':\n case 'AsyncGeneratorFunction': return false;\n }\n try {\n // we can't check .prototype since constructors produced by .bind haven't it\n // `Function#toString` throws on some built-it function in some legacy engines\n // (for example, `DOMQuad` and similar in FF41-)\n return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument));\n } catch (error) {\n return true;\n }\n};\n\nisConstructorLegacy.sham = true;\n\n// `IsConstructor` abstract operation\n// https://tc39.es/ecma262/#sec-isconstructor\nmodule.exports = !construct || fails(function () {\n var called;\n return isConstructorModern(isConstructorModern.call)\n || !isConstructorModern(Object)\n || !isConstructorModern(function () { called = true; })\n || called;\n}) ? isConstructorLegacy : isConstructorModern;\n","'use strict';\nvar global = require('../internals/global');\nvar apply = require('../internals/function-apply');\nvar bind = require('../internals/function-bind-context');\nvar isCallable = require('../internals/is-callable');\nvar hasOwn = require('../internals/has-own-property');\nvar fails = require('../internals/fails');\nvar html = require('../internals/html');\nvar arraySlice = require('../internals/array-slice');\nvar createElement = require('../internals/document-create-element');\nvar validateArgumentsLength = require('../internals/validate-arguments-length');\nvar IS_IOS = require('../internals/engine-is-ios');\nvar IS_NODE = require('../internals/engine-is-node');\n\nvar set = global.setImmediate;\nvar clear = global.clearImmediate;\nvar process = global.process;\nvar Dispatch = global.Dispatch;\nvar Function = global.Function;\nvar MessageChannel = global.MessageChannel;\nvar String = global.String;\nvar counter = 0;\nvar queue = {};\nvar ONREADYSTATECHANGE = 'onreadystatechange';\nvar $location, defer, channel, port;\n\nfails(function () {\n // Deno throws a ReferenceError on `location` access without `--location` flag\n $location = global.location;\n});\n\nvar run = function (id) {\n if (hasOwn(queue, id)) {\n var fn = queue[id];\n delete queue[id];\n fn();\n }\n};\n\nvar runner = function (id) {\n return function () {\n run(id);\n };\n};\n\nvar eventListener = function (event) {\n run(event.data);\n};\n\nvar globalPostMessageDefer = function (id) {\n // old engines have not location.origin\n global.postMessage(String(id), $location.protocol + '//' + $location.host);\n};\n\n// Node.js 0.9+ & IE10+ has setImmediate, otherwise:\nif (!set || !clear) {\n set = function setImmediate(handler) {\n validateArgumentsLength(arguments.length, 1);\n var fn = isCallable(handler) ? handler : Function(handler);\n var args = arraySlice(arguments, 1);\n queue[++counter] = function () {\n apply(fn, undefined, args);\n };\n defer(counter);\n return counter;\n };\n clear = function clearImmediate(id) {\n delete queue[id];\n };\n // Node.js 0.8-\n if (IS_NODE) {\n defer = function (id) {\n process.nextTick(runner(id));\n };\n // Sphere (JS game engine) Dispatch API\n } else if (Dispatch && Dispatch.now) {\n defer = function (id) {\n Dispatch.now(runner(id));\n };\n // Browsers with MessageChannel, includes WebWorkers\n // except iOS - https://github.com/zloirock/core-js/issues/624\n } else if (MessageChannel && !IS_IOS) {\n channel = new MessageChannel();\n port = channel.port2;\n channel.port1.onmessage = eventListener;\n defer = bind(port.postMessage, port);\n // Browsers with postMessage, skip WebWorkers\n // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'\n } else if (\n global.addEventListener &&\n isCallable(global.postMessage) &&\n !global.importScripts &&\n $location && $location.protocol !== 'file:' &&\n !fails(globalPostMessageDefer)\n ) {\n defer = globalPostMessageDefer;\n global.addEventListener('message', eventListener, false);\n // IE8-\n } else if (ONREADYSTATECHANGE in createElement('script')) {\n defer = function (id) {\n html.appendChild(createElement('script'))[ONREADYSTATECHANGE] = function () {\n html.removeChild(this);\n run(id);\n };\n };\n // Rest old browsers\n } else {\n defer = function (id) {\n setTimeout(runner(id), 0);\n };\n }\n}\n\nmodule.exports = {\n set: set,\n clear: clear\n};\n","'use strict';\nvar isConstructor = require('../internals/is-constructor');\nvar tryToString = require('../internals/try-to-string');\n\nvar $TypeError = TypeError;\n\n// `Assert: IsConstructor(argument) is true`\nmodule.exports = function (argument) {\n if (isConstructor(argument)) return argument;\n throw new $TypeError(tryToString(argument) + ' is not a constructor');\n};\n","'use strict';\nvar anObject = require('../internals/an-object');\nvar aConstructor = require('../internals/a-constructor');\nvar isNullOrUndefined = require('../internals/is-null-or-undefined');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar SPECIES = wellKnownSymbol('species');\n\n// `SpeciesConstructor` abstract operation\n// https://tc39.es/ecma262/#sec-speciesconstructor\nmodule.exports = function (O, defaultConstructor) {\n var C = anObject(O).constructor;\n var S;\n return C === undefined || isNullOrUndefined(S = anObject(C)[SPECIES]) ? defaultConstructor : aConstructor(S);\n};\n","'use strict';\nvar uncurryThis = require('../internals/function-uncurry-this');\n\nmodule.exports = uncurryThis([].slice);\n","'use strict';\nvar $TypeError = TypeError;\n\nmodule.exports = function (passed, required) {\n if (passed < required) throw new $TypeError('Not enough arguments');\n return passed;\n};\n","'use strict';\nvar userAgent = require('../internals/engine-user-agent');\n\n// eslint-disable-next-line redos/no-vulnerable -- safe\nmodule.exports = /(?:ipad|iphone|ipod).*applewebkit/i.test(userAgent);\n","'use strict';\nvar Queue = function () {\n this.head = null;\n this.tail = null;\n};\n\nQueue.prototype = {\n add: function (item) {\n var entry = { item: item, next: null };\n var tail = this.tail;\n if (tail) tail.next = entry;\n else this.head = entry;\n this.tail = entry;\n },\n get: function () {\n var entry = this.head;\n if (entry) {\n var next = this.head = entry.next;\n if (next === null) this.tail = null;\n return entry.item;\n }\n }\n};\n\nmodule.exports = Queue;\n","'use strict';\nvar global = require('../internals/global');\nvar bind = require('../internals/function-bind-context');\nvar getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;\nvar macrotask = require('../internals/task').set;\nvar Queue = require('../internals/queue');\nvar IS_IOS = require('../internals/engine-is-ios');\nvar IS_IOS_PEBBLE = require('../internals/engine-is-ios-pebble');\nvar IS_WEBOS_WEBKIT = require('../internals/engine-is-webos-webkit');\nvar IS_NODE = require('../internals/engine-is-node');\n\nvar MutationObserver = global.MutationObserver || global.WebKitMutationObserver;\nvar document = global.document;\nvar process = global.process;\nvar Promise = global.Promise;\n// Node.js 11 shows ExperimentalWarning on getting `queueMicrotask`\nvar queueMicrotaskDescriptor = getOwnPropertyDescriptor(global, 'queueMicrotask');\nvar microtask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value;\nvar notify, toggle, node, promise, then;\n\n// modern engines have queueMicrotask method\nif (!microtask) {\n var queue = new Queue();\n\n var flush = function () {\n var parent, fn;\n if (IS_NODE && (parent = process.domain)) parent.exit();\n while (fn = queue.get()) try {\n fn();\n } catch (error) {\n if (queue.head) notify();\n throw error;\n }\n if (parent) parent.enter();\n };\n\n // browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339\n // also except WebOS Webkit https://github.com/zloirock/core-js/issues/898\n if (!IS_IOS && !IS_NODE && !IS_WEBOS_WEBKIT && MutationObserver && document) {\n toggle = true;\n node = document.createTextNode('');\n new MutationObserver(flush).observe(node, { characterData: true });\n notify = function () {\n node.data = toggle = !toggle;\n };\n // environments with maybe non-completely correct, but existent Promise\n } else if (!IS_IOS_PEBBLE && Promise && Promise.resolve) {\n // Promise.resolve without an argument throws an error in LG WebOS 2\n promise = Promise.resolve(undefined);\n // workaround of WebKit ~ iOS Safari 10.1 bug\n promise.constructor = Promise;\n then = bind(promise.then, promise);\n notify = function () {\n then(flush);\n };\n // Node.js without promises\n } else if (IS_NODE) {\n notify = function () {\n process.nextTick(flush);\n };\n // for other environments - macrotask based on:\n // - setImmediate\n // - MessageChannel\n // - window.postMessage\n // - onreadystatechange\n // - setTimeout\n } else {\n // `webpack` dev server bug on IE global methods - use bind(fn, global)\n macrotask = bind(macrotask, global);\n notify = function () {\n macrotask(flush);\n };\n }\n\n microtask = function (fn) {\n if (!queue.head) notify();\n queue.add(fn);\n };\n}\n\nmodule.exports = microtask;\n","'use strict';\nvar userAgent = require('../internals/engine-user-agent');\n\nmodule.exports = /ipad|iphone|ipod/i.test(userAgent) && typeof Pebble != 'undefined';\n","'use strict';\nvar userAgent = require('../internals/engine-user-agent');\n\nmodule.exports = /web0s(?!.*chrome)/i.test(userAgent);\n","'use strict';\nmodule.exports = function (exec) {\n try {\n return { error: false, value: exec() };\n } catch (error) {\n return { error: true, value: error };\n }\n};\n","'use strict';\nvar global = require('../internals/global');\n\nmodule.exports = global.Promise;\n","'use strict';\n/* global Deno -- Deno case */\nmodule.exports = typeof Deno == 'object' && Deno && typeof Deno.version == 'object';\n","'use strict';\nvar IS_DENO = require('../internals/engine-is-deno');\nvar IS_NODE = require('../internals/engine-is-node');\n\nmodule.exports = !IS_DENO && !IS_NODE\n && typeof window == 'object'\n && typeof document == 'object';\n","'use strict';\nvar global = require('../internals/global');\nvar NativePromiseConstructor = require('../internals/promise-native-constructor');\nvar isCallable = require('../internals/is-callable');\nvar isForced = require('../internals/is-forced');\nvar inspectSource = require('../internals/inspect-source');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar IS_BROWSER = require('../internals/engine-is-browser');\nvar IS_DENO = require('../internals/engine-is-deno');\nvar IS_PURE = require('../internals/is-pure');\nvar V8_VERSION = require('../internals/engine-v8-version');\n\nvar NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;\nvar SPECIES = wellKnownSymbol('species');\nvar SUBCLASSING = false;\nvar NATIVE_PROMISE_REJECTION_EVENT = isCallable(global.PromiseRejectionEvent);\n\nvar FORCED_PROMISE_CONSTRUCTOR = isForced('Promise', function () {\n var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(NativePromiseConstructor);\n var GLOBAL_CORE_JS_PROMISE = PROMISE_CONSTRUCTOR_SOURCE !== String(NativePromiseConstructor);\n // V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables\n // https://bugs.chromium.org/p/chromium/issues/detail?id=830565\n // We can't detect it synchronously, so just check versions\n if (!GLOBAL_CORE_JS_PROMISE && V8_VERSION === 66) return true;\n // We need Promise#{ catch, finally } in the pure version for preventing prototype pollution\n if (IS_PURE && !(NativePromisePrototype['catch'] && NativePromisePrototype['finally'])) return true;\n // We can't use @@species feature detection in V8 since it causes\n // deoptimization and performance degradation\n // https://github.com/zloirock/core-js/issues/679\n if (!V8_VERSION || V8_VERSION < 51 || !/native code/.test(PROMISE_CONSTRUCTOR_SOURCE)) {\n // Detect correctness of subclassing with @@species support\n var promise = new NativePromiseConstructor(function (resolve) { resolve(1); });\n var FakePromise = function (exec) {\n exec(function () { /* empty */ }, function () { /* empty */ });\n };\n var constructor = promise.constructor = {};\n constructor[SPECIES] = FakePromise;\n SUBCLASSING = promise.then(function () { /* empty */ }) instanceof FakePromise;\n if (!SUBCLASSING) return true;\n // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test\n } return !GLOBAL_CORE_JS_PROMISE && (IS_BROWSER || IS_DENO) && !NATIVE_PROMISE_REJECTION_EVENT;\n});\n\nmodule.exports = {\n CONSTRUCTOR: FORCED_PROMISE_CONSTRUCTOR,\n REJECTION_EVENT: NATIVE_PROMISE_REJECTION_EVENT,\n SUBCLASSING: SUBCLASSING\n};\n","'use strict';\nvar aCallable = require('../internals/a-callable');\n\nvar $TypeError = TypeError;\n\nvar PromiseCapability = function (C) {\n var resolve, reject;\n this.promise = new C(function ($$resolve, $$reject) {\n if (resolve !== undefined || reject !== undefined) throw new $TypeError('Bad Promise constructor');\n resolve = $$resolve;\n reject = $$reject;\n });\n this.resolve = aCallable(resolve);\n this.reject = aCallable(reject);\n};\n\n// `NewPromiseCapability` abstract operation\n// https://tc39.es/ecma262/#sec-newpromisecapability\nmodule.exports.f = function (C) {\n return new PromiseCapability(C);\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar IS_PURE = require('../internals/is-pure');\nvar IS_NODE = require('../internals/engine-is-node');\nvar global = require('../internals/global');\nvar call = require('../internals/function-call');\nvar defineBuiltIn = require('../internals/define-built-in');\nvar setPrototypeOf = require('../internals/object-set-prototype-of');\nvar setToStringTag = require('../internals/set-to-string-tag');\nvar setSpecies = require('../internals/set-species');\nvar aCallable = require('../internals/a-callable');\nvar isCallable = require('../internals/is-callable');\nvar isObject = require('../internals/is-object');\nvar anInstance = require('../internals/an-instance');\nvar speciesConstructor = require('../internals/species-constructor');\nvar task = require('../internals/task').set;\nvar microtask = require('../internals/microtask');\nvar hostReportErrors = require('../internals/host-report-errors');\nvar perform = require('../internals/perform');\nvar Queue = require('../internals/queue');\nvar InternalStateModule = require('../internals/internal-state');\nvar NativePromiseConstructor = require('../internals/promise-native-constructor');\nvar PromiseConstructorDetection = require('../internals/promise-constructor-detection');\nvar newPromiseCapabilityModule = require('../internals/new-promise-capability');\n\nvar PROMISE = 'Promise';\nvar FORCED_PROMISE_CONSTRUCTOR = PromiseConstructorDetection.CONSTRUCTOR;\nvar NATIVE_PROMISE_REJECTION_EVENT = PromiseConstructorDetection.REJECTION_EVENT;\nvar NATIVE_PROMISE_SUBCLASSING = PromiseConstructorDetection.SUBCLASSING;\nvar getInternalPromiseState = InternalStateModule.getterFor(PROMISE);\nvar setInternalState = InternalStateModule.set;\nvar NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;\nvar PromiseConstructor = NativePromiseConstructor;\nvar PromisePrototype = NativePromisePrototype;\nvar TypeError = global.TypeError;\nvar document = global.document;\nvar process = global.process;\nvar newPromiseCapability = newPromiseCapabilityModule.f;\nvar newGenericPromiseCapability = newPromiseCapability;\n\nvar DISPATCH_EVENT = !!(document && document.createEvent && global.dispatchEvent);\nvar UNHANDLED_REJECTION = 'unhandledrejection';\nvar REJECTION_HANDLED = 'rejectionhandled';\nvar PENDING = 0;\nvar FULFILLED = 1;\nvar REJECTED = 2;\nvar HANDLED = 1;\nvar UNHANDLED = 2;\n\nvar Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;\n\n// helpers\nvar isThenable = function (it) {\n var then;\n return isObject(it) && isCallable(then = it.then) ? then : false;\n};\n\nvar callReaction = function (reaction, state) {\n var value = state.value;\n var ok = state.state === FULFILLED;\n var handler = ok ? reaction.ok : reaction.fail;\n var resolve = reaction.resolve;\n var reject = reaction.reject;\n var domain = reaction.domain;\n var result, then, exited;\n try {\n if (handler) {\n if (!ok) {\n if (state.rejection === UNHANDLED) onHandleUnhandled(state);\n state.rejection = HANDLED;\n }\n if (handler === true) result = value;\n else {\n if (domain) domain.enter();\n result = handler(value); // can throw\n if (domain) {\n domain.exit();\n exited = true;\n }\n }\n if (result === reaction.promise) {\n reject(new TypeError('Promise-chain cycle'));\n } else if (then = isThenable(result)) {\n call(then, result, resolve, reject);\n } else resolve(result);\n } else reject(value);\n } catch (error) {\n if (domain && !exited) domain.exit();\n reject(error);\n }\n};\n\nvar notify = function (state, isReject) {\n if (state.notified) return;\n state.notified = true;\n microtask(function () {\n var reactions = state.reactions;\n var reaction;\n while (reaction = reactions.get()) {\n callReaction(reaction, state);\n }\n state.notified = false;\n if (isReject && !state.rejection) onUnhandled(state);\n });\n};\n\nvar dispatchEvent = function (name, promise, reason) {\n var event, handler;\n if (DISPATCH_EVENT) {\n event = document.createEvent('Event');\n event.promise = promise;\n event.reason = reason;\n event.initEvent(name, false, true);\n global.dispatchEvent(event);\n } else event = { promise: promise, reason: reason };\n if (!NATIVE_PROMISE_REJECTION_EVENT && (handler = global['on' + name])) handler(event);\n else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason);\n};\n\nvar onUnhandled = function (state) {\n call(task, global, function () {\n var promise = state.facade;\n var value = state.value;\n var IS_UNHANDLED = isUnhandled(state);\n var result;\n if (IS_UNHANDLED) {\n result = perform(function () {\n if (IS_NODE) {\n process.emit('unhandledRejection', value, promise);\n } else dispatchEvent(UNHANDLED_REJECTION, promise, value);\n });\n // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should\n state.rejection = IS_NODE || isUnhandled(state) ? UNHANDLED : HANDLED;\n if (result.error) throw result.value;\n }\n });\n};\n\nvar isUnhandled = function (state) {\n return state.rejection !== HANDLED && !state.parent;\n};\n\nvar onHandleUnhandled = function (state) {\n call(task, global, function () {\n var promise = state.facade;\n if (IS_NODE) {\n process.emit('rejectionHandled', promise);\n } else dispatchEvent(REJECTION_HANDLED, promise, state.value);\n });\n};\n\nvar bind = function (fn, state, unwrap) {\n return function (value) {\n fn(state, value, unwrap);\n };\n};\n\nvar internalReject = function (state, value, unwrap) {\n if (state.done) return;\n state.done = true;\n if (unwrap) state = unwrap;\n state.value = value;\n state.state = REJECTED;\n notify(state, true);\n};\n\nvar internalResolve = function (state, value, unwrap) {\n if (state.done) return;\n state.done = true;\n if (unwrap) state = unwrap;\n try {\n if (state.facade === value) throw new TypeError(\"Promise can't be resolved itself\");\n var then = isThenable(value);\n if (then) {\n microtask(function () {\n var wrapper = { done: false };\n try {\n call(then, value,\n bind(internalResolve, wrapper, state),\n bind(internalReject, wrapper, state)\n );\n } catch (error) {\n internalReject(wrapper, error, state);\n }\n });\n } else {\n state.value = value;\n state.state = FULFILLED;\n notify(state, false);\n }\n } catch (error) {\n internalReject({ done: false }, error, state);\n }\n};\n\n// constructor polyfill\nif (FORCED_PROMISE_CONSTRUCTOR) {\n // 25.4.3.1 Promise(executor)\n PromiseConstructor = function Promise(executor) {\n anInstance(this, PromisePrototype);\n aCallable(executor);\n call(Internal, this);\n var state = getInternalPromiseState(this);\n try {\n executor(bind(internalResolve, state), bind(internalReject, state));\n } catch (error) {\n internalReject(state, error);\n }\n };\n\n PromisePrototype = PromiseConstructor.prototype;\n\n // eslint-disable-next-line no-unused-vars -- required for `.length`\n Internal = function Promise(executor) {\n setInternalState(this, {\n type: PROMISE,\n done: false,\n notified: false,\n parent: false,\n reactions: new Queue(),\n rejection: false,\n state: PENDING,\n value: undefined\n });\n };\n\n // `Promise.prototype.then` method\n // https://tc39.es/ecma262/#sec-promise.prototype.then\n Internal.prototype = defineBuiltIn(PromisePrototype, 'then', function then(onFulfilled, onRejected) {\n var state = getInternalPromiseState(this);\n var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor));\n state.parent = true;\n reaction.ok = isCallable(onFulfilled) ? onFulfilled : true;\n reaction.fail = isCallable(onRejected) && onRejected;\n reaction.domain = IS_NODE ? process.domain : undefined;\n if (state.state === PENDING) state.reactions.add(reaction);\n else microtask(function () {\n callReaction(reaction, state);\n });\n return reaction.promise;\n });\n\n OwnPromiseCapability = function () {\n var promise = new Internal();\n var state = getInternalPromiseState(promise);\n this.promise = promise;\n this.resolve = bind(internalResolve, state);\n this.reject = bind(internalReject, state);\n };\n\n newPromiseCapabilityModule.f = newPromiseCapability = function (C) {\n return C === PromiseConstructor || C === PromiseWrapper\n ? new OwnPromiseCapability(C)\n : newGenericPromiseCapability(C);\n };\n\n if (!IS_PURE && isCallable(NativePromiseConstructor) && NativePromisePrototype !== Object.prototype) {\n nativeThen = NativePromisePrototype.then;\n\n if (!NATIVE_PROMISE_SUBCLASSING) {\n // make `Promise#then` return a polyfilled `Promise` for native promise-based APIs\n defineBuiltIn(NativePromisePrototype, 'then', function then(onFulfilled, onRejected) {\n var that = this;\n return new PromiseConstructor(function (resolve, reject) {\n call(nativeThen, that, resolve, reject);\n }).then(onFulfilled, onRejected);\n // https://github.com/zloirock/core-js/issues/640\n }, { unsafe: true });\n }\n\n // make `.constructor === Promise` work for native promise-based APIs\n try {\n delete NativePromisePrototype.constructor;\n } catch (error) { /* empty */ }\n\n // make `instanceof Promise` work for native promise-based APIs\n if (setPrototypeOf) {\n setPrototypeOf(NativePromisePrototype, PromisePrototype);\n }\n }\n}\n\n$({ global: true, constructor: true, wrap: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {\n Promise: PromiseConstructor\n});\n\nsetToStringTag(PromiseConstructor, PROMISE, false, true);\nsetSpecies(PROMISE);\n","'use strict';\nmodule.exports = function (a, b) {\n try {\n // eslint-disable-next-line no-console -- safe\n arguments.length === 1 ? console.error(a) : console.error(a, b);\n } catch (error) { /* empty */ }\n};\n","'use strict';\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar ITERATOR = wellKnownSymbol('iterator');\nvar SAFE_CLOSING = false;\n\ntry {\n var called = 0;\n var iteratorWithReturn = {\n next: function () {\n return { done: !!called++ };\n },\n 'return': function () {\n SAFE_CLOSING = true;\n }\n };\n iteratorWithReturn[ITERATOR] = function () {\n return this;\n };\n // eslint-disable-next-line es/no-array-from, no-throw-literal -- required for testing\n Array.from(iteratorWithReturn, function () { throw 2; });\n} catch (error) { /* empty */ }\n\nmodule.exports = function (exec, SKIP_CLOSING) {\n try {\n if (!SKIP_CLOSING && !SAFE_CLOSING) return false;\n } catch (error) { return false; } // workaround of old WebKit + `eval` bug\n var ITERATION_SUPPORT = false;\n try {\n var object = {};\n object[ITERATOR] = function () {\n return {\n next: function () {\n return { done: ITERATION_SUPPORT = true };\n }\n };\n };\n exec(object);\n } catch (error) { /* empty */ }\n return ITERATION_SUPPORT;\n};\n","'use strict';\nvar NativePromiseConstructor = require('../internals/promise-native-constructor');\nvar checkCorrectnessOfIteration = require('../internals/check-correctness-of-iteration');\nvar FORCED_PROMISE_CONSTRUCTOR = require('../internals/promise-constructor-detection').CONSTRUCTOR;\n\nmodule.exports = FORCED_PROMISE_CONSTRUCTOR || !checkCorrectnessOfIteration(function (iterable) {\n NativePromiseConstructor.all(iterable).then(undefined, function () { /* empty */ });\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar call = require('../internals/function-call');\nvar aCallable = require('../internals/a-callable');\nvar newPromiseCapabilityModule = require('../internals/new-promise-capability');\nvar perform = require('../internals/perform');\nvar iterate = require('../internals/iterate');\nvar PROMISE_STATICS_INCORRECT_ITERATION = require('../internals/promise-statics-incorrect-iteration');\n\n// `Promise.all` method\n// https://tc39.es/ecma262/#sec-promise.all\n$({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {\n all: function all(iterable) {\n var C = this;\n var capability = newPromiseCapabilityModule.f(C);\n var resolve = capability.resolve;\n var reject = capability.reject;\n var result = perform(function () {\n var $promiseResolve = aCallable(C.resolve);\n var values = [];\n var counter = 0;\n var remaining = 1;\n iterate(iterable, function (promise) {\n var index = counter++;\n var alreadyCalled = false;\n remaining++;\n call($promiseResolve, C, promise).then(function (value) {\n if (alreadyCalled) return;\n alreadyCalled = true;\n values[index] = value;\n --remaining || resolve(values);\n }, reject);\n });\n --remaining || resolve(values);\n });\n if (result.error) reject(result.value);\n return capability.promise;\n }\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar IS_PURE = require('../internals/is-pure');\nvar FORCED_PROMISE_CONSTRUCTOR = require('../internals/promise-constructor-detection').CONSTRUCTOR;\nvar NativePromiseConstructor = require('../internals/promise-native-constructor');\nvar getBuiltIn = require('../internals/get-built-in');\nvar isCallable = require('../internals/is-callable');\nvar defineBuiltIn = require('../internals/define-built-in');\n\nvar NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;\n\n// `Promise.prototype.catch` method\n// https://tc39.es/ecma262/#sec-promise.prototype.catch\n$({ target: 'Promise', proto: true, forced: FORCED_PROMISE_CONSTRUCTOR, real: true }, {\n 'catch': function (onRejected) {\n return this.then(undefined, onRejected);\n }\n});\n\n// makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then`\nif (!IS_PURE && isCallable(NativePromiseConstructor)) {\n var method = getBuiltIn('Promise').prototype['catch'];\n if (NativePromisePrototype['catch'] !== method) {\n defineBuiltIn(NativePromisePrototype, 'catch', method, { unsafe: true });\n }\n}\n","'use strict';\nvar $ = require('../internals/export');\nvar call = require('../internals/function-call');\nvar aCallable = require('../internals/a-callable');\nvar newPromiseCapabilityModule = require('../internals/new-promise-capability');\nvar perform = require('../internals/perform');\nvar iterate = require('../internals/iterate');\nvar PROMISE_STATICS_INCORRECT_ITERATION = require('../internals/promise-statics-incorrect-iteration');\n\n// `Promise.race` method\n// https://tc39.es/ecma262/#sec-promise.race\n$({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {\n race: function race(iterable) {\n var C = this;\n var capability = newPromiseCapabilityModule.f(C);\n var reject = capability.reject;\n var result = perform(function () {\n var $promiseResolve = aCallable(C.resolve);\n iterate(iterable, function (promise) {\n call($promiseResolve, C, promise).then(capability.resolve, reject);\n });\n });\n if (result.error) reject(result.value);\n return capability.promise;\n }\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar call = require('../internals/function-call');\nvar newPromiseCapabilityModule = require('../internals/new-promise-capability');\nvar FORCED_PROMISE_CONSTRUCTOR = require('../internals/promise-constructor-detection').CONSTRUCTOR;\n\n// `Promise.reject` method\n// https://tc39.es/ecma262/#sec-promise.reject\n$({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {\n reject: function reject(r) {\n var capability = newPromiseCapabilityModule.f(this);\n call(capability.reject, undefined, r);\n return capability.promise;\n }\n});\n","'use strict';\nvar anObject = require('../internals/an-object');\nvar isObject = require('../internals/is-object');\nvar newPromiseCapability = require('../internals/new-promise-capability');\n\nmodule.exports = function (C, x) {\n anObject(C);\n if (isObject(x) && x.constructor === C) return x;\n var promiseCapability = newPromiseCapability.f(C);\n var resolve = promiseCapability.resolve;\n resolve(x);\n return promiseCapability.promise;\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar getBuiltIn = require('../internals/get-built-in');\nvar IS_PURE = require('../internals/is-pure');\nvar NativePromiseConstructor = require('../internals/promise-native-constructor');\nvar FORCED_PROMISE_CONSTRUCTOR = require('../internals/promise-constructor-detection').CONSTRUCTOR;\nvar promiseResolve = require('../internals/promise-resolve');\n\nvar PromiseConstructorWrapper = getBuiltIn('Promise');\nvar CHECK_WRAPPER = IS_PURE && !FORCED_PROMISE_CONSTRUCTOR;\n\n// `Promise.resolve` method\n// https://tc39.es/ecma262/#sec-promise.resolve\n$({ target: 'Promise', stat: true, forced: IS_PURE || FORCED_PROMISE_CONSTRUCTOR }, {\n resolve: function resolve(x) {\n return promiseResolve(CHECK_WRAPPER && this === PromiseConstructorWrapper ? NativePromiseConstructor : this, x);\n }\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar call = require('../internals/function-call');\nvar aCallable = require('../internals/a-callable');\nvar newPromiseCapabilityModule = require('../internals/new-promise-capability');\nvar perform = require('../internals/perform');\nvar iterate = require('../internals/iterate');\nvar PROMISE_STATICS_INCORRECT_ITERATION = require('../internals/promise-statics-incorrect-iteration');\n\n// `Promise.allSettled` method\n// https://tc39.es/ecma262/#sec-promise.allsettled\n$({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {\n allSettled: function allSettled(iterable) {\n var C = this;\n var capability = newPromiseCapabilityModule.f(C);\n var resolve = capability.resolve;\n var reject = capability.reject;\n var result = perform(function () {\n var promiseResolve = aCallable(C.resolve);\n var values = [];\n var counter = 0;\n var remaining = 1;\n iterate(iterable, function (promise) {\n var index = counter++;\n var alreadyCalled = false;\n remaining++;\n call(promiseResolve, C, promise).then(function (value) {\n if (alreadyCalled) return;\n alreadyCalled = true;\n values[index] = { status: 'fulfilled', value: value };\n --remaining || resolve(values);\n }, function (error) {\n if (alreadyCalled) return;\n alreadyCalled = true;\n values[index] = { status: 'rejected', reason: error };\n --remaining || resolve(values);\n });\n });\n --remaining || resolve(values);\n });\n if (result.error) reject(result.value);\n return capability.promise;\n }\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar call = require('../internals/function-call');\nvar aCallable = require('../internals/a-callable');\nvar getBuiltIn = require('../internals/get-built-in');\nvar newPromiseCapabilityModule = require('../internals/new-promise-capability');\nvar perform = require('../internals/perform');\nvar iterate = require('../internals/iterate');\nvar PROMISE_STATICS_INCORRECT_ITERATION = require('../internals/promise-statics-incorrect-iteration');\n\nvar PROMISE_ANY_ERROR = 'No one promise resolved';\n\n// `Promise.any` method\n// https://tc39.es/ecma262/#sec-promise.any\n$({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {\n any: function any(iterable) {\n var C = this;\n var AggregateError = getBuiltIn('AggregateError');\n var capability = newPromiseCapabilityModule.f(C);\n var resolve = capability.resolve;\n var reject = capability.reject;\n var result = perform(function () {\n var promiseResolve = aCallable(C.resolve);\n var errors = [];\n var counter = 0;\n var remaining = 1;\n var alreadyResolved = false;\n iterate(iterable, function (promise) {\n var index = counter++;\n var alreadyRejected = false;\n remaining++;\n call(promiseResolve, C, promise).then(function (value) {\n if (alreadyRejected || alreadyResolved) return;\n alreadyResolved = true;\n resolve(value);\n }, function (error) {\n if (alreadyRejected || alreadyResolved) return;\n alreadyRejected = true;\n errors[index] = error;\n --remaining || reject(new AggregateError(errors, PROMISE_ANY_ERROR));\n });\n });\n --remaining || reject(new AggregateError(errors, PROMISE_ANY_ERROR));\n });\n if (result.error) reject(result.value);\n return capability.promise;\n }\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar IS_PURE = require('../internals/is-pure');\nvar NativePromiseConstructor = require('../internals/promise-native-constructor');\nvar fails = require('../internals/fails');\nvar getBuiltIn = require('../internals/get-built-in');\nvar isCallable = require('../internals/is-callable');\nvar speciesConstructor = require('../internals/species-constructor');\nvar promiseResolve = require('../internals/promise-resolve');\nvar defineBuiltIn = require('../internals/define-built-in');\n\nvar NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;\n\n// Safari bug https://bugs.webkit.org/show_bug.cgi?id=200829\nvar NON_GENERIC = !!NativePromiseConstructor && fails(function () {\n // eslint-disable-next-line unicorn/no-thenable -- required for testing\n NativePromisePrototype['finally'].call({ then: function () { /* empty */ } }, function () { /* empty */ });\n});\n\n// `Promise.prototype.finally` method\n// https://tc39.es/ecma262/#sec-promise.prototype.finally\n$({ target: 'Promise', proto: true, real: true, forced: NON_GENERIC }, {\n 'finally': function (onFinally) {\n var C = speciesConstructor(this, getBuiltIn('Promise'));\n var isFunction = isCallable(onFinally);\n return this.then(\n isFunction ? function (x) {\n return promiseResolve(C, onFinally()).then(function () { return x; });\n } : onFinally,\n isFunction ? function (e) {\n return promiseResolve(C, onFinally()).then(function () { throw e; });\n } : onFinally\n );\n }\n});\n\n// makes sure that native promise-based APIs `Promise#finally` properly works with patched `Promise#then`\nif (!IS_PURE && isCallable(NativePromiseConstructor)) {\n var method = getBuiltIn('Promise').prototype['finally'];\n if (NativePromisePrototype['finally'] !== method) {\n defineBuiltIn(NativePromisePrototype, 'finally', method, { unsafe: true });\n }\n}\n","'use strict';\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar toIntegerOrInfinity = require('../internals/to-integer-or-infinity');\nvar toString = require('../internals/to-string');\nvar requireObjectCoercible = require('../internals/require-object-coercible');\n\nvar charAt = uncurryThis(''.charAt);\nvar charCodeAt = uncurryThis(''.charCodeAt);\nvar stringSlice = uncurryThis(''.slice);\n\nvar createMethod = function (CONVERT_TO_STRING) {\n return function ($this, pos) {\n var S = toString(requireObjectCoercible($this));\n var position = toIntegerOrInfinity(pos);\n var size = S.length;\n var first, second;\n if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;\n first = charCodeAt(S, position);\n return first < 0xD800 || first > 0xDBFF || position + 1 === size\n || (second = charCodeAt(S, position + 1)) < 0xDC00 || second > 0xDFFF\n ? CONVERT_TO_STRING\n ? charAt(S, position)\n : first\n : CONVERT_TO_STRING\n ? stringSlice(S, position, position + 2)\n : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;\n };\n};\n\nmodule.exports = {\n // `String.prototype.codePointAt` method\n // https://tc39.es/ecma262/#sec-string.prototype.codepointat\n codeAt: createMethod(false),\n // `String.prototype.at` method\n // https://github.com/mathiasbynens/String.prototype.at\n charAt: createMethod(true)\n};\n","'use strict';\nvar charAt = require('../internals/string-multibyte').charAt;\nvar toString = require('../internals/to-string');\nvar InternalStateModule = require('../internals/internal-state');\nvar defineIterator = require('../internals/iterator-define');\nvar createIterResultObject = require('../internals/create-iter-result-object');\n\nvar STRING_ITERATOR = 'String Iterator';\nvar setInternalState = InternalStateModule.set;\nvar getInternalState = InternalStateModule.getterFor(STRING_ITERATOR);\n\n// `String.prototype[@@iterator]` method\n// https://tc39.es/ecma262/#sec-string.prototype-@@iterator\ndefineIterator(String, 'String', function (iterated) {\n setInternalState(this, {\n type: STRING_ITERATOR,\n string: toString(iterated),\n index: 0\n });\n// `%StringIteratorPrototype%.next` method\n// https://tc39.es/ecma262/#sec-%stringiteratorprototype%.next\n}, function next() {\n var state = getInternalState(this);\n var string = state.string;\n var index = state.index;\n var point;\n if (index >= string.length) return createIterResultObject(undefined, true);\n point = charAt(string, index);\n state.index += point.length;\n return createIterResultObject(point, false);\n});\n","'use strict';\nrequire('../../modules/es.aggregate-error');\nrequire('../../modules/es.array.iterator');\nrequire('../../modules/es.object.to-string');\nrequire('../../modules/es.promise');\nrequire('../../modules/es.promise.all-settled');\nrequire('../../modules/es.promise.any');\nrequire('../../modules/es.promise.finally');\nrequire('../../modules/es.string.iterator');\nvar path = require('../../internals/path');\n\nmodule.exports = path.Promise;\n","'use strict';\nrequire('../modules/es.array.iterator');\nvar DOMIterables = require('../internals/dom-iterables');\nvar global = require('../internals/global');\nvar classof = require('../internals/classof');\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\nvar Iterators = require('../internals/iterators');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar TO_STRING_TAG = wellKnownSymbol('toStringTag');\n\nfor (var COLLECTION_NAME in DOMIterables) {\n var Collection = global[COLLECTION_NAME];\n var CollectionPrototype = Collection && Collection.prototype;\n if (CollectionPrototype && classof(CollectionPrototype) !== TO_STRING_TAG) {\n createNonEnumerableProperty(CollectionPrototype, TO_STRING_TAG, COLLECTION_NAME);\n }\n Iterators[COLLECTION_NAME] = Iterators.Array;\n}\n","'use strict';\n// iterable DOM collections\n// flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods\nmodule.exports = {\n CSSRuleList: 0,\n CSSStyleDeclaration: 0,\n CSSValueList: 0,\n ClientRectList: 0,\n DOMRectList: 0,\n DOMStringList: 0,\n DOMTokenList: 1,\n DataTransferItemList: 0,\n FileList: 0,\n HTMLAllCollection: 0,\n HTMLCollection: 0,\n HTMLFormElement: 0,\n HTMLSelectElement: 0,\n MediaList: 0,\n MimeTypeArray: 0,\n NamedNodeMap: 0,\n NodeList: 1,\n PaintRequestList: 0,\n Plugin: 0,\n PluginArray: 0,\n SVGLengthList: 0,\n SVGNumberList: 0,\n SVGPathSegList: 0,\n SVGPointList: 0,\n SVGStringList: 0,\n SVGTransformList: 0,\n SourceBufferList: 0,\n StyleSheetList: 0,\n TextTrackCueList: 0,\n TextTrackList: 0,\n TouchList: 0\n};\n","'use strict';\nvar parent = require('../../es/promise');\nrequire('../../modules/web.dom-collections.iterator');\n\nmodule.exports = parent;\n","'use strict';\nvar $ = require('../internals/export');\nvar newPromiseCapabilityModule = require('../internals/new-promise-capability');\n\n// `Promise.withResolvers` method\n// https://github.com/tc39/proposal-promise-with-resolvers\n$({ target: 'Promise', stat: true }, {\n withResolvers: function withResolvers() {\n var promiseCapability = newPromiseCapabilityModule.f(this);\n return {\n promise: promiseCapability.promise,\n resolve: promiseCapability.resolve,\n reject: promiseCapability.reject\n };\n }\n});\n","'use strict';\nvar parent = require('../../stable/promise');\nrequire('../../modules/esnext.promise.with-resolvers');\n\nmodule.exports = parent;\n","'use strict';\n// TODO: Remove from `core-js@4`\nvar $ = require('../internals/export');\nvar newPromiseCapabilityModule = require('../internals/new-promise-capability');\nvar perform = require('../internals/perform');\n\n// `Promise.try` method\n// https://github.com/tc39/proposal-promise-try\n$({ target: 'Promise', stat: true, forced: true }, {\n 'try': function (callbackfn) {\n var promiseCapability = newPromiseCapabilityModule.f(this);\n var result = perform(callbackfn);\n (result.error ? promiseCapability.reject : promiseCapability.resolve)(result.value);\n return promiseCapability.promise;\n }\n});\n","'use strict';\nvar parent = require('../../actual/promise');\n// TODO: Remove from `core-js@4`\nrequire('../../modules/esnext.aggregate-error');\nrequire('../../modules/esnext.promise.all-settled');\nrequire('../../modules/esnext.promise.try');\nrequire('../../modules/esnext.promise.any');\n\nmodule.exports = parent;\n","'use strict';\nmodule.exports = require('../../full/promise');\n","import _Promise from \"core-js-pure/features/promise/index.js\";\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n if (info.done) {\n resolve(value);\n } else {\n _Promise.resolve(value).then(_next, _throw);\n }\n}\nexport default function _asyncToGenerator(fn) {\n return function () {\n var self = this,\n args = arguments;\n return new _Promise(function (resolve, reject) {\n var gen = fn.apply(self, args);\n function _next(value) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value);\n }\n function _throw(err) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err);\n }\n _next(undefined);\n });\n };\n}","'use strict';\nvar classof = require('../internals/classof-raw');\n\n// `IsArray` abstract operation\n// https://tc39.es/ecma262/#sec-isarray\n// eslint-disable-next-line es/no-array-isarray -- safe\nmodule.exports = Array.isArray || function isArray(argument) {\n return classof(argument) === 'Array';\n};\n","'use strict';\nvar $TypeError = TypeError;\nvar MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; // 2 ** 53 - 1 == 9007199254740991\n\nmodule.exports = function (it) {\n if (it > MAX_SAFE_INTEGER) throw $TypeError('Maximum allowed index exceeded');\n return it;\n};\n","'use strict';\nvar toPropertyKey = require('../internals/to-property-key');\nvar definePropertyModule = require('../internals/object-define-property');\nvar createPropertyDescriptor = require('../internals/create-property-descriptor');\n\nmodule.exports = function (object, key, value) {\n var propertyKey = toPropertyKey(key);\n if (propertyKey in object) definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value));\n else object[propertyKey] = value;\n};\n","'use strict';\nvar isArray = require('../internals/is-array');\nvar isConstructor = require('../internals/is-constructor');\nvar isObject = require('../internals/is-object');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar SPECIES = wellKnownSymbol('species');\nvar $Array = Array;\n\n// a part of `ArraySpeciesCreate` abstract operation\n// https://tc39.es/ecma262/#sec-arrayspeciescreate\nmodule.exports = function (originalArray) {\n var C;\n if (isArray(originalArray)) {\n C = originalArray.constructor;\n // cross-realm fallback\n if (isConstructor(C) && (C === $Array || isArray(C.prototype))) C = undefined;\n else if (isObject(C)) {\n C = C[SPECIES];\n if (C === null) C = undefined;\n }\n } return C === undefined ? $Array : C;\n};\n","'use strict';\nvar arraySpeciesConstructor = require('../internals/array-species-constructor');\n\n// `ArraySpeciesCreate` abstract operation\n// https://tc39.es/ecma262/#sec-arrayspeciescreate\nmodule.exports = function (originalArray, length) {\n return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);\n};\n","'use strict';\nvar fails = require('../internals/fails');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar V8_VERSION = require('../internals/engine-v8-version');\n\nvar SPECIES = wellKnownSymbol('species');\n\nmodule.exports = function (METHOD_NAME) {\n // We can't use this feature detection in V8 since it causes\n // deoptimization and serious performance degradation\n // https://github.com/zloirock/core-js/issues/677\n return V8_VERSION >= 51 || !fails(function () {\n var array = [];\n var constructor = array.constructor = {};\n constructor[SPECIES] = function () {\n return { foo: 1 };\n };\n return array[METHOD_NAME](Boolean).foo !== 1;\n });\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar fails = require('../internals/fails');\nvar isArray = require('../internals/is-array');\nvar isObject = require('../internals/is-object');\nvar toObject = require('../internals/to-object');\nvar lengthOfArrayLike = require('../internals/length-of-array-like');\nvar doesNotExceedSafeInteger = require('../internals/does-not-exceed-safe-integer');\nvar createProperty = require('../internals/create-property');\nvar arraySpeciesCreate = require('../internals/array-species-create');\nvar arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar V8_VERSION = require('../internals/engine-v8-version');\n\nvar IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');\n\n// We can't use this feature detection in V8 since it causes\n// deoptimization and serious performance degradation\n// https://github.com/zloirock/core-js/issues/679\nvar IS_CONCAT_SPREADABLE_SUPPORT = V8_VERSION >= 51 || !fails(function () {\n var array = [];\n array[IS_CONCAT_SPREADABLE] = false;\n return array.concat()[0] !== array;\n});\n\nvar isConcatSpreadable = function (O) {\n if (!isObject(O)) return false;\n var spreadable = O[IS_CONCAT_SPREADABLE];\n return spreadable !== undefined ? !!spreadable : isArray(O);\n};\n\nvar FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !arrayMethodHasSpeciesSupport('concat');\n\n// `Array.prototype.concat` method\n// https://tc39.es/ecma262/#sec-array.prototype.concat\n// with adding support of @@isConcatSpreadable and @@species\n$({ target: 'Array', proto: true, arity: 1, forced: FORCED }, {\n // eslint-disable-next-line no-unused-vars -- required for `.length`\n concat: function concat(arg) {\n var O = toObject(this);\n var A = arraySpeciesCreate(O, 0);\n var n = 0;\n var i, k, length, len, E;\n for (i = -1, length = arguments.length; i < length; i++) {\n E = i === -1 ? O : arguments[i];\n if (isConcatSpreadable(E)) {\n len = lengthOfArrayLike(E);\n doesNotExceedSafeInteger(n + len);\n for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);\n } else {\n doesNotExceedSafeInteger(n + 1);\n createProperty(A, n++, E);\n }\n }\n A.length = n;\n return A;\n }\n});\n","'use strict';\nvar toAbsoluteIndex = require('../internals/to-absolute-index');\nvar lengthOfArrayLike = require('../internals/length-of-array-like');\nvar createProperty = require('../internals/create-property');\n\nvar $Array = Array;\nvar max = Math.max;\n\nmodule.exports = function (O, start, end) {\n var length = lengthOfArrayLike(O);\n var k = toAbsoluteIndex(start, length);\n var fin = toAbsoluteIndex(end === undefined ? length : end, length);\n var result = $Array(max(fin - k, 0));\n var n = 0;\n for (; k < fin; k++, n++) createProperty(result, n, O[k]);\n result.length = n;\n return result;\n};\n","'use strict';\n/* eslint-disable es/no-object-getownpropertynames -- safe */\nvar classof = require('../internals/classof-raw');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar $getOwnPropertyNames = require('../internals/object-get-own-property-names').f;\nvar arraySlice = require('../internals/array-slice-simple');\n\nvar windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames\n ? Object.getOwnPropertyNames(window) : [];\n\nvar getWindowNames = function (it) {\n try {\n return $getOwnPropertyNames(it);\n } catch (error) {\n return arraySlice(windowNames);\n }\n};\n\n// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window\nmodule.exports.f = function getOwnPropertyNames(it) {\n return windowNames && classof(it) === 'Window'\n ? getWindowNames(it)\n : $getOwnPropertyNames(toIndexedObject(it));\n};\n","'use strict';\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nexports.f = wellKnownSymbol;\n","'use strict';\nvar path = require('../internals/path');\nvar hasOwn = require('../internals/has-own-property');\nvar wrappedWellKnownSymbolModule = require('../internals/well-known-symbol-wrapped');\nvar defineProperty = require('../internals/object-define-property').f;\n\nmodule.exports = function (NAME) {\n var Symbol = path.Symbol || (path.Symbol = {});\n if (!hasOwn(Symbol, NAME)) defineProperty(Symbol, NAME, {\n value: wrappedWellKnownSymbolModule.f(NAME)\n });\n};\n","'use strict';\nvar call = require('../internals/function-call');\nvar getBuiltIn = require('../internals/get-built-in');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar defineBuiltIn = require('../internals/define-built-in');\n\nmodule.exports = function () {\n var Symbol = getBuiltIn('Symbol');\n var SymbolPrototype = Symbol && Symbol.prototype;\n var valueOf = SymbolPrototype && SymbolPrototype.valueOf;\n var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');\n\n if (SymbolPrototype && !SymbolPrototype[TO_PRIMITIVE]) {\n // `Symbol.prototype[@@toPrimitive]` method\n // https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive\n // eslint-disable-next-line no-unused-vars -- required for .length\n defineBuiltIn(SymbolPrototype, TO_PRIMITIVE, function (hint) {\n return call(valueOf, this);\n }, { arity: 1 });\n }\n};\n","'use strict';\nvar bind = require('../internals/function-bind-context');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar IndexedObject = require('../internals/indexed-object');\nvar toObject = require('../internals/to-object');\nvar lengthOfArrayLike = require('../internals/length-of-array-like');\nvar arraySpeciesCreate = require('../internals/array-species-create');\n\nvar push = uncurryThis([].push);\n\n// `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterReject }` methods implementation\nvar createMethod = function (TYPE) {\n var IS_MAP = TYPE === 1;\n var IS_FILTER = TYPE === 2;\n var IS_SOME = TYPE === 3;\n var IS_EVERY = TYPE === 4;\n var IS_FIND_INDEX = TYPE === 6;\n var IS_FILTER_REJECT = TYPE === 7;\n var NO_HOLES = TYPE === 5 || IS_FIND_INDEX;\n return function ($this, callbackfn, that, specificCreate) {\n var O = toObject($this);\n var self = IndexedObject(O);\n var boundFunction = bind(callbackfn, that);\n var length = lengthOfArrayLike(self);\n var index = 0;\n var create = specificCreate || arraySpeciesCreate;\n var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_REJECT ? create($this, 0) : undefined;\n var value, result;\n for (;length > index; index++) if (NO_HOLES || index in self) {\n value = self[index];\n result = boundFunction(value, index, O);\n if (TYPE) {\n if (IS_MAP) target[index] = result; // map\n else if (result) switch (TYPE) {\n case 3: return true; // some\n case 5: return value; // find\n case 6: return index; // findIndex\n case 2: push(target, value); // filter\n } else switch (TYPE) {\n case 4: return false; // every\n case 7: push(target, value); // filterReject\n }\n }\n }\n return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;\n };\n};\n\nmodule.exports = {\n // `Array.prototype.forEach` method\n // https://tc39.es/ecma262/#sec-array.prototype.foreach\n forEach: createMethod(0),\n // `Array.prototype.map` method\n // https://tc39.es/ecma262/#sec-array.prototype.map\n map: createMethod(1),\n // `Array.prototype.filter` method\n // https://tc39.es/ecma262/#sec-array.prototype.filter\n filter: createMethod(2),\n // `Array.prototype.some` method\n // https://tc39.es/ecma262/#sec-array.prototype.some\n some: createMethod(3),\n // `Array.prototype.every` method\n // https://tc39.es/ecma262/#sec-array.prototype.every\n every: createMethod(4),\n // `Array.prototype.find` method\n // https://tc39.es/ecma262/#sec-array.prototype.find\n find: createMethod(5),\n // `Array.prototype.findIndex` method\n // https://tc39.es/ecma262/#sec-array.prototype.findIndex\n findIndex: createMethod(6),\n // `Array.prototype.filterReject` method\n // https://github.com/tc39/proposal-array-filtering\n filterReject: createMethod(7)\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar global = require('../internals/global');\nvar call = require('../internals/function-call');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar IS_PURE = require('../internals/is-pure');\nvar DESCRIPTORS = require('../internals/descriptors');\nvar NATIVE_SYMBOL = require('../internals/symbol-constructor-detection');\nvar fails = require('../internals/fails');\nvar hasOwn = require('../internals/has-own-property');\nvar isPrototypeOf = require('../internals/object-is-prototype-of');\nvar anObject = require('../internals/an-object');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar toPropertyKey = require('../internals/to-property-key');\nvar $toString = require('../internals/to-string');\nvar createPropertyDescriptor = require('../internals/create-property-descriptor');\nvar nativeObjectCreate = require('../internals/object-create');\nvar objectKeys = require('../internals/object-keys');\nvar getOwnPropertyNamesModule = require('../internals/object-get-own-property-names');\nvar getOwnPropertyNamesExternal = require('../internals/object-get-own-property-names-external');\nvar getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols');\nvar getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor');\nvar definePropertyModule = require('../internals/object-define-property');\nvar definePropertiesModule = require('../internals/object-define-properties');\nvar propertyIsEnumerableModule = require('../internals/object-property-is-enumerable');\nvar defineBuiltIn = require('../internals/define-built-in');\nvar defineBuiltInAccessor = require('../internals/define-built-in-accessor');\nvar shared = require('../internals/shared');\nvar sharedKey = require('../internals/shared-key');\nvar hiddenKeys = require('../internals/hidden-keys');\nvar uid = require('../internals/uid');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar wrappedWellKnownSymbolModule = require('../internals/well-known-symbol-wrapped');\nvar defineWellKnownSymbol = require('../internals/well-known-symbol-define');\nvar defineSymbolToPrimitive = require('../internals/symbol-define-to-primitive');\nvar setToStringTag = require('../internals/set-to-string-tag');\nvar InternalStateModule = require('../internals/internal-state');\nvar $forEach = require('../internals/array-iteration').forEach;\n\nvar HIDDEN = sharedKey('hidden');\nvar SYMBOL = 'Symbol';\nvar PROTOTYPE = 'prototype';\n\nvar setInternalState = InternalStateModule.set;\nvar getInternalState = InternalStateModule.getterFor(SYMBOL);\n\nvar ObjectPrototype = Object[PROTOTYPE];\nvar $Symbol = global.Symbol;\nvar SymbolPrototype = $Symbol && $Symbol[PROTOTYPE];\nvar RangeError = global.RangeError;\nvar TypeError = global.TypeError;\nvar QObject = global.QObject;\nvar nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;\nvar nativeDefineProperty = definePropertyModule.f;\nvar nativeGetOwnPropertyNames = getOwnPropertyNamesExternal.f;\nvar nativePropertyIsEnumerable = propertyIsEnumerableModule.f;\nvar push = uncurryThis([].push);\n\nvar AllSymbols = shared('symbols');\nvar ObjectPrototypeSymbols = shared('op-symbols');\nvar WellKnownSymbolsStore = shared('wks');\n\n// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173\nvar USE_SETTER = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;\n\n// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687\nvar fallbackDefineProperty = function (O, P, Attributes) {\n var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor(ObjectPrototype, P);\n if (ObjectPrototypeDescriptor) delete ObjectPrototype[P];\n nativeDefineProperty(O, P, Attributes);\n if (ObjectPrototypeDescriptor && O !== ObjectPrototype) {\n nativeDefineProperty(ObjectPrototype, P, ObjectPrototypeDescriptor);\n }\n};\n\nvar setSymbolDescriptor = DESCRIPTORS && fails(function () {\n return nativeObjectCreate(nativeDefineProperty({}, 'a', {\n get: function () { return nativeDefineProperty(this, 'a', { value: 7 }).a; }\n })).a !== 7;\n}) ? fallbackDefineProperty : nativeDefineProperty;\n\nvar wrap = function (tag, description) {\n var symbol = AllSymbols[tag] = nativeObjectCreate(SymbolPrototype);\n setInternalState(symbol, {\n type: SYMBOL,\n tag: tag,\n description: description\n });\n if (!DESCRIPTORS) symbol.description = description;\n return symbol;\n};\n\nvar $defineProperty = function defineProperty(O, P, Attributes) {\n if (O === ObjectPrototype) $defineProperty(ObjectPrototypeSymbols, P, Attributes);\n anObject(O);\n var key = toPropertyKey(P);\n anObject(Attributes);\n if (hasOwn(AllSymbols, key)) {\n if (!Attributes.enumerable) {\n if (!hasOwn(O, HIDDEN)) nativeDefineProperty(O, HIDDEN, createPropertyDescriptor(1, {}));\n O[HIDDEN][key] = true;\n } else {\n if (hasOwn(O, HIDDEN) && O[HIDDEN][key]) O[HIDDEN][key] = false;\n Attributes = nativeObjectCreate(Attributes, { enumerable: createPropertyDescriptor(0, false) });\n } return setSymbolDescriptor(O, key, Attributes);\n } return nativeDefineProperty(O, key, Attributes);\n};\n\nvar $defineProperties = function defineProperties(O, Properties) {\n anObject(O);\n var properties = toIndexedObject(Properties);\n var keys = objectKeys(properties).concat($getOwnPropertySymbols(properties));\n $forEach(keys, function (key) {\n if (!DESCRIPTORS || call($propertyIsEnumerable, properties, key)) $defineProperty(O, key, properties[key]);\n });\n return O;\n};\n\nvar $create = function create(O, Properties) {\n return Properties === undefined ? nativeObjectCreate(O) : $defineProperties(nativeObjectCreate(O), Properties);\n};\n\nvar $propertyIsEnumerable = function propertyIsEnumerable(V) {\n var P = toPropertyKey(V);\n var enumerable = call(nativePropertyIsEnumerable, this, P);\n if (this === ObjectPrototype && hasOwn(AllSymbols, P) && !hasOwn(ObjectPrototypeSymbols, P)) return false;\n return enumerable || !hasOwn(this, P) || !hasOwn(AllSymbols, P) || hasOwn(this, HIDDEN) && this[HIDDEN][P]\n ? enumerable : true;\n};\n\nvar $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) {\n var it = toIndexedObject(O);\n var key = toPropertyKey(P);\n if (it === ObjectPrototype && hasOwn(AllSymbols, key) && !hasOwn(ObjectPrototypeSymbols, key)) return;\n var descriptor = nativeGetOwnPropertyDescriptor(it, key);\n if (descriptor && hasOwn(AllSymbols, key) && !(hasOwn(it, HIDDEN) && it[HIDDEN][key])) {\n descriptor.enumerable = true;\n }\n return descriptor;\n};\n\nvar $getOwnPropertyNames = function getOwnPropertyNames(O) {\n var names = nativeGetOwnPropertyNames(toIndexedObject(O));\n var result = [];\n $forEach(names, function (key) {\n if (!hasOwn(AllSymbols, key) && !hasOwn(hiddenKeys, key)) push(result, key);\n });\n return result;\n};\n\nvar $getOwnPropertySymbols = function (O) {\n var IS_OBJECT_PROTOTYPE = O === ObjectPrototype;\n var names = nativeGetOwnPropertyNames(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject(O));\n var result = [];\n $forEach(names, function (key) {\n if (hasOwn(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || hasOwn(ObjectPrototype, key))) {\n push(result, AllSymbols[key]);\n }\n });\n return result;\n};\n\n// `Symbol` constructor\n// https://tc39.es/ecma262/#sec-symbol-constructor\nif (!NATIVE_SYMBOL) {\n $Symbol = function Symbol() {\n if (isPrototypeOf(SymbolPrototype, this)) throw new TypeError('Symbol is not a constructor');\n var description = !arguments.length || arguments[0] === undefined ? undefined : $toString(arguments[0]);\n var tag = uid(description);\n var setter = function (value) {\n var $this = this === undefined ? global : this;\n if ($this === ObjectPrototype) call(setter, ObjectPrototypeSymbols, value);\n if (hasOwn($this, HIDDEN) && hasOwn($this[HIDDEN], tag)) $this[HIDDEN][tag] = false;\n var descriptor = createPropertyDescriptor(1, value);\n try {\n setSymbolDescriptor($this, tag, descriptor);\n } catch (error) {\n if (!(error instanceof RangeError)) throw error;\n fallbackDefineProperty($this, tag, descriptor);\n }\n };\n if (DESCRIPTORS && USE_SETTER) setSymbolDescriptor(ObjectPrototype, tag, { configurable: true, set: setter });\n return wrap(tag, description);\n };\n\n SymbolPrototype = $Symbol[PROTOTYPE];\n\n defineBuiltIn(SymbolPrototype, 'toString', function toString() {\n return getInternalState(this).tag;\n });\n\n defineBuiltIn($Symbol, 'withoutSetter', function (description) {\n return wrap(uid(description), description);\n });\n\n propertyIsEnumerableModule.f = $propertyIsEnumerable;\n definePropertyModule.f = $defineProperty;\n definePropertiesModule.f = $defineProperties;\n getOwnPropertyDescriptorModule.f = $getOwnPropertyDescriptor;\n getOwnPropertyNamesModule.f = getOwnPropertyNamesExternal.f = $getOwnPropertyNames;\n getOwnPropertySymbolsModule.f = $getOwnPropertySymbols;\n\n wrappedWellKnownSymbolModule.f = function (name) {\n return wrap(wellKnownSymbol(name), name);\n };\n\n if (DESCRIPTORS) {\n // https://github.com/tc39/proposal-Symbol-description\n defineBuiltInAccessor(SymbolPrototype, 'description', {\n configurable: true,\n get: function description() {\n return getInternalState(this).description;\n }\n });\n if (!IS_PURE) {\n defineBuiltIn(ObjectPrototype, 'propertyIsEnumerable', $propertyIsEnumerable, { unsafe: true });\n }\n }\n}\n\n$({ global: true, constructor: true, wrap: true, forced: !NATIVE_SYMBOL, sham: !NATIVE_SYMBOL }, {\n Symbol: $Symbol\n});\n\n$forEach(objectKeys(WellKnownSymbolsStore), function (name) {\n defineWellKnownSymbol(name);\n});\n\n$({ target: SYMBOL, stat: true, forced: !NATIVE_SYMBOL }, {\n useSetter: function () { USE_SETTER = true; },\n useSimple: function () { USE_SETTER = false; }\n});\n\n$({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL, sham: !DESCRIPTORS }, {\n // `Object.create` method\n // https://tc39.es/ecma262/#sec-object.create\n create: $create,\n // `Object.defineProperty` method\n // https://tc39.es/ecma262/#sec-object.defineproperty\n defineProperty: $defineProperty,\n // `Object.defineProperties` method\n // https://tc39.es/ecma262/#sec-object.defineproperties\n defineProperties: $defineProperties,\n // `Object.getOwnPropertyDescriptor` method\n // https://tc39.es/ecma262/#sec-object.getownpropertydescriptors\n getOwnPropertyDescriptor: $getOwnPropertyDescriptor\n});\n\n$({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL }, {\n // `Object.getOwnPropertyNames` method\n // https://tc39.es/ecma262/#sec-object.getownpropertynames\n getOwnPropertyNames: $getOwnPropertyNames\n});\n\n// `Symbol.prototype[@@toPrimitive]` method\n// https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive\ndefineSymbolToPrimitive();\n\n// `Symbol.prototype[@@toStringTag]` property\n// https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag\nsetToStringTag($Symbol, SYMBOL);\n\nhiddenKeys[HIDDEN] = true;\n","'use strict';\nvar NATIVE_SYMBOL = require('../internals/symbol-constructor-detection');\n\n/* eslint-disable es/no-symbol -- safe */\nmodule.exports = NATIVE_SYMBOL && !!Symbol['for'] && !!Symbol.keyFor;\n","'use strict';\nvar $ = require('../internals/export');\nvar getBuiltIn = require('../internals/get-built-in');\nvar hasOwn = require('../internals/has-own-property');\nvar toString = require('../internals/to-string');\nvar shared = require('../internals/shared');\nvar NATIVE_SYMBOL_REGISTRY = require('../internals/symbol-registry-detection');\n\nvar StringToSymbolRegistry = shared('string-to-symbol-registry');\nvar SymbolToStringRegistry = shared('symbol-to-string-registry');\n\n// `Symbol.for` method\n// https://tc39.es/ecma262/#sec-symbol.for\n$({ target: 'Symbol', stat: true, forced: !NATIVE_SYMBOL_REGISTRY }, {\n 'for': function (key) {\n var string = toString(key);\n if (hasOwn(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string];\n var symbol = getBuiltIn('Symbol')(string);\n StringToSymbolRegistry[string] = symbol;\n SymbolToStringRegistry[symbol] = string;\n return symbol;\n }\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar hasOwn = require('../internals/has-own-property');\nvar isSymbol = require('../internals/is-symbol');\nvar tryToString = require('../internals/try-to-string');\nvar shared = require('../internals/shared');\nvar NATIVE_SYMBOL_REGISTRY = require('../internals/symbol-registry-detection');\n\nvar SymbolToStringRegistry = shared('symbol-to-string-registry');\n\n// `Symbol.keyFor` method\n// https://tc39.es/ecma262/#sec-symbol.keyfor\n$({ target: 'Symbol', stat: true, forced: !NATIVE_SYMBOL_REGISTRY }, {\n keyFor: function keyFor(sym) {\n if (!isSymbol(sym)) throw new TypeError(tryToString(sym) + ' is not a symbol');\n if (hasOwn(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym];\n }\n});\n","'use strict';\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar isArray = require('../internals/is-array');\nvar isCallable = require('../internals/is-callable');\nvar classof = require('../internals/classof-raw');\nvar toString = require('../internals/to-string');\n\nvar push = uncurryThis([].push);\n\nmodule.exports = function (replacer) {\n if (isCallable(replacer)) return replacer;\n if (!isArray(replacer)) return;\n var rawLength = replacer.length;\n var keys = [];\n for (var i = 0; i < rawLength; i++) {\n var element = replacer[i];\n if (typeof element == 'string') push(keys, element);\n else if (typeof element == 'number' || classof(element) === 'Number' || classof(element) === 'String') push(keys, toString(element));\n }\n var keysLength = keys.length;\n var root = true;\n return function (key, value) {\n if (root) {\n root = false;\n return value;\n }\n if (isArray(this)) return value;\n for (var j = 0; j < keysLength; j++) if (keys[j] === key) return value;\n };\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar getBuiltIn = require('../internals/get-built-in');\nvar apply = require('../internals/function-apply');\nvar call = require('../internals/function-call');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar fails = require('../internals/fails');\nvar isCallable = require('../internals/is-callable');\nvar isSymbol = require('../internals/is-symbol');\nvar arraySlice = require('../internals/array-slice');\nvar getReplacerFunction = require('../internals/get-json-replacer-function');\nvar NATIVE_SYMBOL = require('../internals/symbol-constructor-detection');\n\nvar $String = String;\nvar $stringify = getBuiltIn('JSON', 'stringify');\nvar exec = uncurryThis(/./.exec);\nvar charAt = uncurryThis(''.charAt);\nvar charCodeAt = uncurryThis(''.charCodeAt);\nvar replace = uncurryThis(''.replace);\nvar numberToString = uncurryThis(1.0.toString);\n\nvar tester = /[\\uD800-\\uDFFF]/g;\nvar low = /^[\\uD800-\\uDBFF]$/;\nvar hi = /^[\\uDC00-\\uDFFF]$/;\n\nvar WRONG_SYMBOLS_CONVERSION = !NATIVE_SYMBOL || fails(function () {\n var symbol = getBuiltIn('Symbol')('stringify detection');\n // MS Edge converts symbol values to JSON as {}\n return $stringify([symbol]) !== '[null]'\n // WebKit converts symbol values to JSON as null\n || $stringify({ a: symbol }) !== '{}'\n // V8 throws on boxed symbols\n || $stringify(Object(symbol)) !== '{}';\n});\n\n// https://github.com/tc39/proposal-well-formed-stringify\nvar ILL_FORMED_UNICODE = fails(function () {\n return $stringify('\\uDF06\\uD834') !== '\"\\\\udf06\\\\ud834\"'\n || $stringify('\\uDEAD') !== '\"\\\\udead\"';\n});\n\nvar stringifyWithSymbolsFix = function (it, replacer) {\n var args = arraySlice(arguments);\n var $replacer = getReplacerFunction(replacer);\n if (!isCallable($replacer) && (it === undefined || isSymbol(it))) return; // IE8 returns string on undefined\n args[1] = function (key, value) {\n // some old implementations (like WebKit) could pass numbers as keys\n if (isCallable($replacer)) value = call($replacer, this, $String(key), value);\n if (!isSymbol(value)) return value;\n };\n return apply($stringify, null, args);\n};\n\nvar fixIllFormed = function (match, offset, string) {\n var prev = charAt(string, offset - 1);\n var next = charAt(string, offset + 1);\n if ((exec(low, match) && !exec(hi, next)) || (exec(hi, match) && !exec(low, prev))) {\n return '\\\\u' + numberToString(charCodeAt(match, 0), 16);\n } return match;\n};\n\nif ($stringify) {\n // `JSON.stringify` method\n // https://tc39.es/ecma262/#sec-json.stringify\n $({ target: 'JSON', stat: true, arity: 3, forced: WRONG_SYMBOLS_CONVERSION || ILL_FORMED_UNICODE }, {\n // eslint-disable-next-line no-unused-vars -- required for `.length`\n stringify: function stringify(it, replacer, space) {\n var args = arraySlice(arguments);\n var result = apply(WRONG_SYMBOLS_CONVERSION ? stringifyWithSymbolsFix : $stringify, null, args);\n return ILL_FORMED_UNICODE && typeof result == 'string' ? replace(result, tester, fixIllFormed) : result;\n }\n });\n}\n","'use strict';\nvar $ = require('../internals/export');\nvar NATIVE_SYMBOL = require('../internals/symbol-constructor-detection');\nvar fails = require('../internals/fails');\nvar getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols');\nvar toObject = require('../internals/to-object');\n\n// V8 ~ Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives\n// https://bugs.chromium.org/p/v8/issues/detail?id=3443\nvar FORCED = !NATIVE_SYMBOL || fails(function () { getOwnPropertySymbolsModule.f(1); });\n\n// `Object.getOwnPropertySymbols` method\n// https://tc39.es/ecma262/#sec-object.getownpropertysymbols\n$({ target: 'Object', stat: true, forced: FORCED }, {\n getOwnPropertySymbols: function getOwnPropertySymbols(it) {\n var $getOwnPropertySymbols = getOwnPropertySymbolsModule.f;\n return $getOwnPropertySymbols ? $getOwnPropertySymbols(toObject(it)) : [];\n }\n});\n","'use strict';\nvar defineWellKnownSymbol = require('../internals/well-known-symbol-define');\n\n// `Symbol.asyncIterator` well-known symbol\n// https://tc39.es/ecma262/#sec-symbol.asynciterator\ndefineWellKnownSymbol('asyncIterator');\n","'use strict';\nvar defineWellKnownSymbol = require('../internals/well-known-symbol-define');\n\n// `Symbol.hasInstance` well-known symbol\n// https://tc39.es/ecma262/#sec-symbol.hasinstance\ndefineWellKnownSymbol('hasInstance');\n","'use strict';\nvar defineWellKnownSymbol = require('../internals/well-known-symbol-define');\n\n// `Symbol.isConcatSpreadable` well-known symbol\n// https://tc39.es/ecma262/#sec-symbol.isconcatspreadable\ndefineWellKnownSymbol('isConcatSpreadable');\n","'use strict';\nvar defineWellKnownSymbol = require('../internals/well-known-symbol-define');\n\n// `Symbol.iterator` well-known symbol\n// https://tc39.es/ecma262/#sec-symbol.iterator\ndefineWellKnownSymbol('iterator');\n","'use strict';\nvar defineWellKnownSymbol = require('../internals/well-known-symbol-define');\n\n// `Symbol.match` well-known symbol\n// https://tc39.es/ecma262/#sec-symbol.match\ndefineWellKnownSymbol('match');\n","'use strict';\nvar defineWellKnownSymbol = require('../internals/well-known-symbol-define');\n\n// `Symbol.matchAll` well-known symbol\n// https://tc39.es/ecma262/#sec-symbol.matchall\ndefineWellKnownSymbol('matchAll');\n","'use strict';\nvar defineWellKnownSymbol = require('../internals/well-known-symbol-define');\n\n// `Symbol.replace` well-known symbol\n// https://tc39.es/ecma262/#sec-symbol.replace\ndefineWellKnownSymbol('replace');\n","'use strict';\nvar defineWellKnownSymbol = require('../internals/well-known-symbol-define');\n\n// `Symbol.search` well-known symbol\n// https://tc39.es/ecma262/#sec-symbol.search\ndefineWellKnownSymbol('search');\n","'use strict';\nvar defineWellKnownSymbol = require('../internals/well-known-symbol-define');\n\n// `Symbol.species` well-known symbol\n// https://tc39.es/ecma262/#sec-symbol.species\ndefineWellKnownSymbol('species');\n","'use strict';\nvar defineWellKnownSymbol = require('../internals/well-known-symbol-define');\n\n// `Symbol.split` well-known symbol\n// https://tc39.es/ecma262/#sec-symbol.split\ndefineWellKnownSymbol('split');\n","'use strict';\nvar defineWellKnownSymbol = require('../internals/well-known-symbol-define');\nvar defineSymbolToPrimitive = require('../internals/symbol-define-to-primitive');\n\n// `Symbol.toPrimitive` well-known symbol\n// https://tc39.es/ecma262/#sec-symbol.toprimitive\ndefineWellKnownSymbol('toPrimitive');\n\n// `Symbol.prototype[@@toPrimitive]` method\n// https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive\ndefineSymbolToPrimitive();\n","'use strict';\nvar getBuiltIn = require('../internals/get-built-in');\nvar defineWellKnownSymbol = require('../internals/well-known-symbol-define');\nvar setToStringTag = require('../internals/set-to-string-tag');\n\n// `Symbol.toStringTag` well-known symbol\n// https://tc39.es/ecma262/#sec-symbol.tostringtag\ndefineWellKnownSymbol('toStringTag');\n\n// `Symbol.prototype[@@toStringTag]` property\n// https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag\nsetToStringTag(getBuiltIn('Symbol'), 'Symbol');\n","'use strict';\nvar defineWellKnownSymbol = require('../internals/well-known-symbol-define');\n\n// `Symbol.unscopables` well-known symbol\n// https://tc39.es/ecma262/#sec-symbol.unscopables\ndefineWellKnownSymbol('unscopables');\n","'use strict';\nvar global = require('../internals/global');\nvar setToStringTag = require('../internals/set-to-string-tag');\n\n// JSON[@@toStringTag] property\n// https://tc39.es/ecma262/#sec-json-@@tostringtag\nsetToStringTag(global.JSON, 'JSON', true);\n","'use strict';\nrequire('../../modules/es.array.concat');\nrequire('../../modules/es.object.to-string');\nrequire('../../modules/es.symbol');\nrequire('../../modules/es.symbol.async-iterator');\nrequire('../../modules/es.symbol.description');\nrequire('../../modules/es.symbol.has-instance');\nrequire('../../modules/es.symbol.is-concat-spreadable');\nrequire('../../modules/es.symbol.iterator');\nrequire('../../modules/es.symbol.match');\nrequire('../../modules/es.symbol.match-all');\nrequire('../../modules/es.symbol.replace');\nrequire('../../modules/es.symbol.search');\nrequire('../../modules/es.symbol.species');\nrequire('../../modules/es.symbol.split');\nrequire('../../modules/es.symbol.to-primitive');\nrequire('../../modules/es.symbol.to-string-tag');\nrequire('../../modules/es.symbol.unscopables');\nrequire('../../modules/es.json.to-string-tag');\nrequire('../../modules/es.math.to-string-tag');\nrequire('../../modules/es.reflect.to-string-tag');\nvar path = require('../../internals/path');\n\nmodule.exports = path.Symbol;\n","'use strict';\nvar parent = require('../../es/symbol');\nrequire('../../modules/web.dom-collections.iterator');\n\nmodule.exports = parent;\n","'use strict';\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar defineProperty = require('../internals/object-define-property').f;\n\nvar METADATA = wellKnownSymbol('metadata');\nvar FunctionPrototype = Function.prototype;\n\n// Function.prototype[@@metadata]\n// https://github.com/tc39/proposal-decorator-metadata\nif (FunctionPrototype[METADATA] === undefined) {\n defineProperty(FunctionPrototype, METADATA, {\n value: null\n });\n}\n","'use strict';\nvar defineWellKnownSymbol = require('../internals/well-known-symbol-define');\n\n// `Symbol.asyncDispose` well-known symbol\n// https://github.com/tc39/proposal-async-explicit-resource-management\ndefineWellKnownSymbol('asyncDispose');\n","'use strict';\nvar defineWellKnownSymbol = require('../internals/well-known-symbol-define');\n\n// `Symbol.dispose` well-known symbol\n// https://github.com/tc39/proposal-explicit-resource-management\ndefineWellKnownSymbol('dispose');\n","'use strict';\nvar defineWellKnownSymbol = require('../internals/well-known-symbol-define');\n\n// `Symbol.metadata` well-known symbol\n// https://github.com/tc39/proposal-decorators\ndefineWellKnownSymbol('metadata');\n","'use strict';\nvar parent = require('../../stable/symbol');\n\nrequire('../../modules/esnext.function.metadata');\nrequire('../../modules/esnext.symbol.async-dispose');\nrequire('../../modules/esnext.symbol.dispose');\nrequire('../../modules/esnext.symbol.metadata');\n\nmodule.exports = parent;\n","'use strict';\nvar getBuiltIn = require('../internals/get-built-in');\nvar uncurryThis = require('../internals/function-uncurry-this');\n\nvar Symbol = getBuiltIn('Symbol');\nvar keyFor = Symbol.keyFor;\nvar thisSymbolValue = uncurryThis(Symbol.prototype.valueOf);\n\n// `Symbol.isRegisteredSymbol` method\n// https://tc39.es/proposal-symbol-predicates/#sec-symbol-isregisteredsymbol\nmodule.exports = Symbol.isRegisteredSymbol || function isRegisteredSymbol(value) {\n try {\n return keyFor(thisSymbolValue(value)) !== undefined;\n } catch (error) {\n return false;\n }\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar isRegisteredSymbol = require('../internals/symbol-is-registered');\n\n// `Symbol.isRegisteredSymbol` method\n// https://tc39.es/proposal-symbol-predicates/#sec-symbol-isregisteredsymbol\n$({ target: 'Symbol', stat: true }, {\n isRegisteredSymbol: isRegisteredSymbol\n});\n","'use strict';\nvar shared = require('../internals/shared');\nvar getBuiltIn = require('../internals/get-built-in');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar isSymbol = require('../internals/is-symbol');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar Symbol = getBuiltIn('Symbol');\nvar $isWellKnownSymbol = Symbol.isWellKnownSymbol;\nvar getOwnPropertyNames = getBuiltIn('Object', 'getOwnPropertyNames');\nvar thisSymbolValue = uncurryThis(Symbol.prototype.valueOf);\nvar WellKnownSymbolsStore = shared('wks');\n\nfor (var i = 0, symbolKeys = getOwnPropertyNames(Symbol), symbolKeysLength = symbolKeys.length; i < symbolKeysLength; i++) {\n // some old engines throws on access to some keys like `arguments` or `caller`\n try {\n var symbolKey = symbolKeys[i];\n if (isSymbol(Symbol[symbolKey])) wellKnownSymbol(symbolKey);\n } catch (error) { /* empty */ }\n}\n\n// `Symbol.isWellKnownSymbol` method\n// https://tc39.es/proposal-symbol-predicates/#sec-symbol-iswellknownsymbol\n// We should patch it for newly added well-known symbols. If it's not required, this module just will not be injected\nmodule.exports = function isWellKnownSymbol(value) {\n if ($isWellKnownSymbol && $isWellKnownSymbol(value)) return true;\n try {\n var symbol = thisSymbolValue(value);\n for (var j = 0, keys = getOwnPropertyNames(WellKnownSymbolsStore), keysLength = keys.length; j < keysLength; j++) {\n // eslint-disable-next-line eqeqeq -- polyfilled symbols case\n if (WellKnownSymbolsStore[keys[j]] == symbol) return true;\n }\n } catch (error) { /* empty */ }\n return false;\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar isWellKnownSymbol = require('../internals/symbol-is-well-known');\n\n// `Symbol.isWellKnownSymbol` method\n// https://tc39.es/proposal-symbol-predicates/#sec-symbol-iswellknownsymbol\n// We should patch it for newly added well-known symbols. If it's not required, this module just will not be injected\n$({ target: 'Symbol', stat: true, forced: true }, {\n isWellKnownSymbol: isWellKnownSymbol\n});\n","'use strict';\nvar defineWellKnownSymbol = require('../internals/well-known-symbol-define');\n\n// `Symbol.matcher` well-known symbol\n// https://github.com/tc39/proposal-pattern-matching\ndefineWellKnownSymbol('matcher');\n","'use strict';\nvar defineWellKnownSymbol = require('../internals/well-known-symbol-define');\n\n// `Symbol.observable` well-known symbol\n// https://github.com/tc39/proposal-observable\ndefineWellKnownSymbol('observable');\n","'use strict';\nvar $ = require('../internals/export');\nvar isRegisteredSymbol = require('../internals/symbol-is-registered');\n\n// `Symbol.isRegistered` method\n// obsolete version of https://tc39.es/proposal-symbol-predicates/#sec-symbol-isregisteredsymbol\n$({ target: 'Symbol', stat: true, name: 'isRegisteredSymbol' }, {\n isRegistered: isRegisteredSymbol\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar isWellKnownSymbol = require('../internals/symbol-is-well-known');\n\n// `Symbol.isWellKnown` method\n// obsolete version of https://tc39.es/proposal-symbol-predicates/#sec-symbol-iswellknownsymbol\n// We should patch it for newly added well-known symbols. If it's not required, this module just will not be injected\n$({ target: 'Symbol', stat: true, name: 'isWellKnownSymbol', forced: true }, {\n isWellKnown: isWellKnownSymbol\n});\n","'use strict';\n// TODO: Remove from `core-js@4`\nvar defineWellKnownSymbol = require('../internals/well-known-symbol-define');\n\n// `Symbol.metadataKey` well-known symbol\n// https://github.com/tc39/proposal-decorator-metadata\ndefineWellKnownSymbol('metadataKey');\n","'use strict';\n// TODO: remove from `core-js@4`\nvar defineWellKnownSymbol = require('../internals/well-known-symbol-define');\n\n// `Symbol.patternMatch` well-known symbol\n// https://github.com/tc39/proposal-pattern-matching\ndefineWellKnownSymbol('patternMatch');\n","'use strict';\n// TODO: remove from `core-js@4`\nvar defineWellKnownSymbol = require('../internals/well-known-symbol-define');\n\ndefineWellKnownSymbol('replaceAll');\n","'use strict';\nvar parent = require('../../actual/symbol');\nrequire('../../modules/esnext.symbol.is-registered-symbol');\nrequire('../../modules/esnext.symbol.is-well-known-symbol');\nrequire('../../modules/esnext.symbol.matcher');\nrequire('../../modules/esnext.symbol.observable');\n// TODO: Remove from `core-js@4`\nrequire('../../modules/esnext.symbol.is-registered');\nrequire('../../modules/esnext.symbol.is-well-known');\nrequire('../../modules/esnext.symbol.metadata-key');\nrequire('../../modules/esnext.symbol.pattern-match');\nrequire('../../modules/esnext.symbol.replace-all');\n\nmodule.exports = parent;\n","'use strict';\nmodule.exports = require('../../full/symbol');\n","'use strict';\nvar parent = require('../../es/symbol/iterator');\nrequire('../../modules/web.dom-collections.iterator');\n\nmodule.exports = parent;\n","'use strict';\nrequire('../../modules/es.array.iterator');\nrequire('../../modules/es.object.to-string');\nrequire('../../modules/es.string.iterator');\nrequire('../../modules/es.symbol.iterator');\nvar WrappedWellKnownSymbolModule = require('../../internals/well-known-symbol-wrapped');\n\nmodule.exports = WrappedWellKnownSymbolModule.f('iterator');\n","'use strict';\nmodule.exports = require('../../full/symbol/iterator');\n","'use strict';\nvar parent = require('../../stable/symbol/iterator');\n\nmodule.exports = parent;\n","var _Symbol = require(\"core-js-pure/features/symbol/index.js\");\nvar _Symbol$iterator = require(\"core-js-pure/features/symbol/iterator.js\");\nfunction _typeof(o) {\n \"@babel/helpers - typeof\";\n\n return (module.exports = _typeof = \"function\" == typeof _Symbol && \"symbol\" == typeof _Symbol$iterator ? function (o) {\n return typeof o;\n } : function (o) {\n return o && \"function\" == typeof _Symbol && o.constructor === _Symbol && o !== _Symbol.prototype ? \"symbol\" : typeof o;\n }, module.exports.__esModule = true, module.exports[\"default\"] = module.exports), _typeof(o);\n}\nmodule.exports = _typeof, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","'use strict';\nvar $ = require('../internals/export');\nvar DESCRIPTORS = require('../internals/descriptors');\nvar defineProperty = require('../internals/object-define-property').f;\n\n// `Object.defineProperty` method\n// https://tc39.es/ecma262/#sec-object.defineproperty\n// eslint-disable-next-line es/no-object-defineproperty -- safe\n$({ target: 'Object', stat: true, forced: Object.defineProperty !== defineProperty, sham: !DESCRIPTORS }, {\n defineProperty: defineProperty\n});\n","'use strict';\nrequire('../../modules/es.object.define-property');\nvar path = require('../../internals/path');\n\nvar Object = path.Object;\n\nvar defineProperty = module.exports = function defineProperty(it, key, desc) {\n return Object.defineProperty(it, key, desc);\n};\n\nif (Object.defineProperty.sham) defineProperty.sham = true;\n","'use strict';\nvar parent = require('../../es/object/define-property');\n\nmodule.exports = parent;\n","'use strict';\nmodule.exports = require('../../full/object/define-property');\n","'use strict';\nvar parent = require('../../stable/object/define-property');\n\nmodule.exports = parent;\n","'use strict';\n// TODO: Remove from `core-js@4`\nvar $ = require('../internals/export');\nvar DESCRIPTORS = require('../internals/descriptors');\nvar create = require('../internals/object-create');\n\n// `Object.create` method\n// https://tc39.es/ecma262/#sec-object.create\n$({ target: 'Object', stat: true, sham: !DESCRIPTORS }, {\n create: create\n});\n","'use strict';\nrequire('../../modules/es.object.create');\nvar path = require('../../internals/path');\n\nvar Object = path.Object;\n\nmodule.exports = function create(P, D) {\n return Object.create(P, D);\n};\n","'use strict';\nvar parent = require('../../es/object/create');\n\nmodule.exports = parent;\n","'use strict';\nmodule.exports = require('../../full/object/create');\n","'use strict';\nvar parent = require('../../stable/object/create');\n\nmodule.exports = parent;\n","'use strict';\nvar $ = require('../internals/export');\nvar fails = require('../internals/fails');\nvar toObject = require('../internals/to-object');\nvar nativeGetPrototypeOf = require('../internals/object-get-prototype-of');\nvar CORRECT_PROTOTYPE_GETTER = require('../internals/correct-prototype-getter');\n\nvar FAILS_ON_PRIMITIVES = fails(function () { nativeGetPrototypeOf(1); });\n\n// `Object.getPrototypeOf` method\n// https://tc39.es/ecma262/#sec-object.getprototypeof\n$({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES, sham: !CORRECT_PROTOTYPE_GETTER }, {\n getPrototypeOf: function getPrototypeOf(it) {\n return nativeGetPrototypeOf(toObject(it));\n }\n});\n\n","'use strict';\nrequire('../../modules/es.object.get-prototype-of');\nvar path = require('../../internals/path');\n\nmodule.exports = path.Object.getPrototypeOf;\n","'use strict';\nmodule.exports = require('../../full/object/get-prototype-of');\n","'use strict';\nvar fails = require('../internals/fails');\n\nmodule.exports = function (METHOD_NAME, argument) {\n var method = [][METHOD_NAME];\n return !!method && fails(function () {\n // eslint-disable-next-line no-useless-call -- required for testing\n method.call(null, argument || function () { return 1; }, 1);\n });\n};\n","'use strict';\nvar $forEach = require('../internals/array-iteration').forEach;\nvar arrayMethodIsStrict = require('../internals/array-method-is-strict');\n\nvar STRICT_METHOD = arrayMethodIsStrict('forEach');\n\n// `Array.prototype.forEach` method implementation\n// https://tc39.es/ecma262/#sec-array.prototype.foreach\nmodule.exports = !STRICT_METHOD ? function forEach(callbackfn /* , thisArg */) {\n return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n// eslint-disable-next-line es/no-array-prototype-foreach -- safe\n} : [].forEach;\n","'use strict';\nvar $ = require('../internals/export');\nvar forEach = require('../internals/array-for-each');\n\n// `Array.prototype.forEach` method\n// https://tc39.es/ecma262/#sec-array.prototype.foreach\n// eslint-disable-next-line es/no-array-prototype-foreach -- safe\n$({ target: 'Array', proto: true, forced: [].forEach !== forEach }, {\n forEach: forEach\n});\n","'use strict';\nvar global = require('../internals/global');\nvar path = require('../internals/path');\n\nmodule.exports = function (CONSTRUCTOR, METHOD) {\n var Namespace = path[CONSTRUCTOR + 'Prototype'];\n var pureMethod = Namespace && Namespace[METHOD];\n if (pureMethod) return pureMethod;\n var NativeConstructor = global[CONSTRUCTOR];\n var NativePrototype = NativeConstructor && NativeConstructor.prototype;\n return NativePrototype && NativePrototype[METHOD];\n};\n","'use strict';\nrequire('../../../modules/es.array.for-each');\nvar getBuiltInPrototypeMethod = require('../../../internals/get-built-in-prototype-method');\n\nmodule.exports = getBuiltInPrototypeMethod('Array', 'forEach');\n","'use strict';\nvar classof = require('../../internals/classof');\nvar hasOwn = require('../../internals/has-own-property');\nvar isPrototypeOf = require('../../internals/object-is-prototype-of');\nvar method = require('../array/virtual/for-each');\nrequire('../../modules/web.dom-collections.for-each');\n\nvar ArrayPrototype = Array.prototype;\n\nvar DOMIterables = {\n DOMTokenList: true,\n NodeList: true\n};\n\nmodule.exports = function (it) {\n var own = it.forEach;\n return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.forEach)\n || hasOwn(DOMIterables, classof(it)) ? method : own;\n};\n","'use strict';\nvar parent = require('../../../es/array/virtual/for-each');\n\nmodule.exports = parent;\n","'use strict';\nmodule.exports = require('../../full/instance/for-each');\n","'use strict';\nvar parent = require('../../stable/instance/for-each');\n\nmodule.exports = parent;\n","'use strict';\nvar DESCRIPTORS = require('../internals/descriptors');\nvar isArray = require('../internals/is-array');\n\nvar $TypeError = TypeError;\n// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe\nvar getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\n\n// Safari < 13 does not throw an error in this case\nvar SILENT_ON_NON_WRITABLE_LENGTH_SET = DESCRIPTORS && !function () {\n // makes no sense without proper strict mode support\n if (this !== undefined) return true;\n try {\n // eslint-disable-next-line es/no-object-defineproperty -- safe\n Object.defineProperty([], 'length', { writable: false }).length = 1;\n } catch (error) {\n return error instanceof TypeError;\n }\n}();\n\nmodule.exports = SILENT_ON_NON_WRITABLE_LENGTH_SET ? function (O, length) {\n if (isArray(O) && !getOwnPropertyDescriptor(O, 'length').writable) {\n throw new $TypeError('Cannot set read only .length');\n } return O.length = length;\n} : function (O, length) {\n return O.length = length;\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar toObject = require('../internals/to-object');\nvar lengthOfArrayLike = require('../internals/length-of-array-like');\nvar setArrayLength = require('../internals/array-set-length');\nvar doesNotExceedSafeInteger = require('../internals/does-not-exceed-safe-integer');\nvar fails = require('../internals/fails');\n\nvar INCORRECT_TO_LENGTH = fails(function () {\n return [].push.call({ length: 0x100000000 }, 1) !== 4294967297;\n});\n\n// V8 and Safari <= 15.4, FF < 23 throws InternalError\n// https://bugs.chromium.org/p/v8/issues/detail?id=12681\nvar properErrorOnNonWritableLength = function () {\n try {\n // eslint-disable-next-line es/no-object-defineproperty -- safe\n Object.defineProperty([], 'length', { writable: false }).push();\n } catch (error) {\n return error instanceof TypeError;\n }\n};\n\nvar FORCED = INCORRECT_TO_LENGTH || !properErrorOnNonWritableLength();\n\n// `Array.prototype.push` method\n// https://tc39.es/ecma262/#sec-array.prototype.push\n$({ target: 'Array', proto: true, arity: 1, forced: FORCED }, {\n // eslint-disable-next-line no-unused-vars -- required for `.length`\n push: function push(item) {\n var O = toObject(this);\n var len = lengthOfArrayLike(O);\n var argCount = arguments.length;\n doesNotExceedSafeInteger(len + argCount);\n for (var i = 0; i < argCount; i++) {\n O[len] = arguments[i];\n len++;\n }\n setArrayLength(O, len);\n return len;\n }\n});\n","'use strict';\nrequire('../../../modules/es.array.push');\nvar getBuiltInPrototypeMethod = require('../../../internals/get-built-in-prototype-method');\n\nmodule.exports = getBuiltInPrototypeMethod('Array', 'push');\n","'use strict';\nvar isPrototypeOf = require('../../internals/object-is-prototype-of');\nvar method = require('../array/virtual/push');\n\nvar ArrayPrototype = Array.prototype;\n\nmodule.exports = function (it) {\n var own = it.push;\n return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.push) ? method : own;\n};\n","'use strict';\nmodule.exports = require('../../full/instance/push');\n","'use strict';\nvar $ = require('../internals/export');\nvar setPrototypeOf = require('../internals/object-set-prototype-of');\n\n// `Object.setPrototypeOf` method\n// https://tc39.es/ecma262/#sec-object.setprototypeof\n$({ target: 'Object', stat: true }, {\n setPrototypeOf: setPrototypeOf\n});\n","'use strict';\nrequire('../../modules/es.object.set-prototype-of');\nvar path = require('../../internals/path');\n\nmodule.exports = path.Object.setPrototypeOf;\n","'use strict';\nmodule.exports = require('../../full/object/set-prototype-of');\n","'use strict';\nvar $ = require('../internals/export');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar isArray = require('../internals/is-array');\n\nvar nativeReverse = uncurryThis([].reverse);\nvar test = [1, 2];\n\n// `Array.prototype.reverse` method\n// https://tc39.es/ecma262/#sec-array.prototype.reverse\n// fix for Safari 12.0 bug\n// https://bugs.webkit.org/show_bug.cgi?id=188794\n$({ target: 'Array', proto: true, forced: String(test) === String(test.reverse()) }, {\n reverse: function reverse() {\n // eslint-disable-next-line no-self-assign -- dirty hack\n if (isArray(this)) this.length = this.length;\n return nativeReverse(this);\n }\n});\n","'use strict';\nrequire('../../../modules/es.array.reverse');\nvar getBuiltInPrototypeMethod = require('../../../internals/get-built-in-prototype-method');\n\nmodule.exports = getBuiltInPrototypeMethod('Array', 'reverse');\n","'use strict';\nvar isPrototypeOf = require('../../internals/object-is-prototype-of');\nvar method = require('../array/virtual/reverse');\n\nvar ArrayPrototype = Array.prototype;\n\nmodule.exports = function (it) {\n var own = it.reverse;\n return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.reverse) ? method : own;\n};\n","'use strict';\nvar parent = require('../../es/instance/reverse');\n\nmodule.exports = parent;\n","'use strict';\nmodule.exports = require('../../full/instance/reverse');\n","'use strict';\nvar parent = require('../../stable/instance/reverse');\n\nmodule.exports = parent;\n","'use strict';\nvar $ = require('../internals/export');\nvar isArray = require('../internals/is-array');\nvar isConstructor = require('../internals/is-constructor');\nvar isObject = require('../internals/is-object');\nvar toAbsoluteIndex = require('../internals/to-absolute-index');\nvar lengthOfArrayLike = require('../internals/length-of-array-like');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar createProperty = require('../internals/create-property');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support');\nvar nativeSlice = require('../internals/array-slice');\n\nvar HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('slice');\n\nvar SPECIES = wellKnownSymbol('species');\nvar $Array = Array;\nvar max = Math.max;\n\n// `Array.prototype.slice` method\n// https://tc39.es/ecma262/#sec-array.prototype.slice\n// fallback for not array-like ES3 strings and DOM objects\n$({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {\n slice: function slice(start, end) {\n var O = toIndexedObject(this);\n var length = lengthOfArrayLike(O);\n var k = toAbsoluteIndex(start, length);\n var fin = toAbsoluteIndex(end === undefined ? length : end, length);\n // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible\n var Constructor, result, n;\n if (isArray(O)) {\n Constructor = O.constructor;\n // cross-realm fallback\n if (isConstructor(Constructor) && (Constructor === $Array || isArray(Constructor.prototype))) {\n Constructor = undefined;\n } else if (isObject(Constructor)) {\n Constructor = Constructor[SPECIES];\n if (Constructor === null) Constructor = undefined;\n }\n if (Constructor === $Array || Constructor === undefined) {\n return nativeSlice(O, k, fin);\n }\n }\n result = new (Constructor === undefined ? $Array : Constructor)(max(fin - k, 0));\n for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]);\n result.length = n;\n return result;\n }\n});\n","'use strict';\nrequire('../../../modules/es.array.slice');\nvar getBuiltInPrototypeMethod = require('../../../internals/get-built-in-prototype-method');\n\nmodule.exports = getBuiltInPrototypeMethod('Array', 'slice');\n","'use strict';\nvar isPrototypeOf = require('../../internals/object-is-prototype-of');\nvar method = require('../array/virtual/slice');\n\nvar ArrayPrototype = Array.prototype;\n\nmodule.exports = function (it) {\n var own = it.slice;\n return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.slice) ? method : own;\n};\n","'use strict';\nvar parent = require('../../es/instance/slice');\n\nmodule.exports = parent;\n","'use strict';\nmodule.exports = require('../../full/instance/slice');\n","'use strict';\nvar parent = require('../../stable/instance/slice');\n\nmodule.exports = parent;\n","var _typeof = require(\"./typeof.js\")[\"default\"];\nvar _Object$defineProperty = require(\"core-js-pure/features/object/define-property.js\");\nvar _Symbol = require(\"core-js-pure/features/symbol/index.js\");\nvar _Object$create = require(\"core-js-pure/features/object/create.js\");\nvar _Object$getPrototypeOf = require(\"core-js-pure/features/object/get-prototype-of.js\");\nvar _forEachInstanceProperty = require(\"core-js-pure/features/instance/for-each.js\");\nvar _pushInstanceProperty = require(\"core-js-pure/features/instance/push.js\");\nvar _Object$setPrototypeOf = require(\"core-js-pure/features/object/set-prototype-of.js\");\nvar _Promise = require(\"core-js-pure/features/promise/index.js\");\nvar _reverseInstanceProperty = require(\"core-js-pure/features/instance/reverse.js\");\nvar _sliceInstanceProperty = require(\"core-js-pure/features/instance/slice.js\");\nfunction _regeneratorRuntime() {\n \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */\n module.exports = _regeneratorRuntime = function _regeneratorRuntime() {\n return e;\n }, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n var t,\n e = {},\n r = Object.prototype,\n n = r.hasOwnProperty,\n o = _Object$defineProperty || function (t, e, r) {\n t[e] = r.value;\n },\n i = \"function\" == typeof _Symbol ? _Symbol : {},\n a = i.iterator || \"@@iterator\",\n c = i.asyncIterator || \"@@asyncIterator\",\n u = i.toStringTag || \"@@toStringTag\";\n function define(t, e, r) {\n return _Object$defineProperty(t, e, {\n value: r,\n enumerable: !0,\n configurable: !0,\n writable: !0\n }), t[e];\n }\n try {\n define({}, \"\");\n } catch (t) {\n define = function define(t, e, r) {\n return t[e] = r;\n };\n }\n function wrap(t, e, r, n) {\n var i = e && e.prototype instanceof Generator ? e : Generator,\n a = _Object$create(i.prototype),\n c = new Context(n || []);\n return o(a, \"_invoke\", {\n value: makeInvokeMethod(t, r, c)\n }), a;\n }\n function tryCatch(t, e, r) {\n try {\n return {\n type: \"normal\",\n arg: t.call(e, r)\n };\n } catch (t) {\n return {\n type: \"throw\",\n arg: t\n };\n }\n }\n e.wrap = wrap;\n var h = \"suspendedStart\",\n l = \"suspendedYield\",\n f = \"executing\",\n s = \"completed\",\n y = {};\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n var p = {};\n define(p, a, function () {\n return this;\n });\n var d = _Object$getPrototypeOf,\n v = d && d(d(values([])));\n v && v !== r && n.call(v, a) && (p = v);\n var g = GeneratorFunctionPrototype.prototype = Generator.prototype = _Object$create(p);\n function defineIteratorMethods(t) {\n var _context;\n _forEachInstanceProperty(_context = [\"next\", \"throw\", \"return\"]).call(_context, function (e) {\n define(t, e, function (t) {\n return this._invoke(e, t);\n });\n });\n }\n function AsyncIterator(t, e) {\n function invoke(r, o, i, a) {\n var c = tryCatch(t[r], t, o);\n if (\"throw\" !== c.type) {\n var u = c.arg,\n h = u.value;\n return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) {\n invoke(\"next\", t, i, a);\n }, function (t) {\n invoke(\"throw\", t, i, a);\n }) : e.resolve(h).then(function (t) {\n u.value = t, i(u);\n }, function (t) {\n return invoke(\"throw\", t, i, a);\n });\n }\n a(c.arg);\n }\n var r;\n o(this, \"_invoke\", {\n value: function value(t, n) {\n function callInvokeWithMethodAndArg() {\n return new e(function (e, r) {\n invoke(t, n, e, r);\n });\n }\n return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();\n }\n });\n }\n function makeInvokeMethod(e, r, n) {\n var o = h;\n return function (i, a) {\n if (o === f) throw new Error(\"Generator is already running\");\n if (o === s) {\n if (\"throw\" === i) throw a;\n return {\n value: t,\n done: !0\n };\n }\n for (n.method = i, n.arg = a;;) {\n var c = n.delegate;\n if (c) {\n var u = maybeInvokeDelegate(c, n);\n if (u) {\n if (u === y) continue;\n return u;\n }\n }\n if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) {\n if (o === h) throw o = s, n.arg;\n n.dispatchException(n.arg);\n } else \"return\" === n.method && n.abrupt(\"return\", n.arg);\n o = f;\n var p = tryCatch(e, r, n);\n if (\"normal\" === p.type) {\n if (o = n.done ? s : l, p.arg === y) continue;\n return {\n value: p.arg,\n done: n.done\n };\n }\n \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg);\n }\n };\n }\n function maybeInvokeDelegate(e, r) {\n var n = r.method,\n o = e.iterator[n];\n if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y;\n var i = tryCatch(o, e.iterator, r.arg);\n if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y;\n var a = i.arg;\n return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y);\n }\n function pushTryEntry(t) {\n var _context2;\n var e = {\n tryLoc: t[0]\n };\n 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), _pushInstanceProperty(_context2 = this.tryEntries).call(_context2, e);\n }\n function resetTryEntry(t) {\n var e = t.completion || {};\n e.type = \"normal\", delete e.arg, t.completion = e;\n }\n function Context(t) {\n this.tryEntries = [{\n tryLoc: \"root\"\n }], _forEachInstanceProperty(t).call(t, pushTryEntry, this), this.reset(!0);\n }\n function values(e) {\n if (e || \"\" === e) {\n var r = e[a];\n if (r) return r.call(e);\n if (\"function\" == typeof e.next) return e;\n if (!isNaN(e.length)) {\n var o = -1,\n i = function next() {\n for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;\n return next.value = t, next.done = !0, next;\n };\n return i.next = i;\n }\n }\n throw new TypeError(_typeof(e) + \" is not iterable\");\n }\n return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", {\n value: GeneratorFunctionPrototype,\n configurable: !0\n }), o(GeneratorFunctionPrototype, \"constructor\", {\n value: GeneratorFunction,\n configurable: !0\n }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) {\n var e = \"function\" == typeof t && t.constructor;\n return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name));\n }, e.mark = function (t) {\n return _Object$setPrototypeOf ? _Object$setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = _Object$create(g), t;\n }, e.awrap = function (t) {\n return {\n __await: t\n };\n }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {\n return this;\n }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {\n void 0 === i && (i = _Promise);\n var a = new AsyncIterator(wrap(t, r, n, o), i);\n return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {\n return t.done ? t.value : a.next();\n });\n }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () {\n return this;\n }), define(g, \"toString\", function () {\n return \"[object Generator]\";\n }), e.keys = function (t) {\n var e = Object(t),\n r = [];\n for (var n in e) _pushInstanceProperty(r).call(r, n);\n return _reverseInstanceProperty(r).call(r), function next() {\n for (; r.length;) {\n var t = r.pop();\n if (t in e) return next.value = t, next.done = !1, next;\n }\n return next.done = !0, next;\n };\n }, e.values = values, Context.prototype = {\n constructor: Context,\n reset: function reset(e) {\n var _context3;\n if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, _forEachInstanceProperty(_context3 = this.tryEntries).call(_context3, resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+_sliceInstanceProperty(r).call(r, 1)) && (this[r] = t);\n },\n stop: function stop() {\n this.done = !0;\n var t = this.tryEntries[0].completion;\n if (\"throw\" === t.type) throw t.arg;\n return this.rval;\n },\n dispatchException: function dispatchException(e) {\n if (this.done) throw e;\n var r = this;\n function handle(n, o) {\n return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o;\n }\n for (var o = this.tryEntries.length - 1; o >= 0; --o) {\n var i = this.tryEntries[o],\n a = i.completion;\n if (\"root\" === i.tryLoc) return handle(\"end\");\n if (i.tryLoc <= this.prev) {\n var c = n.call(i, \"catchLoc\"),\n u = n.call(i, \"finallyLoc\");\n if (c && u) {\n if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);\n if (this.prev < i.finallyLoc) return handle(i.finallyLoc);\n } else if (c) {\n if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);\n } else {\n if (!u) throw new Error(\"try statement without catch or finally\");\n if (this.prev < i.finallyLoc) return handle(i.finallyLoc);\n }\n }\n }\n },\n abrupt: function abrupt(t, e) {\n for (var r = this.tryEntries.length - 1; r >= 0; --r) {\n var o = this.tryEntries[r];\n if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) {\n var i = o;\n break;\n }\n }\n i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);\n var a = i ? i.completion : {};\n return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a);\n },\n complete: function complete(t, e) {\n if (\"throw\" === t.type) throw t.arg;\n return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y;\n },\n finish: function finish(t) {\n for (var e = this.tryEntries.length - 1; e >= 0; --e) {\n var r = this.tryEntries[e];\n if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;\n }\n },\n \"catch\": function _catch(t) {\n for (var e = this.tryEntries.length - 1; e >= 0; --e) {\n var r = this.tryEntries[e];\n if (r.tryLoc === t) {\n var n = r.completion;\n if (\"throw\" === n.type) {\n var o = n.arg;\n resetTryEntry(r);\n }\n return o;\n }\n }\n throw new Error(\"illegal catch attempt\");\n },\n delegateYield: function delegateYield(e, r, n) {\n return this.delegate = {\n iterator: values(e),\n resultName: r,\n nextLoc: n\n }, \"next\" === this.method && (this.arg = t), y;\n }\n }, e;\n}\nmodule.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","// TODO(Babel 8): Remove this file.\n\nvar runtime = require(\"../helpers/regeneratorRuntime\")();\nmodule.exports = runtime;\n\n// Copied from https://github.com/facebook/regenerator/blob/main/packages/runtime/runtime.js#L736=\ntry {\n regeneratorRuntime = runtime;\n} catch (accidentalStrictMode) {\n if (typeof globalThis === \"object\") {\n globalThis.regeneratorRuntime = runtime;\n } else {\n Function(\"r\", \"regeneratorRuntime = r\")(runtime);\n }\n}\n","'use strict';\nvar $ = require('../internals/export');\nvar toObject = require('../internals/to-object');\nvar nativeKeys = require('../internals/object-keys');\nvar fails = require('../internals/fails');\n\nvar FAILS_ON_PRIMITIVES = fails(function () { nativeKeys(1); });\n\n// `Object.keys` method\n// https://tc39.es/ecma262/#sec-object.keys\n$({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {\n keys: function keys(it) {\n return nativeKeys(toObject(it));\n }\n});\n","'use strict';\nrequire('../../modules/es.object.keys');\nvar path = require('../../internals/path');\n\nmodule.exports = path.Object.keys;\n","'use strict';\nvar parent = require('../../es/object/keys');\n\nmodule.exports = parent;\n","module.exports = require(\"core-js-pure/stable/object/keys\");","'use strict';\nvar parent = require('../../es/object/get-own-property-symbols');\n\nmodule.exports = parent;\n","'use strict';\nrequire('../../modules/es.symbol');\nvar path = require('../../internals/path');\n\nmodule.exports = path.Object.getOwnPropertySymbols;\n","module.exports = require(\"core-js-pure/stable/object/get-own-property-symbols\");","'use strict';\nvar $ = require('../internals/export');\nvar fails = require('../internals/fails');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar nativeGetOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;\nvar DESCRIPTORS = require('../internals/descriptors');\n\nvar FORCED = !DESCRIPTORS || fails(function () { nativeGetOwnPropertyDescriptor(1); });\n\n// `Object.getOwnPropertyDescriptor` method\n// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor\n$({ target: 'Object', stat: true, forced: FORCED, sham: !DESCRIPTORS }, {\n getOwnPropertyDescriptor: function getOwnPropertyDescriptor(it, key) {\n return nativeGetOwnPropertyDescriptor(toIndexedObject(it), key);\n }\n});\n","'use strict';\nrequire('../../modules/es.object.get-own-property-descriptor');\nvar path = require('../../internals/path');\n\nvar Object = path.Object;\n\nvar getOwnPropertyDescriptor = module.exports = function getOwnPropertyDescriptor(it, key) {\n return Object.getOwnPropertyDescriptor(it, key);\n};\n\nif (Object.getOwnPropertyDescriptor.sham) getOwnPropertyDescriptor.sham = true;\n","'use strict';\nvar parent = require('../../es/object/get-own-property-descriptor');\n\nmodule.exports = parent;\n","module.exports = require(\"core-js-pure/stable/object/get-own-property-descriptor\");","'use strict';\nvar $ = require('../internals/export');\nvar DESCRIPTORS = require('../internals/descriptors');\nvar ownKeys = require('../internals/own-keys');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor');\nvar createProperty = require('../internals/create-property');\n\n// `Object.getOwnPropertyDescriptors` method\n// https://tc39.es/ecma262/#sec-object.getownpropertydescriptors\n$({ target: 'Object', stat: true, sham: !DESCRIPTORS }, {\n getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) {\n var O = toIndexedObject(object);\n var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;\n var keys = ownKeys(O);\n var result = {};\n var index = 0;\n var key, descriptor;\n while (keys.length > index) {\n descriptor = getOwnPropertyDescriptor(O, key = keys[index++]);\n if (descriptor !== undefined) createProperty(result, key, descriptor);\n }\n return result;\n }\n});\n","'use strict';\nrequire('../../modules/es.object.get-own-property-descriptors');\nvar path = require('../../internals/path');\n\nmodule.exports = path.Object.getOwnPropertyDescriptors;\n","'use strict';\nvar $ = require('../internals/export');\nvar DESCRIPTORS = require('../internals/descriptors');\nvar defineProperties = require('../internals/object-define-properties').f;\n\n// `Object.defineProperties` method\n// https://tc39.es/ecma262/#sec-object.defineproperties\n// eslint-disable-next-line es/no-object-defineproperties -- safe\n$({ target: 'Object', stat: true, forced: Object.defineProperties !== defineProperties, sham: !DESCRIPTORS }, {\n defineProperties: defineProperties\n});\n","'use strict';\nrequire('../../modules/es.object.define-properties');\nvar path = require('../../internals/path');\n\nvar Object = path.Object;\n\nvar defineProperties = module.exports = function defineProperties(T, D) {\n return Object.defineProperties(T, D);\n};\n\nif (Object.defineProperties.sham) defineProperties.sham = true;\n","module.exports = require(\"core-js-pure/stable/object/define-property\");","import _Symbol from \"core-js-pure/features/symbol/index.js\";\nimport _Symbol$iterator from \"core-js-pure/features/symbol/iterator.js\";\nexport default function _typeof(o) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof _Symbol && \"symbol\" == typeof _Symbol$iterator ? function (o) {\n return typeof o;\n } : function (o) {\n return o && \"function\" == typeof _Symbol && o.constructor === _Symbol && o !== _Symbol.prototype ? \"symbol\" : typeof o;\n }, _typeof(o);\n}","'use strict';\nvar parent = require('../../stable/object/get-own-property-symbols');\n\nmodule.exports = parent;\n","'use strict';\n/* eslint-disable es/no-array-prototype-indexof -- required for testing */\nvar $ = require('../internals/export');\nvar uncurryThis = require('../internals/function-uncurry-this-clause');\nvar $indexOf = require('../internals/array-includes').indexOf;\nvar arrayMethodIsStrict = require('../internals/array-method-is-strict');\n\nvar nativeIndexOf = uncurryThis([].indexOf);\n\nvar NEGATIVE_ZERO = !!nativeIndexOf && 1 / nativeIndexOf([1], 1, -0) < 0;\nvar FORCED = NEGATIVE_ZERO || !arrayMethodIsStrict('indexOf');\n\n// `Array.prototype.indexOf` method\n// https://tc39.es/ecma262/#sec-array.prototype.indexof\n$({ target: 'Array', proto: true, forced: FORCED }, {\n indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {\n var fromIndex = arguments.length > 1 ? arguments[1] : undefined;\n return NEGATIVE_ZERO\n // convert -0 to +0\n ? nativeIndexOf(this, searchElement, fromIndex) || 0\n : $indexOf(this, searchElement, fromIndex);\n }\n});\n","'use strict';\nrequire('../../../modules/es.array.index-of');\nvar getBuiltInPrototypeMethod = require('../../../internals/get-built-in-prototype-method');\n\nmodule.exports = getBuiltInPrototypeMethod('Array', 'indexOf');\n","'use strict';\nvar isPrototypeOf = require('../../internals/object-is-prototype-of');\nvar method = require('../array/virtual/index-of');\n\nvar ArrayPrototype = Array.prototype;\n\nmodule.exports = function (it) {\n var own = it.indexOf;\n return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.indexOf) ? method : own;\n};\n","'use strict';\nvar parent = require('../../es/instance/index-of');\n\nmodule.exports = parent;\n","'use strict';\nvar parent = require('../../stable/instance/index-of');\n\nmodule.exports = parent;\n","'use strict';\nvar parent = require('../../stable/object/keys');\n\nmodule.exports = parent;\n","import _Object$getOwnPropertySymbols from \"core-js-pure/features/object/get-own-property-symbols.js\";\nimport _indexOfInstanceProperty from \"core-js-pure/features/instance/index-of.js\";\nimport objectWithoutPropertiesLoose from \"./objectWithoutPropertiesLoose.js\";\nexport default function _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n var target = objectWithoutPropertiesLoose(source, excluded);\n var key, i;\n if (_Object$getOwnPropertySymbols) {\n var sourceSymbolKeys = _Object$getOwnPropertySymbols(source);\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (_indexOfInstanceProperty(excluded).call(excluded, key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n return target;\n}","import _Object$keys from \"core-js-pure/features/object/keys.js\";\nimport _indexOfInstanceProperty from \"core-js-pure/features/instance/index-of.js\";\nexport default function _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = _Object$keys(source);\n var key, i;\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (_indexOfInstanceProperty(excluded).call(excluded, key) >= 0) continue;\n target[key] = source[key];\n }\n return target;\n}","export default function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}","'use strict';\nrequire('../../modules/es.date.to-primitive');\nrequire('../../modules/es.symbol.to-primitive');\nvar WrappedWellKnownSymbolModule = require('../../internals/well-known-symbol-wrapped');\n\nmodule.exports = WrappedWellKnownSymbolModule.f('toPrimitive');\n","import _typeof from \"./typeof.js\";\nimport toPrimitive from \"./toPrimitive.js\";\nexport default function _toPropertyKey(arg) {\n var key = toPrimitive(arg, \"string\");\n return _typeof(key) === \"symbol\" ? key : String(key);\n}","import _typeof from \"./typeof.js\";\nimport _Symbol$toPrimitive from \"core-js-pure/features/symbol/to-primitive.js\";\nexport default function _toPrimitive(input, hint) {\n if (_typeof(input) !== \"object\" || input === null) return input;\n var prim = input[_Symbol$toPrimitive];\n if (prim !== undefined) {\n var res = prim.call(input, hint || \"default\");\n if (_typeof(res) !== \"object\") return res;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (hint === \"string\" ? String : Number)(input);\n}","import _Object$defineProperty from \"core-js-pure/features/object/define-property.js\";\nimport toPropertyKey from \"./toPropertyKey.js\";\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n _Object$defineProperty(target, toPropertyKey(descriptor.key), descriptor);\n }\n}\nexport default function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n _Object$defineProperty(Constructor, \"prototype\", {\n writable: false\n });\n return Constructor;\n}","import _Object$defineProperty from \"core-js-pure/features/object/define-property.js\";\nimport toPropertyKey from \"./toPropertyKey.js\";\nexport default function _defineProperty(obj, key, value) {\n key = toPropertyKey(key);\n if (key in obj) {\n _Object$defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n return obj;\n}","module.exports = require(\"core-js-pure/stable/instance/for-each\");","'use strict';\nvar $ = require('../internals/export');\nvar $filter = require('../internals/array-iteration').filter;\nvar arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support');\n\nvar HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('filter');\n\n// `Array.prototype.filter` method\n// https://tc39.es/ecma262/#sec-array.prototype.filter\n// with adding support of @@species\n$({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {\n filter: function filter(callbackfn /* , thisArg */) {\n return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n }\n});\n","'use strict';\nrequire('../../../modules/es.array.filter');\nvar getBuiltInPrototypeMethod = require('../../../internals/get-built-in-prototype-method');\n\nmodule.exports = getBuiltInPrototypeMethod('Array', 'filter');\n","'use strict';\nvar isPrototypeOf = require('../../internals/object-is-prototype-of');\nvar method = require('../array/virtual/filter');\n\nvar ArrayPrototype = Array.prototype;\n\nmodule.exports = function (it) {\n var own = it.filter;\n return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.filter) ? method : own;\n};\n","'use strict';\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar aCallable = require('../internals/a-callable');\nvar isObject = require('../internals/is-object');\nvar hasOwn = require('../internals/has-own-property');\nvar arraySlice = require('../internals/array-slice');\nvar NATIVE_BIND = require('../internals/function-bind-native');\n\nvar $Function = Function;\nvar concat = uncurryThis([].concat);\nvar join = uncurryThis([].join);\nvar factories = {};\n\nvar construct = function (C, argsLength, args) {\n if (!hasOwn(factories, argsLength)) {\n var list = [];\n var i = 0;\n for (; i < argsLength; i++) list[i] = 'a[' + i + ']';\n factories[argsLength] = $Function('C,a', 'return new C(' + join(list, ',') + ')');\n } return factories[argsLength](C, args);\n};\n\n// `Function.prototype.bind` method implementation\n// https://tc39.es/ecma262/#sec-function.prototype.bind\n// eslint-disable-next-line es/no-function-prototype-bind -- detection\nmodule.exports = NATIVE_BIND ? $Function.bind : function bind(that /* , ...args */) {\n var F = aCallable(this);\n var Prototype = F.prototype;\n var partArgs = arraySlice(arguments, 1);\n var boundFunction = function bound(/* args... */) {\n var args = concat(partArgs, arraySlice(arguments));\n return this instanceof boundFunction ? construct(F, args.length, args) : F.apply(that, args);\n };\n if (isObject(Prototype)) boundFunction.prototype = Prototype;\n return boundFunction;\n};\n","'use strict';\n// TODO: Remove from `core-js@4`\nvar $ = require('../internals/export');\nvar bind = require('../internals/function-bind');\n\n// `Function.prototype.bind` method\n// https://tc39.es/ecma262/#sec-function.prototype.bind\n// eslint-disable-next-line es/no-function-prototype-bind -- detection\n$({ target: 'Function', proto: true, forced: Function.bind !== bind }, {\n bind: bind\n});\n","'use strict';\nrequire('../../../modules/es.function.bind');\nvar getBuiltInPrototypeMethod = require('../../../internals/get-built-in-prototype-method');\n\nmodule.exports = getBuiltInPrototypeMethod('Function', 'bind');\n","'use strict';\nvar isPrototypeOf = require('../../internals/object-is-prototype-of');\nvar method = require('../function/virtual/bind');\n\nvar FunctionPrototype = Function.prototype;\n\nmodule.exports = function (it) {\n var own = it.bind;\n return it === FunctionPrototype || (isPrototypeOf(FunctionPrototype, it) && own === FunctionPrototype.bind) ? method : own;\n};\n","'use strict';\nvar parent = require('../../es/instance/bind');\n\nmodule.exports = parent;\n","module.exports = require(\"core-js-pure/stable/instance/bind\");","'use strict';\nvar $ = require('../internals/export');\nvar $includes = require('../internals/array-includes').includes;\nvar fails = require('../internals/fails');\nvar addToUnscopables = require('../internals/add-to-unscopables');\n\n// FF99+ bug\nvar BROKEN_ON_SPARSE = fails(function () {\n // eslint-disable-next-line es/no-array-prototype-includes -- detection\n return !Array(1).includes();\n});\n\n// `Array.prototype.includes` method\n// https://tc39.es/ecma262/#sec-array.prototype.includes\n$({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, {\n includes: function includes(el /* , fromIndex = 0 */) {\n return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);\n }\n});\n\n// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables\naddToUnscopables('includes');\n","'use strict';\nrequire('../../../modules/es.array.includes');\nvar getBuiltInPrototypeMethod = require('../../../internals/get-built-in-prototype-method');\n\nmodule.exports = getBuiltInPrototypeMethod('Array', 'includes');\n","'use strict';\nvar isObject = require('../internals/is-object');\nvar classof = require('../internals/classof-raw');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar MATCH = wellKnownSymbol('match');\n\n// `IsRegExp` abstract operation\n// https://tc39.es/ecma262/#sec-isregexp\nmodule.exports = function (it) {\n var isRegExp;\n return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classof(it) === 'RegExp');\n};\n","'use strict';\nvar isRegExp = require('../internals/is-regexp');\n\nvar $TypeError = TypeError;\n\nmodule.exports = function (it) {\n if (isRegExp(it)) {\n throw new $TypeError(\"The method doesn't accept regular expressions\");\n } return it;\n};\n","'use strict';\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar MATCH = wellKnownSymbol('match');\n\nmodule.exports = function (METHOD_NAME) {\n var regexp = /./;\n try {\n '/./'[METHOD_NAME](regexp);\n } catch (error1) {\n try {\n regexp[MATCH] = false;\n return '/./'[METHOD_NAME](regexp);\n } catch (error2) { /* empty */ }\n } return false;\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar notARegExp = require('../internals/not-a-regexp');\nvar requireObjectCoercible = require('../internals/require-object-coercible');\nvar toString = require('../internals/to-string');\nvar correctIsRegExpLogic = require('../internals/correct-is-regexp-logic');\n\nvar stringIndexOf = uncurryThis(''.indexOf);\n\n// `String.prototype.includes` method\n// https://tc39.es/ecma262/#sec-string.prototype.includes\n$({ target: 'String', proto: true, forced: !correctIsRegExpLogic('includes') }, {\n includes: function includes(searchString /* , position = 0 */) {\n return !!~stringIndexOf(\n toString(requireObjectCoercible(this)),\n toString(notARegExp(searchString)),\n arguments.length > 1 ? arguments[1] : undefined\n );\n }\n});\n","'use strict';\nrequire('../../../modules/es.string.includes');\nvar getBuiltInPrototypeMethod = require('../../../internals/get-built-in-prototype-method');\n\nmodule.exports = getBuiltInPrototypeMethod('String', 'includes');\n","'use strict';\nvar isPrototypeOf = require('../../internals/object-is-prototype-of');\nvar arrayMethod = require('../array/virtual/includes');\nvar stringMethod = require('../string/virtual/includes');\n\nvar ArrayPrototype = Array.prototype;\nvar StringPrototype = String.prototype;\n\nmodule.exports = function (it) {\n var own = it.includes;\n if (it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.includes)) return arrayMethod;\n if (typeof it == 'string' || it === StringPrototype || (isPrototypeOf(StringPrototype, it) && own === StringPrototype.includes)) {\n return stringMethod;\n } return own;\n};\n","'use strict';\nrequire('../../../modules/es.array.concat');\nvar getBuiltInPrototypeMethod = require('../../../internals/get-built-in-prototype-method');\n\nmodule.exports = getBuiltInPrototypeMethod('Array', 'concat');\n","'use strict';\nvar isPrototypeOf = require('../../internals/object-is-prototype-of');\nvar method = require('../array/virtual/concat');\n\nvar ArrayPrototype = Array.prototype;\n\nmodule.exports = function (it) {\n var own = it.concat;\n return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.concat) ? method : own;\n};\n","module.exports = require(\"core-js-pure/stable/promise\");","'use strict';\nvar $ = require('../internals/export');\nvar $find = require('../internals/array-iteration').find;\nvar addToUnscopables = require('../internals/add-to-unscopables');\n\nvar FIND = 'find';\nvar SKIPS_HOLES = true;\n\n// Shouldn't skip holes\n// eslint-disable-next-line es/no-array-prototype-find -- testing\nif (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });\n\n// `Array.prototype.find` method\n// https://tc39.es/ecma262/#sec-array.prototype.find\n$({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {\n find: function find(callbackfn /* , that = undefined */) {\n return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n }\n});\n\n// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables\naddToUnscopables(FIND);\n","'use strict';\nrequire('../../../modules/es.array.find');\nvar getBuiltInPrototypeMethod = require('../../../internals/get-built-in-prototype-method');\n\nmodule.exports = getBuiltInPrototypeMethod('Array', 'find');\n","'use strict';\nvar isPrototypeOf = require('../../internals/object-is-prototype-of');\nvar method = require('../array/virtual/find');\n\nvar ArrayPrototype = Array.prototype;\n\nmodule.exports = function (it) {\n var own = it.find;\n return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.find) ? method : own;\n};\n","'use strict';\nrequire('../../modules/es.json.stringify');\nvar path = require('../../internals/path');\nvar apply = require('../../internals/function-apply');\n\n// eslint-disable-next-line es/no-json -- safe\nif (!path.JSON) path.JSON = { stringify: JSON.stringify };\n\n// eslint-disable-next-line no-unused-vars -- required for `.length`\nmodule.exports = function stringify(it, replacer, space) {\n return apply(path.JSON.stringify, null, arguments);\n};\n","'use strict';\nvar parent = require('../../es/json/stringify');\n\nmodule.exports = parent;\n","'use strict';\nvar fails = require('../internals/fails');\n\nmodule.exports = !fails(function () {\n // eslint-disable-next-line es/no-object-isextensible, es/no-object-preventextensions -- required for testing\n return Object.isExtensible(Object.preventExtensions({}));\n});\n","'use strict';\n// FF26- bug: ArrayBuffers are non-extensible, but Object.isExtensible does not report it\nvar fails = require('../internals/fails');\n\nmodule.exports = fails(function () {\n if (typeof ArrayBuffer == 'function') {\n var buffer = new ArrayBuffer(8);\n // eslint-disable-next-line es/no-object-isextensible, es/no-object-defineproperty -- safe\n if (Object.isExtensible(buffer)) Object.defineProperty(buffer, 'a', { value: 8 });\n }\n});\n","'use strict';\nvar fails = require('../internals/fails');\nvar isObject = require('../internals/is-object');\nvar classof = require('../internals/classof-raw');\nvar ARRAY_BUFFER_NON_EXTENSIBLE = require('../internals/array-buffer-non-extensible');\n\n// eslint-disable-next-line es/no-object-isextensible -- safe\nvar $isExtensible = Object.isExtensible;\nvar FAILS_ON_PRIMITIVES = fails(function () { $isExtensible(1); });\n\n// `Object.isExtensible` method\n// https://tc39.es/ecma262/#sec-object.isextensible\nmodule.exports = (FAILS_ON_PRIMITIVES || ARRAY_BUFFER_NON_EXTENSIBLE) ? function isExtensible(it) {\n if (!isObject(it)) return false;\n if (ARRAY_BUFFER_NON_EXTENSIBLE && classof(it) === 'ArrayBuffer') return false;\n return $isExtensible ? $isExtensible(it) : true;\n} : $isExtensible;\n","'use strict';\nvar $ = require('../internals/export');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar hiddenKeys = require('../internals/hidden-keys');\nvar isObject = require('../internals/is-object');\nvar hasOwn = require('../internals/has-own-property');\nvar defineProperty = require('../internals/object-define-property').f;\nvar getOwnPropertyNamesModule = require('../internals/object-get-own-property-names');\nvar getOwnPropertyNamesExternalModule = require('../internals/object-get-own-property-names-external');\nvar isExtensible = require('../internals/object-is-extensible');\nvar uid = require('../internals/uid');\nvar FREEZING = require('../internals/freezing');\n\nvar REQUIRED = false;\nvar METADATA = uid('meta');\nvar id = 0;\n\nvar setMetadata = function (it) {\n defineProperty(it, METADATA, { value: {\n objectID: 'O' + id++, // object ID\n weakData: {} // weak collections IDs\n } });\n};\n\nvar fastKey = function (it, create) {\n // return a primitive with prefix\n if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;\n if (!hasOwn(it, METADATA)) {\n // can't set metadata to uncaught frozen object\n if (!isExtensible(it)) return 'F';\n // not necessary to add metadata\n if (!create) return 'E';\n // add missing metadata\n setMetadata(it);\n // return object ID\n } return it[METADATA].objectID;\n};\n\nvar getWeakData = function (it, create) {\n if (!hasOwn(it, METADATA)) {\n // can't set metadata to uncaught frozen object\n if (!isExtensible(it)) return true;\n // not necessary to add metadata\n if (!create) return false;\n // add missing metadata\n setMetadata(it);\n // return the store of weak collections IDs\n } return it[METADATA].weakData;\n};\n\n// add metadata on freeze-family methods calling\nvar onFreeze = function (it) {\n if (FREEZING && REQUIRED && isExtensible(it) && !hasOwn(it, METADATA)) setMetadata(it);\n return it;\n};\n\nvar enable = function () {\n meta.enable = function () { /* empty */ };\n REQUIRED = true;\n var getOwnPropertyNames = getOwnPropertyNamesModule.f;\n var splice = uncurryThis([].splice);\n var test = {};\n test[METADATA] = 1;\n\n // prevent exposing of metadata key\n if (getOwnPropertyNames(test).length) {\n getOwnPropertyNamesModule.f = function (it) {\n var result = getOwnPropertyNames(it);\n for (var i = 0, length = result.length; i < length; i++) {\n if (result[i] === METADATA) {\n splice(result, i, 1);\n break;\n }\n } return result;\n };\n\n $({ target: 'Object', stat: true, forced: true }, {\n getOwnPropertyNames: getOwnPropertyNamesExternalModule.f\n });\n }\n};\n\nvar meta = module.exports = {\n enable: enable,\n fastKey: fastKey,\n getWeakData: getWeakData,\n onFreeze: onFreeze\n};\n\nhiddenKeys[METADATA] = true;\n","'use strict';\nvar $ = require('../internals/export');\nvar FREEZING = require('../internals/freezing');\nvar fails = require('../internals/fails');\nvar isObject = require('../internals/is-object');\nvar onFreeze = require('../internals/internal-metadata').onFreeze;\n\n// eslint-disable-next-line es/no-object-freeze -- safe\nvar $freeze = Object.freeze;\nvar FAILS_ON_PRIMITIVES = fails(function () { $freeze(1); });\n\n// `Object.freeze` method\n// https://tc39.es/ecma262/#sec-object.freeze\n$({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES, sham: !FREEZING }, {\n freeze: function freeze(it) {\n return $freeze && isObject(it) ? $freeze(onFreeze(it)) : it;\n }\n});\n","'use strict';\nrequire('../../modules/es.object.freeze');\nvar path = require('../../internals/path');\n\nmodule.exports = path.Object.freeze;\n","'use strict';\nvar $ = require('../internals/export');\nvar isArray = require('../internals/is-array');\n\n// `Array.isArray` method\n// https://tc39.es/ecma262/#sec-array.isarray\n$({ target: 'Array', stat: true }, {\n isArray: isArray\n});\n","'use strict';\nrequire('../../modules/es.array.is-array');\nvar path = require('../../internals/path');\n\nmodule.exports = path.Array.isArray;\n","'use strict';\nvar parent = require('../../es/array/is-array');\n\nmodule.exports = parent;\n","'use strict';\nvar parent = require('../../stable/array/is-array');\n\nmodule.exports = parent;\n","'use strict';\nrequire('../modules/es.array.iterator');\nrequire('../modules/es.string.iterator');\nvar getIteratorMethod = require('../internals/get-iterator-method');\n\nmodule.exports = getIteratorMethod;\n","'use strict';\nmodule.exports = require('../full/get-iterator-method');\n","'use strict';\nvar anObject = require('../internals/an-object');\nvar iteratorClose = require('../internals/iterator-close');\n\n// call something on iterator step with safe closing on error\nmodule.exports = function (iterator, fn, value, ENTRIES) {\n try {\n return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);\n } catch (error) {\n iteratorClose(iterator, 'throw', error);\n }\n};\n","'use strict';\nvar bind = require('../internals/function-bind-context');\nvar call = require('../internals/function-call');\nvar toObject = require('../internals/to-object');\nvar callWithSafeIterationClosing = require('../internals/call-with-safe-iteration-closing');\nvar isArrayIteratorMethod = require('../internals/is-array-iterator-method');\nvar isConstructor = require('../internals/is-constructor');\nvar lengthOfArrayLike = require('../internals/length-of-array-like');\nvar createProperty = require('../internals/create-property');\nvar getIterator = require('../internals/get-iterator');\nvar getIteratorMethod = require('../internals/get-iterator-method');\n\nvar $Array = Array;\n\n// `Array.from` method implementation\n// https://tc39.es/ecma262/#sec-array.from\nmodule.exports = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {\n var O = toObject(arrayLike);\n var IS_CONSTRUCTOR = isConstructor(this);\n var argumentsLength = arguments.length;\n var mapfn = argumentsLength > 1 ? arguments[1] : undefined;\n var mapping = mapfn !== undefined;\n if (mapping) mapfn = bind(mapfn, argumentsLength > 2 ? arguments[2] : undefined);\n var iteratorMethod = getIteratorMethod(O);\n var index = 0;\n var length, result, step, iterator, next, value;\n // if the target is not iterable or it's an array with the default iterator - use a simple case\n if (iteratorMethod && !(this === $Array && isArrayIteratorMethod(iteratorMethod))) {\n iterator = getIterator(O, iteratorMethod);\n next = iterator.next;\n result = IS_CONSTRUCTOR ? new this() : [];\n for (;!(step = call(next, iterator)).done; index++) {\n value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value;\n createProperty(result, index, value);\n }\n } else {\n length = lengthOfArrayLike(O);\n result = IS_CONSTRUCTOR ? new this(length) : $Array(length);\n for (;length > index; index++) {\n value = mapping ? mapfn(O[index], index) : O[index];\n createProperty(result, index, value);\n }\n }\n result.length = index;\n return result;\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar from = require('../internals/array-from');\nvar checkCorrectnessOfIteration = require('../internals/check-correctness-of-iteration');\n\nvar INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) {\n // eslint-disable-next-line es/no-array-from -- required for testing\n Array.from(iterable);\n});\n\n// `Array.from` method\n// https://tc39.es/ecma262/#sec-array.from\n$({ target: 'Array', stat: true, forced: INCORRECT_ITERATION }, {\n from: from\n});\n","'use strict';\nrequire('../../modules/es.string.iterator');\nrequire('../../modules/es.array.from');\nvar path = require('../../internals/path');\n\nmodule.exports = path.Array.from;\n","'use strict';\nvar parent = require('../../es/array/from');\n\nmodule.exports = parent;\n","'use strict';\nvar parent = require('../../stable/array/from');\n\nmodule.exports = parent;\n","export default function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];\n return arr2;\n}","import _sliceInstanceProperty from \"core-js-pure/features/instance/slice.js\";\nimport _Array$from from \"core-js-pure/features/array/from.js\";\nimport arrayLikeToArray from \"./arrayLikeToArray.js\";\nexport default function _unsupportedIterableToArray(o, minLen) {\n var _context;\n if (!o) return;\n if (typeof o === \"string\") return arrayLikeToArray(o, minLen);\n var n = _sliceInstanceProperty(_context = Object.prototype.toString.call(o)).call(_context, 8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return _Array$from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);\n}","import arrayWithHoles from \"./arrayWithHoles.js\";\nimport iterableToArrayLimit from \"./iterableToArrayLimit.js\";\nimport unsupportedIterableToArray from \"./unsupportedIterableToArray.js\";\nimport nonIterableRest from \"./nonIterableRest.js\";\nexport default function _slicedToArray(arr, i) {\n return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();\n}","import _Array$isArray from \"core-js-pure/features/array/is-array.js\";\nexport default function _arrayWithHoles(arr) {\n if (_Array$isArray(arr)) return arr;\n}","import _Symbol from \"core-js-pure/features/symbol/index.js\";\nimport _getIteratorMethod from \"core-js-pure/features/get-iterator-method.js\";\nimport _pushInstanceProperty from \"core-js-pure/features/instance/push.js\";\nexport default function _iterableToArrayLimit(r, l) {\n var t = null == r ? null : \"undefined\" != typeof _Symbol && _getIteratorMethod(r) || r[\"@@iterator\"];\n if (null != t) {\n var e,\n n,\n i,\n u,\n a = [],\n f = !0,\n o = !1;\n try {\n if (i = (t = t.call(r)).next, 0 === l) {\n if (Object(t) !== t) return;\n f = !1;\n } else for (; !(f = (e = i.call(t)).done) && (_pushInstanceProperty(a).call(a, e.value), a.length !== l); f = !0);\n } catch (r) {\n o = !0, n = r;\n } finally {\n try {\n if (!f && null != t[\"return\"] && (u = t[\"return\"](), Object(u) !== u)) return;\n } finally {\n if (o) throw n;\n }\n }\n return a;\n }\n}","export default function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}","import arrayWithoutHoles from \"./arrayWithoutHoles.js\";\nimport iterableToArray from \"./iterableToArray.js\";\nimport unsupportedIterableToArray from \"./unsupportedIterableToArray.js\";\nimport nonIterableSpread from \"./nonIterableSpread.js\";\nexport default function _toConsumableArray(arr) {\n return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();\n}","import _Array$isArray from \"core-js-pure/features/array/is-array.js\";\nimport arrayLikeToArray from \"./arrayLikeToArray.js\";\nexport default function _arrayWithoutHoles(arr) {\n if (_Array$isArray(arr)) return arrayLikeToArray(arr);\n}","import _Symbol from \"core-js-pure/features/symbol/index.js\";\nimport _getIteratorMethod from \"core-js-pure/features/get-iterator-method.js\";\nimport _Array$from from \"core-js-pure/features/array/from.js\";\nexport default function _iterableToArray(iter) {\n if (typeof _Symbol !== \"undefined\" && _getIteratorMethod(iter) != null || iter[\"@@iterator\"] != null) return _Array$from(iter);\n}","export default function _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}","module.exports = require(\"core-js-pure/stable/instance/index-of\");","'use strict';\nvar aCallable = require('../internals/a-callable');\nvar toObject = require('../internals/to-object');\nvar IndexedObject = require('../internals/indexed-object');\nvar lengthOfArrayLike = require('../internals/length-of-array-like');\n\nvar $TypeError = TypeError;\n\n// `Array.prototype.{ reduce, reduceRight }` methods implementation\nvar createMethod = function (IS_RIGHT) {\n return function (that, callbackfn, argumentsLength, memo) {\n aCallable(callbackfn);\n var O = toObject(that);\n var self = IndexedObject(O);\n var length = lengthOfArrayLike(O);\n var index = IS_RIGHT ? length - 1 : 0;\n var i = IS_RIGHT ? -1 : 1;\n if (argumentsLength < 2) while (true) {\n if (index in self) {\n memo = self[index];\n index += i;\n break;\n }\n index += i;\n if (IS_RIGHT ? index < 0 : length <= index) {\n throw new $TypeError('Reduce of empty array with no initial value');\n }\n }\n for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {\n memo = callbackfn(memo, self[index], index, O);\n }\n return memo;\n };\n};\n\nmodule.exports = {\n // `Array.prototype.reduce` method\n // https://tc39.es/ecma262/#sec-array.prototype.reduce\n left: createMethod(false),\n // `Array.prototype.reduceRight` method\n // https://tc39.es/ecma262/#sec-array.prototype.reduceright\n right: createMethod(true)\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar $reduce = require('../internals/array-reduce').left;\nvar arrayMethodIsStrict = require('../internals/array-method-is-strict');\nvar CHROME_VERSION = require('../internals/engine-v8-version');\nvar IS_NODE = require('../internals/engine-is-node');\n\n// Chrome 80-82 has a critical bug\n// https://bugs.chromium.org/p/chromium/issues/detail?id=1049982\nvar CHROME_BUG = !IS_NODE && CHROME_VERSION > 79 && CHROME_VERSION < 83;\nvar FORCED = CHROME_BUG || !arrayMethodIsStrict('reduce');\n\n// `Array.prototype.reduce` method\n// https://tc39.es/ecma262/#sec-array.prototype.reduce\n$({ target: 'Array', proto: true, forced: FORCED }, {\n reduce: function reduce(callbackfn /* , initialValue */) {\n var length = arguments.length;\n return $reduce(this, callbackfn, length, length > 1 ? arguments[1] : undefined);\n }\n});\n","'use strict';\nrequire('../../../modules/es.array.reduce');\nvar getBuiltInPrototypeMethod = require('../../../internals/get-built-in-prototype-method');\n\nmodule.exports = getBuiltInPrototypeMethod('Array', 'reduce');\n","'use strict';\nvar isPrototypeOf = require('../../internals/object-is-prototype-of');\nvar method = require('../array/virtual/reduce');\n\nvar ArrayPrototype = Array.prototype;\n\nmodule.exports = function (it) {\n var own = it.reduce;\n return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.reduce) ? method : own;\n};\n","'use strict';\nrequire('../../../modules/es.array.iterator');\nrequire('../../../modules/es.object.to-string');\nvar getBuiltInPrototypeMethod = require('../../../internals/get-built-in-prototype-method');\n\nmodule.exports = getBuiltInPrototypeMethod('Array', 'values');\n","'use strict';\nrequire('../../modules/web.dom-collections.iterator');\nvar classof = require('../../internals/classof');\nvar hasOwn = require('../../internals/has-own-property');\nvar isPrototypeOf = require('../../internals/object-is-prototype-of');\nvar method = require('../array/virtual/values');\n\nvar ArrayPrototype = Array.prototype;\n\nvar DOMIterables = {\n DOMTokenList: true,\n NodeList: true\n};\n\nmodule.exports = function (it) {\n var own = it.values;\n return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.values)\n || hasOwn(DOMIterables, classof(it)) ? method : own;\n};\n","'use strict';\nvar parent = require('../../../es/array/virtual/values');\n\nmodule.exports = parent;\n","'use strict';\nvar $ = require('../internals/export');\nvar $map = require('../internals/array-iteration').map;\nvar arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support');\n\nvar HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('map');\n\n// `Array.prototype.map` method\n// https://tc39.es/ecma262/#sec-array.prototype.map\n// with adding support of @@species\n$({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {\n map: function map(callbackfn /* , thisArg */) {\n return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n }\n});\n","'use strict';\nrequire('../../../modules/es.array.map');\nvar getBuiltInPrototypeMethod = require('../../../internals/get-built-in-prototype-method');\n\nmodule.exports = getBuiltInPrototypeMethod('Array', 'map');\n","'use strict';\nvar isPrototypeOf = require('../../internals/object-is-prototype-of');\nvar method = require('../array/virtual/map');\n\nvar ArrayPrototype = Array.prototype;\n\nmodule.exports = function (it) {\n var own = it.map;\n return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.map) ? method : own;\n};\n","import defaultTrans from './locales/en-US.json';\n\n/**\n * FALLBACK_LOCALE - **MUST** match the locale string in the above import\n */\nexport const FALLBACK_LOCALE = 'en-US';\n\nexport const defaultTranslation = defaultTrans;\n","export default {\n ar: () => import('./ar.json'),\n 'cs-CZ': () => import('./cs-CZ.json'),\n 'da-DK': () => import('./da-DK.json'),\n 'de-DE': () => import('./de-DE.json'),\n 'el-GR': () => import('./el-GR.json'),\n 'en-US': () => import('./en-US.json'),\n 'es-ES': () => import('./es-ES.json'),\n 'fi-FI': () => import('./fi-FI.json'),\n 'fr-FR': () => import('./fr-FR.json'),\n 'hr-HR': () => import('./hr-HR.json'),\n 'hu-HU': () => import('./hu-HU.json'),\n 'it-IT': () => import('./it-IT.json'),\n 'ja-JP': () => import('./ja-JP.json'),\n 'ko-KR': () => import('./ko-KR.json'),\n 'nl-NL': () => import('./nl-NL.json'),\n 'no-NO': () => import('./no-NO.json'),\n 'pl-PL': () => import('./pl-PL.json'),\n 'pt-BR': () => import('./pt-BR.json'),\n 'pt-PT': () => import('./pt-PT.json'),\n 'ro-RO': () => import('./ro-RO.json'),\n 'ru-RU': () => import('./ru-RU.json'),\n 'sk-SK': () => import('./sk-SK.json'),\n 'sl-SI': () => import('./sl-SI.json'),\n 'sv-SE': () => import('./sv-SE.json'),\n 'zh-CN': () => import('./zh-CN.json'),\n 'zh-TW': () => import('./zh-TW.json')\n};\n","import { FALLBACK_LOCALE, defaultTranslation } from './config';\nimport locales from './locales';\nimport { h } from 'preact';\n\n/**\n * Convert to ISO 639-1\n */\nconst toTwoLetterCode = locale => locale.toLowerCase().substring(0, 2);\n\n/**\n * Matches a string with one of the locales\n * @param locale -\n * @param supportedLocales -\n\n * @example\n * matchLocale('en-GB');\n * // 'en-US'\n */\nexport function matchLocale(locale: string, supportedLocales: any): string {\n if (!locale || typeof locale !== 'string') return null;\n return supportedLocales.find(supLoc => toTwoLetterCode(supLoc) === toTwoLetterCode(locale)) || null;\n}\n\n/**\n * Returns a locale with the proper format\n * @param localeParam -\n *\n * @example\n * formatLocale('En_us');\n * // 'en-US'\n */\nexport function formatLocale(localeParam: string): string {\n const locale = localeParam.replace('_', '-');\n const format = new RegExp('([a-z]{2})([-])([A-Z]{2})');\n\n // If it's already formatted, return the locale\n if (format.test(locale)) return locale;\n\n // Split the string in two\n const [languageCode, countryCode] = locale.split('-');\n\n // If the locale or the country codes are missing, return null\n if (!languageCode || !countryCode) return null;\n\n // Ensure correct format and join the strings back together\n const fullLocale = [languageCode.toLowerCase(), countryCode.toUpperCase()].join('-');\n\n return fullLocale.length === 5 ? fullLocale : null;\n}\n\n/**\n * Checks the locale format.\n * Also checks if it's on the locales array.\n * If it is not, tries to match it with one.\n * @param locale -\n * @param supportedLocales -\n */\nexport function parseLocale(locale: string, supportedLocales: string[] = []): string {\n if (!locale || locale.length < 1 || locale.length > 5) return FALLBACK_LOCALE;\n\n const formattedLocale = formatLocale(locale);\n const hasMatch = supportedLocales.indexOf(formattedLocale) > -1;\n\n if (hasMatch) return formattedLocale;\n\n return matchLocale(formattedLocale || locale, supportedLocales);\n}\n\n/**\n * Formats the locales inside the customTranslations object against the supportedLocales\n * @param customTranslations -\n * @param supportedLocales -\n */\nexport function formatCustomTranslations(customTranslations: object = {}, supportedLocales: string[]): object {\n return Object.keys(customTranslations).reduce((acc, cur) => {\n const formattedLocale = formatLocale(cur) || parseLocale(cur, supportedLocales);\n if (formattedLocale) {\n acc[formattedLocale] = customTranslations[cur];\n }\n\n return acc;\n }, {});\n}\n\nconst replaceTranslationValues = (translation, values) => {\n return translation.replace(/%{(\\w+)}/g, (_, k) => values[k] || '');\n};\n\n/**\n * Returns a translation string by key\n * @param translations -\n * @param key -\n * @param options -\n *\n * @internal\n */\nexport const getTranslation = (translations: object, key: string, options: { [key: string]: any } = { values: {}, count: 0 }): string => {\n const keyPlural = `${key}__plural`;\n const keyForCount = count => `${key}__${count}`;\n\n if (Object.prototype.hasOwnProperty.call(translations, keyForCount(options.count))) {\n // Find key__count translation key\n return replaceTranslationValues(translations[keyForCount(options.count)], options.values);\n } else if (Object.prototype.hasOwnProperty.call(translations, keyPlural) && options.count > 1) {\n // Find key__plural translation key, if count greater than 1 (e.g. myTranslation__plural)\n return replaceTranslationValues(translations[keyPlural], options.values);\n } else if (Object.prototype.hasOwnProperty.call(translations, key)) {\n // Find key translation key (e.g. myTranslation)\n return replaceTranslationValues(translations[key], options.values);\n }\n\n return null;\n};\n\n/**\n * Returns an Object which contains all the key/values of the translation labels\n *\n * @param locale - The locale the user wants to use\n * @param customTranslations - Custom translations provided by the merchant\n */\nexport const loadTranslations = async (locale: string, customTranslations: object = {}): Promise> => {\n // Match locale to one of our available locales (e.g. es-AR => es-ES)\n const localeToLoad = parseLocale(locale, Object.keys(locales)) || FALLBACK_LOCALE;\n const loadedLocale = await locales[localeToLoad]();\n\n return {\n ...defaultTranslation, // Default en-US translations (in case any other translation file is missing any key)\n ...loadedLocale.default, // Merge with our locale file of the locale they are loading\n ...(!!customTranslations[locale] && customTranslations[locale]) // Merge with their custom locales if available\n };\n};\n\n/**\n * Injects JSX elements in a middle of a translation and returns a JSX array\n * The input string should use %# as the token to know where to insert the component\n * @param translation - Translation string\n * @param renderFunctions - An array function that renders JSX elements\n */\nexport const interpolateElement = (translation: string, renderFunctions: Array<(translation: string) => h.JSX.Element | string>) => {\n // splits by regex group, it guarantees that it only splits with 2 tokens (%#)\n const matches = translation.split(/%#(.*?)%#/gm);\n\n if (renderFunctions.length !== Math.floor(matches.length / 2)) {\n throw Error('The number of functions provided does not match the number of elements in the translation string.');\n }\n\n // the map will create an array of JSX / string elements, this syntax in accepted in JSX/react to render elements\n return matches.map((term, index) => {\n // math to get the index of the renderFunction that should be used\n // since we split on tokens, that means the index of the render function is half of the index of the string\n const indexInFunctionArray = Math.floor(index / 2);\n return index % 2 === 0 ? term : renderFunctions[indexInFunctionArray](term);\n });\n};\n","'use strict';\n// a string of all valid unicode whitespaces\nmodule.exports = '\\u0009\\u000A\\u000B\\u000C\\u000D\\u0020\\u00A0\\u1680\\u2000\\u2001\\u2002' +\n '\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000\\u2028\\u2029\\uFEFF';\n","'use strict';\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar requireObjectCoercible = require('../internals/require-object-coercible');\nvar toString = require('../internals/to-string');\nvar whitespaces = require('../internals/whitespaces');\n\nvar replace = uncurryThis(''.replace);\nvar ltrim = RegExp('^[' + whitespaces + ']+');\nvar rtrim = RegExp('(^|[^' + whitespaces + '])[' + whitespaces + ']+$');\n\n// `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation\nvar createMethod = function (TYPE) {\n return function ($this) {\n var string = toString(requireObjectCoercible($this));\n if (TYPE & 1) string = replace(string, ltrim, '');\n if (TYPE & 2) string = replace(string, rtrim, '$1');\n return string;\n };\n};\n\nmodule.exports = {\n // `String.prototype.{ trimLeft, trimStart }` methods\n // https://tc39.es/ecma262/#sec-string.prototype.trimstart\n start: createMethod(1),\n // `String.prototype.{ trimRight, trimEnd }` methods\n // https://tc39.es/ecma262/#sec-string.prototype.trimend\n end: createMethod(2),\n // `String.prototype.trim` method\n // https://tc39.es/ecma262/#sec-string.prototype.trim\n trim: createMethod(3)\n};\n","'use strict';\nvar global = require('../internals/global');\nvar fails = require('../internals/fails');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar toString = require('../internals/to-string');\nvar trim = require('../internals/string-trim').trim;\nvar whitespaces = require('../internals/whitespaces');\n\nvar $parseInt = global.parseInt;\nvar Symbol = global.Symbol;\nvar ITERATOR = Symbol && Symbol.iterator;\nvar hex = /^[+-]?0x/i;\nvar exec = uncurryThis(hex.exec);\nvar FORCED = $parseInt(whitespaces + '08') !== 8 || $parseInt(whitespaces + '0x16') !== 22\n // MS Edge 18- broken with boxed symbols\n || (ITERATOR && !fails(function () { $parseInt(Object(ITERATOR)); }));\n\n// `parseInt` method\n// https://tc39.es/ecma262/#sec-parseint-string-radix\nmodule.exports = FORCED ? function parseInt(string, radix) {\n var S = trim(toString(string));\n return $parseInt(S, (radix >>> 0) || (exec(hex, S) ? 16 : 10));\n} : $parseInt;\n","'use strict';\nvar $ = require('../internals/export');\nvar $parseInt = require('../internals/number-parse-int');\n\n// `parseInt` method\n// https://tc39.es/ecma262/#sec-parseint-string-radix\n$({ global: true, forced: parseInt !== $parseInt }, {\n parseInt: $parseInt\n});\n","'use strict';\nrequire('../modules/es.parse-int');\nvar path = require('../internals/path');\n\nmodule.exports = path.parseInt;\n","const CURRENCY_DECIMALS = {\n // ZERO_DECIMAL_CURRENCIES\n IDR: 1,\n JPY: 1,\n KRW: 1,\n VND: 1,\n BYR: 1,\n CVE: 1,\n DJF: 1,\n GHC: 1,\n GNF: 1,\n KMF: 1,\n PYG: 1,\n RWF: 1,\n UGX: 1,\n VUV: 1,\n XAF: 1,\n XOF: 1,\n XPF: 1,\n\n // ONE_DECIMAL_CURRENCIES\n MRO: 10,\n\n // THREE_DECIMAL_CURRENCIES\n BHD: 1000,\n IQD: 1000,\n JOD: 1000,\n KWD: 1000,\n OMR: 1000,\n LYD: 1000,\n TND: 1000\n};\n\nexport default CURRENCY_DECIMALS;\n","/** Work around solution until chromium bug is fixed https://bugs.chromium.org/p/chromium/issues/detail?id=1381996\n * We need to hardcode minimumFractionDigits for the following currencies\n */\nexport const currencyMinorUnitsConfig = {\n RSD: { minimumFractionDigits: 2 },\n AFN: { minimumFractionDigits: 2 },\n ALL: { minimumFractionDigits: 2 },\n IRR: { minimumFractionDigits: 2 },\n LAK: { minimumFractionDigits: 2 },\n LBP: { minimumFractionDigits: 2 },\n MMK: { minimumFractionDigits: 2 },\n SOS: { minimumFractionDigits: 2 },\n SYP: { minimumFractionDigits: 2 },\n YER: { minimumFractionDigits: 2 },\n IQD: { minimumFractionDigits: 3 }\n};\n","import CURRENCY_CODES from './constants/currency-codes';\nimport CURRENCY_DECIMALS from './constants/currency-decimals';\nimport { currencyMinorUnitsConfig } from './constants/currency-minor-units';\n\n/**\n * @internal\n * @param currencyCode -\n * Get divider amount\n */\nexport const getDivider = (currencyCode: string): number => CURRENCY_DECIMALS[currencyCode] || 100;\n\n/**\n * @internal\n * @param currencyCode -\n * Returns whether a CURRENCY CODE is valid\n */\nexport const isValidCurrencyCode = (currencyCode: string): boolean => !!CURRENCY_CODES[currencyCode];\n\n/**\n * @internal\n */\nexport const getCurrencyCode = (currencyCode: string): string => (isValidCurrencyCode(currencyCode) ? CURRENCY_CODES[currencyCode] : false);\n\n/**\n * @internal\n */\nexport const getDecimalAmount = (amount: number | string, currencyCode: string): number => {\n const divider = getDivider(currencyCode);\n return parseInt(String(amount), 10) / divider;\n};\n\n/**\n * @internal\n */\nexport const getLocalisedAmount = (amount: number, locale: string, currencyCode: string, options = {}): string => {\n const stringAmount = amount.toString(); // Changing amount to string to avoid 0-value from returning false\n\n const decimalAmount = getDecimalAmount(stringAmount, currencyCode);\n const formattedLocale = locale.replace('_', '-');\n\n const modifiedOptions = currencyMinorUnitsConfig[currencyCode] ? { ...options, ...currencyMinorUnitsConfig[currencyCode] } : options;\n const localeOptions = {\n style: 'currency',\n currency: currencyCode,\n currencyDisplay: 'symbol',\n ...modifiedOptions\n };\n\n try {\n return decimalAmount.toLocaleString(formattedLocale, localeOptions);\n } catch (e) {\n return stringAmount;\n }\n};\n\n/**\n * @internal\n */\nexport const getLocalisedPercentage = (percent = 0, locale: string): string => {\n const decimalPercent = percent / 100 / 100;\n const localeOptions = {\n style: 'percent',\n maximumFractionDigits: 2\n };\n\n try {\n return decimalPercent.toLocaleString(locale, localeOptions);\n } catch (e) {\n return null;\n }\n};\n","import { formatCustomTranslations, formatLocale, getTranslation, loadTranslations, parseLocale } from './utils';\nimport { FALLBACK_LOCALE, defaultTranslation } from './config';\nimport locales from './locales';\nimport { getLocalisedAmount } from '../utils/amount-util';\nimport DateTimeFormatOptions = Intl.DateTimeFormatOptions;\nimport DateTimeFormat = Intl.DateTimeFormat;\nexport class Language {\n private readonly supportedLocales: string[];\n\n public readonly locale: string;\n public readonly languageCode: string;\n public translations: Record = defaultTranslation;\n public readonly customTranslations;\n public loaded: Promise;\n\n public readonly timeFormatOptions: DateTimeFormatOptions = {\n hour: 'numeric',\n minute: 'numeric'\n };\n public readonly timeAndDateFormatOptions: DateTimeFormatOptions = {\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n ...this.timeFormatOptions\n };\n public readonly timeAndDateFormatter: DateTimeFormat;\n\n constructor(locale: string = FALLBACK_LOCALE, customTranslations: object = {}) {\n const defaultLocales = Object.keys(locales);\n this.customTranslations = formatCustomTranslations(customTranslations, defaultLocales);\n\n const localesFromCustomTranslations = Object.keys(this.customTranslations);\n this.supportedLocales = [...defaultLocales, ...localesFromCustomTranslations].filter((v, i, a) => a.indexOf(v) === i); // our locales + validated custom locales\n this.locale = formatLocale(locale) || parseLocale(locale, this.supportedLocales) || FALLBACK_LOCALE;\n const [languageCode] = this.locale.split('-');\n this.languageCode = languageCode;\n\n this.timeAndDateFormatter = DateTimeFormat(this.locale, this.timeAndDateFormatOptions);\n\n this.loaded = loadTranslations(this.locale, this.customTranslations).then(translations => {\n this.translations = translations;\n });\n }\n\n /**\n * Returns a translated string from a key in the current {@link Language.locale}\n * @param key - Translation key\n * @param options - Translation options\n * @returns Translated string\n */\n get(key: string, options?): string {\n const translation = getTranslation(this.translations, key, options);\n if (translation !== null) {\n return translation;\n }\n\n return key;\n }\n\n /**\n * Returns a localized string for an amount\n * @param amount - Amount to be converted\n * @param currencyCode - Currency code of the amount\n * @param options - Options for String.prototype.toLocaleString\n */\n amount(amount: number, currencyCode: string, options?: object): string {\n return getLocalisedAmount(amount, this.locale, currencyCode, options);\n }\n\n /**\n * Returns a localized string for a date\n * @param date - Date to be localized\n * @param options - Options for {@link Date.toLocaleDateString}\n */\n date(date: string, options: object = {}) {\n if (date === undefined) return '';\n const dateOptions: DateTimeFormatOptions = { year: 'numeric', month: '2-digit', day: '2-digit', ...options };\n return new Date(date).toLocaleDateString(this.locale, dateOptions);\n }\n\n /**\n * Returns a localized string for a date and time\n * @param date - Date to be localized\n */\n dateTime(date: string) {\n if (date === undefined) return '';\n return this.timeAndDateFormatter.format(new Date(date));\n }\n}\n\nexport default Language;\n","'use strict';\nvar $ = require('../internals/export');\nvar getBuiltIn = require('../internals/get-built-in');\nvar apply = require('../internals/function-apply');\nvar bind = require('../internals/function-bind');\nvar aConstructor = require('../internals/a-constructor');\nvar anObject = require('../internals/an-object');\nvar isObject = require('../internals/is-object');\nvar create = require('../internals/object-create');\nvar fails = require('../internals/fails');\n\nvar nativeConstruct = getBuiltIn('Reflect', 'construct');\nvar ObjectPrototype = Object.prototype;\nvar push = [].push;\n\n// `Reflect.construct` method\n// https://tc39.es/ecma262/#sec-reflect.construct\n// MS Edge supports only 2 arguments and argumentsList argument is optional\n// FF Nightly sets third argument as `new.target`, but does not create `this` from it\nvar NEW_TARGET_BUG = fails(function () {\n function F() { /* empty */ }\n return !(nativeConstruct(function () { /* empty */ }, [], F) instanceof F);\n});\n\nvar ARGS_BUG = !fails(function () {\n nativeConstruct(function () { /* empty */ });\n});\n\nvar FORCED = NEW_TARGET_BUG || ARGS_BUG;\n\n$({ target: 'Reflect', stat: true, forced: FORCED, sham: FORCED }, {\n construct: function construct(Target, args /* , newTarget */) {\n aConstructor(Target);\n anObject(args);\n var newTarget = arguments.length < 3 ? Target : aConstructor(arguments[2]);\n if (ARGS_BUG && !NEW_TARGET_BUG) return nativeConstruct(Target, args, newTarget);\n if (Target === newTarget) {\n // w/o altered newTarget, optimization for 0-4 arguments\n switch (args.length) {\n case 0: return new Target();\n case 1: return new Target(args[0]);\n case 2: return new Target(args[0], args[1]);\n case 3: return new Target(args[0], args[1], args[2]);\n case 4: return new Target(args[0], args[1], args[2], args[3]);\n }\n // w/o altered newTarget, lot of arguments case\n var $args = [null];\n apply(push, $args, args);\n return new (apply(bind, Target, $args))();\n }\n // with altered newTarget, not support built-in constructors\n var proto = newTarget.prototype;\n var instance = create(isObject(proto) ? proto : ObjectPrototype);\n var result = apply(Target, instance, args);\n return isObject(result) ? result : instance;\n }\n});\n","'use strict';\nrequire('../../modules/es.reflect.construct');\nvar path = require('../../internals/path');\n\nmodule.exports = path.Reflect.construct;\n","'use strict';\nvar parent = require('../../es/reflect/construct');\n\nmodule.exports = parent;\n","module.exports = require(\"core-js-pure/stable/reflect/construct\");","'use strict';\nvar DESCRIPTORS = require('../internals/descriptors');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar call = require('../internals/function-call');\nvar fails = require('../internals/fails');\nvar objectKeys = require('../internals/object-keys');\nvar getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols');\nvar propertyIsEnumerableModule = require('../internals/object-property-is-enumerable');\nvar toObject = require('../internals/to-object');\nvar IndexedObject = require('../internals/indexed-object');\n\n// eslint-disable-next-line es/no-object-assign -- safe\nvar $assign = Object.assign;\n// eslint-disable-next-line es/no-object-defineproperty -- required for testing\nvar defineProperty = Object.defineProperty;\nvar concat = uncurryThis([].concat);\n\n// `Object.assign` method\n// https://tc39.es/ecma262/#sec-object.assign\nmodule.exports = !$assign || fails(function () {\n // should have correct order of operations (Edge bug)\n if (DESCRIPTORS && $assign({ b: 1 }, $assign(defineProperty({}, 'a', {\n enumerable: true,\n get: function () {\n defineProperty(this, 'b', {\n value: 3,\n enumerable: false\n });\n }\n }), { b: 2 })).b !== 1) return true;\n // should work with symbols and should have deterministic property order (V8 bug)\n var A = {};\n var B = {};\n // eslint-disable-next-line es/no-symbol -- safe\n var symbol = Symbol('assign detection');\n var alphabet = 'abcdefghijklmnopqrst';\n A[symbol] = 7;\n alphabet.split('').forEach(function (chr) { B[chr] = chr; });\n return $assign({}, A)[symbol] !== 7 || objectKeys($assign({}, B)).join('') !== alphabet;\n}) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length`\n var T = toObject(target);\n var argumentsLength = arguments.length;\n var index = 1;\n var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;\n var propertyIsEnumerable = propertyIsEnumerableModule.f;\n while (argumentsLength > index) {\n var S = IndexedObject(arguments[index++]);\n var keys = getOwnPropertySymbols ? concat(objectKeys(S), getOwnPropertySymbols(S)) : objectKeys(S);\n var length = keys.length;\n var j = 0;\n var key;\n while (length > j) {\n key = keys[j++];\n if (!DESCRIPTORS || call(propertyIsEnumerable, S, key)) T[key] = S[key];\n }\n } return T;\n} : $assign;\n","'use strict';\nvar $ = require('../internals/export');\nvar assign = require('../internals/object-assign');\n\n// `Object.assign` method\n// https://tc39.es/ecma262/#sec-object.assign\n// eslint-disable-next-line es/no-object-assign -- required for testing\n$({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign }, {\n assign: assign\n});\n","'use strict';\nrequire('../../modules/es.object.assign');\nvar path = require('../../internals/path');\n\nmodule.exports = path.Object.assign;\n","'use strict';\nvar parent = require('../../es/object/assign');\n\nmodule.exports = parent;\n","'use strict';\nvar parent = require('../../stable/object/assign');\n\nmodule.exports = parent;\n","'use strict';\nvar parent = require('../../stable/instance/bind');\n\nmodule.exports = parent;\n","import _Object$assign from \"core-js-pure/features/object/assign.js\";\nimport _bindInstanceProperty from \"core-js-pure/features/instance/bind.js\";\nexport default function _extends() {\n var _context;\n _extends = _Object$assign ? _bindInstanceProperty(_context = _Object$assign).call(_context) : function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n };\n return _extends.apply(this, arguments);\n}","export default function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n return self;\n}","import _Object$setPrototypeOf from \"core-js-pure/features/object/set-prototype-of.js\";\nimport _bindInstanceProperty from \"core-js-pure/features/instance/bind.js\";\nexport default function _setPrototypeOf(o, p) {\n var _context;\n _setPrototypeOf = _Object$setPrototypeOf ? _bindInstanceProperty(_context = _Object$setPrototypeOf).call(_context) : function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n return _setPrototypeOf(o, p);\n}","import _Object$create from \"core-js-pure/features/object/create.js\";\nimport _Object$defineProperty from \"core-js-pure/features/object/define-property.js\";\nimport setPrototypeOf from \"./setPrototypeOf.js\";\nexport default function _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n subClass.prototype = _Object$create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n _Object$defineProperty(subClass, \"prototype\", {\n writable: false\n });\n if (superClass) setPrototypeOf(subClass, superClass);\n}","import _typeof from \"./typeof.js\";\nimport assertThisInitialized from \"./assertThisInitialized.js\";\nexport default function _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n } else if (call !== void 0) {\n throw new TypeError(\"Derived constructors may only return object or undefined\");\n }\n return assertThisInitialized(self);\n}","import _Object$setPrototypeOf from \"core-js-pure/features/object/set-prototype-of.js\";\nimport _bindInstanceProperty from \"core-js-pure/features/instance/bind.js\";\nimport _Object$getPrototypeOf from \"core-js-pure/features/object/get-prototype-of.js\";\nexport default function _getPrototypeOf(o) {\n var _context;\n _getPrototypeOf = _Object$setPrototypeOf ? _bindInstanceProperty(_context = _Object$getPrototypeOf).call(_context) : function _getPrototypeOf(o) {\n return o.__proto__ || _Object$getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}","var n,l,u,i,t,r,o,f,e,c={},s=[],a=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function h(n,l){for(var u in l)n[u]=l[u];return n}function v(n){var l=n.parentNode;l&&l.removeChild(n)}function y(l,u,i){var t,r,o,f={};for(o in u)\"key\"==o?t=u[o]:\"ref\"==o?r=u[o]:f[o]=u[o];if(arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):i),\"function\"==typeof l&&null!=l.defaultProps)for(o in l.defaultProps)void 0===f[o]&&(f[o]=l.defaultProps[o]);return p(l,f,t,r,null)}function p(n,i,t,r,o){var f={type:n,props:i,key:t,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==o?++u:o};return null==o&&null!=l.vnode&&l.vnode(f),f}function d(){return{current:null}}function _(n){return n.children}function k(n,l){this.props=n,this.context=l}function b(n,l){if(null==l)return n.__?b(n.__,n.__.__k.indexOf(n)+1):null;for(var u;ll&&t.sort(f));w.__r=0}function x(n,l,u,i,t,r,o,f,e,a){var h,v,y,d,k,g,m,w=i&&i.__k||s,x=w.length;for(u.__k=[],h=0;h0?p(d.type,d.props,d.key,d.ref?d.ref:null,d.__v):d)){if(d.__=u,d.__b=u.__b+1,null===(y=w[h])||y&&d.key==y.key&&d.type===y.type)w[h]=void 0;else for(v=0;v=0;l--)if((u=n.__k[l])&&(i=$(u)))return i;return null}function H(n,l,u,i,t){var r;for(r in u)\"children\"===r||\"key\"===r||r in l||T(n,r,null,u[r],i);for(r in l)t&&\"function\"!=typeof l[r]||\"children\"===r||\"key\"===r||\"value\"===r||\"checked\"===r||u[r]===l[r]||T(n,r,l[r],u[r],i)}function I(n,l,u){\"-\"===l[0]?n.setProperty(l,null==u?\"\":u):n[l]=null==u?\"\":\"number\"!=typeof u||a.test(l)?u:u+\"px\"}function T(n,l,u,i,t){var r;n:if(\"style\"===l)if(\"string\"==typeof u)n.style.cssText=u;else{if(\"string\"==typeof i&&(n.style.cssText=i=\"\"),i)for(l in i)u&&l in u||I(n.style,l,\"\");if(u)for(l in u)i&&u[l]===i[l]||I(n.style,l,u[l])}else if(\"o\"===l[0]&&\"n\"===l[1])r=l!==(l=l.replace(/Capture$/,\"\")),l=l.toLowerCase()in n?l.toLowerCase().slice(2):l.slice(2),n.l||(n.l={}),n.l[l+r]=u,u?i||n.addEventListener(l,r?z:j,r):n.removeEventListener(l,r?z:j,r);else if(\"dangerouslySetInnerHTML\"!==l){if(t)l=l.replace(/xlink(H|:h)/,\"h\").replace(/sName$/,\"s\");else if(\"width\"!==l&&\"height\"!==l&&\"href\"!==l&&\"list\"!==l&&\"form\"!==l&&\"tabIndex\"!==l&&\"download\"!==l&&l in n)try{n[l]=null==u?\"\":u;break n}catch(n){}\"function\"==typeof u||(null==u||!1===u&&\"-\"!==l[4]?n.removeAttribute(l):n.setAttribute(l,u))}}function j(n){return this.l[n.type+!1](l.event?l.event(n):n)}function z(n){return this.l[n.type+!0](l.event?l.event(n):n)}function L(n,u,i,t,r,o,f,e,c){var s,a,v,y,p,d,b,g,m,w,A,P,C,$,H,I=u.type;if(void 0!==u.constructor)return null;null!=i.__h&&(c=i.__h,e=u.__e=i.__e,u.__h=null,o=[e]),(s=l.__b)&&s(u);try{n:if(\"function\"==typeof I){if(g=u.props,m=(s=I.contextType)&&t[s.__c],w=s?m?m.props.value:s.__:t,i.__c?b=(a=u.__c=i.__c).__=a.__E:(\"prototype\"in I&&I.prototype.render?u.__c=a=new I(g,w):(u.__c=a=new k(g,w),a.constructor=I,a.render=q),m&&m.sub(a),a.props=g,a.state||(a.state={}),a.context=w,a.__n=t,v=a.__d=!0,a.__h=[],a._sb=[]),null==a.__s&&(a.__s=a.state),null!=I.getDerivedStateFromProps&&(a.__s==a.state&&(a.__s=h({},a.__s)),h(a.__s,I.getDerivedStateFromProps(g,a.__s))),y=a.props,p=a.state,a.__v=u,v)null==I.getDerivedStateFromProps&&null!=a.componentWillMount&&a.componentWillMount(),null!=a.componentDidMount&&a.__h.push(a.componentDidMount);else{if(null==I.getDerivedStateFromProps&&g!==y&&null!=a.componentWillReceiveProps&&a.componentWillReceiveProps(g,w),!a.__e&&null!=a.shouldComponentUpdate&&!1===a.shouldComponentUpdate(g,a.__s,w)||u.__v===i.__v){for(u.__v!==i.__v&&(a.props=g,a.state=a.__s,a.__d=!1),a.__e=!1,u.__e=i.__e,u.__k=i.__k,u.__k.forEach(function(n){n&&(n.__=u)}),A=0;A2&&(f.children=arguments.length>3?n.call(arguments,2):i),p(l.type,f,t||l.key,r||l.ref,null)}function F(n,l){var u={__c:l=\"__cC\"+e++,__:n,Consumer:function(n,l){return n.children(l)},Provider:function(n){var u,i;return this.getChildContext||(u=[],(i={})[l]=this,this.getChildContext=function(){return i},this.shouldComponentUpdate=function(n){this.props.value!==n.value&&u.some(function(n){n.__e=!0,m(n)})},this.sub=function(n){u.push(n);var l=n.componentWillUnmount;n.componentWillUnmount=function(){u.splice(u.indexOf(n),1),l&&l.call(n)}}),n.children}};return u.Provider.__=u.Consumer.contextType=u}n=s.slice,l={__e:function(n,l,u,i){for(var t,r,o;l=l.__;)if((t=l.__c)&&!t.__)try{if((r=t.constructor)&&null!=r.getDerivedStateFromError&&(t.setState(r.getDerivedStateFromError(n)),o=t.__d),null!=t.componentDidCatch&&(t.componentDidCatch(n,i||{}),o=t.__d),o)return t.__E=t}catch(l){n=l}throw n}},u=0,i=function(n){return null!=n&&void 0===n.constructor},k.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=h({},this.state),\"function\"==typeof n&&(n=n(h({},u),this.props)),n&&h(u,n),null!=n&&this.__v&&(l&&this._sb.push(l),m(this))},k.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),m(this))},k.prototype.render=_,t=[],o=\"function\"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,f=function(n,l){return n.__v.__b-l.__v.__b},w.__r=0,e=0;export{k as Component,_ as Fragment,E as cloneElement,F as createContext,y as createElement,d as createRef,y as h,D as hydrate,i as isValidElement,l as options,B as render,P as toChildArray};\n//# sourceMappingURL=preact.module.js.map\n","/**\n * returns the indicated property of an object, if it exists.\n *\n * @param object - The object to query\n * @param path - The property name or path to the property\n * @returns The value at `obj[p]`.\n\n * @example\n * ```\n * getProp({x: 100}, 'x'); //=> 100\n * getProp({}, 'x'); //=> undefined\n * ```\n */\nconst getProp = (object: any, path: string): any => {\n const splitPath = path.split('.');\n const reducer = (xs, x) => (xs && xs[x] ? xs[x] : undefined);\n\n return splitPath.reduce(reducer, object);\n};\n\nexport default getProp;\n","class EventEmitter {\n public events = {};\n\n public on = (eventName: string, fn: Function): void => {\n this.events[eventName] = this.events[eventName] || [];\n this.events[eventName].push(fn);\n };\n\n public off = (eventName: string, fn: Function): void => {\n if (this.events[eventName]) {\n this.events[eventName] = this.events[eventName].reduce((acc, cur) => {\n if (cur !== fn) acc.push(cur);\n return acc;\n }, []);\n }\n };\n\n public emit = (eventName: string, data: any): void => {\n if (this.events[eventName]) {\n this.events[eventName].forEach(fn => {\n fn(data);\n });\n }\n };\n}\n\nexport default EventEmitter;\n","/* eslint-disable */\nexport default function uuidv4(): string {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {\n let r = (Math.random() * 16) | 0,\n v = c == 'x' ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n}\n/* eslint-enable */\n","export const ANALYTICS_PATH = 'v3/analytics';\n\nexport const ANALYTICS_INFO_TIMER_INTERVAL = process.env.NODE_ENV === 'development' ? 5000 : 10000;\n\nexport const ANALYTICS_SEARCH_DEBOUNCE_TIME = 3000;\n\nexport const ANALYTICS_EVENT_LOG = 'log';\nexport const ANALYTICS_EVENT_ERROR = 'error';\nexport const ANALYTICS_EVENT_INFO = 'info';\n\nexport const ANALYTICS_ACTION_STR = 'action';\nexport const ANALYTICS_SUBMIT_STR = 'submit';\nexport const ANALYTICS_SELECTED_STR = 'selected';\nexport const ANALYTICS_RENDERED_STR = 'rendered';\nexport const ANALYTICS_DISPLAYED_STR = 'displayed';\nexport const ANALYTICS_INPUT_STR = 'input';\n\nexport const ANALYTICS_DOWNLOAD_STR = 'download';\n\nexport const ANALYTICS_VALIDATION_ERROR_STR = 'validationError';\n\nexport const ANALYTICS_FOCUS_STR = 'focus';\nexport const ANALYTICS_UNFOCUS_STR = 'unfocus';\n\nexport const ANALYTICS_CONFIGURED_STR = 'configured';\n\nexport const ANALYTICS_QR_CODE_DOWNLOAD = 'qr_download_button';\n\nexport const ANALYTICS_INSTANT_PAYMENT_BUTTON = 'instant_payment_button';\nexport const ANALYTICS_FEATURED_ISSUER = 'featured_issuer';\nexport const ANALYTICS_LIST = 'list';\nexport const ANALYTICS_LIST_SEARCH = 'list_search';\n\nexport const ANALYTICS_IMPLEMENTATION_ERROR = 'ImplementationError';\nexport const ANALYTICS_API_ERROR = 'ApiError';\nexport const ANALYTICS_SDK_ERROR = 'SdkError';\nexport const ANALYTICS_NETWORK_ERROR = 'Network';\nexport const ANALYTICS_INTERNAL_ERROR = 'Internal';\n\nexport const ANALYTICS_ERROR_CODE_ACTION_IS_MISSING_PAYMENT_DATA = 'web_700'; // Missing 'paymentData' property from threeDS2 action\nexport const ANALYTICS_ERROR_CODE_ACTION_IS_MISSING_TOKEN = 'web_701'; // Missing 'token' property from threeDS2 action`\nexport const ANALYTICS_ERROR_CODE_TOKEN_IS_MISSING_THREEDSMETHODURL = 'web_702'; // Decoded token is missing a valid threeDSMethodURL property\n\n/**\n * Decoded token is missing one or more of the following properties:\n * fingerprint: (threeDSMethodNotificationURL | postMessageDomain | threeDSServerTransID)\n * challenge: (acsTransID | messageVersion | threeDSServerTransID)\n */\nexport const ANALYTICS_ERROR_CODE_TOKEN_IS_MISSING_OTHER_PROPS = 'web_703';\n\nexport const ANALYTICS_ERROR_CODE_TOKEN_DECODE_OR_PARSING_FAILED = 'web_704'; // token decoding or parsing has failed. ('not base64', 'malformed URI sequence' or 'Could not JSON parse token')\nexport const ANALYTICS_ERROR_CODE_3DS2_TIMEOUT = 'web_705'; // 3DS2 process has timed out\n\nexport const ANALYTICS_ERROR_CODE_TOKEN_IS_MISSING_ACSURL = 'web_800'; // Decoded token is missing a valid acsURL property\nexport const ANALYTICS_ERROR_CODE_NO_TRANSSTATUS = 'web_801'; // Challenge has resulted in an error (no transStatus could be retrieved by the backend)\n\nexport const errorCodeMapping = {\n ['error.va.sf-cc-num.02']: '900',\n ['error.va.sf-cc-num.04']: '901',\n ['error.va.sf-cc-num.01']: '902',\n ['error.va.sf-cc-num.03']: '903',\n //\n ['error.va.sf-cc-dat.04']: '910',\n ['error.va.sf-cc-dat.05']: '911',\n ['error.va.sf-cc-dat.01']: '912',\n ['error.va.sf-cc-dat.02']: '913',\n ['error.va.sf-cc-dat.03']: '914',\n ['error.va.sf-cc-mth.01']: '915',\n ['error.va.sf-cc-yr.01']: '917',\n ['error.va.sf-cc-yr.02']: '918',\n //\n ['error.va.sf-cc-cvc.01']: '920',\n ['error.va.sf-cc-cvc.02']: '921',\n //\n ['creditCard.holderName.invalid']: '925',\n //\n ['boleto.socialSecurityNumber.invalid']: '926',\n //\n ['error.va.gen.01.country']: '930',\n ['error.va.gen.01.street']: '931',\n ['error.va.gen.01.house_number_or_name']: '932',\n ['error.va.gen.01.postal_code']: '933',\n ['invalidFormatExpects.postal_code']: '934',\n ['error.va.gen.01.city']: '935',\n ['error.va.gen.01.state_or_province']: '936',\n //\n ['error.va.sf-kcp-pwd.01']: '940',\n ['error.va.sf-kcp-pwd.02']: '941',\n ['creditCard.taxNumber.invalid']: '942',\n //\n ['error.va.sf-ach-num.01']: '945',\n ['error.va.sf-ach-num.02']: '946',\n ['error.va.sf-ach-loc.01']: '947',\n ['error.va.sf-ach-loc.02']: '948'\n};\n\nexport const ANALYTICS_EXPRESS_PAGES_ARRAY = ['cart', 'minicart', 'pdp', 'checkout'];\n","import { ComponentChild, render } from 'preact';\nimport getProp from '../utils/getProp';\nimport EventEmitter from './EventEmitter';\nimport uuid from '../utils/uuid';\nimport Core from '../core';\nimport { BaseElementProps, PaymentData } from './types';\nimport { RiskData } from '../core/RiskModule/RiskModule';\nimport { Resources } from '../core/Context/Resources';\nimport { AnalyticsInitialEvent, SendAnalyticsObject } from '../core/Analytics/types';\nimport { ANALYTICS_RENDERED_STR } from '../core/Analytics/constants';\n\nclass BaseElement

{\n public readonly _id = `${this.constructor['type']}-${uuid()}`;\n public props: P;\n public state;\n protected static defaultProps = {};\n public _node;\n public _component;\n public eventEmitter = new EventEmitter();\n protected readonly _parentInstance: Core;\n\n protected resources: Resources;\n\n protected constructor(props: P) {\n this.props = this.formatProps({ ...this.constructor['defaultProps'], setStatusAutomatically: true, ...props });\n this._parentInstance = this.props._parentInstance;\n this._node = null;\n this.state = {};\n this.resources = this.props.modules ? this.props.modules.resources : undefined;\n }\n\n /**\n * Executed during creation of any payment element.\n * Gives a chance to any paymentMethod to format the props we're receiving.\n */\n protected formatProps(props: P) {\n return props;\n }\n\n /**\n * Executed on the `data` getter.\n * Returns the component data necessary for the /payments request\n *\n * TODO: Replace 'any' by type PaymentMethodData - this change requires updating all payment methods,\n * properly adding the type of the formatData function\n */\n protected formatData(): any {\n return {};\n }\n\n /* eslint-disable-next-line */\n protected setUpAnalytics(setUpAnalyticsObj: AnalyticsInitialEvent) {\n return null;\n }\n\n /* eslint-disable-next-line */\n protected submitAnalytics(analyticsObj?: SendAnalyticsObject) {\n return null;\n }\n\n protected setState(newState: object): void {\n this.state = { ...this.state, ...newState };\n }\n\n /**\n * Returns the component payment data ready to submit to the Checkout API\n * Note: this does not ensure validity, check isValid first\n */\n get data(): PaymentData | RiskData {\n const clientData = getProp(this.props, 'modules.risk.data');\n const useAnalytics = !!getProp(this.props, 'modules.analytics.getEnabled')?.();\n const checkoutAttemptId = useAnalytics ? getProp(this.props, 'modules.analytics.getCheckoutAttemptId')?.() : 'do-not-track';\n const order = this.state.order || this.props.order;\n\n const componentData = this.formatData();\n if (componentData.paymentMethod && checkoutAttemptId) {\n componentData.paymentMethod.checkoutAttemptId = checkoutAttemptId;\n }\n\n // Workaround, to be fixed properly\n // Remove the firstName & lastName in the billingAddress for non Riverty components\n // @ts-ignore type exists\n if (this.props.type !== 'riverty' && componentData.billingAddress) {\n const { firstName, lastName, ...rest } = componentData.billingAddress;\n componentData.billingAddress = { ...rest };\n }\n\n return {\n ...(clientData && { riskData: { clientData } }),\n ...(order && { order: { orderData: order.orderData, pspReference: order.pspReference } }),\n ...componentData,\n clientStateDataIndicator: true\n };\n }\n\n public render(): ComponentChild | Error {\n // render() not implemented in the element\n throw new Error('Payment method cannot be rendered.');\n }\n\n /**\n * Mounts an element into the dom\n * @param domNode - Node (or selector) where we will mount the payment element\n * @returns this - the payment element instance we mounted\n */\n public mount(domNode: HTMLElement | string): this {\n const node = typeof domNode === 'string' ? document.querySelector(domNode) : domNode;\n\n if (!node) {\n throw new Error('Component could not mount. Root node was not found.');\n }\n\n const setupAnalytics = !this._node;\n\n if (this._node) {\n this.unmount(); // new, if this._node exists then we are \"remounting\" so we first need to unmount if it's not already been done\n }\n\n this._node = node;\n\n this._component = this.render();\n\n render(this._component, node);\n\n // Set up analytics (once, since this._node is currently undefined) now that we have mounted and rendered\n if (setupAnalytics) {\n if (this.props.modules && this.props.modules.analytics) {\n this.setUpAnalytics({\n containerWidth: node && (node as HTMLElement).offsetWidth,\n component: !this.props.isDropin ? this.constructor['analyticsType'] ?? this.constructor['type'] : 'dropin',\n flavor: !this.props.isDropin ? 'components' : 'dropin'\n }).then(() => {\n // Once the initial analytics set up call has been made...\n // ...create an analytics event declaring that the component has been rendered\n // (The dropin will do this itself from DropinComponent once the PM list has rendered)\n if (!this.props.isDropin) {\n this.submitAnalytics({ type: ANALYTICS_RENDERED_STR });\n }\n });\n }\n }\n\n return this;\n }\n\n /**\n * Updates props, resets the internal state and remounts the element.\n * @param props - props to update\n * @returns this - the element instance\n */\n public update(props: P): this {\n this.props = this.formatProps({ ...this.props, ...props });\n this.state = {};\n\n return this.unmount().mount(this._node); // for new mount fny\n }\n\n /**\n * Unmounts an element and mounts it again on the same node i.e. allows mount w/o having to pass a node.\n * Should be \"private\" & undocumented (although being a public function is useful for testing).\n * Left in for legacy reasons\n */\n public remount(component?): this {\n if (!this._node) {\n throw new Error('Component is not mounted.');\n }\n\n const newComponent = component || this.render();\n\n render(newComponent, this._node, null);\n\n return this;\n }\n\n /**\n * Unmounts a payment element from the DOM\n */\n public unmount(): this {\n if (this._node) {\n render(null, this._node);\n }\n\n return this;\n }\n\n /**\n * Unmounts an element and removes it from the parent instance\n * For \"destroy\" type cleanup - when you don't intend to use the component again\n */\n public remove() {\n this.unmount();\n\n if (this._parentInstance) {\n this._parentInstance.remove(this);\n }\n }\n}\n\nexport default BaseElement;\n","'use strict';\n/* global Bun -- Bun case */\nmodule.exports = typeof Bun == 'function' && Bun && typeof Bun.version == 'string';\n","'use strict';\nvar global = require('../internals/global');\nvar apply = require('../internals/function-apply');\nvar isCallable = require('../internals/is-callable');\nvar ENGINE_IS_BUN = require('../internals/engine-is-bun');\nvar USER_AGENT = require('../internals/engine-user-agent');\nvar arraySlice = require('../internals/array-slice');\nvar validateArgumentsLength = require('../internals/validate-arguments-length');\n\nvar Function = global.Function;\n// dirty IE9- and Bun 0.3.0- checks\nvar WRAP = /MSIE .\\./.test(USER_AGENT) || ENGINE_IS_BUN && (function () {\n var version = global.Bun.version.split('.');\n return version.length < 3 || version[0] === '0' && (version[1] < 3 || version[1] === '3' && version[2] === '0');\n})();\n\n// IE9- / Bun 0.3.0- setTimeout / setInterval / setImmediate additional parameters fix\n// https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#timers\n// https://github.com/oven-sh/bun/issues/1633\nmodule.exports = function (scheduler, hasTimeArg) {\n var firstParamIndex = hasTimeArg ? 2 : 1;\n return WRAP ? function (handler, timeout /* , ...arguments */) {\n var boundArgs = validateArgumentsLength(arguments.length, 1) > firstParamIndex;\n var fn = isCallable(handler) ? handler : Function(handler);\n var params = boundArgs ? arraySlice(arguments, firstParamIndex) : [];\n var callback = boundArgs ? function () {\n apply(fn, this, params);\n } : fn;\n return hasTimeArg ? scheduler(callback, timeout) : scheduler(callback);\n } : scheduler;\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar global = require('../internals/global');\nvar schedulersFix = require('../internals/schedulers-fix');\n\nvar setInterval = schedulersFix(global.setInterval, true);\n\n// Bun / IE9- setInterval additional parameters fix\n// https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-setinterval\n$({ global: true, bind: true, forced: global.setInterval !== setInterval }, {\n setInterval: setInterval\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar global = require('../internals/global');\nvar schedulersFix = require('../internals/schedulers-fix');\n\nvar setTimeout = schedulersFix(global.setTimeout, true);\n\n// Bun / IE9- setTimeout additional parameters fix\n// https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-settimeout\n$({ global: true, bind: true, forced: global.setTimeout !== setTimeout }, {\n setTimeout: setTimeout\n});\n","'use strict';\nrequire('../modules/web.timers');\nvar path = require('../internals/path');\n\nmodule.exports = path.setTimeout;\n","module.exports = require(\"core-js-pure/stable/array/is-array\");","/*!\n\tCopyright (c) 2018 Jed Watson.\n\tLicensed under the MIT License (MIT), see\n\thttp://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\tvar nativeCodeString = '[native code]';\n\n\tfunction classNames() {\n\t\tvar classes = [];\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (!arg) continue;\n\n\t\t\tvar argType = typeof arg;\n\n\t\t\tif (argType === 'string' || argType === 'number') {\n\t\t\t\tclasses.push(arg);\n\t\t\t} else if (Array.isArray(arg)) {\n\t\t\t\tif (arg.length) {\n\t\t\t\t\tvar inner = classNames.apply(null, arg);\n\t\t\t\t\tif (inner) {\n\t\t\t\t\t\tclasses.push(inner);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (argType === 'object') {\n\t\t\t\tif (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {\n\t\t\t\t\tclasses.push(arg.toString());\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tfor (var key in arg) {\n\t\t\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\t\t\tclasses.push(key);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn classes.join(' ');\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n","import{options as n}from\"preact\";var t,r,u,i,o=0,f=[],c=[],e=n.__b,a=n.__r,v=n.diffed,l=n.__c,m=n.unmount;function d(t,u){n.__h&&n.__h(r,t,o||u),o=0;var i=r.__H||(r.__H={__:[],__h:[]});return t>=i.__.length&&i.__.push({__V:c}),i.__[t]}function h(n){return o=1,s(B,n)}function s(n,u,i){var o=d(t++,2);if(o.t=n,!o.__c&&(o.__=[i?i(u):B(void 0,u),function(n){var t=o.__N?o.__N[0]:o.__[0],r=o.t(t,n);t!==r&&(o.__N=[r,o.__[1]],o.__c.setState({}))}],o.__c=r,!r.u)){var f=function(n,t,r){if(!o.__c.__H)return!0;var u=o.__c.__H.__.filter(function(n){return n.__c});if(u.every(function(n){return!n.__N}))return!c||c.call(this,n,t,r);var i=!1;return u.forEach(function(n){if(n.__N){var t=n.__[0];n.__=n.__N,n.__N=void 0,t!==n.__[0]&&(i=!0)}}),!(!i&&o.__c.props===n)&&(!c||c.call(this,n,t,r))};r.u=!0;var c=r.shouldComponentUpdate,e=r.componentWillUpdate;r.componentWillUpdate=function(n,t,r){if(this.__e){var u=c;c=void 0,f(n,t,r),c=u}e&&e.call(this,n,t,r)},r.shouldComponentUpdate=f}return o.__N||o.__}function p(u,i){var o=d(t++,3);!n.__s&&z(o.__H,i)&&(o.__=u,o.i=i,r.__H.__h.push(o))}function y(u,i){var o=d(t++,4);!n.__s&&z(o.__H,i)&&(o.__=u,o.i=i,r.__h.push(o))}function _(n){return o=5,F(function(){return{current:n}},[])}function A(n,t,r){o=6,y(function(){return\"function\"==typeof n?(n(t()),function(){return n(null)}):n?(n.current=t(),function(){return n.current=null}):void 0},null==r?r:r.concat(n))}function F(n,r){var u=d(t++,7);return z(u.__H,r)?(u.__V=n(),u.i=r,u.__h=n,u.__V):u.__}function T(n,t){return o=8,F(function(){return n},t)}function q(n){var u=r.context[n.__c],i=d(t++,9);return i.c=n,u?(null==i.__&&(i.__=!0,u.sub(r)),u.props.value):n.__}function x(t,r){n.useDebugValue&&n.useDebugValue(r?r(t):t)}function P(n){var u=d(t++,10),i=h();return u.__=n,r.componentDidCatch||(r.componentDidCatch=function(n,t){u.__&&u.__(n,t),i[1](n)}),[i[0],function(){i[1](void 0)}]}function V(){var n=d(t++,11);if(!n.__){for(var u=r.__v;null!==u&&!u.__m&&null!==u.__;)u=u.__;var i=u.__m||(u.__m=[0,0]);n.__=\"P\"+i[0]+\"-\"+i[1]++}return n.__}function b(){for(var t;t=f.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(k),t.__H.__h.forEach(w),t.__H.__h=[]}catch(r){t.__H.__h=[],n.__e(r,t.__v)}}n.__b=function(n){r=null,e&&e(n)},n.__r=function(n){a&&a(n),t=0;var i=(r=n.__c).__H;i&&(u===r?(i.__h=[],r.__h=[],i.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=c,n.__N=n.i=void 0})):(i.__h.forEach(k),i.__h.forEach(w),i.__h=[])),u=r},n.diffed=function(t){v&&v(t);var o=t.__c;o&&o.__H&&(o.__H.__h.length&&(1!==f.push(o)&&i===n.requestAnimationFrame||((i=n.requestAnimationFrame)||j)(b)),o.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==c&&(n.__=n.__V),n.i=void 0,n.__V=c})),u=r=null},n.__c=function(t,r){r.some(function(t){try{t.__h.forEach(k),t.__h=t.__h.filter(function(n){return!n.__||w(n)})}catch(u){r.some(function(n){n.__h&&(n.__h=[])}),r=[],n.__e(u,t.__v)}}),l&&l(t,r)},n.unmount=function(t){m&&m(t);var r,u=t.__c;u&&u.__H&&(u.__H.__.forEach(function(n){try{k(n)}catch(n){r=n}}),u.__H=void 0,r&&n.__e(r,u.__v))};var g=\"function\"==typeof requestAnimationFrame;function j(n){var t,r=function(){clearTimeout(u),g&&cancelAnimationFrame(t),setTimeout(n)},u=setTimeout(r,100);g&&(t=requestAnimationFrame(r))}function k(n){var t=r,u=n.__c;\"function\"==typeof u&&(n.__c=void 0,u()),r=t}function w(n){var t=r;n.__c=n.__(),r=t}function z(n,t){return!n||n.length!==t.length||t.some(function(t,r){return t!==n[r]})}function B(n,t){return\"function\"==typeof t?t(n):t}export{T as useCallback,q as useContext,x as useDebugValue,p as useEffect,P as useErrorBoundary,V as useId,A as useImperativeHandle,y as useLayoutEffect,F as useMemo,s as useReducer,_ as useRef,h as useState};\n//# sourceMappingURL=hooks.module.js.map\n","import { h } from 'preact';\nimport './Spinner.scss';\n\ninterface SpinnerProps {\n /**\n * Whether the spinner should be rendered inline\n */\n inline?: boolean;\n\n /**\n * size of the spinner (small/medium/large)\n */\n size?: string;\n}\n\n/**\n * Default Loading Spinner\n * @param props -\n */\nconst Spinner = ({ inline = false, size = 'large' }: SpinnerProps) => (\n

\n
\n
\n);\n\nexport default Spinner;\n","export const FALLBACK_CONTEXT = 'https://checkoutshopper-live.adyen.com/checkoutshopper/';\nexport const resolveEnvironment = (env = '', environmentUrl?: string): string => {\n if (environmentUrl) {\n return environmentUrl;\n }\n\n const environments = {\n test: 'https://checkoutshopper-test.adyen.com/checkoutshopper/',\n live: 'https://checkoutshopper-live.adyen.com/checkoutshopper/',\n 'live-us': 'https://checkoutshopper-live-us.adyen.com/checkoutshopper/',\n 'live-au': 'https://checkoutshopper-live-au.adyen.com/checkoutshopper/',\n 'live-apse': 'https://checkoutshopper-live-apse.adyen.com/checkoutshopper/',\n 'live-in': 'https://checkoutshopper-live-in.adyen.com/checkoutshopper/'\n };\n\n return environments[env.toLowerCase()] || FALLBACK_CONTEXT;\n};\n\nexport const FALLBACK_CDN_CONTEXT = 'https://checkoutshopper-live.adyen.com/checkoutshopper/';\nexport const resolveCDNEnvironment = (env = '', environmentUrl?: string) => {\n if (environmentUrl) {\n return environmentUrl;\n }\n\n const environments = {\n beta: 'https://cdf6519016.cdn.adyen.com/checkoutshopper/',\n test: 'https://checkoutshopper-test.adyen.com/checkoutshopper/',\n live: 'https://checkoutshopper-live.adyen.com/checkoutshopper/',\n 'live-us': 'https://checkoutshopper-live-us.adyen.com/checkoutshopper/',\n 'live-au': 'https://checkoutshopper-live-au.adyen.com/checkoutshopper/',\n 'live-apse': 'https://checkoutshopper-live-apse.adyen.com/checkoutshopper/',\n 'live-in': 'https://checkoutshopper-live-in.adyen.com/checkoutshopper/'\n };\n\n return environments[env.toLowerCase()] || FALLBACK_CDN_CONTEXT;\n};\n\nexport const FALLBACK_ANALYTICS_CONTEXT = 'https://checkoutanalytics-live.adyen.com/checkoutanalytics/';\n\nexport const resolveAnalyticsEnvironment = (env: string = FALLBACK_ANALYTICS_CONTEXT) => {\n const environments = {\n test: 'https://checkoutanalytics-test.adyen.com/checkoutanalytics/',\n live: 'https://checkoutanalytics-live.adyen.com/checkoutanalytics/',\n 'live-us': 'https://checkoutanalytics-live-us.adyen.com/checkoutanalytics/',\n 'live-au': 'https://checkoutanalytics-live-au.adyen.com/checkoutanalytics/',\n 'live-apse': 'https://checkoutanalytics-live-apse.adyen.com/checkoutanalytics/',\n 'live-in': 'https://checkoutanalytics-live-in.adyen.com/checkoutanalytics/'\n };\n\n return environments[env] || environments[env.toLowerCase()] || env;\n};\n","import { FALLBACK_CDN_CONTEXT } from '../Environment/Environment';\n\nexport interface ImageOptions {\n extension?: string;\n imageFolder?: string;\n resourceContext?: string;\n name?: string;\n parentFolder?: string;\n size?: string;\n subFolder?: string;\n svgOptions?: string;\n type?: string;\n}\n\nexport type GetImageFnType = (name) => string;\n\nexport class Resources {\n private readonly resourceContext: string;\n\n constructor(cdnContext: string = FALLBACK_CDN_CONTEXT) {\n this.resourceContext = cdnContext;\n }\n\n private returnImage = ({\n name,\n resourceContext,\n imageFolder = '',\n parentFolder = '',\n extension,\n size = '',\n subFolder = ''\n }: ImageOptions): string => `${resourceContext}images/${imageFolder}${subFolder}${parentFolder}${name}${size}.${extension}`;\n\n private getImageUrl =\n ({ resourceContext = FALLBACK_CDN_CONTEXT, extension = 'svg', ...options }: ImageOptions): GetImageFnType =>\n (name: string): string => {\n const imageOptions: ImageOptions = {\n extension,\n resourceContext,\n imageFolder: 'logos/',\n parentFolder: '',\n name,\n ...options\n };\n\n return this.returnImage(imageOptions);\n };\n\n public getImage(props = {} as ImageOptions) {\n return this.getImageUrl({ ...props, resourceContext: this.resourceContext });\n }\n}\n","import { createContext } from 'preact';\nimport { CommonPropsTypes } from './CoreProvider';\nimport Language from '../../language/Language';\nimport { Resources } from './Resources';\n\nexport const CoreContext = createContext({\n i18n: new Language(),\n loadingContext: '',\n commonProps: {} as CommonPropsTypes,\n resources: new Resources()\n});\n","import { useContext } from 'preact/hooks';\nimport { CoreContext } from './CoreContext';\n\nfunction useCoreContext() {\n return useContext(CoreContext);\n}\n\nexport default useCoreContext;\n","import { Component, h } from 'preact';\nimport classNames from 'classnames';\nimport Spinner from '../Spinner';\nimport useCoreContext from '../../../core/Context/useCoreContext';\nimport './Button.scss';\nimport { ButtonProps, ButtonState } from './types';\n\nclass Button extends Component {\n public static defaultProps = {\n status: 'default',\n variant: 'primary',\n disabled: false,\n label: '',\n inline: false,\n target: '_self',\n onClick: () => {}\n };\n\n public onClick = e => {\n e.preventDefault();\n\n if (!this.props.disabled) {\n this.props.onClick(e, { complete: this.complete });\n }\n };\n\n public complete = (delay = 1000) => {\n this.setState({ completed: true });\n setTimeout(() => {\n this.setState({ completed: false });\n }, delay);\n };\n\n render({ classNameModifiers = [], disabled, href, icon, inline, label, status, variant }, { completed }) {\n const { i18n } = useCoreContext();\n\n const buttonIcon = icon ? \"\" : '';\n\n const modifiers = [\n ...classNameModifiers,\n ...(variant !== 'primary' ? [variant] : []),\n ...(inline ? ['inline'] : []),\n ...(completed ? ['completed'] : []),\n ...(status === 'loading' || status === 'redirect' ? ['loading'] : [])\n ];\n\n const buttonClasses = classNames(['adyen-checkout__button', ...modifiers.map(m => `adyen-checkout__button--${m}`)]);\n\n const buttonStates = {\n loading: ,\n redirect: (\n \n \n {i18n.get('payButton.redirecting')}\n \n ),\n default: (\n \n {buttonIcon}\n {label}\n \n )\n };\n\n const buttonText = buttonStates[status] || buttonStates.default;\n\n if (href) {\n return (\n \n {buttonText}\n \n );\n }\n\n return (\n \n );\n }\n}\n\nexport default Button;\n","import Language from '../../../language';\nimport { PaymentAmountExtended } from '../../../types';\n\nexport const PAY_BTN_DIVIDER = '/ ';\n\nconst amountLabel = (i18n, amount: PaymentAmountExtended) =>\n !!amount?.value && !!amount?.currency ? i18n.amount(amount.value, amount.currency, { currencyDisplay: amount.currencyDisplay || 'symbol' }) : '';\n\nconst payAmountLabel = (i18n: Language, amount: PaymentAmountExtended) => `${i18n.get('payButton')} ${amountLabel(i18n, amount)}`;\n\nconst secondaryAmountLabel = (i18n: Language, secondaryAmount: PaymentAmountExtended) => {\n const convertedSecondaryAmount =\n secondaryAmount && !!secondaryAmount?.value && !!secondaryAmount?.currency\n ? i18n.amount(secondaryAmount.value, secondaryAmount.currency, { currencyDisplay: secondaryAmount.currencyDisplay || 'symbol' })\n : '';\n\n const divider = convertedSecondaryAmount.length ? PAY_BTN_DIVIDER : '';\n\n return `${divider}${convertedSecondaryAmount}`;\n};\n\nexport { payAmountLabel, amountLabel, secondaryAmountLabel };\n","import { h } from 'preact';\nimport './SecondaryButtonLabel.scss';\n\nconst SecondaryButtonLabel = ({ label }) => {\n return {label};\n};\n\nexport default SecondaryButtonLabel;\n","import { h } from 'preact';\nimport Button from '../Button';\nimport useCoreContext from '../../../core/Context/useCoreContext';\nimport { ButtonProps } from '../Button/types';\nimport { payAmountLabel, secondaryAmountLabel } from './utils';\nimport { PaymentAmountExtended } from '../../../types';\nimport SecondaryButtonLabel from './components/SecondaryButtonLabel';\n\nexport interface PayButtonProps extends ButtonProps {\n /**\n * Class name modifiers will be used as: `adyen-checkout__image--${modifier}`\n */\n classNameModifiers?: string[];\n label?: string;\n amount: PaymentAmountExtended;\n secondaryAmount?: PaymentAmountExtended;\n status?: string;\n disabled?: boolean;\n icon?: string;\n onClick?(): void;\n}\n\nconst PayButton = ({ amount, secondaryAmount, classNameModifiers = [], label, ...props }: PayButtonProps) => {\n const { i18n } = useCoreContext();\n const isZeroAuth = amount && {}.hasOwnProperty.call(amount, 'value') && amount.value === 0;\n const defaultLabel = isZeroAuth ? i18n.get('confirmPreauthorization') : payAmountLabel(i18n, amount);\n\n /**\n * Show the secondaryLabel if:\n * - it's not zero auth, and\n * - we don't have a predefined label (i.e. redirect, qrcode, await based comps...), and\n * - we do have an amount object (merchant might not be passing this in order to not show the amount on the button), and\n * - we have a secondaryAmount object with some properties\n */\n const secondaryLabel =\n !isZeroAuth && !label && amount && secondaryAmount && Object.keys(secondaryAmount).length\n ? secondaryAmountLabel(i18n, secondaryAmount)\n : null;\n\n return (\n \n {secondaryLabel && }\n \n );\n};\n\nexport default PayButton;\nexport { payAmountLabel };\n","import { PaymentResponse, RawPaymentResponse, UIElementStatus } from './types';\n\nconst ALLOWED_PROPERTIES = ['action', 'resultCode', 'sessionData', 'order', 'sessionResult'];\n\nexport function getSanitizedResponse(response: RawPaymentResponse): PaymentResponse {\n const removedProperties = [];\n\n const sanitizedObject = Object.keys(response).reduce((acc, cur) => {\n if (!ALLOWED_PROPERTIES.includes(cur)) {\n removedProperties.push(cur);\n } else {\n acc[cur] = response[cur];\n }\n return acc;\n }, {});\n\n if (removedProperties.length) console.warn(`The following properties should not be passed to the client: ${removedProperties.join(', ')}`);\n\n return sanitizedObject as PaymentResponse;\n}\n\nexport function resolveFinalResult(result: PaymentResponse): [status: UIElementStatus, statusProps?: any] {\n switch (result.resultCode) {\n case 'Authorised':\n case 'Received':\n return ['success'];\n case 'Pending':\n return ['success'];\n case 'Cancelled':\n case 'Error':\n case 'Refused':\n return ['error'];\n default:\n }\n}\n\nexport function getRegulatoryDefaults(countryCode: string): Record {\n switch (countryCode) {\n // Finnish regulations state that no payment method can be open by default\n case 'FI':\n return {\n openFirstPaymentMethod: false,\n openFirstStoredPaymentMethod: false\n };\n default:\n return {};\n }\n}\n","'use strict';\nvar $ = require('../internals/export');\nvar global = require('../internals/global');\nvar InternalMetadataModule = require('../internals/internal-metadata');\nvar fails = require('../internals/fails');\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\nvar iterate = require('../internals/iterate');\nvar anInstance = require('../internals/an-instance');\nvar isCallable = require('../internals/is-callable');\nvar isObject = require('../internals/is-object');\nvar isNullOrUndefined = require('../internals/is-null-or-undefined');\nvar setToStringTag = require('../internals/set-to-string-tag');\nvar defineProperty = require('../internals/object-define-property').f;\nvar forEach = require('../internals/array-iteration').forEach;\nvar DESCRIPTORS = require('../internals/descriptors');\nvar InternalStateModule = require('../internals/internal-state');\n\nvar setInternalState = InternalStateModule.set;\nvar internalStateGetterFor = InternalStateModule.getterFor;\n\nmodule.exports = function (CONSTRUCTOR_NAME, wrapper, common) {\n var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1;\n var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1;\n var ADDER = IS_MAP ? 'set' : 'add';\n var NativeConstructor = global[CONSTRUCTOR_NAME];\n var NativePrototype = NativeConstructor && NativeConstructor.prototype;\n var exported = {};\n var Constructor;\n\n if (!DESCRIPTORS || !isCallable(NativeConstructor)\n || !(IS_WEAK || NativePrototype.forEach && !fails(function () { new NativeConstructor().entries().next(); }))\n ) {\n // create collection constructor\n Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER);\n InternalMetadataModule.enable();\n } else {\n Constructor = wrapper(function (target, iterable) {\n setInternalState(anInstance(target, Prototype), {\n type: CONSTRUCTOR_NAME,\n collection: new NativeConstructor()\n });\n if (!isNullOrUndefined(iterable)) iterate(iterable, target[ADDER], { that: target, AS_ENTRIES: IS_MAP });\n });\n\n var Prototype = Constructor.prototype;\n\n var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);\n\n forEach(['add', 'clear', 'delete', 'forEach', 'get', 'has', 'set', 'keys', 'values', 'entries'], function (KEY) {\n var IS_ADDER = KEY === 'add' || KEY === 'set';\n if (KEY in NativePrototype && !(IS_WEAK && KEY === 'clear')) {\n createNonEnumerableProperty(Prototype, KEY, function (a, b) {\n var collection = getInternalState(this).collection;\n if (!IS_ADDER && IS_WEAK && !isObject(a)) return KEY === 'get' ? undefined : false;\n var result = collection[KEY](a === 0 ? 0 : a, b);\n return IS_ADDER ? this : result;\n });\n }\n });\n\n IS_WEAK || defineProperty(Prototype, 'size', {\n configurable: true,\n get: function () {\n return getInternalState(this).collection.size;\n }\n });\n }\n\n setToStringTag(Constructor, CONSTRUCTOR_NAME, false, true);\n\n exported[CONSTRUCTOR_NAME] = Constructor;\n $({ global: true, forced: true }, exported);\n\n if (!IS_WEAK) common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP);\n\n return Constructor;\n};\n","'use strict';\nvar defineBuiltIn = require('../internals/define-built-in');\n\nmodule.exports = function (target, src, options) {\n for (var key in src) {\n if (options && options.unsafe && target[key]) target[key] = src[key];\n else defineBuiltIn(target, key, src[key], options);\n } return target;\n};\n","'use strict';\nvar create = require('../internals/object-create');\nvar defineBuiltInAccessor = require('../internals/define-built-in-accessor');\nvar defineBuiltIns = require('../internals/define-built-ins');\nvar bind = require('../internals/function-bind-context');\nvar anInstance = require('../internals/an-instance');\nvar isNullOrUndefined = require('../internals/is-null-or-undefined');\nvar iterate = require('../internals/iterate');\nvar defineIterator = require('../internals/iterator-define');\nvar createIterResultObject = require('../internals/create-iter-result-object');\nvar setSpecies = require('../internals/set-species');\nvar DESCRIPTORS = require('../internals/descriptors');\nvar fastKey = require('../internals/internal-metadata').fastKey;\nvar InternalStateModule = require('../internals/internal-state');\n\nvar setInternalState = InternalStateModule.set;\nvar internalStateGetterFor = InternalStateModule.getterFor;\n\nmodule.exports = {\n getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {\n var Constructor = wrapper(function (that, iterable) {\n anInstance(that, Prototype);\n setInternalState(that, {\n type: CONSTRUCTOR_NAME,\n index: create(null),\n first: undefined,\n last: undefined,\n size: 0\n });\n if (!DESCRIPTORS) that.size = 0;\n if (!isNullOrUndefined(iterable)) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP });\n });\n\n var Prototype = Constructor.prototype;\n\n var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);\n\n var define = function (that, key, value) {\n var state = getInternalState(that);\n var entry = getEntry(that, key);\n var previous, index;\n // change existing entry\n if (entry) {\n entry.value = value;\n // create new entry\n } else {\n state.last = entry = {\n index: index = fastKey(key, true),\n key: key,\n value: value,\n previous: previous = state.last,\n next: undefined,\n removed: false\n };\n if (!state.first) state.first = entry;\n if (previous) previous.next = entry;\n if (DESCRIPTORS) state.size++;\n else that.size++;\n // add to index\n if (index !== 'F') state.index[index] = entry;\n } return that;\n };\n\n var getEntry = function (that, key) {\n var state = getInternalState(that);\n // fast case\n var index = fastKey(key);\n var entry;\n if (index !== 'F') return state.index[index];\n // frozen object case\n for (entry = state.first; entry; entry = entry.next) {\n if (entry.key === key) return entry;\n }\n };\n\n defineBuiltIns(Prototype, {\n // `{ Map, Set }.prototype.clear()` methods\n // https://tc39.es/ecma262/#sec-map.prototype.clear\n // https://tc39.es/ecma262/#sec-set.prototype.clear\n clear: function clear() {\n var that = this;\n var state = getInternalState(that);\n var data = state.index;\n var entry = state.first;\n while (entry) {\n entry.removed = true;\n if (entry.previous) entry.previous = entry.previous.next = undefined;\n delete data[entry.index];\n entry = entry.next;\n }\n state.first = state.last = undefined;\n if (DESCRIPTORS) state.size = 0;\n else that.size = 0;\n },\n // `{ Map, Set }.prototype.delete(key)` methods\n // https://tc39.es/ecma262/#sec-map.prototype.delete\n // https://tc39.es/ecma262/#sec-set.prototype.delete\n 'delete': function (key) {\n var that = this;\n var state = getInternalState(that);\n var entry = getEntry(that, key);\n if (entry) {\n var next = entry.next;\n var prev = entry.previous;\n delete state.index[entry.index];\n entry.removed = true;\n if (prev) prev.next = next;\n if (next) next.previous = prev;\n if (state.first === entry) state.first = next;\n if (state.last === entry) state.last = prev;\n if (DESCRIPTORS) state.size--;\n else that.size--;\n } return !!entry;\n },\n // `{ Map, Set }.prototype.forEach(callbackfn, thisArg = undefined)` methods\n // https://tc39.es/ecma262/#sec-map.prototype.foreach\n // https://tc39.es/ecma262/#sec-set.prototype.foreach\n forEach: function forEach(callbackfn /* , that = undefined */) {\n var state = getInternalState(this);\n var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n var entry;\n while (entry = entry ? entry.next : state.first) {\n boundFunction(entry.value, entry.key, this);\n // revert to the last existing entry\n while (entry && entry.removed) entry = entry.previous;\n }\n },\n // `{ Map, Set}.prototype.has(key)` methods\n // https://tc39.es/ecma262/#sec-map.prototype.has\n // https://tc39.es/ecma262/#sec-set.prototype.has\n has: function has(key) {\n return !!getEntry(this, key);\n }\n });\n\n defineBuiltIns(Prototype, IS_MAP ? {\n // `Map.prototype.get(key)` method\n // https://tc39.es/ecma262/#sec-map.prototype.get\n get: function get(key) {\n var entry = getEntry(this, key);\n return entry && entry.value;\n },\n // `Map.prototype.set(key, value)` method\n // https://tc39.es/ecma262/#sec-map.prototype.set\n set: function set(key, value) {\n return define(this, key === 0 ? 0 : key, value);\n }\n } : {\n // `Set.prototype.add(value)` method\n // https://tc39.es/ecma262/#sec-set.prototype.add\n add: function add(value) {\n return define(this, value = value === 0 ? 0 : value, value);\n }\n });\n if (DESCRIPTORS) defineBuiltInAccessor(Prototype, 'size', {\n configurable: true,\n get: function () {\n return getInternalState(this).size;\n }\n });\n return Constructor;\n },\n setStrong: function (Constructor, CONSTRUCTOR_NAME, IS_MAP) {\n var ITERATOR_NAME = CONSTRUCTOR_NAME + ' Iterator';\n var getInternalCollectionState = internalStateGetterFor(CONSTRUCTOR_NAME);\n var getInternalIteratorState = internalStateGetterFor(ITERATOR_NAME);\n // `{ Map, Set }.prototype.{ keys, values, entries, @@iterator }()` methods\n // https://tc39.es/ecma262/#sec-map.prototype.entries\n // https://tc39.es/ecma262/#sec-map.prototype.keys\n // https://tc39.es/ecma262/#sec-map.prototype.values\n // https://tc39.es/ecma262/#sec-map.prototype-@@iterator\n // https://tc39.es/ecma262/#sec-set.prototype.entries\n // https://tc39.es/ecma262/#sec-set.prototype.keys\n // https://tc39.es/ecma262/#sec-set.prototype.values\n // https://tc39.es/ecma262/#sec-set.prototype-@@iterator\n defineIterator(Constructor, CONSTRUCTOR_NAME, function (iterated, kind) {\n setInternalState(this, {\n type: ITERATOR_NAME,\n target: iterated,\n state: getInternalCollectionState(iterated),\n kind: kind,\n last: undefined\n });\n }, function () {\n var state = getInternalIteratorState(this);\n var kind = state.kind;\n var entry = state.last;\n // revert to the last existing entry\n while (entry && entry.removed) entry = entry.previous;\n // get next entry\n if (!state.target || !(state.last = entry = entry ? entry.next : state.state.first)) {\n // or finish the iteration\n state.target = undefined;\n return createIterResultObject(undefined, true);\n }\n // return step by kind\n if (kind === 'keys') return createIterResultObject(entry.key, false);\n if (kind === 'values') return createIterResultObject(entry.value, false);\n return createIterResultObject([entry.key, entry.value], false);\n }, IS_MAP ? 'entries' : 'values', !IS_MAP, true);\n\n // `{ Map, Set }.prototype[@@species]` accessors\n // https://tc39.es/ecma262/#sec-get-map-@@species\n // https://tc39.es/ecma262/#sec-get-set-@@species\n setSpecies(CONSTRUCTOR_NAME);\n }\n};\n","'use strict';\nvar collection = require('../internals/collection');\nvar collectionStrong = require('../internals/collection-strong');\n\n// `Map` constructor\n// https://tc39.es/ecma262/#sec-map-objects\ncollection('Map', function (init) {\n return function Map() { return init(this, arguments.length ? arguments[0] : undefined); };\n}, collectionStrong);\n","'use strict';\nrequire('../../modules/es.array.iterator');\nrequire('../../modules/es.map');\nrequire('../../modules/es.object.to-string');\nrequire('../../modules/es.string.iterator');\nvar path = require('../../internals/path');\n\nmodule.exports = path.Map;\n","'use strict';\nvar parent = require('../../es/map');\nrequire('../../modules/web.dom-collections.iterator');\n\nmodule.exports = parent;\n","'use strict';\nvar getBuiltIn = require('../internals/get-built-in');\nvar caller = require('../internals/caller');\n\nvar Map = getBuiltIn('Map');\n\nmodule.exports = {\n Map: Map,\n set: caller('set', 2),\n get: caller('get', 1),\n has: caller('has', 1),\n remove: caller('delete', 1),\n proto: Map.prototype\n};\n","'use strict';\nmodule.exports = function (methodName, numArgs) {\n return numArgs === 1 ? function (object, arg) {\n return object[methodName](arg);\n } : function (object, arg1, arg2) {\n return object[methodName](arg1, arg2);\n };\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar aCallable = require('../internals/a-callable');\nvar requireObjectCoercible = require('../internals/require-object-coercible');\nvar iterate = require('../internals/iterate');\nvar MapHelpers = require('../internals/map-helpers');\nvar IS_PURE = require('../internals/is-pure');\n\nvar Map = MapHelpers.Map;\nvar has = MapHelpers.has;\nvar get = MapHelpers.get;\nvar set = MapHelpers.set;\nvar push = uncurryThis([].push);\n\n// `Map.groupBy` method\n// https://github.com/tc39/proposal-array-grouping\n$({ target: 'Map', stat: true, forced: IS_PURE }, {\n groupBy: function groupBy(items, callbackfn) {\n requireObjectCoercible(items);\n aCallable(callbackfn);\n var map = new Map();\n var k = 0;\n iterate(items, function (value) {\n var key = callbackfn(value, k++);\n if (!has(map, key)) set(map, key, [value]);\n else push(get(map, key), value);\n });\n return map;\n }\n});\n","'use strict';\nvar parent = require('../../stable/map');\nrequire('../../modules/esnext.map.group-by');\n\nmodule.exports = parent;\n","'use strict';\n// https://tc39.github.io/proposal-setmap-offrom/\nvar bind = require('../internals/function-bind-context');\nvar call = require('../internals/function-call');\nvar aCallable = require('../internals/a-callable');\nvar aConstructor = require('../internals/a-constructor');\nvar isNullOrUndefined = require('../internals/is-null-or-undefined');\nvar iterate = require('../internals/iterate');\n\nvar push = [].push;\n\nmodule.exports = function from(source /* , mapFn, thisArg */) {\n var length = arguments.length;\n var mapFn = length > 1 ? arguments[1] : undefined;\n var mapping, array, n, boundFunction;\n aConstructor(this);\n mapping = mapFn !== undefined;\n if (mapping) aCallable(mapFn);\n if (isNullOrUndefined(source)) return new this();\n array = [];\n if (mapping) {\n n = 0;\n boundFunction = bind(mapFn, length > 2 ? arguments[2] : undefined);\n iterate(source, function (nextItem) {\n call(push, array, boundFunction(nextItem, n++));\n });\n } else {\n iterate(source, push, { that: array });\n }\n return new this(array);\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar from = require('../internals/collection-from');\n\n// `Map.from` method\n// https://tc39.github.io/proposal-setmap-offrom/#sec-map.from\n$({ target: 'Map', stat: true, forced: true }, {\n from: from\n});\n","'use strict';\nvar arraySlice = require('../internals/array-slice');\n\n// https://tc39.github.io/proposal-setmap-offrom/\nmodule.exports = function of() {\n return new this(arraySlice(arguments));\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar of = require('../internals/collection-of');\n\n// `Map.of` method\n// https://tc39.github.io/proposal-setmap-offrom/#sec-map.of\n$({ target: 'Map', stat: true, forced: true }, {\n of: of\n});\n","'use strict';\nvar tryToString = require('../internals/try-to-string');\n\nvar $TypeError = TypeError;\n\n// Perform ? RequireInternalSlot(M, [[MapData]])\nmodule.exports = function (it) {\n if (typeof it == 'object' && 'size' in it && 'has' in it && 'get' in it && 'set' in it && 'delete' in it && 'entries' in it) return it;\n throw new $TypeError(tryToString(it) + ' is not a map');\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar aMap = require('../internals/a-map');\nvar remove = require('../internals/map-helpers').remove;\n\n// `Map.prototype.deleteAll` method\n// https://github.com/tc39/proposal-collection-methods\n$({ target: 'Map', proto: true, real: true, forced: true }, {\n deleteAll: function deleteAll(/* ...elements */) {\n var collection = aMap(this);\n var allDeleted = true;\n var wasDeleted;\n for (var k = 0, len = arguments.length; k < len; k++) {\n wasDeleted = remove(collection, arguments[k]);\n allDeleted = allDeleted && wasDeleted;\n } return !!allDeleted;\n }\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar aMap = require('../internals/a-map');\nvar MapHelpers = require('../internals/map-helpers');\n\nvar get = MapHelpers.get;\nvar has = MapHelpers.has;\nvar set = MapHelpers.set;\n\n// `Map.prototype.emplace` method\n// https://github.com/tc39/proposal-upsert\n$({ target: 'Map', proto: true, real: true, forced: true }, {\n emplace: function emplace(key, handler) {\n var map = aMap(this);\n var value, inserted;\n if (has(map, key)) {\n value = get(map, key);\n if ('update' in handler) {\n value = handler.update(value, key, map);\n set(map, key, value);\n } return value;\n }\n inserted = handler.insert(key, map);\n set(map, key, inserted);\n return inserted;\n }\n});\n","'use strict';\nvar call = require('../internals/function-call');\n\nmodule.exports = function (record, fn, ITERATOR_INSTEAD_OF_RECORD) {\n var iterator = ITERATOR_INSTEAD_OF_RECORD ? record : record.iterator;\n var next = record.next;\n var step, result;\n while (!(step = call(next, iterator)).done) {\n result = fn(step.value);\n if (result !== undefined) return result;\n }\n};\n","'use strict';\nvar iterateSimple = require('../internals/iterate-simple');\n\nmodule.exports = function (map, fn, interruptible) {\n return interruptible ? iterateSimple(map.entries(), function (entry) {\n return fn(entry[1], entry[0]);\n }, true) : map.forEach(fn);\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar bind = require('../internals/function-bind-context');\nvar aMap = require('../internals/a-map');\nvar iterate = require('../internals/map-iterate');\n\n// `Map.prototype.every` method\n// https://github.com/tc39/proposal-collection-methods\n$({ target: 'Map', proto: true, real: true, forced: true }, {\n every: function every(callbackfn /* , thisArg */) {\n var map = aMap(this);\n var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n return iterate(map, function (value, key) {\n if (!boundFunction(value, key, map)) return false;\n }, true) !== false;\n }\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar bind = require('../internals/function-bind-context');\nvar aMap = require('../internals/a-map');\nvar MapHelpers = require('../internals/map-helpers');\nvar iterate = require('../internals/map-iterate');\n\nvar Map = MapHelpers.Map;\nvar set = MapHelpers.set;\n\n// `Map.prototype.filter` method\n// https://github.com/tc39/proposal-collection-methods\n$({ target: 'Map', proto: true, real: true, forced: true }, {\n filter: function filter(callbackfn /* , thisArg */) {\n var map = aMap(this);\n var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n var newMap = new Map();\n iterate(map, function (value, key) {\n if (boundFunction(value, key, map)) set(newMap, key, value);\n });\n return newMap;\n }\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar bind = require('../internals/function-bind-context');\nvar aMap = require('../internals/a-map');\nvar iterate = require('../internals/map-iterate');\n\n// `Map.prototype.find` method\n// https://github.com/tc39/proposal-collection-methods\n$({ target: 'Map', proto: true, real: true, forced: true }, {\n find: function find(callbackfn /* , thisArg */) {\n var map = aMap(this);\n var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n var result = iterate(map, function (value, key) {\n if (boundFunction(value, key, map)) return { value: value };\n }, true);\n return result && result.value;\n }\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar bind = require('../internals/function-bind-context');\nvar aMap = require('../internals/a-map');\nvar iterate = require('../internals/map-iterate');\n\n// `Map.prototype.findKey` method\n// https://github.com/tc39/proposal-collection-methods\n$({ target: 'Map', proto: true, real: true, forced: true }, {\n findKey: function findKey(callbackfn /* , thisArg */) {\n var map = aMap(this);\n var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n var result = iterate(map, function (value, key) {\n if (boundFunction(value, key, map)) return { key: key };\n }, true);\n return result && result.key;\n }\n});\n","'use strict';\n// `SameValueZero` abstract operation\n// https://tc39.es/ecma262/#sec-samevaluezero\nmodule.exports = function (x, y) {\n // eslint-disable-next-line no-self-compare -- NaN check\n return x === y || x !== x && y !== y;\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar sameValueZero = require('../internals/same-value-zero');\nvar aMap = require('../internals/a-map');\nvar iterate = require('../internals/map-iterate');\n\n// `Map.prototype.includes` method\n// https://github.com/tc39/proposal-collection-methods\n$({ target: 'Map', proto: true, real: true, forced: true }, {\n includes: function includes(searchElement) {\n return iterate(aMap(this), function (value) {\n if (sameValueZero(value, searchElement)) return true;\n }, true) === true;\n }\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar call = require('../internals/function-call');\nvar iterate = require('../internals/iterate');\nvar isCallable = require('../internals/is-callable');\nvar aCallable = require('../internals/a-callable');\nvar Map = require('../internals/map-helpers').Map;\n\n// `Map.keyBy` method\n// https://github.com/tc39/proposal-collection-methods\n$({ target: 'Map', stat: true, forced: true }, {\n keyBy: function keyBy(iterable, keyDerivative) {\n var C = isCallable(this) ? this : Map;\n var newMap = new C();\n aCallable(keyDerivative);\n var setter = aCallable(newMap.set);\n iterate(iterable, function (element) {\n call(setter, newMap, keyDerivative(element), element);\n });\n return newMap;\n }\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar aMap = require('../internals/a-map');\nvar iterate = require('../internals/map-iterate');\n\n// `Map.prototype.keyOf` method\n// https://github.com/tc39/proposal-collection-methods\n$({ target: 'Map', proto: true, real: true, forced: true }, {\n keyOf: function keyOf(searchElement) {\n var result = iterate(aMap(this), function (value, key) {\n if (value === searchElement) return { key: key };\n }, true);\n return result && result.key;\n }\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar bind = require('../internals/function-bind-context');\nvar aMap = require('../internals/a-map');\nvar MapHelpers = require('../internals/map-helpers');\nvar iterate = require('../internals/map-iterate');\n\nvar Map = MapHelpers.Map;\nvar set = MapHelpers.set;\n\n// `Map.prototype.mapKeys` method\n// https://github.com/tc39/proposal-collection-methods\n$({ target: 'Map', proto: true, real: true, forced: true }, {\n mapKeys: function mapKeys(callbackfn /* , thisArg */) {\n var map = aMap(this);\n var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n var newMap = new Map();\n iterate(map, function (value, key) {\n set(newMap, boundFunction(value, key, map), value);\n });\n return newMap;\n }\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar bind = require('../internals/function-bind-context');\nvar aMap = require('../internals/a-map');\nvar MapHelpers = require('../internals/map-helpers');\nvar iterate = require('../internals/map-iterate');\n\nvar Map = MapHelpers.Map;\nvar set = MapHelpers.set;\n\n// `Map.prototype.mapValues` method\n// https://github.com/tc39/proposal-collection-methods\n$({ target: 'Map', proto: true, real: true, forced: true }, {\n mapValues: function mapValues(callbackfn /* , thisArg */) {\n var map = aMap(this);\n var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n var newMap = new Map();\n iterate(map, function (value, key) {\n set(newMap, key, boundFunction(value, key, map));\n });\n return newMap;\n }\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar aMap = require('../internals/a-map');\nvar iterate = require('../internals/iterate');\nvar set = require('../internals/map-helpers').set;\n\n// `Map.prototype.merge` method\n// https://github.com/tc39/proposal-collection-methods\n$({ target: 'Map', proto: true, real: true, arity: 1, forced: true }, {\n // eslint-disable-next-line no-unused-vars -- required for `.length`\n merge: function merge(iterable /* ...iterables */) {\n var map = aMap(this);\n var argumentsLength = arguments.length;\n var i = 0;\n while (i < argumentsLength) {\n iterate(arguments[i++], function (key, value) {\n set(map, key, value);\n }, { AS_ENTRIES: true });\n }\n return map;\n }\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar aCallable = require('../internals/a-callable');\nvar aMap = require('../internals/a-map');\nvar iterate = require('../internals/map-iterate');\n\nvar $TypeError = TypeError;\n\n// `Map.prototype.reduce` method\n// https://github.com/tc39/proposal-collection-methods\n$({ target: 'Map', proto: true, real: true, forced: true }, {\n reduce: function reduce(callbackfn /* , initialValue */) {\n var map = aMap(this);\n var noInitial = arguments.length < 2;\n var accumulator = noInitial ? undefined : arguments[1];\n aCallable(callbackfn);\n iterate(map, function (value, key) {\n if (noInitial) {\n noInitial = false;\n accumulator = value;\n } else {\n accumulator = callbackfn(accumulator, value, key, map);\n }\n });\n if (noInitial) throw new $TypeError('Reduce of empty map with no initial value');\n return accumulator;\n }\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar bind = require('../internals/function-bind-context');\nvar aMap = require('../internals/a-map');\nvar iterate = require('../internals/map-iterate');\n\n// `Map.prototype.some` method\n// https://github.com/tc39/proposal-collection-methods\n$({ target: 'Map', proto: true, real: true, forced: true }, {\n some: function some(callbackfn /* , thisArg */) {\n var map = aMap(this);\n var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n return iterate(map, function (value, key) {\n if (boundFunction(value, key, map)) return true;\n }, true) === true;\n }\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar aCallable = require('../internals/a-callable');\nvar aMap = require('../internals/a-map');\nvar MapHelpers = require('../internals/map-helpers');\n\nvar $TypeError = TypeError;\nvar get = MapHelpers.get;\nvar has = MapHelpers.has;\nvar set = MapHelpers.set;\n\n// `Map.prototype.update` method\n// https://github.com/tc39/proposal-collection-methods\n$({ target: 'Map', proto: true, real: true, forced: true }, {\n update: function update(key, callback /* , thunk */) {\n var map = aMap(this);\n var length = arguments.length;\n aCallable(callback);\n var isPresentInMap = has(map, key);\n if (!isPresentInMap && length < 3) {\n throw new $TypeError('Updating absent value');\n }\n var value = isPresentInMap ? get(map, key) : aCallable(length > 2 ? arguments[2] : undefined)(key, map);\n set(map, key, callback(value, key, map));\n return map;\n }\n});\n","'use strict';\nvar call = require('../internals/function-call');\nvar aCallable = require('../internals/a-callable');\nvar isCallable = require('../internals/is-callable');\nvar anObject = require('../internals/an-object');\n\nvar $TypeError = TypeError;\n\n// `Map.prototype.upsert` method\n// https://github.com/tc39/proposal-upsert\nmodule.exports = function upsert(key, updateFn /* , insertFn */) {\n var map = anObject(this);\n var get = aCallable(map.get);\n var has = aCallable(map.has);\n var set = aCallable(map.set);\n var insertFn = arguments.length > 2 ? arguments[2] : undefined;\n var value;\n if (!isCallable(updateFn) && !isCallable(insertFn)) {\n throw new $TypeError('At least one callback required');\n }\n if (call(has, map, key)) {\n value = call(get, map, key);\n if (isCallable(updateFn)) {\n value = updateFn(value);\n call(set, map, key, value);\n }\n } else if (isCallable(insertFn)) {\n value = insertFn();\n call(set, map, key, value);\n } return value;\n};\n","'use strict';\n// TODO: remove from `core-js@4`\nvar $ = require('../internals/export');\nvar upsert = require('../internals/map-upsert');\n\n// `Map.prototype.upsert` method (replaced by `Map.prototype.emplace`)\n// https://github.com/thumbsupep/proposal-upsert\n$({ target: 'Map', proto: true, real: true, forced: true }, {\n upsert: upsert\n});\n","'use strict';\n// TODO: remove from `core-js@4`\nvar $ = require('../internals/export');\nvar upsert = require('../internals/map-upsert');\n\n// `Map.prototype.updateOrInsert` method (replaced by `Map.prototype.emplace`)\n// https://github.com/thumbsupep/proposal-upsert\n$({ target: 'Map', proto: true, real: true, name: 'upsert', forced: true }, {\n updateOrInsert: upsert\n});\n","'use strict';\nvar parent = require('../../actual/map');\nrequire('../../modules/esnext.map.from');\nrequire('../../modules/esnext.map.of');\nrequire('../../modules/esnext.map.delete-all');\nrequire('../../modules/esnext.map.emplace');\nrequire('../../modules/esnext.map.every');\nrequire('../../modules/esnext.map.filter');\nrequire('../../modules/esnext.map.find');\nrequire('../../modules/esnext.map.find-key');\nrequire('../../modules/esnext.map.includes');\nrequire('../../modules/esnext.map.key-by');\nrequire('../../modules/esnext.map.key-of');\nrequire('../../modules/esnext.map.map-keys');\nrequire('../../modules/esnext.map.map-values');\nrequire('../../modules/esnext.map.merge');\nrequire('../../modules/esnext.map.reduce');\nrequire('../../modules/esnext.map.some');\nrequire('../../modules/esnext.map.update');\n// TODO: remove from `core-js@4`\nrequire('../../modules/esnext.map.upsert');\n// TODO: remove from `core-js@4`\nrequire('../../modules/esnext.map.update-or-insert');\n\nmodule.exports = parent;\n","'use strict';\nvar parent = require('../../stable/reflect/construct');\n\nmodule.exports = parent;\n","import _bindInstanceProperty from \"core-js-pure/features/instance/bind.js\";\nimport _Reflect$construct from \"core-js-pure/features/reflect/construct.js\";\nimport _pushInstanceProperty from \"core-js-pure/features/instance/push.js\";\nimport setPrototypeOf from \"./setPrototypeOf.js\";\nimport isNativeReflectConstruct from \"./isNativeReflectConstruct.js\";\nexport default function _construct(Parent, args, Class) {\n if (isNativeReflectConstruct()) {\n var _context;\n _construct = _bindInstanceProperty(_context = _Reflect$construct).call(_context);\n } else {\n _construct = function _construct(Parent, args, Class) {\n var a = [null];\n _pushInstanceProperty(a).apply(a, args);\n var Constructor = _bindInstanceProperty(Function).apply(Parent, a);\n var instance = new Constructor();\n if (Class) setPrototypeOf(instance, Class.prototype);\n return instance;\n };\n }\n return _construct.apply(null, arguments);\n}","import _Reflect$construct from \"core-js-pure/features/reflect/construct.js\";\nexport default function _isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !_Reflect$construct) return false;\n if (_Reflect$construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n try {\n Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {}));\n return true;\n } catch (e) {\n return false;\n }\n}","import _Map from \"core-js-pure/features/map/index.js\";\nimport _Object$create from \"core-js-pure/features/object/create.js\";\nimport getPrototypeOf from \"./getPrototypeOf.js\";\nimport setPrototypeOf from \"./setPrototypeOf.js\";\nimport isNativeFunction from \"./isNativeFunction.js\";\nimport construct from \"./construct.js\";\nexport default function _wrapNativeSuper(Class) {\n var _cache = typeof _Map === \"function\" ? new _Map() : undefined;\n _wrapNativeSuper = function _wrapNativeSuper(Class) {\n if (Class === null || !isNativeFunction(Class)) return Class;\n if (typeof Class !== \"function\") {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n if (typeof _cache !== \"undefined\") {\n if (_cache.has(Class)) return _cache.get(Class);\n _cache.set(Class, Wrapper);\n }\n function Wrapper() {\n return construct(Class, arguments, getPrototypeOf(this).constructor);\n }\n Wrapper.prototype = _Object$create(Class.prototype, {\n constructor: {\n value: Wrapper,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n return setPrototypeOf(Wrapper, Class);\n };\n return _wrapNativeSuper(Class);\n}","import _indexOfInstanceProperty from \"core-js-pure/features/instance/index-of.js\";\nexport default function _isNativeFunction(fn) {\n try {\n var _context;\n return _indexOfInstanceProperty(_context = Function.toString.call(fn)).call(_context, \"[native code]\") !== -1;\n } catch (e) {\n return typeof fn === \"function\";\n }\n}","interface CheckoutErrorOptions {\n cause: any;\n}\n\nclass AdyenCheckoutError extends Error {\n protected static errorTypes = {\n /** Network error. */\n NETWORK_ERROR: 'NETWORK_ERROR',\n\n /** Shopper canceled the current transaction. */\n CANCEL: 'CANCEL',\n\n /** Implementation error. The method or parameter are incorrect or are not supported. */\n IMPLEMENTATION_ERROR: 'IMPLEMENTATION_ERROR',\n\n /** Generic error. */\n ERROR: 'ERROR'\n };\n\n public cause: unknown;\n\n constructor(type: keyof typeof AdyenCheckoutError.errorTypes, message?: string, options?: CheckoutErrorOptions) {\n super(message);\n\n this.name = AdyenCheckoutError.errorTypes[type];\n\n this.cause = options?.cause;\n }\n}\n\nexport default AdyenCheckoutError;\n","export function hasOwnProperty(obj = {}, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n","import { h } from 'preact';\nimport BaseElement from './BaseElement';\nimport { PaymentAction } from '../types';\nimport { PaymentResponse } from './types';\nimport PayButton from './internal/PayButton';\nimport { IUIElement, PayButtonFunctionProps, RawPaymentResponse, UIElementProps } from './types';\nimport { getSanitizedResponse, resolveFinalResult } from './utils';\nimport AdyenCheckoutError from '../core/Errors/AdyenCheckoutError';\nimport { UIElementStatus } from './types';\nimport { hasOwnProperty } from '../utils/hasOwnProperty';\nimport DropinElement from './Dropin';\nimport { CoreOptions } from '../core/types';\nimport Core from '../core';\nimport { ANALYTICS_SUBMIT_STR } from '../core/Analytics/constants';\nimport { AnalyticsInitialEvent, SendAnalyticsObject } from '../core/Analytics/types';\n\nexport class UIElement

extends BaseElement

implements IUIElement {\n protected componentRef: any;\n public elementRef: UIElement;\n\n constructor(props: P) {\n super(props);\n this.submit = this.submit.bind(this);\n this.setState = this.setState.bind(this);\n this.onValid = this.onValid.bind(this);\n this.onComplete = this.onComplete.bind(this);\n this.onSubmit = this.onSubmit.bind(this);\n this.handleAction = this.handleAction.bind(this);\n this.handleOrder = this.handleOrder.bind(this);\n this.handleResponse = this.handleResponse.bind(this);\n this.setElementStatus = this.setElementStatus.bind(this);\n this.submitAnalytics = this.submitAnalytics.bind(this);\n\n this.elementRef = (props && props.elementRef) || this;\n }\n\n public setState(newState: object): void {\n this.state = { ...this.state, ...newState };\n this.onChange();\n }\n\n protected onChange(): object {\n const isValid = this.isValid;\n const state = { data: this.data, errors: this.state.errors, valid: this.state.valid, isValid };\n if (this.props.onChange) this.props.onChange(state, this.elementRef);\n if (isValid) this.onValid();\n\n return state;\n }\n\n // Only called once, for UIElements (including Dropin), as they are being mounted\n protected setUpAnalytics(setUpAnalyticsObj: AnalyticsInitialEvent) {\n const sessionId = this.props.session?.id;\n\n return this.props.modules.analytics.setUp({\n ...setUpAnalyticsObj,\n ...(sessionId && { sessionId })\n });\n }\n\n /**\n * A function for all UIElements, or BaseElement, to use to create an analytics action for when it's been:\n * - mounted,\n * - a PM has been selected\n * - onSubmit has been called (as a result of the pay button being pressed)\n *\n * In some other cases e.g. 3DS2 components, this function is overridden to allow more specific analytics actions to be created\n */\n /* eslint-disable-next-line */\n protected submitAnalytics(analyticsObj: SendAnalyticsObject, uiElementProps?) {\n /** Work out what the component's \"type\" is:\n * - first check for a dedicated \"analyticsType\" (currently only applies to custom-cards)\n * - otherwise, distinguish cards from non-cards: cards will use their static type property, everything else will use props.type\n */\n let component = this.constructor['analyticsType'];\n if (!component) {\n component = this.constructor['type'] === 'scheme' || this.constructor['type'] === 'bcmc' ? this.constructor['type'] : this.props.type;\n }\n\n this.props.modules?.analytics.sendAnalytics(component, analyticsObj, uiElementProps);\n }\n\n private onSubmit(): void {\n //TODO: refactor this, instant payment methods are part of Dropin logic not UIElement\n if (this.props.isInstantPayment) {\n const dropinElementRef = this.elementRef as DropinElement;\n dropinElementRef.closeActivePaymentMethod();\n }\n\n if (this.props.setStatusAutomatically) {\n this.setElementStatus('loading');\n }\n\n if (this.props.onSubmit) {\n /** Classic flow */\n // Call analytics endpoint\n this.submitAnalytics({ type: ANALYTICS_SUBMIT_STR });\n\n // Call onSubmit handler\n this.props.onSubmit({ data: this.data, isValid: this.isValid }, this.elementRef);\n } else if (this._parentInstance.session) {\n /** Session flow */\n // wrap beforeSubmit callback in a promise\n const beforeSubmitEvent = this.props.beforeSubmit\n ? new Promise((resolve, reject) =>\n this.props.beforeSubmit(this.data, this.elementRef, {\n resolve,\n reject\n })\n )\n : Promise.resolve(this.data);\n\n beforeSubmitEvent\n .then(data => {\n // Call analytics endpoint\n this.submitAnalytics({ type: ANALYTICS_SUBMIT_STR });\n // Submit payment\n return this.submitPayment(data);\n })\n .catch(() => {\n // set state as ready to submit if the merchant cancels the action\n this.elementRef.setStatus('ready');\n });\n } else {\n this.handleError(new AdyenCheckoutError('IMPLEMENTATION_ERROR', 'Could not submit the payment'));\n }\n }\n\n private onValid() {\n const state = { data: this.data };\n if (this.props.onValid) this.props.onValid(state, this.elementRef);\n return state;\n }\n\n onComplete(state): void {\n if (this.props.onComplete) this.props.onComplete(state, this.elementRef);\n }\n\n /**\n * Submit payment method data. If the form is not valid, it will trigger validation.\n */\n public submit(): void {\n if (!this.isValid) {\n this.showValidation();\n return;\n }\n\n this.onSubmit();\n }\n\n public showValidation(): this {\n if (this.componentRef && this.componentRef.showValidation) this.componentRef.showValidation();\n return this;\n }\n\n public setElementStatus(status: UIElementStatus, props?: any): this {\n this.elementRef?.setStatus(status, props);\n return this;\n }\n\n public setStatus(status: UIElementStatus, props?): this {\n if (this.componentRef?.setStatus) {\n this.componentRef.setStatus(status, props);\n }\n return this;\n }\n\n private submitPayment(data): Promise {\n return this._parentInstance.session\n .submitPayment(data)\n .then(this.handleResponse)\n .catch(error => this.handleError(error));\n }\n\n private submitAdditionalDetails(data): Promise {\n return this._parentInstance.session.submitDetails(data).then(this.handleResponse).catch(this.handleError);\n }\n\n protected handleError = (error: AdyenCheckoutError): void => {\n /**\n * Set status using elementRef, which:\n * - If Drop-in, will set status for Dropin component, and then it will propagate the new status for the active payment method component\n * - If Component, it will set its own status\n */\n this.setElementStatus('ready');\n\n if (this.props.onError) {\n this.props.onError(error, this.elementRef);\n }\n };\n\n protected handleAdditionalDetails = state => {\n if (this.props.onAdditionalDetails) {\n this.props.onAdditionalDetails(state, this.elementRef);\n } else if (this.props.session) {\n this.submitAdditionalDetails(state.data);\n }\n\n return state;\n };\n\n public handleAction(action: PaymentAction, props = {}): UIElement | null {\n if (!action || !action.type) {\n if (hasOwnProperty(action, 'action') && hasOwnProperty(action, 'resultCode')) {\n throw new Error(\n 'handleAction::Invalid Action - the passed action object itself has an \"action\" property and ' +\n 'a \"resultCode\": have you passed in the whole response object by mistake?'\n );\n }\n throw new Error('handleAction::Invalid Action - the passed action object does not have a \"type\" property');\n }\n\n const paymentAction = this._parentInstance.createFromAction(action, {\n ...this.elementRef.props,\n ...props,\n onAdditionalDetails: this.handleAdditionalDetails\n });\n\n if (paymentAction) {\n this.unmount();\n return paymentAction.mount(this._node);\n }\n\n return null;\n }\n\n protected handleOrder = (response: PaymentResponse): void => {\n this.updateParent({ order: response.order });\n // in case we receive an order in any other component then a GiftCard trigger handleFinalResult\n if (this.props.onPaymentCompleted) this.props.onPaymentCompleted(response, this.elementRef);\n };\n\n protected handleFinalResult = (result: PaymentResponse) => {\n if (this.props.setStatusAutomatically) {\n const [status, statusProps] = resolveFinalResult(result);\n if (status) this.setElementStatus(status, statusProps);\n }\n\n if (this.props.onPaymentCompleted) this.props.onPaymentCompleted(result, this.elementRef);\n return result;\n };\n\n /**\n * Handles a session /payments or /payments/details response.\n * The component will handle automatically actions, orders, and final results.\n * @param rawResponse -\n */\n protected handleResponse(rawResponse: RawPaymentResponse): void {\n const response = getSanitizedResponse(rawResponse);\n\n if (response.action) {\n this.elementRef.handleAction(response.action);\n } else if (response.order?.remainingAmount?.value > 0) {\n // we don't want to call elementRef here, use the component handler\n // we do this way so the logic on handlingOrder is associated with payment method\n this.handleOrder(response);\n } else {\n this.elementRef.handleFinalResult(response);\n }\n }\n\n /**\n * Call update on parent instance\n * This function exist to make safe access to the protect _parentInstance\n * @param options - CoreOptions\n */\n public updateParent(options: CoreOptions = {}): Promise {\n return this.elementRef._parentInstance.update(options);\n }\n\n public setComponentRef = ref => {\n this.componentRef = ref;\n };\n\n /**\n * Get the current validation status of the element\n */\n get isValid(): boolean {\n return false;\n }\n\n /**\n * Get the element icon URL for the current environment\n */\n get icon(): string {\n const type = this.props.paymentMethodType || this.type;\n return this.props.icon ?? this.resources.getImage()(type);\n }\n\n /**\n * Get the element's displayable name\n */\n get displayName(): string {\n return this.props.name || this.constructor['type'];\n }\n\n /**\n * Used to display the second line of a payment method item\n */\n get additionalInfo(): string {\n return null;\n }\n\n /**\n * Get the element accessible name, used in the aria-label of the button that controls selected payment method\n */\n get accessibleName(): string {\n return this.displayName;\n }\n\n /**\n * Return the type of an element\n */\n get type(): string {\n return this.props.type || this.constructor['type'];\n }\n\n /**\n * Get the payButton component for the current element\n */\n protected payButton = (props: PayButtonFunctionProps) => {\n return ;\n };\n}\n\nexport default UIElement;\n","import { Component, h } from 'preact';\nimport classNames from 'classnames';\nimport './Iframe.scss';\n\ninterface IframeProps {\n width?: string;\n height?: string;\n minWidth?: string;\n minHeight?: string;\n border?: string;\n src?: string;\n allow?: string;\n name?: string;\n title?: string;\n classNameModifiers?: string[];\n callback?: (contentWindow) => void;\n}\n\nclass Iframe extends Component {\n public static defaultProps = {\n width: '0',\n height: '0',\n minWidth: '0',\n minHeight: '0',\n src: null,\n allow: null,\n title: 'components iframe',\n classNameModifiers: []\n };\n\n private iframeEl;\n\n iframeOnLoad() {\n if (this.props.callback && typeof this.props.callback === 'function') {\n this.props.callback(this.iframeEl.contentWindow);\n }\n }\n\n componentDidMount() {\n if (this.iframeEl.addEventListener) {\n this.iframeEl.addEventListener('load', this.iframeOnLoad.bind(this), false);\n } else if (this.iframeEl.attachEvent) {\n // IE fallback\n this.iframeEl.attachEvent('onload', this.iframeOnLoad.bind(this));\n } else {\n this.iframeEl.onload = this.iframeOnLoad.bind(this);\n }\n }\n\n componentWillUnmount() {\n if (this.iframeEl.removeEventListener) {\n this.iframeEl.removeEventListener('load', this.iframeOnLoad.bind(this), false);\n } else if (this.iframeEl.detachEvent) {\n // IE fallback\n this.iframeEl.detachEvent('onload', this.iframeOnLoad.bind(this));\n } else {\n this.iframeEl.onload = null;\n }\n }\n\n render({ name, src, width, height, minWidth, minHeight, allow, title, classNameModifiers }: IframeProps) {\n const validClassNameModifiers = classNameModifiers.filter(m => !!m);\n\n return (\n {\n this.iframeEl = ref;\n }}\n allow={allow}\n className={classNames(\n 'adyen-checkout__iframe',\n `adyen-checkout__iframe--${name}`,\n validClassNameModifiers.length && classNameModifiers.map(m => `adyen-checkout__iframe--${name}-${m}`)\n )}\n name={name}\n src={src}\n width={width}\n height={height}\n frameBorder=\"0\"\n title={title}\n /* eslint-disable react/no-unknown-property */\n referrerpolicy=\"origin\"\n min-width={minWidth}\n min-height={minHeight}\n /* eslint-enable react/no-unknown-property */\n />\n );\n }\n}\n\nexport default Iframe;\n","/**\n * Tests if a passed promise settles before a certain amount of time has elapsed\n *\n * @param ms - number of milliseconds the passed promise has to settle\n * @param promise - the passed promise\n * @param timeOutObject - the object that the promiseTimeout will reject with if the passed promise doesn't settle in time\n */\nconst promiseTimeout = (ms: number, promise: Promise, timeOutObject: object) => {\n let timer;\n\n const promiseTimer: Promise = new Promise((resolve, reject): void => {\n // Create a timeout to reject promise if not resolved\n /* eslint-disable-next-line */\n timer = setTimeout((): void => {\n reject(timeOutObject);\n }, ms);\n\n promise\n .then((res): void => {\n clearTimeout(timer);\n resolve(res);\n })\n .catch((err): void => {\n clearTimeout(timer);\n reject(err);\n });\n });\n\n const cancelTimer = (): void => {\n clearTimeout(timer);\n };\n\n return {\n promise: promiseTimer,\n cancel: cancelTimer\n };\n};\n\nexport default promiseTimeout;\n","export const RISK_DATA_VERSION = '1.0.0';\nexport const DF_VERSION = '1.0.0';\n\nexport const DEVICE_FINGERPRINT = 'deviceFingerprint';\nexport const DF_TIMEOUT = 20000;\n\nexport const FAILED_DFP_RESOLVE_OBJECT_TIMEOUT = {\n result: {\n type: DEVICE_FINGERPRINT,\n value: 'df-timedOut'\n },\n errorCode: 'timeout'\n};\n\nexport const ERRORS = {\n TIME_OUT: 'timeout',\n WRONG_ORIGIN: 'wrongOrigin',\n WRONG_DATA_TYPE: 'wrongDataType',\n MISSING_PROPERTY: 'missingProperty',\n UNKNOWN: 'unknownError'\n};\n\nexport const ERROR_MESSAGES = {\n timeout: 'iframe loading timed out',\n wrongOrigin: 'Result did not come from the expected origin',\n wrongDataType: 'Result data was not of the expected type',\n missingProperty: 'Result data did not contain the expected properties',\n unknownError: 'An unknown error occurred'\n};\n","/**\n * Centralised window.postMessage processing function used in 3DS2 components and also by the deviceFingerprinting process\n * NOTE: this latter use case means that while the deviceFingerprinting is still completing this component is also listening to\n * securedFields related postMessaging\n *\n * @param domain - expected domain for the postMesssage to have originated from\n * @param resolve - the resolve function from the Promise that called this function\n * @param reject - the reject function from the Promise that called this function\n * @param parseErrorObj - an error object to log in the case of unparseable data (albeit from a valid origin)\n * @param expectedType - string to check that the passed data has the expected type\n */\nimport { hasOwnProperty } from './hasOwnProperty';\nimport { PostMsgParseErrorObject } from '../components/ThreeDS2/types';\n\nconst getProcessMessageHandler =\n (domain: string, resolve: Function, reject: Function, expectedType: string): Function =>\n event => {\n const parseErrorObj: PostMsgParseErrorObject = {};\n const origin = event.origin || event.originalEvent.origin;\n\n if (origin !== domain) {\n return 'Message was not sent from the expected domain';\n }\n\n if (typeof event.data !== 'string') {\n return 'Event data was not of type string';\n }\n\n if (!event.data.length) {\n return 'Invalid event data string';\n }\n\n // Try to parse the data\n try {\n const feedbackObj = JSON.parse(event.data);\n if (hasOwnProperty(feedbackObj, 'type') && feedbackObj.type === expectedType) {\n resolve(feedbackObj);\n } else {\n // Silent fail - applies when RiskModule device fingerprinting is ongoing and this handler is picking up securedFields traffic\n return 'Event data was not of expected type';\n }\n } catch (e) {\n parseErrorObj.type = `${expectedType}-JSON-parse-error`;\n parseErrorObj.comment = 'failed to JSON parse event.data';\n parseErrorObj.extraInfo = `event.data = ${event.data}`;\n parseErrorObj.eventDataRaw = event.data;\n\n // TODO - decide whether to console.log/debug/error &/or call the merchant defined onError callback\n console.debug('get-process-message-handler::CATCH::Un-parseable JSON:: parseErrorObj=', parseErrorObj);\n\n return false;\n }\n\n return true;\n };\n\nexport default getProcessMessageHandler;\n","/**\n * Used to retrieve the origin from a url\n *\n * @remarks\n * Uses a regex to get origin (can't handle localhost origins)\n *\n * @param url - URL\n * @returns The origin of the url\n */\nexport const getOrigin = (url: string): string => {\n const originRegex = /^(?:([A-Za-z]+):)?(\\/{0,3})([0-9.\\-A-Za-z]+)(?::(\\d+))?(?:\\/([^?#]*))?(?:\\?([^#]*))?(?:#(.*))?$/;\n const matches = originRegex.exec(url);\n\n if (!matches) return null;\n\n const [, protocol, separator, host, port] = matches;\n\n if (!protocol || !separator || !host) return null;\n\n return `${protocol}:${separator}${host}${port ? `:${port}` : ''}`;\n};\n\nexport default getOrigin;\n","import { Component, h } from 'preact';\nimport Iframe from '../../../../components/internal/IFrame';\nimport promiseTimeout from '../../../../utils/promiseTimeout';\nimport { DEVICE_FINGERPRINT, DF_TIMEOUT, FAILED_DFP_RESOLVE_OBJECT_TIMEOUT } from '../../constants';\nimport getProcessMessageHandler from '../../../../utils/get-process-message-handler';\nimport { getOrigin } from '../../../../utils/getOrigin';\nimport { GetDeviceFingerprintProps } from './types';\n\nconst iframeName = 'dfIframe';\nconst allowProperties = 'geolocation; microphone; camera;';\n\nclass GetDeviceFingerprint extends Component {\n public postMessageDomain;\n public processMessageHandler;\n public deviceFingerPrintPromise;\n\n constructor(props) {\n super(props);\n\n this.postMessageDomain = getOrigin(this.props.loadingContext) || this.props.loadingContext;\n }\n\n getDfpPromise(): Promise {\n return new Promise((resolve, reject) => {\n /**\n * Listen for postMessage responses from the notification url\n */\n this.processMessageHandler = getProcessMessageHandler(this.postMessageDomain, resolve, reject, DEVICE_FINGERPRINT);\n\n /* eslint-disable-next-line */\n window.addEventListener('message', this.processMessageHandler);\n });\n }\n\n componentDidMount() {\n // Get device fingerprint\n this.deviceFingerPrintPromise = promiseTimeout(DF_TIMEOUT, this.getDfpPromise(), FAILED_DFP_RESOLVE_OBJECT_TIMEOUT);\n this.deviceFingerPrintPromise.promise\n .then(resolveObject => {\n this.props.onCompleteFingerprint(resolveObject);\n window.removeEventListener('message', this.processMessageHandler);\n })\n .catch(rejectObject => {\n this.props.onErrorFingerprint(rejectObject);\n window.removeEventListener('message', this.processMessageHandler);\n });\n }\n\n render({ dfpURL }) {\n return (\n

\n