JeremyDunn / php-fedex-api-wrapper

This library provides a fluid interface for constructing requests to the FedEx web service API.
269 stars 184 forks source link

How to solve "Invalid language code for event notification 1" ? #47

Closed onlymaj closed 6 years ago

onlymaj commented 7 years ago

I'm trying to add a special service for Fedex API as an email notification . I go through the classes in the wrapper but i face to "Invalid language code for event notification 1" error code . here's my code :

$localization  = new ComplexType\Localization();
$localization->setLocaleCode("CA")->setLanguageCode("EN");

$emailNotif = SimpleType\ShipmentSpecialServiceType::_EMAIL_NOTIFICATION;
$emailRecip = new ComplexType\EMailNotificationRecipient();
$emailRecip->setEMailNotificationRecipientType(SimpleType\EMailNotificationRecipientType::_SHIPPER)
           ->setEMailAddress($to['email'])
           ->setLocalization($localization)
           ->setFormat(SimpleType\EMailNotificationFormatType::_TEXT)
           ->setNotificationEventsRequested([SimpleType\EMailNotificationEventType::_ON_SHIPMENT,SimpleType\EMailNotificationEventType::_ON_DELIVERY]);
$emailNotifDet = new ComplexType\EMailNotificationDetail();
$emailNotifDet->setAggregationType(SimpleType\EMailNotificationAggregationType::_PER_SHIPMENT)
              ->setPersonalMessage($emailNotifCont['PersonalMessage'])
              ->setRecipients([$emailRecip]);
$specialServicesRequested = new ComplexType\ShipmentSpecialServicesRequested();
 $specialServicesRequested->setSpecialServiceTypes([$emailNotif])->setEMailNotificationDetail($emailNotifDet);
$requestedShipment->setSpecialServicesRequested($specialServicesRequested);

But i think localization part doesn't apply to the final codes at All. Any idea would be appreciable .

JeremyDunn commented 6 years ago

Please open a support ticket with FedEx web services and send them the raw SOAP request.

Call ->getSoapClient()->__getLastRequest() on your Request object after you've made the request to get the raw soap data.

You can also call ->toArray() on your instance of ProcessShipmentRequest to get the same data sent to the php SoapClient for the request.