Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unregisteredparcellockermember #29

Open
webrectoversocreationbe opened this issue May 29, 2017 · 6 comments
Open

unregisteredparcellockermember #29

webrectoversocreationbe opened this issue May 29, 2017 · 6 comments

Comments

@webrectoversocreationbe
Copy link

webrectoversocreationbe commented May 29, 2017

line 128 of antidot-be/bpost-api-library/src/Bpost/Order/Box/National/ParcelLockerReducedMobilityZone.php

    $tagName = $this->getPrefixedTagName('unregisteredParcelLockerMember', $prefix);

should be :

    $tagName = $this->getPrefixedTagName('unregistered', $prefix);

because i've had "invalid response: Error in request: cvc-complex-type.2.4.a: Invalid content was found starting with element 'unregisteredParcelLockerMember'. One of '{"http://schema.post.be/shm/deepintegration/v3/national":memberId, "http://schema.post.be/shm/deepintegration/v3/national":unregistered}' is expected."

@webrectoversocreationbe
Copy link
Author

Hello,
I use your classes to speak with bpost, thanks for your work, everything seems ok.
I can create manualy orders for theses modes and print label :

  • at home national
  • at home international
  • pugo national
  • bpost247 national

Since your last pulls, Bpost added a new delivery method : AtIntlPugo (point d'enlèvement international)
May i ask some help to implement a new class to manage it ? it's a mix of pugo and international...

maybe we can talk with email ? : web@rectoversocreation.be
thanks again

@motchju
Copy link

motchju commented Jun 25, 2018

Hello,

Sorry to use this issue, however I can see you were able to use at home international.

Do you have a working exemple ? I can't make it work

@webrectoversocreationbe
Copy link
Author

Hello,
voici un bout de code qui devrait t'aider :
`include('autoload.php');
global $pref; // some data from my shop
use Bpost\BpostApiClient\Bpost;
use Bpost\BpostApiClient\Bpost\Order;
use Bpost\BpostApiClient\Bpost\Order\Address;
use Bpost\BpostApiClient\Bpost\Order\Box;
use Bpost\BpostApiClient\Bpost\Order\Box\AtBpost;
use Bpost\BpostApiClient\Bpost\Order\Box\AtHome;
use Bpost\BpostApiClient\Bpost\Order\Box\At247;
use Bpost\BpostApiClient\Bpost\Order\Box\AtIntlPugo;
use Bpost\BpostApiClient\Bpost\Order\Box\CustomsInfo\CustomsInfo;
use Bpost\BpostApiClient\Bpost\Order\Box\National;
use Bpost\BpostApiClient\Bpost\Order\Box\National\UnregisteredParcelLockerMember;
use Bpost\BpostApiClient\Bpost\Order\Box\International;
use Bpost\BpostApiClient\Bpost\Order\Box\Option\Insurance;
use Bpost\BpostApiClient\Bpost\Order\Box\Option\Messaging;
use Bpost\BpostApiClient\Bpost\Order\Line;
use Bpost\BpostApiClient\Bpost\Order\PugoAddress;
use Bpost\BpostApiClient\Bpost\Order\PugoAddressIntl;
use Bpost\BpostApiClient\Bpost\Order\ParcelsDepotAddress;
use Bpost\BpostApiClient\Bpost\Order\Receiver;
use Bpost\BpostApiClient\Bpost\Order\Sender;
use Bpost\BpostApiClient\Bpost\ProductConfiguration\Product;
use Bpost\BpostApiClient\Bpost\Labels;
use Bpost\BpostApiClient\Bpost\Label;
use Bpost\BpostApiClient\Bpost\Label\Barcode;
use Bpost\BpostApiClient\Bpost\CreateLabelInBulkForOrders;
use Bpost\BpostApiClient\Common\ValidatedValue\LabelFormat;
use Bpost\BpostApiClient\BpostException;
use Bpost\BpostApiClient\Bpack247;
use Bpost\BpostApiClient\Geo6;
use Bpost\BpostApiClient\Common\BasicAttribute\EmailAddressCharacteristic;
use Bpost\BpostApiClient\Common\BasicAttribute\Language;
use Bpost\BpostApiClient\Common\BasicAttribute\PhoneNumber;
use Bpost\BpostApiClient\Common\ComplexAttribute;

use Bpost\BpostApiClient\Bpost\ProductConfiguration;
use Bpost\BpostApiClient\Exception\BpostApiResponseException\BpostCurlException;
use Bpost\BpostApiClient\Exception\BpostApiResponseException\BpostInvalidResponseException;
use Bpost\BpostApiClient\Exception\BpostApiResponseException\BpostInvalidSelectionException;
use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidValueException;
use Bpost\BpostApiClient\Exception\XmlException\BpostXmlInvalidItemException;
use Psr\Log\LoggerInterface;

function creenouvcdeINT($refcde,$adrlivr,$cli,$nbbox) {
global $pref;
$apiUsername=$pref['BPostUser']; // your user num
$apiPassword=$pref['BPostPassPhrase']; // your secret
$apiUrl = $pref['BPostUrl']; //https://api-parcel.bpost.be/services/shm
$costcenter=$pref['BPostCostCenter']; // your shop
$bpost = new Bpost($apiUsername, $apiPassword, $apiUrl);
try {
// nouvelle commande
$order = new Order($costcenter.$refcde);
$order->setCostCenter($costcenter);
// sender
$address = new Address();
$address->setStreetName($pref['BPostExpAdresse']);
$address->setNumber($pref['BPostExpNum']);
$address->setPostalCode($pref['BPostExpCP']);
$address->setLocality($pref['BPostExpVille']);
$address->setCountryCode($pref['BPostExpPays']);
$sender = new Sender();
$sender->setAddress($address);
$sender->setName($pref['BPostExpNom']);
$sender->setCompany($pref['BPostExpSociete']);
$sender->setPhoneNumber($pref['BPostExpTel']);
$sender->setEmailAddress($pref['BPostExpEmail']);
// chaque boite
for($cptb=0;$cptb<$nbbox;$cptb++) {
$box[$cptb] = new Box();
$box[$cptb]->setSender($sender);
$box[$cptb]->setRemark($costcenter.$refcde.' - '.$pref['BPostExpRemarque']);
// receiver
$address = new Address();
$address->setStreetName(GetStreetName($adrlivr['Adresse']));
$address->setNumber(+($adrlivr['NumR']));
$address->setPostalCode($adrlivr['CP']);
$address->setLocality($adrlivr['Ville']);
$address->setCountryCode($adrlivr['Pays']);
$receiver = new Receiver();
$receiver->setAddress($address);
$receiver->setName($adrlivr['Prenom'].' '.$adrlivr['Nom']);
$receiver->setCompany($adrlivr['Societe']);
$receiver->setPhoneNumber($cli['Tel']);
$receiver->setEmailAddress($cli['Email']);
// mode envoi
$customsInfo = new CustomsInfo();
$customsInfo->setParcelValue(700);
$customsInfo->setContentDescription('Marchandise');
$customsInfo->setShipmentType($pref['BPostShipmentType']);
$customsInfo->setParcelReturnInstructions($pref['BPostReturnInstruction']);
$customsInfo->setPrivateAddress(false);
$international = new International();
$international->setProduct('bpack World Express Pro');
$international->setReceiver($receiver);
$international->setParcelWeight(1000);
$international->setCustomsInfo($customsInfo);
$box[$cptb]->setInternationalBox($international);
$order->addBox($box[$cptb]);
}
// maj/création
$resp = $bpost->createOrReplaceOrder($order);
return true;
} catch (Exception $e) {
$bposterr=1;
return false;
}
}`

@motchju
Copy link

motchju commented Jun 25, 2018

This is what I was using already, the respond from Bpost is

The delivery method bpack BUSINESS with product group bpack World Express Pro is not valid for the country FR (receiver)

I guess I need to focus more on the Bpost documentation !

@webrectoversocreationbe
Copy link
Author

try on the bpost manager to manually encode a new order on the international...
if you can't, your app can't too

on the bpost manager, click "admin" / "paramètres de livraison" / le sigle € sur international domicilebureau

you must have a "zone", with the pencil, you can select countries and enable FR....

good luck ;)

@motchju
Copy link

motchju commented Jun 26, 2018

You are the man of the match, I forgot to allow some foreign countries ...

Thank you for the help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants