Closed BelginFish closed 2 years ago
Hello, have you solved this problem?I have the same problem now, can you share the solution?thank you
我看到了上载文档的示例,但是可以显示一个如何将其附加到RequestedShipment的示例吗?我假设您需要使用ShippingDocumentSpecification对象。
+1
+1
+1
@JeremyDunn
I've solved it
$CommercialInvoice = new ComplexType\CommercialInvoice();
$FreightCharge = new ComplexType\Money([
'Currency' => 'USD',
'Amount' => $this->getShippingCostForInvoice()
]);
$CommercialInvoice
->setPurpose(new SimpleType\PurposeOfShipmentType(SimpleType\PurposeOfShipmentType::_GIFT))
->setFreightCharge($FreightCharge);
//->setDeclarationStatement('bla bla');
$CustomsClearanceDetail = [
'DutiesPayment' => new ComplexType\Payment([
'PaymentType' => 'RECIPIENT', // valid values RECIPIENT, SENDER and THIRD_PARTY
]),
'DocumentContent' => 'NON_DOCUMENTS',
'CustomsValue' => new ComplexType\Money([
'Currency' => 'USD',
'Amount' => $this->getContentSummaryValue()
]),
'Commodities' => $commodities,
'ExportDetail' => new ComplexType\ExportDetail([
'B13AFilingOption' => 'NOT_REQUIRED'
]),
'CommercialInvoice' => $CommercialInvoice
];
and then add
$requestedShipment->setCustomsClearanceDetail(new ComplexType\CustomsClearanceDetail(
$CustomsClearanceDetail
));
@MarianMatys
$commodities ??????
$commodities = array();
$totalItems = $this->getContentItemsTotalPcs();
$weightPerItem = round(($this->getTotalWeight()/$totalItems), 2);
foreach ($this->getContentItems() AS $row)
{
$commodities[] = array(
'NumberOfPieces' => 1,
'Description' => Tools::removeUtf($row['description']),
'CountryOfManufacture' => 'CN',
'Weight' => array(
'Units' => 'KG',
'Value' => $weightPerItem
),
'Quantity' => $row['quantity'],
'QuantityUnits' => 'EA',
'UnitPrice' => array(
'Currency' => 'USD',
'Amount' => round((float)($row['item_value']/$row['quantity']),2)
),
'CustomsValue' => array(
'Currency' => 'USD',
'Amount' => round((float)($row['item_value']/$row['quantity']),2)
)
);
}
to @MarianMatys thanks.
I get
object(FedEx\ShipService\ComplexType\ProcessShipmentReply)#1248 (2) { ["name":protected]=> string(20) "ProcessShipmentReply" ["values":protected]=> array(3) { ["HighestSeverity"]=> string(5) "ERROR" ["Notifications"]=> array(5) { [0]=> object(FedEx\ShipService\ComplexType\Notification)#1262 (2) { ["name":protected]=> string(12) "Notification" ["values":protected]=> array(5) { ["Severity"]=> string(5) "ERROR" ["Source"]=> string(4) "ship" ["Code"]=> string(4) "6566" ["Message"]=> string(51) "CommercialInvoice FreightCharges - Invalid currency" ["LocalizedMessage"]=> string(51) "CommercialInvoice FreightCharges - Invalid currency" } }
code
` $fedex_uk = config('fedexconfig.uk'); $shipper_info = config('ukaddress'); $userCredential = new ComplexType\WebAuthenticationCredential(); $userCredential ->setKey($fedex_uk['FEDEX_KEY']) ->setPassword($fedex_uk['FEDEX_PASSWORD']);
$webAuthenticationDetail = new ComplexType\WebAuthenticationDetail();
$webAuthenticationDetail->setUserCredential($userCredential);
$clientDetail = new ComplexType\ClientDetail();
$clientDetail
->setAccountNumber($fedex_uk['FEDEX_ACCOUNT_NUMBER'])
->setMeterNumber($fedex_uk['FEDEX_METER_NUMBER']);
$version = new ComplexType\VersionId();
$version
->setMajor(26)
->setIntermediate(0)
->setMinor(0)
->setServiceId('ship');
$shipperAddress = new ComplexType\Address();
$shipperAddress
->setStreetLines(
[
$shipper_info['line_1'],
$shipper_info['line_2'],
$shipper_info['line_3'],
]
)
->setCity($shipper_info['city'])
->setStateOrProvinceCode('GB')
->setPostalCode($shipper_info['postcode'])
->setCountryCode('GB');
$shipperContact = new ComplexType\Contact();
$shipperContact
->setCompanyName(
$shipper_info['company']
)
->setEMailAddress($shipper_info['first_name'])
->setPersonName(
$shipper_info['first_name'].' '.$shipper_info['last_name']
)
->setPhoneNumber(('004477329000'));
$shipper = new ComplexType\Party();
$shipper
->setAccountNumber($fedex_uk['FEDEX_ACCOUNT_NUMBER'])
->setAddress($shipperAddress)
->setContact($shipperContact);
dump($fedex_uk, $shipper_info);
$recipientAddress = new ComplexType\Address();
$recipientAddress
->setStreetLines(['Weitlingstraße 41'])
->setCity('Berlin')
->setStateOrProvinceCode('DE')
->setPostalCode('10559')
->setCountryCode('DE');
$recipientContact = new ComplexType\Contact();
$recipientContact
->setPersonName('Calogero Pumpignano')
->setPhoneNumber('+493028420000');
$recipient = new ComplexType\Party();
$recipient
->setAddress($recipientAddress)
->setContact($recipientContact);
$labelSpecification = new ComplexType\LabelSpecification();
$labelSpecification
->setLabelStockType(new SimpleType\LabelStockType(SimpleType\LabelStockType::_PAPER_7X4POINT75))
->setImageType(new SimpleType\ShippingDocumentImageType(SimpleType\ShippingDocumentImageType::_PDF))
->setLabelFormatType(new SimpleType\LabelFormatType(SimpleType\LabelFormatType::_COMMON2D));
$packageLineItem1 = new ComplexType\RequestedPackageLineItem();
$packageLineItem1
->setSequenceNumber(1)
->setItemDescription('Product description')
->setDimensions(new ComplexType\Dimensions(array(
'Width' => 10,
'Height' => 10,
'Length' => 25,
'Units' => SimpleType\LinearUnits::_CM
)))
->setWeight(new ComplexType\Weight(array(
'Value' => 2,
'Units' => SimpleType\WeightUnits::_KG
)));
$shippingChargesPayor = new ComplexType\Payor();
$shippingChargesPayor->setResponsibleParty($shipper);
$shippingChargesPayment = new ComplexType\Payment();
$shippingChargesPayment
->setPaymentType(SimpleType\PaymentType::_SENDER)
->setPayor($shippingChargesPayor);
$requestedShipment = new ComplexType\RequestedShipment();
// dd(date('c'));
$requestedShipment->setShipTimestamp(date('c'));
$requestedShipment->setDropoffType(new SimpleType\DropoffType(SimpleType\DropoffType::_REGULAR_PICKUP));
$requestedShipment->setServiceType(new SimpleType\ServiceType(SimpleType\ServiceType::_INTERNATIONAL_ECONOMY));
$requestedShipment->setPackagingType(new SimpleType\PackagingType(SimpleType\PackagingType::_FEDEX_BOX));
$requestedShipment->setShipper($shipper);
$requestedShipment->setRecipient($recipient);
$requestedShipment->setLabelSpecification($labelSpecification);
$requestedShipment->setRateRequestTypes(array(new SimpleType\RateRequestType(SimpleType\RateRequestType::_PREFERRED)));
$requestedShipment->setPackageCount(1);
$requestedShipment->setRequestedPackageLineItems([
$packageLineItem1
]);
$requestedShipment->setShippingChargesPayment($shippingChargesPayment);
$processShipmentRequest = new ComplexType\ProcessShipmentRequest();
$processShipmentRequest->setWebAuthenticationDetail($webAuthenticationDetail);
$processShipmentRequest->setClientDetail($clientDetail);
$processShipmentRequest->setVersion($version);
$processShipmentRequest->setRequestedShipment($requestedShipment);
$CommercialInvoice = new ComplexType\CommercialInvoice();
$FreightCharge = new ComplexType\Money([
'Currency' => 'GBP',
'Amount' => 20.00
]);
$CommercialInvoice
->setPurpose(new SimpleType\PurposeOfShipmentType(SimpleType\PurposeOfShipmentType::_SOLD))
->setFreightCharge($FreightCharge);
$commodity[]= [
'NumberOfPieces' => 1,
'Description' =>'Testing Name',
'CountryOfManufacture' => 'GB',
'Weight' => [
'Units' => 'KG',
'Value' => 2
],
'Quantity' => 1,
'QuantityUnits' => 'EA',
'UnitPrice' => [
'Currency' => 'GBP',
'Amount' => 20.00
],
'CustomsValue' => array(
'Currency' => 'GBP',
'Amount' => 20.00
)
];
$CustomsClearanceDetail = [
'DutiesPayment' => new ComplexType\Payment([
'PaymentType' => 'RECIPIENT', // valid values RECIPIENT, SENDER and THIRD_PARTY
// 'Payor' => new ComplexType\Payor([
// 'ResponsibleParty' => new ComplexType\Party([
// 'AccountNumber' => FEDEX_ACCOUNT_NUMBER, // OPTIONAL
// 'Contact' => new ComplexType\Contact([]),
// 'Address' => new ComplexType\Address([])
// ])
// ])
]),
'DocumentContent' => 'NON_DOCUMENTS',
'CustomsValue' => new ComplexType\Money([
'Currency' => 'GBP',
'Amount' => 20.00
]),
'Commodities' => $commodity,
'ExportDetail' => new ComplexType\ExportDetail([
'B13AFilingOption' => 'NOT_REQUIRED'
]),
'CommercialInvoice' => $CommercialInvoice
];
$requestedShipment->setCustomsClearanceDetail(new ComplexType\CustomsClearanceDetail( $CustomsClearanceDetail ));
$shipService = new ShipService\Request();
//$shipService->getSoapClient()->__setLocation('https://ws.fedex.com:443/web-services/ship');
$result = $shipService->getProcessShipmentReply($processShipmentRequest);
var_dump($result);
`
@BelginFish @MarianMatys @ygzong @e-hop @JeremyDunn
@pcualmac you have to use 'UKL'. Not GBP Please read error message.
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.
I see the example for uploading a document, but would it be possible to show an example of how to attach this to a RequestedShipment? I'm assuming you need to use the ShippingDocumentSpecification object.