定制 lqt/loqate-integration 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

lqt/loqate-integration

Composer 安装命令:

composer require lqt/loqate-integration

包简介

Performs address capture and data validation (email, phone number and address) using Loqate API.

README 文档

README

What is the Loqate API Integration?

Performs address capture and data validation (email, phone number and address) using Loqate API.

Download

Download via composer

Request composer to fetch the module:

composer require loqate-integration/adobe

Manual Download

Download & copy the git content to /app/code/Loqate/ApiIntegration.

Install

Please run the following commands after you download the module.

php bin/magento module:enable Loqate_ApiIntegration
php bin/magento setup:upgrade
php bin/magento setup:di:compile

Configuration Instructions

The configuration for the module is located under Stores -> Configuration -> Loqate.

Magento 2 DevContainer Setup

This repository includes a devcontainer for rapid Magento 2 extension development.

Quick Start

  1. Create a devcontainer.env: Before opening the devcontainer you will need to create a devcontainer.env file which you can copy from devcontainer.env.example.
  2. Open in VS Code: Use the "Reopen in Container" command (requires the Remote - Containers extension).
  3. Wait for Setup: The devcontainer will build, install dependencies, and set up Magento 2 automatically.
  4. Access Magento:
  5. Live Extension Development: Your extension source is mounted into the running Magento instance. Changes are reflected immediately after running bin/magento setup:upgrade and clearing cache.

Services

  • PHP-FPM (8.1)
  • Nginx
  • MySQL 8
  • Opensearch
  • Redis

Notes

  • The first startup may take several minutes (Magento install, Composer, DB setup).
  • The extension is symlinked into app/code/Loqate/ApiIntegration.
  • To re-run setup, use .devcontainer/setup-magento.sh inside the container.
  • If you have any DNS issues, you will need to copy your Zscaler certificate into the PHP container - see the Zscaler workaround comment in the Dockerfile.

Useful helpers

  • php -r '$e=include "app/etc/env.php"; $d=$e["db"]["connection"]["default"]; printf("mysql -h%s -u%s -p%s %s\n",$d["host"],$d["username"],$d["password"],$d["dbname"]);' Will extract the command to access mysql within the devcontainer, currently that command is mysql -hdb -umagento -pmagento magento
  • bin/magento config:show will list all of the config currently set in the instance, this can be set with bin/magento config:set <PATH> <VALUE>

Testing

Automated unit tests

Unit tests live under Test/Unit and run with Magento's unit test suite. From the Magento root of an instance that has the module installed:

# Module installed via composer:
vendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist \
  vendor/gbg-loqate/loqate-integration/Test/Unit

# Module installed under app/code:
vendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist \
  app/code/Loqate/ApiIntegration/Test/Unit

Test/Unit/Helper/ValidatorTest.php covers the captured-address (Loqate lookup) bypass: array-street parsing, that a looked-up address is recognised across countries (e.g. UK province-name vs region, US CA vs California), case/whitespace tolerance, and the guards that a different or empty address is not bypassed.

Manual testing (checkout flow)

Prerequisites (Admin → Stores → Configuration → Loqate, or bin/magento config:set):

  • loqate_settings/settings/api_key — a valid Loqate API key
  • loqate_settings/address_settings/enable_checkout = 1 (verification enabled at checkout)
  • Capture/lookup enabled on checkout
  • Optional: set strict thresholds under loqate_settings/verify_threshold_settings so a hand-typed address would be rejected, making the bypass behaviour obvious

Verify a looked-up address is accepted (the main regression):

  1. Go to checkout (guest or logged-in).
  2. Use the Loqate lookup and select a suggested address from the dropdown — do not hand-type it.
  3. Proceed through shipping / place order. The address should be accepted and checkout should proceed (the selected address bypasses re-verification).

Different-country checks (the bypass is locale-agnostic):

  • US — lookup returns the state as a full name (e.g. California) while Magento stores the region as CA; the address should still be accepted.
  • UK — lookup an address with no region; should be accepted.

Guard checks (verification is still active):

  • Hand-type an invalid address without using the lookup → verification still fires and rejects it.
  • Select a lookup address, then edit a field (e.g. the street) → it is re-verified, since it no longer matches the captured address.

Observe via logs — a bypassed (captured) address makes no verify API call, whereas a hand-typed one does:

tail -f var/log/loqate*.log

Deployment

Releasing a new version requires two separate deployments: one to the Adobe Marketplace and one via Composer. Before proceeding with either, update the version number in both composer.json and etc/module.xml to reflect the new release, then commit and push the change.

Note that the Git tag for the Composer release is created automatically when changes are merged to master — see the Composer section below.

Adobe Marketplace

  1. Create a zip of the whole repository. Ensure that .devcontainer, .git and .gitignore are excluded, as the Magento malware scan does not allow them to be uploaded. The following command will produce a clean archive:
    zip -r loqate-integration.zip . -x "*.git*" -x "*.devcontainer*"
  2. Log in to your Adobe account at account.magento.com.
  3. Navigate to the extension versions page on the Adobe Commerce Developer Portal.
  4. Upload the zip archive.
  5. Adobe will automatically process and scan the submission. This can take up to 15 business days if a manual approval is required.
    • If the scan fails, review the provided feedback, address the reported issues, and resubmit.
    • If the scan passes, the extension will be published to the marketplace within the hour.

Composer

The Git tag for a Composer release is created automatically. When changes are merged to master, the auto-tag.yml GitHub Action analyses the commits since the previous tag and creates a new version tag based on Conventional Commits:

  • feat: commits → MINOR bump (e.g. v2.0.4v2.1.0)
  • fix: commits → PATCH bump (e.g. v2.0.4v2.0.5)
  • feat!: or BREAKING CHANGE:MAJOR bump (e.g. v2.0.4v3.0.0)
  • Other types (docs:, style:, refactor:, etc.) → no bump (no tag created)

If none of the commits since the previous tag are feat:, fix:, or a breaking change, no tag is created and no release is published — so commits like docs:, chore:, ci:, refactor:, etc. can be merged to master without cutting a release. When a release is cut, the workflow also publishes a GitHub release with an auto-generated changelog. Once the new tag is pushed, Composer will automatically detect it and make the release available on packagist.

To ensure a release is tagged correctly, make sure your commit messages follow the Conventional Commits format.

lqt/loqate-integration 适用场景与选型建议

lqt/loqate-integration 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 11.93k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2024 年 11 月 19 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 lqt/loqate-integration 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 lqt/loqate-integration 我们能提供哪些服务?
定制开发 / 二次开发

基于 lqt/loqate-integration 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 11.93k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 17
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 1
  • 开发语言: JavaScript

其他信息

  • 授权协议: Unknown
  • 更新时间: 2024-11-19