Skip to content

Commit

Permalink
Merged develop into master
Browse files Browse the repository at this point in the history
  • Loading branch information
mbe1987 committed Aug 26, 2022
2 parents 8882625 + ac0fdd9 commit 10ec0c1
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 2 deletions.
4 changes: 4 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 1.6.3
* bugfix: don't apply the billing country to an existing delivery address
* add order numbers to Soap fault log messages in GKV calls

## 1.6.2
* filter out results not suitable to receive packages

Expand Down
2 changes: 1 addition & 1 deletion project.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"pathToModule": "copy_this/modules/mo/mo_dhl",
"prefix": "mo_",
"suffix": "",
"version": "1.6.2",
"version": "1.6.3",
"compatibility": {
"minimumVersion": "6.0",
"maximumVersion": null,
Expand Down
25 changes: 25 additions & 0 deletions src/modules/mo/mo_dhl/Api/GKV.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use Mediaopt\DHL\Api\GKV\Response\GetVersionResponse;
use Mediaopt\DHL\Api\GKV\Response\UpdateShipmentOrderResponse;
use Mediaopt\DHL\Api\GKV\Response\ValidateShipmentResponse;
use Mediaopt\DHL\Api\GKV\Shipment;
use Mediaopt\DHL\Api\GKV\Version;
use Mediaopt\DHL\Exception\WebserviceException;
use Psr\Log\LoggerInterface;
Expand Down Expand Up @@ -167,6 +168,7 @@ protected function callSoap($functionName, $request)
return $this->__soapCall($functionName, [$request], null, $header);
} catch (\SoapFault $exception) {
$message = __METHOD__ . " - The SOAP API call for function $functionName failed due to {$exception->getMessage()}";
$message = $this->appendOrderNr($request, $message);
$this->getLogger()->error($message, ['exception' => $exception]);
throw new WebserviceException('Failed API call.', 0, $exception);
}
Expand Down Expand Up @@ -280,4 +282,27 @@ public function buildVersion(): Version
{
return new Version(3, 0);
}

/**
* @param $request
* @param $message
* @return mixed|string
*/
protected function appendOrderNr($request, $message)
{
if (!method_exists($request, 'getShipmentOrder')) {
return $message;
}
$shipmentOrders = $request->getShipmentOrder();
$shipmentOrderNumbers = [];
foreach (is_array($shipmentOrders) ? $shipmentOrders : [$shipmentOrders] as $shipmentOrder) {
if (method_exists($shipmentOrder, 'getShipment') && $shipmentOrder->getShipment() instanceof Shipment) {
$shipmentOrderNumbers[] = $shipmentOrder->getShipment()->getShipmentDetails()->getCustomerReference();
}
}
if ($shipmentOrderNumbers) {
$message .= ' for orderNumbers: ' . implode(', ', $shipmentOrderNumbers);
}
return $message;
}
}
2 changes: 1 addition & 1 deletion src/modules/mo/mo_dhl/metadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
'en' => '<p>Enable features providing Post & Paket Delivery to your OXID shop.</p>' . '<p><a href="https://projects.mediaopt.de/projects/mopt-postp-ua/wiki" target="_blank">Handbook</a></p>',
],
'thumbnail' => 'logo.png',
'version' => '1.6.2',
'version' => '1.6.3',
'author' => '<a href="http://www.mediaopt.de" target="_blank">mediaopt.</a>',
'url' => 'http://www.mediaopt.de',
'email' => '[email protected]',
Expand Down
3 changes: 3 additions & 0 deletions src/modules/mo/mo_dhl/out/src/js/widgets/azure/mo_dhl.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,9 @@
$("[name='deladr[oxaddress__oxcountryid]']").val($("#germany-oxid").text());
},
setDeliveryCountryToBillingCountry: function () {
if ($('#delCountrySelect').val()) {
return;
}
$('#delCountrySelect').val($("#invCountrySelect").val());
}
};
Expand Down
3 changes: 3 additions & 0 deletions src/modules/mo/mo_dhl/out/src/js/widgets/flow/mo_dhl.js
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,9 @@
$("[name='deladr[oxaddress__oxcountryid]']").val($("#germany-oxid").text());
},
setDeliveryCountryToBillingCountry: function () {
if ($('#delCountrySelect').val()) {
return;
}
var invCountry = $("#invCountrySelect").val();

var label = $('#invCountrySelect').children('[value="' + invCountry + '"]').text();
Expand Down
4 changes: 4 additions & 0 deletions src/modules/mo/mo_dhl/out/src/js/widgets/wave/mo_dhl.js
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,10 @@
$("[name='deladr[oxaddress__oxcountryid]']").val($("#germany-oxid").text());
},
setDeliveryCountryToBillingCountry: function () {
if ($('#delCountrySelect').val()) {
return;
}

var invCountry = $("#invCountrySelect").val();

var label = $('#invCountrySelect').children('[value="' + invCountry + '"]').text();
Expand Down

0 comments on commit 10ec0c1

Please sign in to comment.