How track by Tracking Number Unique Identifier? - php

I'm having issues attempting to track a package by Tracking Number Unique Identifier. I'm working with the sample PHP code from Fedex Developer Resource Center.
How can I track it using the TrackingNumberUniqueIdentifier?
$path_to_wsdl = __DIR__ . "/WSDL/FEDEX/TrackService_v6.wsdl";
ini_set("soap.wsdl_cache_enabled", "0");
$client = new \Soapclient($path_to_wsdl, array('trace' => 1));
$request = array(
'WebAuthenticationDetail' => array(
'UserCredential' => array(
'Key' => #KEY#,
'Password' => #PASSWORD#
)
),
'ClientDetail' => array(
'AccountNumber' => #SHIPACCOUNT#,
'MeterNumber' => #METER#
),
'Version' => array(
'ServiceId' => 'trck',
'Major' => '6',
'Intermediate' => '0',
'Minor' => '0'
),
'PackageIdentifier' => array(
'Type' => 'TRACKING_NUMBER_OR_DOORTAG',
'Value' => '123456789012',
),
'IncludeDetailedScans' => 1
'TrackingNumberUniqueIdentifier' => '510987654321~123456789012~FX'
);

When you desire to track a package using the FedEx API, you simply provided the tracking number or the door tag number; however, FedEx reuses the tracking numbers, so you may find that one of your tracking numbers has more than one set of events (or more than two shipments associated with it). When that happens, you must use the FedEx tracking number unique identifier (which has the tracking number as prefix) to get the desired set of events.
In case of your request, you are using a non-valid tracking number (123456789012) for the FedEx test environment and an unrelated tracking number unique identifier (510987654321~123456789012~FX). Notice that the suffix of the unique identifier is not the tracking number.
Sadly, FedEx does not provide test tracking number, so I recommend you to switch the endpoint to the production URL, and test the tracking service using real tracking numbers because the production tracking numbers don't work in the test environment.
Remember, don't use the tracking number unique identifier unless your tracking number has two shipments associated with it.
Regards,

Related

Onesignal Badge count increment is not working

In Onesignal api, I have added isIos => true,ios_badgeType => Increase,ios_badgeCount => 1,content_available => true in the field array.
But the badge count always remains as 1, it's not increasing with multiple messages.
This is my payload details : $fields = array( 'app_id' => "xxxxxx", 'included_segments' => array('All'), 'data' => array( "notification_type" => "update" ), 'contents' => $content, 'subtitle' => $subtitle, 'headings' => $heading, 'isIos' => true, 'ios_badgeType' => "Increase", 'ios_badgeCount' => 1, 'content_available' => true );
You must add Notification Extension in order to get badge auto update. Please follow the link to setup.
Also, need to create app group and assign both bundle id to that particular group. Please see the section -
In order for your application to be able to let push notifications
increment/decrement the badge count, you need to set up an App Group
for your application.
See here
Please follow https://documentation.onesignal.com/docs/ios-sdk-app-groups-setup in detail.
The name of your app group should be
group.{your_bundle_id}.onesignal
So for example, if your application's bundle identifier is
com.test.app, your app group name should be
group.com.test.app.onesignal.
Assign the group to both
target.
Open your Info.plist file and add a new OneSignal_app_groups_key as a String type.
Enter the group name you checked in the last step as it's value.
Make sure to do the same for the Info.plist under the OneSignalNotificationServiceExtension folder.

Kraken API <-> PHP withdrawl issue

I need help with the kraken API. I have created the connection and I am able to trade various pairs but now I need to make an automatic withdraw using their API. For the trading pairs I have the following running which buys 0.002 BTC using EURO
$res = $kraken->QueryPrivate('AddOrder', array(
'pair' => 'XBTEUR',
'type' => 'sell',
'ordertype' => 'market',
'volume' => '0.002',
));
print_r($res);
Now... how do I withdraw 0.002 btc using the api and sending these to my wallet: 1BujYrWGkzFdmecXUNgj8nE13gwXtxZxKZ
I can't seem to find this specific information anywhere :(
To answer my own question, this was the code I needed:
$res = $kraken->QueryPrivate('Withdraw', array(
'asset' => 'XBT',
'key' => 'withdrawal key name here',
'amount' => '0.002',
));
print_r($res);
Where as the key, was the name of the account which contained the wallet I wanted to withdraw fund to.

'SenderID' issues sending SMS on Amazon SNS (Official PHP SDK)

