Skip to content

Commit e4d2b68

Browse files
committed
VERSION 3.2.1
1 parent a430017 commit e4d2b68

File tree

3 files changed

+61
-15
lines changed

3 files changed

+61
-15
lines changed

admin/controller/payment/paypal.php

Lines changed: 59 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,26 @@ public function index(): void {
108108
$webhook_id = $result['id'];
109109
}
110110

111+
$merchant_id = $this->request->get['merchantIdInPayPal'];
112+
113+
$result = $paypal->getSellerStatus($config_setting['partner'][$environment]['partner_id'], $merchant_id);
114+
115+
$fastlane_status = false;
116+
117+
if (!empty($result['capabilities'])) {
118+
foreach ($result['capabilities'] as $capability) {
119+
if (($capability['name'] == 'FASTLANE_CHECKOUT') && ($capability['status'] == 'ACTIVE')) {
120+
$fastlane_status = true;
121+
}
122+
}
123+
}
124+
125+
$country_code = '';
126+
127+
if (!empty($result['country'])) {
128+
$country_code = $result['country'];
129+
}
130+
111131
if ($paypal->hasErrors()) {
112132
$error_messages = [];
113133

@@ -129,9 +149,7 @@ public function index(): void {
129149

130150
$this->error['warning'] = implode(' ', $error_messages);
131151
}
132-
133-
$merchant_id = $this->request->get['merchantIdInPayPal'];
134-
152+
135153
$setting = $this->model_setting_setting->getSetting('payment_paypal');
136154

137155
$setting['payment_paypal_environment'] = $environment;
@@ -147,13 +165,18 @@ public function index(): void {
147165
$setting['payment_paypal_setting']['general']['callback_token'] = $callback_token;
148166
$setting['payment_paypal_setting']['general']['webhook_token'] = $webhook_token;
149167
$setting['payment_paypal_setting']['general']['cron_token'] = $cron_token;
150-
151-
$this->load->model('localisation/country');
168+
$setting['payment_paypal_setting']['fastlane']['status'] = $fastlane_status;
169+
170+
if (!empty($country_code)) {
171+
$setting['payment_paypal_setting']['general']['country_code'] = $country_code;
172+
} else {
173+
$this->load->model('localisation/country');
152174

153-
$country = $this->model_localisation_country->getCountry($this->config->get('config_country_id'));
175+
$country = $this->model_localisation_country->getCountry($this->config->get('config_country_id'));
154176

155-
$setting['payment_paypal_setting']['general']['country_code'] = $country['iso_code_2'];
156-
177+
$setting['payment_paypal_setting']['general']['country_code'] = $country['iso_code_2'];
178+
}
179+
157180
$currency_code = $this->config->get('config_currency');
158181
$currency_value = $this->currency->getValue($this->config->get('config_currency'));
159182

@@ -1811,6 +1834,24 @@ public function connect(): void {
18111834
if (isset($result['id'])) {
18121835
$webhook_id = $result['id'];
18131836
}
1837+
1838+
$result = $paypal->getSellerStatus($config_setting['partner'][$environment]['partner_id'], $merchant_id);
1839+
1840+
$fastlane_status = false;
1841+
1842+
if (!empty($result['capabilities'])) {
1843+
foreach ($result['capabilities'] as $capability) {
1844+
if (($capability['name'] == 'FASTLANE_CHECKOUT') && ($capability['status'] == 'ACTIVE')) {
1845+
$fastlane_status = true;
1846+
}
1847+
}
1848+
}
1849+
1850+
$country_code = '';
1851+
1852+
if (!empty($result['country'])) {
1853+
$country_code = $result['country'];
1854+
}
18141855

18151856
if ($paypal->hasErrors()) {
18161857
$error_messages = [];
@@ -1852,13 +1893,18 @@ public function connect(): void {
18521893
$setting['payment_paypal_setting']['general']['callback_token'] = $callback_token;
18531894
$setting['payment_paypal_setting']['general']['webhook_token'] = $webhook_token;
18541895
$setting['payment_paypal_setting']['general']['cron_token'] = $cron_token;
1855-
1856-
$this->load->model('localisation/country');
1896+
$setting['payment_paypal_setting']['fastlane']['status'] = $fastlane_status;
1897+
1898+
if (!empty($country_code)) {
1899+
$setting['payment_paypal_setting']['general']['country_code'] = $country_code;
1900+
} else {
1901+
$this->load->model('localisation/country');
18571902

1858-
$country = $this->model_localisation_country->getCountry($this->config->get('config_country_id'));
1903+
$country = $this->model_localisation_country->getCountry($this->config->get('config_country_id'));
18591904

1860-
$setting['payment_paypal_setting']['general']['country_code'] = $country['iso_code_2'];
1861-
1905+
$setting['payment_paypal_setting']['general']['country_code'] = $country['iso_code_2'];
1906+
}
1907+
18621908
$currency_code = $this->config->get('config_currency');
18631909
$currency_value = $this->currency->getValue($this->config->get('config_currency'));
18641910

install.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "PayPal",
33
"code": "paypal",
44
"license": "GPL",
5-
"version": "3.2.0",
5+
"version": "3.2.1",
66
"author": "Dreamvention",
77
"link": "https://dreamvention.com/"
88
}

system/config/paypal.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
$_['paypal_setting'] = [
3-
'version' => '3.2.0',
3+
'version' => '3.2.1',
44
'partner' => [
55
'production' => [
66
'partner_id' => 'TY2Q25KP2PX9L',

0 commit comments

Comments
 (0)