Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CET-494/fix: Switch to company search V2 for all address lookups #56

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<p align="center">
<img src="https://user-images.githubusercontent.com/24823946/157635240-66cf8713-3912-4db8-b729-597b376a0453.jpg" width="128" height="128"/>
<img src="view/frontend/web/images/logo.svg" width="128" height="128"/>
</p>
<h1 align="center">Two payment plugin for Magento 2.3.3 and higher</h1>
Sell to your business customers in one click. The Two payment Module simplifies B2B shopping, making it easy and safe for Merchants to offer invoices as payment method.
Expand Down Expand Up @@ -39,7 +39,7 @@ Check if your server has composer installed by running the following command:
composer –v
```

If your server doesn’t have composer installed, you can easily install it by using this manual: https://getcomposer.org/doc/00-intro.md
If your server doesn’t have composer installed, you can easily install it by using this manual: <https://getcomposer.org/doc/00-intro.md>

Step-by-step to install the Magento® 2 extension through Composer:

Expand Down
2 changes: 1 addition & 1 deletion bumpver.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tool.bumpver]
current_version = "1.6.5"
current_version = "1.6.6"
version_pattern = "MAJOR.MINOR.PATCH[-TAGNUM]"
commit_message = "chore: Bump version {old_version} -> {new_version}"
commit = true
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "two-inc/magento2",
"description": "Two B2B BNPL payments extension",
"type": "magento2-module",
"version": "1.6.5",
"version": "1.6.6",
"license": [
"OSL-3.0",
"AFL-3.0"
Expand Down
2 changes: 1 addition & 1 deletion etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<payment>
<two_payment>
<active>1</active>
<version>1.6.5</version>
<version>1.6.6</version>
<title>Business invoice - 30 days</title>
<mode>sandbox</mode>
<invoice_type>FUNDED_INVOICE</invoice_type>
Expand Down
38 changes: 10 additions & 28 deletions view/frontend/web/js/view/address-autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,34 +71,16 @@ define([
},
addressLookup: function (selectedCompany, countryCode) {
const self = this;
if (countryCode.toLowerCase() == 'gb') {
// Use legacy address search for GB
const addressResponse = $.ajax({
dataType: 'json',
url: `${config.checkoutApiUrl}/v1/${countryCode}/company/${selectedCompany.companyId}/address`
});
addressResponse.done(function (response) {
if (response.address) {
self.setAddressData({
city: response.address.city,
postal_code: response.address.postalCode,
street_address: response.address.streetAddress
});
}
});
} else {
// Use new address lookup for unsupported country codes
const addressResponse = $.ajax({
dataType: 'json',
url: `${config.checkoutApiUrl}/companies/v2/company/${selectedCompany.lookupId}`
});
addressResponse.done(function (response) {
// Use new address lookup by default
if (response.addresses) {
self.setAddressData(response.addresses[0]);
}
});
}
const addressResponse = $.ajax({
dataType: 'json',
url: `${config.checkoutApiUrl}/companies/v2/company/${selectedCompany.lookupId}`
});
addressResponse.done(function (response) {
// Use new address lookup by default
if (response.addresses) {
self.setAddressData(response.addresses[0]);
}
});
},
enableCompanySearch: function () {
if (!config.isCompanySearchEnabled) return;
Expand Down