I am using "GetReportList" api with report list type as "_GET_ORDERS_DATA" to pull order reports from amazon. But I want to pull only new orders. How can I use the "acknowledged" field to make sure that I pull only new orders(which were not previously pulled).I observed that the "acknowledged" field is true by default. Please let me know if there is a way to pull new orders only(I am trying to avoid using timestamp here)
Thanks
You need to acknowledge the order report when you picked it up, then you will only get order reports set to acknowledged false on the next call.
So you need to run this operation:
$request1 = new MarketplaceWebService_Model_UpdateReportAcknowledgementsRequest();
$request1->setMerchant(MERCHANT_ID);
$idList1 = new MarketplaceWebService_Model_IdList();
$request1->setReportIdList($idList1->withId(/* SET THE REPORT ID YOU HAVE TAKEN */));
$request1->setAcknowledged(true);
invokeUpdateReportAcknowledgements($service, $request1);
function invokeUpdateReportAcknowledgements(MarketplaceWebService_Interface $service, $request1)
{
try {
$response = $service->updateReportAcknowledgements($request1);
} catch (MarketplaceWebService_Exception $ex) {
var_dump($ex);
After you have picked up the order report, and then, you can simply request the next order report with this line:
$request->setAcknowledged(false);
Like this, only reports you haven't set to acknowledged with the first call will be shown in the list.
The first call is described in the php API, I think it's called something like SetAcknowledgmentSample, and the second call needs to be called in the getReportListSample file
I think you can set them as below which I found from sample code found in Amazon Report's API sample
$parameters = array (
'Merchant' => MERCHANT_ID,
'AvailableToDate' => new DateTime('now', new DateTimeZone('UTC')),
'AvailableFromDate' => new DateTime('-6 months', new DateTimeZone('UTC')),
'Acknowledged' => false,
);
$request = new MarketplaceWebService_Model_GetReportListRequest($parameters);
$request = new MarketplaceWebService_Model_GetReportListRequest();
$request->setMerchant(MERCHANT_ID);
$request->setAvailableToDate(new DateTime('now', new DateTimeZone('UTC')));
$request->setAvailableFromDate(new DateTime('-3 months', new DateTimeZone('UTC')));
$request->setAcknowledged(false);
Related
I'm currently using AWS Lambda (NodeJS) with AWS QLDB.
The scenario is like this.
I have the first table and its indexes when I deployed the service. So the table and indexes will be created. My problem is that, once I need to add new table and its indexes; it can't create the index because there's existing table.
My workaround to be able to create new table even if there's an existing table in my Ledger is that I'm querying the list of tables I have.
const getTables = async (transactionExecutor: TransactionExecutor) => {
const statement = `SELECT name FROM information_schema.user_tables`;
return await transactionExecutor.execute(statement);
};
Then I have this condition to check if the table is already existing
const tables = JSON.stringify(result.getResultList());
if (
!JSON.parse(tables).some((object): boolean => object.name === process.env.TABLE_NAME)
) {
console.log('TABLE A NOT EXISTING');
await createTable(transactionExecutor, process.env.TABLE_NAME);
}
if (
!JSON.parse(tables).some(
(object): boolean => object.name === process.env.TABLE_NAME_1,
)
) {
console.log('TABLE B NOT EXISTING');
await createTable(transactionExecutor, process.env.TABLE_NAME_1);
}
I don't know how to do it with indexes, I tried using SQL commands in QLDB but it's not working.
I hope you can help me.
Thank you
I'm not quite sure what your question is (the post title and body hint at different things), but I'm going to do my best to answer.
First, QLDB stores data in Ion, not JSON. So, please use the Ion APIs to parse data and not the JSON ones. The reason your code works at all is because Ion is a superset of JSON and the result set doesn't include types that are unknown to JSON. So, for example, if the result set was changed to include an Ion Timestamp, then your code would break.
Next, actually getting a list of tables has first class support in the driver. Simply use driver.getTableNames.
Third, I think you have a question "can I add an index to a non-empty table?". The answer is "no". This is planned functionality and I will update this answer when it is available. UPDATE: Now you can! https://aws.amazon.com/about-aws/whats-new/2020/09/amazon-qldb-launches-index-improvements/
Finally, I think you're also asking if there is a way to list indexes on a table in the same way as you can list tables in a ledger. The answer to that is 'yes'. The documents returned in information_schema.user_tables look like this:
{
tableId:"...",
name:"THE_TABLE_NAME",
indexes:[
{
expr:"[THE_FIELD_BEING_INDEXED]"
}
],
status:"ACTIVE"
}
I am new to using AWS and am writing something that will add an attribute to the provided item given some keyAttributes. I got it working, but the code I ended up writing just looks unintuitive and silly to me. (I just based it off of documentation I've been finding online.)
I was able to do a successful basic update of an item in a dynamoDB table with this code:
final AttributeValue fulfilled = new AttributeValue().withBOOL(true);
final UpdateItemRequest updateItemRequest = new UpdateItemRequest()
.withTableName(tableName)
.withKey(keyAttributes)
.withUpdateExpression("SET fulfilled = :fulfilled")
.withExpressionAttributeValues(ImmutableMap.of(":fulfilled", fulfilled));
final UpdateItemResult result = dynamoClient.updateItem(updateItemRequest);
Is there anything I can do to cut it down to just the barebones thing I'm trying to do here: just adding a new attribute "fulfilled" to an item, set to true?
An UpdateItemRequest must always contain the table name and the key attributes. (Otherwise how would DynamoDB know which item to update?)
You can simplify it, though, by getting rid of the ExpressionAttributeValues, like this:
final UpdateItemRequest updateItemRequest = new UpdateItemRequest()
.withTableName(tableName)
.withKey(keyAttributes)
.withUpdateExpression("SET fulfilled = TRUE");
final UpdateItemResult result = dynamoClient.updateItem(updateItemRequest);
http://dev.apollodata.com/react/mutations.html
I am trying out with optimisticResponse, but i am confused... and couldn't get it working on my local.
My questions are:
will optimisticResponse update the props and hence the re-render? how important is __typename: 'Mutation' can you leave it?
updateQueries is for new record appear? is this function trigger automatically or you need to invoke it?
is there any full example of out there which include the apollo server side?
Solution found:
const networkInterface = createNetworkInterface('http://localhost:8080/graphql');
this.client = new ApolloClient({
networkInterface,
dataIdFromObject: r => r.id
}
);
dataIdFromObject is the one thing i am missing during the Apolloclient initiation
dataIdFromObject (Object) => string
A function that returns a object identifier given a particular result object.
it will give unique ID for all result object.
I've been trying to update our API call to the CIM interface for Authorize.net to hide the Billing Address fields on the hosted profile page.
The documentation states that when call the token creation function, passing in a setting "hostedProfileBillingAddressOptions" with a value of "showNone" will hide the billing address part of the form, however when I pass in this setting I am still getting the billing address showing.
I've verified that I'm passing the setting correctly (added the same way as the "hostedProfileIFrameCommunicatorUrl" and "hostedProfilePageBorderVisible" settings) and if I pass an invalid value for the "hostedProfileBillingAddressOptions" option, the Token creation function will return an error
Is there something else that this option is dependent on, such as an account setting or another settings parameter?
For reference, I'm testing this in the Sandbox system and I'm using the dotNet SDK, my test code for calling the API function is as follows
Public Shared Function CreateHostFormToken(apiId As String, apiKey As String, branchId As Int64, nUser As Contact, iframeComURL As String) As String
Dim nCustProfile = GetCustomerProfile(apiId, apiKey, branchId, nUser)
Dim nHost = New AuthorizeNet.Api.Contracts.V1.getHostedProfilePageRequest()
nHost.customerProfileId = nCustProfile
' Set Auth
Dim nAuth = New Api.Contracts.V1.merchantAuthenticationType()
nAuth.ItemElementName = Api.Contracts.V1.ItemChoiceType.transactionKey
nAuth.name = apiId
nAuth.Item = apiKey
nHost.merchantAuthentication = nAuth
' Set Params
Dim settingList As New List(Of Api.Contracts.V1.settingType)
Dim nParam As New Api.Contracts.V1.settingType With {.settingName = "hostedProfileIFrameCommunicatorUrl",
.settingValue = iframeComURL}
settingList.Add(nParam)
nParam = New Api.Contracts.V1.settingType With {.settingName = "hostedProfilePageBorderVisible",
.settingValue = "false"}
settingList.Add(nParam)
nParam = New Api.Contracts.V1.settingType With {.settingName = "hostedProfileBillingAddressOptions",
.settingValue = "showNone"}
settingList.Add(nParam)
nHost.hostedProfileSettings = settingList.ToArray
Dim nX = New AuthorizeNet.Api.Controllers.getHostedProfilePageController(nHost)
Dim nRes = nX.ExecuteWithApiResponse(GetEnvironment())
Return nRes.token
End Function
I've looked through the SDK code as well, and I don't see anything there that would be preventing the setting from being passed through.
Has anyone come across this issue, or successfully set the card entry form to hide the billing address?
There turned out to be two parts to the solution to this problem:
In order to use the "hostedProfileBillingAddressOptions" option, you need to use a newer version of the capture page than I was using. I was using "https://secure2.authorize.net/profile/", while the new version is "https://secure2.authorize.net/customer/". Added bonus, the new URL provides a much nicer and modern looking form.
However, once this was working, I then had the problem that on entering the card, a validation message told me that "address and Zip code are required", despite not being visible. I did also make sure that I had the option "hostedProfileBillingAddressRequired" set to false (which is it's default value anyway)
The response from Authorize.net support is that in order to capture card without an address, the option "hostedProfileValidationMode" must be set to "testMode".
This is not mentioned in the documentation (at least as far as I could see), so may not be something that other people are aware of since it is a little counter-intuitive to use 'testMode' on a live environment.
It's not ideal since validating the card for a customer account will send a transaction email to the merchant, but it seems there is not another way around this just now.
In summary, to allow the customer to add a credit card to their profile without having to provide an address, you need to specify the following options:
Form URL for capture - https://secure2.authorize.net/customer/
getHostedProfilePageRequest -
hostedProfileIFrameCommunicatorUrl: *your URL*
hostedProfilePageBorderVisible: false //assuming you are using an iFrame
hostedProfileValidationMode: testMode
hostedProfileBillingAddressOptions: showNone
I am using the Google Admin SDK to create, update and delete mailing lists (aka groups).
Everything works fine so far and I can create a new group and add members to it. But: Every adding of a member takes about 1s so I was thinking of a batch request to add several users to a group at once.
In the Google Admin interface it is easy to add several users at once but I didn't find any way to implement this via the API.
Is there a way to do so or do I have to loop through every user?
This works but takes a lot of time if I have to do it for every single user:
$service = new Google_Service_Directory($this->getGoogleClient());
$user = new Google_Service_Directory_Member();
$user->setEmail('test#test.com');
$user->setRole('MEMBER');
$user->setType('USER');
$service->members->insert($group_id, $user);
finally I found a solution on my own: The Admin SDK comes with a Batch class :)
To get batch requests working these steps are necessary:
When initiating the Google Client add the following line to the code
$client->setUseBatch(true);
then you can initiate the batch object
$batch = new Google_Http_Batch($client);
a little modification on the code posted above brings me to this code
foreach($arr_users as $user)
{
$userdata = new Google_Service_Directory_Member();
$userdata->setEmail($user);
$userdata->setRole('MEMBER');
$userdata->setType('USER');
$batch->add($service->members->insert($temp_list_name, $userdata));
}
finally you have to execute the request which is done by this line:
$client->execute($batch);
that's all and it works perfectly
While using the method of Christian Lange I was getting this error -
Argument 1 passed to Google\Client::execute() must implement interface Psr\Http\Message\RequestInterface, instance of Google\Http\Batch given,
So I used this instead
$client->setUseBatch(true);
$service = new Google_Service_Directory($client);
$batch = $service->createBatch();
foreach ($emails as $email)
{
$user = new Google_Service_Directory_Member(array('email' => $email,
'kind' => 'member',
'role' => 'MEMBER',
'type' => 'USER'));
$list = $service->members->insert($key, $user);
$batch->add($list);
}
$resultsBatch = $batch->execute();