@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | /** |
| 22 | - * @return transportationShipmentCharge |
|
| 22 | + * @return ShipmentCharge |
|
| 23 | 23 | */ |
| 24 | 24 | public function getTransportationShipmentCharge() |
| 25 | 25 | { |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /** |
| 46 | - * @return dutiesAndTaxesShipmentCharge |
|
| 46 | + * @return ShipmentCharge |
|
| 47 | 47 | */ |
| 48 | 48 | public function getDutiesAndTaxesShipmentCharge() |
| 49 | 49 | { |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | public function setShipmentCharge(ShipmentCharge $shipmentCharge) |
| 34 | 34 | { |
| 35 | 35 | if ($shipmentCharge->getType() == ShipmentCharge::SHIPMENT_CHARGE_TYPE_TRANSPORTATION) { |
| 36 | - $this->transportationShipmentCharge = $shipmentCharge; |
|
| 36 | + $this->transportationShipmentCharge = $shipmentCharge; |
|
| 37 | 37 | } else if ($shipmentCharge->getType() == ShipmentCharge::SHIPMENT_CHARGE_TYPE_DUTIES) { |
| 38 | 38 | $this->dutiesAndTaxesShipmentCharge = $shipmentCharge; |
| 39 | 39 | } else { |
@@ -310,60 +310,60 @@ |
||
| 310 | 310 | |
| 311 | 311 | for ($shipmentChargeRec = 1; $shipmentChargeRec <= 2; $shipmentChargeRec++) { |
| 312 | 312 | |
| 313 | - if ($shipmentChargeRec == 1) { |
|
| 314 | - $rec = $shipment->getItemizedPaymentInformation()->getTransportationShipmentCharge(); |
|
| 315 | - if ($rec == null) continue; |
|
| 316 | - $node = $paymentNode->appendChild($xml->createElement('ShipmentCharge')); |
|
| 317 | - $node->appendChild($xml->createElement('Type', \Ups\Entity\ShipmentCharge::SHIPMENT_CHARGE_TYPE_TRANSPORTATION)); |
|
| 318 | - } else { |
|
| 319 | - $rec = $shipment->getItemizedPaymentInformation()->getDutiesAndTaxesShipmentCharge(); |
|
| 320 | - if ($rec == null) continue; |
|
| 321 | - $node = $paymentNode->appendChild($xml->createElement('ShipmentCharge')); |
|
| 322 | - $node->appendChild($xml->createElement('Type', \Ups\Entity\ShipmentCharge::SHIPMENT_CHARGE_TYPE_DUTIES)); |
|
| 323 | - } |
|
| 313 | + if ($shipmentChargeRec == 1) { |
|
| 314 | + $rec = $shipment->getItemizedPaymentInformation()->getTransportationShipmentCharge(); |
|
| 315 | + if ($rec == null) continue; |
|
| 316 | + $node = $paymentNode->appendChild($xml->createElement('ShipmentCharge')); |
|
| 317 | + $node->appendChild($xml->createElement('Type', \Ups\Entity\ShipmentCharge::SHIPMENT_CHARGE_TYPE_TRANSPORTATION)); |
|
| 318 | + } else { |
|
| 319 | + $rec = $shipment->getItemizedPaymentInformation()->getDutiesAndTaxesShipmentCharge(); |
|
| 320 | + if ($rec == null) continue; |
|
| 321 | + $node = $paymentNode->appendChild($xml->createElement('ShipmentCharge')); |
|
| 322 | + $node->appendChild($xml->createElement('Type', \Ups\Entity\ShipmentCharge::SHIPMENT_CHARGE_TYPE_DUTIES)); |
|
| 323 | + } |
|
| 324 | 324 | |
| 325 | - if ($rec->getBillShipper()) { |
|
| 326 | - $node = $node->appendChild($xml->createElement('BillShipper')); |
|
| 325 | + if ($rec->getBillShipper()) { |
|
| 326 | + $node = $node->appendChild($xml->createElement('BillShipper')); |
|
| 327 | 327 | |
| 328 | - $billShipper = $rec->getBillShipper(); |
|
| 329 | - if (isset($billShipper) && $rec->getBillShipper()->getAccountNumber()) { |
|
| 330 | - $node->appendChild($xml->createElement('AccountNumber', $rec->getBillShipper()->getAccountNumber())); |
|
| 331 | - } elseif (isset($billShipper) && $rec->getBillShipper()->getCreditCard()) { |
|
| 332 | - $ccNode = $node->appendChild($xml->createElement('CreditCard')); |
|
| 333 | - $ccNode->appendChild($xml->createElement('Type', $rec->getBillShipper()->getCreditCard()->getType())); |
|
| 334 | - $ccNode->appendChild($xml->createElement('Number', $rec->getBillShipper()->getCreditCard()->getNumber())); |
|
| 335 | - $ccNode->appendChild($xml->createElement('ExpirationDate', $rec->getBillShipper()->getCreditCard()->getExpirationDate())); |
|
| 328 | + $billShipper = $rec->getBillShipper(); |
|
| 329 | + if (isset($billShipper) && $rec->getBillShipper()->getAccountNumber()) { |
|
| 330 | + $node->appendChild($xml->createElement('AccountNumber', $rec->getBillShipper()->getAccountNumber())); |
|
| 331 | + } elseif (isset($billShipper) && $rec->getBillShipper()->getCreditCard()) { |
|
| 332 | + $ccNode = $node->appendChild($xml->createElement('CreditCard')); |
|
| 333 | + $ccNode->appendChild($xml->createElement('Type', $rec->getBillShipper()->getCreditCard()->getType())); |
|
| 334 | + $ccNode->appendChild($xml->createElement('Number', $rec->getBillShipper()->getCreditCard()->getNumber())); |
|
| 335 | + $ccNode->appendChild($xml->createElement('ExpirationDate', $rec->getBillShipper()->getCreditCard()->getExpirationDate())); |
|
| 336 | 336 | |
| 337 | - if ($rec->getBillShipper()->getCreditCard()->getSecurityCode()) { |
|
| 338 | - $ccNode->appendChild($xml->createElement('SecurityCode', $rec->getBillShipper()->getCreditCard()->getSecurityCode())); |
|
| 339 | - } |
|
| 337 | + if ($rec->getBillShipper()->getCreditCard()->getSecurityCode()) { |
|
| 338 | + $ccNode->appendChild($xml->createElement('SecurityCode', $rec->getBillShipper()->getCreditCard()->getSecurityCode())); |
|
| 339 | + } |
|
| 340 | 340 | |
| 341 | - if ($rec->getBillShipper()->getCreditCard()->getAddress()) { |
|
| 342 | - $ccNode->appendChild($rec->getBillShipper()->getCreditCard()->getAddress()->toNode($xml)); |
|
| 343 | - } |
|
| 344 | - } |
|
| 345 | - } else if ($rec->getBillReceiver()) { |
|
| 346 | - // TODO not done yet |
|
| 347 | - } elseif ($rec->getBillThirdParty()) { |
|
| 348 | - $node = $node->appendChild($xml->createElement('BillThirdParty')); |
|
| 349 | - $btpNode = $node->appendChild($xml->createElement('BillThirdPartyShipper')); |
|
| 350 | - $btpNode->appendChild($xml->createElement('AccountNumber', $rec->getBillThirdParty()->getAccountNumber())); |
|
| 341 | + if ($rec->getBillShipper()->getCreditCard()->getAddress()) { |
|
| 342 | + $ccNode->appendChild($rec->getBillShipper()->getCreditCard()->getAddress()->toNode($xml)); |
|
| 343 | + } |
|
| 344 | + } |
|
| 345 | + } else if ($rec->getBillReceiver()) { |
|
| 346 | + // TODO not done yet |
|
| 347 | + } elseif ($rec->getBillThirdParty()) { |
|
| 348 | + $node = $node->appendChild($xml->createElement('BillThirdParty')); |
|
| 349 | + $btpNode = $node->appendChild($xml->createElement('BillThirdPartyShipper')); |
|
| 350 | + $btpNode->appendChild($xml->createElement('AccountNumber', $rec->getBillThirdParty()->getAccountNumber())); |
|
| 351 | 351 | |
| 352 | - $tpNode = $btpNode->appendChild($xml->createElement('ThirdParty')); |
|
| 353 | - $addressNode = $tpNode->appendChild($xml->createElement('Address')); |
|
| 352 | + $tpNode = $btpNode->appendChild($xml->createElement('ThirdParty')); |
|
| 353 | + $addressNode = $tpNode->appendChild($xml->createElement('Address')); |
|
| 354 | 354 | |
| 355 | - $thirdPartAddress = $rec->getBillThirdParty()->getThirdPartyAddress(); |
|
| 356 | - if (isset($thirdPartAddress) && $rec->getBillThirdParty()->getThirdPartyAddress()->getPostalCode()) { |
|
| 357 | - $addressNode->appendChild($xml->createElement('PostalCode', $rec->getBillThirdParty()->getThirdPartyAddress()->getPostalCode())); |
|
| 358 | - } |
|
| 355 | + $thirdPartAddress = $rec->getBillThirdParty()->getThirdPartyAddress(); |
|
| 356 | + if (isset($thirdPartAddress) && $rec->getBillThirdParty()->getThirdPartyAddress()->getPostalCode()) { |
|
| 357 | + $addressNode->appendChild($xml->createElement('PostalCode', $rec->getBillThirdParty()->getThirdPartyAddress()->getPostalCode())); |
|
| 358 | + } |
|
| 359 | 359 | |
| 360 | - $addressNode->appendChild($xml->createElement('CountryCode', $rec->getBillThirdParty()->getThirdPartyAddress()->getCountryCode())); |
|
| 361 | - } elseif ($rec->getConsigneeBilled()) { |
|
| 362 | - $node->appendChild($xml->createElement('ConsigneeBilled')); |
|
| 363 | - } |
|
| 360 | + $addressNode->appendChild($xml->createElement('CountryCode', $rec->getBillThirdParty()->getThirdPartyAddress()->getCountryCode())); |
|
| 361 | + } elseif ($rec->getConsigneeBilled()) { |
|
| 362 | + $node->appendChild($xml->createElement('ConsigneeBilled')); |
|
| 363 | + } |
|
| 364 | 364 | } |
| 365 | 365 | if ($shipment->getItemizedPaymentInformation()->getSplitDutyVATIndicator()) { |
| 366 | - $paymentNode->appendChild($xml->createElement('SplitDutyVATIndicator')); |
|
| 366 | + $paymentNode->appendChild($xml->createElement('SplitDutyVATIndicator')); |
|
| 367 | 367 | } |
| 368 | 368 | } |
| 369 | 369 | |
@@ -308,7 +308,7 @@ |
||
| 308 | 308 | } elseif ($shipment->getItemizedPaymentInformation()) { |
| 309 | 309 | $paymentNode = $shipmentNode->appendChild($xml->createElement('ItemizedPaymentInformation')); |
| 310 | 310 | |
| 311 | - for ($shipmentChargeRec = 1; $shipmentChargeRec <= 2; $shipmentChargeRec++) { |
|
| 311 | + for ($shipmentChargeRec = 1; $shipmentChargeRec <= 2; $shipmentChargeRec++) { |
|
| 312 | 312 | |
| 313 | 313 | if ($shipmentChargeRec == 1) { |
| 314 | 314 | $rec = $shipment->getItemizedPaymentInformation()->getTransportationShipmentCharge(); |
@@ -312,12 +312,16 @@ |
||
| 312 | 312 | |
| 313 | 313 | if ($shipmentChargeRec == 1) { |
| 314 | 314 | $rec = $shipment->getItemizedPaymentInformation()->getTransportationShipmentCharge(); |
| 315 | - if ($rec == null) continue; |
|
| 315 | + if ($rec == null) { |
|
| 316 | + continue; |
|
| 317 | + } |
|
| 316 | 318 | $node = $paymentNode->appendChild($xml->createElement('ShipmentCharge')); |
| 317 | 319 | $node->appendChild($xml->createElement('Type', \Ups\Entity\ShipmentCharge::SHIPMENT_CHARGE_TYPE_TRANSPORTATION)); |
| 318 | 320 | } else { |
| 319 | 321 | $rec = $shipment->getItemizedPaymentInformation()->getDutiesAndTaxesShipmentCharge(); |
| 320 | - if ($rec == null) continue; |
|
| 322 | + if ($rec == null) { |
|
| 323 | + continue; |
|
| 324 | + } |
|
| 321 | 325 | $node = $paymentNode->appendChild($xml->createElement('ShipmentCharge')); |
| 322 | 326 | $node->appendChild($xml->createElement('Type', \Ups\Entity\ShipmentCharge::SHIPMENT_CHARGE_TYPE_DUTIES)); |
| 323 | 327 | } |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | * @param BillShipper $billShipper |
| 86 | 86 | * @return ShipmentCharge |
| 87 | 87 | */ |
| 88 | - public function setBillShipper(BillShipper $billShipper= null) |
|
| 88 | + public function setBillShipper(BillShipper $billShipper = null) |
|
| 89 | 89 | { |
| 90 | 90 | $this->billShipper = $billShipper; |
| 91 | 91 | |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | * @param BillReceiver $billReceiver |
| 105 | 105 | * @return ShipmentCharge |
| 106 | 106 | */ |
| 107 | - public function setBillReceiver(BillReceiver $billReceiver= null) |
|
| 107 | + public function setBillReceiver(BillReceiver $billReceiver = null) |
|
| 108 | 108 | { |
| 109 | 109 | $this->billReceiver = $billReceiver; |
| 110 | 110 | |