For some reason the SenderID seems to revert to NOTICE - see here when I set the SenderID in the code.
When I leave the SenderID variable out, it sends as the default set - this is good, but we will be occasionally changing the name for different uses.
I am using the Official PHP SDK, with the code below:
$aws_cred = array(
'credentials' => array(
'key' => 'GOT THE KEY',
'secret' => 'GOT THE SECRET',
),
'region' => 'eu-west-1', // < your aws from SNS Topic region
'version' => 'latest'
);
$sns = new \Aws\Sns\SnsClient($aws_cred);
$args = array(
"SenderID" => "MySendID",
"SMSType" => "Promotional",
"Message" => "Amazon y u do dis??",
"PhoneNumber" => "+number"
);
$result = $sns->publish($args);
I am sending to the UK (so SID works there), and also it is within the 11 character limit.
Does anyone have any idea why this is happening?
Cheers
I have found the answer.
The search system didn't materialise this originally, but finally, I have found it.
QUOTE FROM: https://stackoverflow.com/a/43748448/7586984
I found the solution. Set the args this way. It works!
$args = array(
'MessageAttributes' => [
'AWS.SNS.SMS.SenderID' => [
'DataType' => 'String',
'StringValue' => 'YourSenderName'
]
],
"SMSType" => "Transactional",
"PhoneNumber" => "+87654321",
"Message" => "Hello World!"
);
(Optional) For Sender ID, type a custom ID that contains up to 11
alphanumeric characters, including at least one letter and no spaces.
The sender ID is displayed as the message sender on the receiving
device. For example, you can use your business brand to make the
message source easier to recognize.
Support for sender IDs varies by country. For example, messages
delivered to U.S. phone numbers will not display the sender ID. For
the countries that support sender IDs, see Supported Regions and
Countries.
If you do not specify a sender ID, the message will display a long
code as the sender ID in supported countries. For countries that
require an alphabetic sender ID, the message displays NOTICE as the
sender ID.
http://docs.aws.amazon.com/sns/latest/dg/sms_publish-to-phone.html
to sumerise you cant use spaces(you have one) and it wont always work, it depends on country and carrier, it wont work in more places than it will

Set reminder to a task API Podio

I try to set a reminder (30 minutes before due date) on a task created by the API based on doc examples: https://developers.podio.com/doc/tasks/create-task-with-reference-22420
https://developers.podio.com/doc/tasks/create-task-22419
Here's the code:
PodioTask::create_for(
'item',
$order->item_id,
array(
'text' => "Préparer la livraison de la commande",
'description' => "Testing tasks",
'responsible' => 00000,
'due_date' => date('Y-m-d'),
'due_time' => '09:00:00',
'reminder' => array('remind_delta' => 30)
)
);
Beside of the fact that the reminder is not set, the task is created with the provided information above. There is no error related to the API.
Is there something missing?
I realize this is old, but I finally figured it out. See below:
PodioTask::create_for(
'item',
$item_id,
$attributes = array (
'text' => $item_id,
'private' => true,
'due_date' => $appt_date,
'due_time' => $appt_time,
'responsible' => 1234567, // User ID
'reminder' => (object)[
'remind_delta' => 0
]
)
);
For my purposes the user will always be the same, so I set that as static.
BE AWARE You MUST authenticate with the API using the users credentials that the reminder is being set for. It WILL NOT set a reminder for another user (partially why I'm using a static user).
EDIT Since I don't have enough reputation points, I want to call out Pavlo - Podio
One can verify if a reminder is set by looking at it in Podio. It's pretty simple, either there's a reminder set or there's not.
The OP, and myself, aren't using Ruby, so whether Ruby works or not is irrelevant to the problems we're facing.
While I realize you were trying to help. The fact that you're a "Test Automation Engineer at Podio" raises the expectation that you COULD provide useful information. So pull out the PHP and see what we're experiencing.

Why AmazonDynamoDB::TYPE_STRING or NUMBER?

What are these constants defined in Amazon DynamoDB?
Can someone please explain the need of these constants?
Why are these placed in key of associative array?
I see a strange notation during putting items in table like
'Name' => array( AmazonDynamoDB::TYPE_STRING => 'Amazon S3')
PHP SDK guide says 4 type of constants.
TYPE_ARRAY_OF_NUMBERS
TYPE_ARRAY_OF_STRINGS
TYPE_NUMBER
TYPE_STRING
$dynamodb->batch($queue)->put_item(array(
'TableName' => 'Forum',
'Item' => array(
'Name' => array( AmazonDynamoDB::TYPE_STRING => 'Amazon S3'), // Hash Key
'Category' => array( AmazonDynamoDB::TYPE_STRING => 'Amazon Web Services'),
// Range Key
'Threads' => array( AmazonDynamoDB::TYPE_NUMBER => '0')
)
));
These constants reflect the four available Amazon DynamoDB Data Types:
String - Strings are Unicode with UTF8 binary encoding. There is no limit to the string size when you assign it to an attribute except
when the attribute is part of the primary key. [...]
Number - Numbers are positive or negative exact-value decimals and integers. A number can have up to 38 digits of precision after the
decimal point, and can be between 10^-128 to 10^+126. The
representation in Amazon DynamoDB is of variable length. [...]
String and Number Sets - Amazon DynamoDB also supports both Number Sets and String Sets.
[...] Note that, because it is a
set, the values in the set must be unique. String Sets and Number Sets
are not ordered; the order of the values returned in a set is not
preserved.
You will need to specify or handle these data types in various API calls, e.g. for the KeySchema in CreateTable or the Item in PutItem as seen in the example you provided.
The newest version of the AWS PHP SDK adds convenience methods to help make formatting your request easier. See the docs for the attributes() method. For example:
$dynamodb->put_item(array(
'TableName' => 'my-table',
'Item' => $dynamodb->attributes(array(
'id' => 1,
'key1' => 'value1',
'key2' => 'value2',
))
));
Seems much easier to work with this way.

Categories