@@ -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 | |
@@ -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 { |