For each customer order, the distance seller will send a purchase order to YellowCube. For all ordered articles, a corresponding article must be submitted to the master data and physically transferred to the warehouse.
In addition, the available stock (YAFS stock) must be sufficient. Otherwise, the order is rejected. The distance seller receives a goods issue confirmation (WAR) from YellowCube whenever a WAB is issued.
An order contains the following information:
- Parameter formats
- For a comprehensive documentation of parameters and formats, please consult the YellowCube SOAP Interface manual.
Order Header
The OrderHeader
is mandatory and contains identifiers for the depositor and the customer order.
$order = new Order();
$order->setOrderHeader(new OrderHeader(
'0000040730', // DepositorNo
\uniqid('yc'), // CustomerOrderNo
date('Ymd') // CustomerOrderDate
));
Partner Address
$partner = new Partner();
$partner
->setPartnerType('WE')
->setPartnerNo('0000300020')
->setPartnerReference('LiiP AG')
->setTitle('Madame')
->setName1('We Name')
->setName2('c/o Cailler')
->setStreet('Strasse')
->setCountryCode('CH')
->setZIPCode('8057')
->setCity('Zurich')
->setPOBox('po box')
->setPhoneNo('0041793020467')
->setSMSAvisMobNo('0041793020467')
->setFaxNo('0041793020467')
->setEmail('name@test.ch')
->setLanguageCode('en');
$order->setPartnerAddress($partner);
Order Position
The PosNo
is a incrementing integer like 10, 20, 30.
$position = new Position();
$position
->setPosNo(10)
->setArticleNo('200522004')
->setEAN('714718003580')
->setPlant('Y010')
->setQuantity(1.00)
->setQuantityISO('PCE')
->setShortDescription('loral Pasty Daisie');
$order->addOrderPosition($position);
Additional Services
For a complete list of additional services, please consult the YellowCube Interface Manual.
$order
->addValueAddedService(new AdditionalShippingServices())
->addValueAddedService(new BasicShippingServices(BasicShippingServices::ECO))
->addValueAddedService(new DeliveryInstructions('ZAW3219;ZAW3222'))
->addValueAddedService(new DeliveryLocation('Last house in the street.'))
->addValueAddedService(new DeliveryPeriodeCode(DeliveryPeriodeCode::MORNING))
->addValueAddedService(new DeliveryTimeFrom('13:00'))
->addValueAddedService(new DeliveryTimeTo('15:00'))
->addValueAddedService(new DeliveryTimeJIT('14:00'))
->addValueAddedService(new DeliveryDate(date('Ymd', strtotime('+4 days'))))
->addValueAddedService(new CODAmount('150.00')) // COD amount in CHF (Cash on 153.45 Delivery).
->addValueAddedService(new CODAccountNo('010683242'))
->addValueAddedService(new CODRefNo('897201301070000097673'))
->addValueAddedService(new FrightShippingFlag('1')) // Yes, fright consignment (small consignments).
->addValueAddedService(new FloorNo('3'))
->addValueAddedService(new NotificationType(NotificationType::EMAIL))
->addValueAddedService(new NotificationServiceCode('2'));
Order Documents
You can add documents to your order by using the addOrderDocument()
method.
It is advised to use the Doc::fromFile()
factory method which reads the provided file
and base64-encodes it.
$exampleDocument = YellowCube\WAB\Doc::fromFile(
'LS', // DocType
'pdf', // DocMimeType
'../../../../../order/example-file.pdf' // FilePath
);
$order->addOrderDocument($exampleDocument);
To create a customer order, create an Order
object and pass it to
YellowCube\Service::createYCCustomerOrder($order)
.
$service = new YellowCube\Service(Config::testConfig());
$response = $service->createYCCustomerOrder($order);
echo "Successfully created order with reference {$response->getReference()}" . PHP_EOL . PHP_EOL;
print_r($response);
When running this code a GEN_Response
is returned.
Successfully created order with reference 14286
YellowCube\GEN_Response Object
(
[EventTimestamp:protected] => 2015-04-14T09:30:02Z
[MessageType:protected] => WAB
[StatusCode:protected] => 10
[StatusType:protected] => S
[StatusText:protected] => File received
[Reference:protected] => 14286
[Reference1:protected] =>
[Reference2:protected] =>
[Reference3:protected] =>
[Reference4:protected] =>
)
The reference can be used to receive a customer order status.