How to remove null objects of whois results - string

I use the python-whois module.
I have this code:
for whoisInfo in domainWhoisInfo :
stringWhoisInfo = str(stringWhoisInfo) + str(whoisInfo) + "\n\n"
domainWhoisInfo => array which contains whois data of each domain
stringWhoisInfo => string which concatenate whois data of all domains
I concatenate whois results of many domain name in a string.
And When I store these results in a log file I get the
following output :
{
"updated_date": null,
"status": null,
"name": null,
"dnssec": null,
"city": null,
"expiration_date": null,
"zipcode": null,
"domain_name": null,
"country": null,
"whois_server": null,
"state": null,
"registrar": null,
"referral_url": null,
"address": null,
"name_servers": null,
"org": null,
"creation_date": null,
"emails": null
}
{
"updated_date": null,
"status": [
"clientDeleteProhibited -- http://www.icann.org/epp#clientDeleteProhibited",
"clientTransferProhibited -- http://www.icann.org/epp#clientTransferProhibited",
"serverTransferProhibited -- http://www.icann.org/epp#serverTransferProhibited"
],
"name": "Panayiotis Yianni",
"dnssec": null,
"city": "Enfield",
"expiration_date": "2017-03-06 23:25:46",
"zipcode": "EN3 7FY",
"domain_name": "AMON.PRO",
"country": "GB",
"whois_server": null,
"state": "London, City of",
"registrar": "OVH (R2367-PRO)",
"referral_url": null,
"address": null,
"name_servers": [
"DNS200.ANYCAST.ME",
"NS200.ANYCAST.ME"
],
"org": "Amon Interactive Ltd",
"creation_date": null,
"emails": [
"panayiotisyianni#live.com",
"panayiotis#amon.pro"
]
}
{
"updated_date": null,
"status": null,
"name": null,
"dnssec": null,
"city": null,
"expiration_date": null,
"zipcode": null,
"domain_name": null,
"country": null,
"whois_server": null,
"state": null,
"registrar": null,
"referral_url": null,
"address": null,
"name_servers": null,
"org": null,
"creation_date": null,
"emails": null
}
I am looking for deleting the whois results which are null
from my string.
And get finally only this output :
{
"updated_date": null,
"status": [
"clientDeleteProhibited -- http://www.icann.org/epp#clientDeleteProhibited",
"clientTransferProhibited -- http://www.icann.org/epp#clientTransferProhibited",
"serverTransferProhibited -- http://www.icann.org/epp#serverTransferProhibited"
],
"name": "Panayiotis Yianni",
"dnssec": null,
"city": "Enfield",
"expiration_date": "2017-03-06 23:25:46",
"zipcode": "EN3 7FY",
"domain_name": "AMON.PRO",
"country": "GB",
"whois_server": null,
"state": "London, City of",
"registrar": "OVH (R2367-PRO)",
"referral_url": null,
"address": null,
"name_servers": [
"DNS200.ANYCAST.ME",
"NS200.ANYCAST.ME"
],
"org": "Amon Interactive Ltd",
"creation_date": null,
"emails": [
"panayiotisyianni#live.com",
"panayiotis#amon.pro"
]
}

Related

How to get Product and Quantity information from payment_intent.succeeded event via Webhooks in Stripe?

Here is how I'm initializing the Checkout Process in Node.js.
let email = req.body.email
let product_id = req.body.product_id
let YOUR_DOMAIN = 'http://localhost:8000'
const session = await stripe.checkout.sessions.create({
line_items: [{
price: product_id,
adjustable_quantity: {
enabled: true,
minimum: 1,
maximum: 5,
},
quantity: 1,
}],
customer_email: email,
mode: 'payment',
success_url: `${YOUR_DOMAIN}/payment-success`,
cancel_url: `${YOUR_DOMAIN}/payment-failure`,
});
Here are the events I have subscribed to in Webhooks
payment_intent.succeeded
checkout.session.completed
Object Received in Payment Intent Succeeded
{
"id": "evt_1KEqIxI5cib7rtVMoKMkak96",
"object": "event",
"api_version": "2020-03-02",
"created": 1641453754,
"data": {
"object": {
"id": "pi_1KEqIeI5cib7rtVMcz8zsXys",
"object": "payment_intent",
"amount": 59700,
"amount_capturable": 0,
"amount_received": 59700,
"application": null,
"application_fee_amount": null,
"automatic_payment_methods": null,
"canceled_at": null,
"cancellation_reason": null,
"capture_method": "automatic",
"charges": {
"object": "list",
"data": [{
"id": "ch_1KEqIvI5cib7rtVMYUVn5gfQ",
"object": "charge",
"amount": 59700,
"amount_captured": 59700,
"amount_refunded": 0,
"application": null,
"application_fee": null,
"application_fee_amount": null,
"balance_transaction": "txn_1KEqIwI5cib7rtVMGfJlEahg",
"billing_details": {
"address": {
"city": "NY",
"country": "US",
"line1": "sada",
"line2": "asd",
"postal_code": "10001",
"state": "NY"
},
"email": "test#gmail.com",
"name": "John Doe",
"phone": null
},
"calculated_statement_descriptor": "VIDEOFORM",
"captured": true,
"created": 1641453753,
"currency": "usd",
"customer": "cus_KufeYc1hifvZGA",
"description": null,
"destination": null,
"dispute": null,
"disputed": false,
"failure_code": null,
"failure_message": null,
"fraud_details": {},
"invoice": null,
"livemode": false,
"metadata": {},
"on_behalf_of": null,
"order": null,
"outcome": {
"network_status": "approved_by_network",
"reason": null,
"risk_level": "normal",
"risk_score": 25,
"seller_message": "Payment complete.",
"type": "authorized"
},
"paid": true,
"payment_intent": "pi_1KEqIeI5cib7rtVMcz8zsXys",
"payment_method": "pm_1KEqIuI5cib7rtVMYPWlLV8S",
"payment_method_details": {
"card": {
"brand": "visa",
"checks": {
"address_line1_check": "pass",
"address_postal_code_check": "pass",
"cvc_check": "pass"
},
"country": "US",
"exp_month": 1,
"exp_year": 2023,
"fingerprint": "QaiTi5PATFO8ZoC3",
"funding": "credit",
"installments": null,
"last4": "4242",
"mandate": null,
"network": "visa",
"three_d_secure": null,
"wallet": null
},
"type": "card"
},
"receipt_email": null,
"receipt_number": null,
"receipt_url": "https://pay.stripe.com/receipts/acct_1GhUSuI5cib7rtVM/ch_1KEqIvI5cib7rtVMYUVn5gfQ/rcpt_KufeysPW3LD8Yu47q14iYOIIlcGth9h",
"refunded": false,
"refunds": {
"object": "list",
"data": [],
"has_more": false,
"total_count": 0,
"url": "/v1/charges/ch_1KEqIvI5cib7rtVMYUVn5gfQ/refunds"
},
"review": null,
"shipping": null,
"source": null,
"source_transfer": null,
"statement_descriptor": null,
"statement_descriptor_suffix": null,
"status": "succeeded",
"transfer_data": null,
"transfer_group": null
}],
"has_more": false,
"total_count": 1,
"url": "/v1/charges?payment_intent=pi_1KEqIeI5cib7rtVMcz8zsXys"
},
"client_secret": "pi_1KEqIeI5cib7rtVMcz8zsXys_secret_uZwm3uziwfaWePgTHENYXeraD",
"confirmation_method": "automatic",
"created": 1641453736,
"currency": "usd",
"customer": "cus_KufeYc1hifvZGA",
"description": null,
"invoice": null,
"last_payment_error": null,
"livemode": false,
"metadata": {},
"next_action": null,
"on_behalf_of": null,
"payment_method": "pm_1KEqIuI5cib7rtVMYPWlLV8S",
"payment_method_options": {
"card": {
"installments": null,
"mandate_options": null,
"network": null,
"request_three_d_secure": "automatic"
}
},
"payment_method_types": ["card"],
"processing": null,
"receipt_email": null,
"review": null,
"setup_future_usage": null,
"shipping": null,
"source": null,
"statement_descriptor": null,
"statement_descriptor_suffix": null,
"status": "succeeded",
"transfer_data": null,
"transfer_group": null
}
},
"livemode": false,
"pending_webhooks": 3,
"request": {
"id": "req_Y87umQuitz9WCc",
"idempotency_key": "a4b6af76-73d8-49b4-8393-9017e673af7e"
},
"type": "payment_intent.succeeded"
}
Object Received in Checkout Session Completed
{
"id": "evt_1KEqQOI5cib7rtVMRwAHWDvV",
"object": "event",
"api_version": "2020-03-02",
"created": 1641454214,
"data": {
"object": {
"id": "cs_test_a1AQ9EKIaxi8dXFAJzZ86xYm5meRkWb9Vu0eLowfkiKgUO4cyToooBzSTd",
"object": "checkout.session",
"after_expiration": null,
"allow_promotion_codes": null,
"amount_subtotal": 59700,
"amount_total": 59700,
"automatic_tax": {
"enabled": false,
"status": null
},
"billing_address_collection": null,
"cancel_url": "http://localhost:8000/payment-failure",
"client_reference_id": null,
"consent": null,
"consent_collection": null,
"currency": "usd",
"customer": "cus_Kuflo6N0n4HTzL",
"customer_details": {
"email": "test#gmail.com",
"phone": null,
"tax_exempt": "none",
"tax_ids": []
},
"customer_email": "test#gmail.com",
"expires_at": 1641540596,
"livemode": false,
"locale": null,
"mode": "payment",
"payment_intent": "pi_1KEqQ4I5cib7rtVMyND6NhQG",
"payment_method_options": {},
"payment_method_types": ["card"],
"payment_status": "paid",
"phone_number_collection": {
"enabled": false
},
"recovered_from": null,
"setup_intent": null,
"shipping": null,
"shipping_address_collection": null,
"shipping_options": [],
"shipping_rate": null,
"status": "complete",
"submit_type": null,
"subscription": null,
"success_url": "http://localhost:8000/payment-success",
"total_details": {
"amount_discount": 0,
"amount_shipping": 0,
"amount_tax": 0
},
"url": null
}
},
"livemode": false,
"pending_webhooks": 4,
"request": {
"id": null,
"idempotency_key": null
},
"type": "checkout.session.completed"
}
I'm unable to figure out how to get the Product ID and the Quantity. Could anyone suggest the right approach here?
You can find the Product and the quantity from the Checkout Session by using expand on the line_items property. The code should look like this.
// In "checkout.session.completed" event handler, get the ID of the Checkout Session
const id = event.data.object.id; // "cs_xxx"
// Retrieve the Checkout Session with expand
const session = await stripe.checkout.sessions.retrieve(id, {
expand: [ "line_items" ]
});
// Get the quantity
console.log(session.line_items.data[0].quantity);
// Get the product ID
console.log(session.line_items.data[0].price.product);

How to remove parameters that has null from the docusign result

I have implemented the endpoint by using DocuSign Java SDK and it is working fine but the result is a bit different in comparison to the result getting from Postman. Below is the result from Postman when calling {{baseUrl}}/v2.1/accounts/{{accountId}}/envelopes?folder_ids=out_for_signature&include=recipients&exclude=folders,powerforms
result
{
"resultSetSize": "1",
"startPosition": "0",
"endPosition": "0",
"totalSetSize": "1",
"nextUri": "",
"previousUri": "",
"envelopes": [
{
"status": "sent",
"documentsUri": "/envelopes/xxxx-9777-7153b02d44e3/documents",
"recipientsUri": "/envelopes/axxxxfaf-9777-7153b02d44e3/recipients",
"attachmentsUri": "/envelopes/xxxxaf-9777-7153b02d44e3/attachments",
"envelopeUri": "/envelopes/xxxxx4faf-9777-7153b02d44e3",
"emailSubject": "Please sign this document set",
"envelopeId": "a826d1da-8cf6-4faf-9777-7153b02d44e3",
"customFieldsUri": "/envelopes/xxf-9777-7153b02d44e3/custom_fields",
"notificationUri": "/envelopes/x6-4faf-9777xxxx-7153b02d44e3/notification",
"createdDateTime": "2021-12-06T21:27:02.8300000Z",
"lastModifiedDateTime": "2021-12-14T19:45:07.3300000Z",
"initialSentDateTime": "2021-12-06T21:27:04.0800000Z",
"sentDateTime": "2021-12-13T20:19:00.8570000Z",
"statusChangedDateTime": "2021-12-14T19:45:07.3900000Z",
"documentsCombinedUri": "/envelopes/a826d1da-8cf6-4faf-9777-7153b02d44e3/documents/combined",
"certificateUri": "/envelopes/xxxx-4faf-9777-7153b02d44e3/documents/certificate",
"templatesUri": "/envelopes/xxxx4faf-9777-7153b02d44e3/templates",
"expireEnabled": "true",
"expireDateTime": "2022-04-05T21:27:04.0800000Z",
"expireAfter": "111",
"sender": {
"userName": "rizauddin Mohammad",
"userId": "xxxxxx11-987f-0c9253822c79",
"accountId": "xxxxx-46d2-9f5e-d39f7ffaeec3"
},
"certifiedDeliveries": [],
"inPersonSigners": [],
"seals": [],
"witnesses": [],
"notaries": [],
"recipientCount": "2",
"currentRoutingOrder": "1"
},
"purgeState": "unpurged",
"isSignatureProviderEnvelope": "false",
"anySigner": null,
"envelopeLocation": "current_site"
}
]
}
And the result from SDK when having this code
final EnvelopesApi envelopesApi = new EnvelopesApi(apiClient);
val options = envelopesApi.new ListStatusChangesOptions();
options.setFolderIds("out_for_signature");
options.setInclude("recipients");
options.setExclude("folders,powerForms");
EnvelopesInformation envelopesInformation = envelopesApi.listStatusChanges(accountId, options);
[
{
"accessControlListBase64": null,
"allowComments": null,
"allowMarkup": null,
"allowReassign": null,
"allowViewHistory": null,
"anySigner": null,
"asynchronous": null,
"attachmentsUri": "/envelopes/xxxxx9777-7153b02d44e3/attachments",
"authoritativeCopy": null,
"authoritativeCopyDefault": null,
"autoNavigation": null,
"brandId": null,
"brandLock": null,
"certificateUri": "/envelopes/a826d1da-8cf6-4faf-9777-7153b02d44e3/documents/certificate",
"completedDateTime": null,
"copyRecipientData": null,
"createdDateTime": "2021-12-06T21:27:02.8300000Z",
"customFields": null,
"customFieldsUri": "/envelopes/xxxx6-4faf-9777-7153b02d44e3/custom_fields",
"declinedDateTime": null,
"deletedDateTime": null,
"deliveredDateTime": null,
"disableResponsiveDocument": null,
"documentBase64": null,
"documentsCombinedUri": "/envelopes/a826d1da-8cf6-4faf-9777-7153b02d44e3/documents/combined",
"documentsUri": "/envelopes/xxxxx4faf-9777-7153b02d44e3/documents",
"emailBlurb": null,
"emailSettings": null,
"emailSubject": "Please sign this document set",
"enableWetSign": null,
"enforceSignerVisibility": null,
"envelopeAttachments": null,
"envelopeDocuments": null,
"envelopeId": "xxxx-9777-7153b02d44e3",
"envelopeIdStamping": null,
"envelopeLocation": "current_site",
"envelopeMetadata": null,
"envelopeUri": "/envelopes/xxxxx4faf-9777-7153b02d44e3",
"expireAfter": "111",
"expireDateTime": "2022-04-05T21:27:04.0800000Z",
"expireEnabled": "true",
"externalEnvelopeId": null,
"certifiedDeliveries": [],
"currentRoutingOrder": "1",
"editors": [],
"errorDetails": null,
"inPersonSigners": [],
"intermediaries": [],
"notaries": [],
"recipientCount": "2",
"seals": [],
"signers": [
{
"accessCode": null,
"accessCodeMetadata": null,
"addAccessCodeToEmail": null,
"additionalNotifications": null,
"agentCanEditEmail": null,
"agentCanEditName": null,
"allowSystemOverrideForLockedRecipient": null,
"autoNavigation": null,
"autoRespondedReason": null,
"bulkRecipientsUri": null,
"canSignOffline": null,
"clientUserId": null,
"completedCount": "0",
"creationReason": "sender",
"customFields": null,
"declinedDateTime": null,
"declinedReason": null,
"defaultRecipient": null,
"deliveredDateTime": null,
"deliveryMethod": "email",
"deliveryMethodMetadata": null,
"designatorId": null,
"designatorIdGuid": null,
"documentVisibility": null,
"email": "rizauddin446#gmail.com",
"emailMetadata": null,
"emailNotification": null,
"embeddedRecipientStartURL": null,
"errorDetails": null,
"excludedDocuments": null,
"faxNumber": null,
"faxNumberMetadata": null,
"firstName": "",
"firstNameMetadata": null,
"fullName": null,
"fullNameMetadata": null,
"idCheckConfigurationName": null,
"idCheckConfigurationNameMetadata": null,
"idCheckInformationInput": null,
"identityVerification": null,
"inheritEmailNotificationConfiguration": null,
"isBulkRecipient": null,
"isBulkRecipientMetadata": null,
"lastName": "",
"lastNameMetadata": null,
"lockedRecipientPhoneAuthEditable": null,
"lockedRecipientSmsEditable": null,
"name": "rizauddin mohammad",
"nameMetadata": null,
"notaryId": null,
"note": null,
"noteMetadata": null,
"offlineAttributes": null,
"phoneAuthentication": null,
"phoneNumber": null,
"proofFile": null,
"recipientAttachments": null,
"recipientAuthenticationStatus": null,
"recipientFeatureMetadata": null,
"recipientId": "1",
"recipientIdGuid": "xdcd3-4fxxxxc2-aec2-ef83d86cadaa",
"recipientSignatureProviders": null,
"recipientSuppliesTabs": null,
"recipientType": "signer",
"recipientTypeMetadata": null,
"requireIdLookup": "false",
"requireIdLookupMetadata": null,
"requireSignerCertificate": null,
"requireSignOnPaper": null,
"requireUploadSignature": "false",
"roleName": null,
"routingOrder": "1",
"routingOrderMetadata": null,
"sentDateTime": null,
"signatureInfo": null,
"signedDateTime": null,
"signInEachLocation": null,
"signInEachLocationMetadata": null,
"signingGroupId": null,
"signingGroupIdMetadata": null,
"signingGroupName": null,
"signingGroupUsers": null,
"smsAuthentication": null,
"socialAuthentications": null,
"status": "sent",
"statusCode": null,
"suppressEmails": null,
"tabs": null,
"templateLocked": null,
"templateRequired": null,
"totalTabCount": null,
"userId": "xxxxx-4e74-aab8-bd1f98e63fb6"
}
],
"witnesses": []
},
}
]
I have to get the same result as I get from Postman. Is there any options I need to add or remove in coding?
In C# and Java the DocuSign SDKs not yet using dynamic typing and modern techniques to build objects. The objects have to (from the nature of classic OOP design for both C# and Java) have all the various properties that can be returned, or else you will need a different object for each combination of returned data.
I have to get the same result as I get from Postman. Is there any
options I need to add or remove in coding?
Well, you are getting the same results in the JSON that the SDK sends behind the scenes, but the object has additional null properties. I'm not clear why this is an issue for you. Simple null checks can be used to determine which of these have a value. You can even build your own type of dynamic objects by creating them on the fly and eliminating nulls if you really need this.

Stripe events: How to capture the product that was successfully paid with Stripe events and a webhook?

My website's users will buy credits using Stripe's single-payment workflow with a checkout session. They can buy single credits or credit packages, like 10 credits package at discount price.
After a successfully payment I want to capture the event with a webhook and update the user balance according to the product and quantity paid by the user.
I'm currently tracking payment_intent.succeeded events and I can see payment and charge information however I can't find any information related to the product ordered. What am I missing? Thank you.
This is an example of the payment intent event I'm capturing:
{
"amount": 5250,
"amount_capturable": 0,
"amount_received": 5250,
"application": null,
"application_fee_amount": null,
"canceled_at": null,
"cancellation_reason": null,
"capture_method": "automatic",
"charges": {
"data": [
{
"amount": 5250,
"amount_captured": 5250,
"amount_refunded": 0,
"application": null,
"application_fee": null,
"application_fee_amount": null,
"balance_transaction": "txn_1HUSonCfZ37XLQD8mLERR2YR",
"billing_details": {
"address": {
"city": null,
"country": "JP",
"line1": null,
"line2": null,
"postal_code": null,
"state": null
},
"email": "xxxx.xxxx.xxxx#gmail.com",
"name": "asd",
"phone": null
},
"calculated_statement_descriptor": "XXX XXXX",
"captured": true,
"created": 1600847712,
"currency": "jpy",
"customer": "cus_I4c27DIUQuvAHQ",
"description": null,
"destination": null,
"dispute": null,
"disputed": false,
"failure_code": null,
"failure_message": null,
"fraud_details": {},
"id": "ch_1HUSomCfZ37XLQD8d133buOK",
"invoice": null,
"livemode": false,
"metadata": {},
"object": "charge",
"on_behalf_of": null,
"order": null,
"outcome": {
"network_status": "approved_by_network",
"reason": null,
"risk_level": "normal",
"risk_score": 39,
"seller_message": "Payment complete.",
"type": "authorized"
},
"paid": true,
"payment_intent": "pi_1HUSoWCfZ37XLQD82vnE1yQT",
"payment_method": "pm_1HUSolCfZ37XLQD8gSn0oy4x",
"payment_method_details": {
"card": {
"brand": "visa",
"checks": {
"address_line1_check": null,
"address_postal_code_check": null,
"cvc_check": "pass"
},
"country": "US",
"exp_month": 11,
"exp_year": 2050,
"fingerprint": "uaJa23vzDgA7fnSC",
"funding": "credit",
"installments": null,
"last4": "4242",
"network": "visa",
"three_d_secure": null,
"wallet": null
},
"type": "card"
},
"receipt_email": null,
"receipt_number": null,
"receipt_url": "https://pay.stripe.com/receipts/acct_1HU77uCfZ37XLQD8/ch_1HUSomCfZ37XLQD8d133buOK/rcpt_I4c233eGeSYOaN9cPvncC4AcU2Sm4s7",
"refunded": false,
"refunds": {},
"review": null,
"shipping": null,
"source": null,
"source_transfer": null,
"statement_descriptor": null,
"statement_descriptor_suffix": null,
"status": "succeeded",
"transfer_data": null,
"transfer_group": null
}
],
"has_more": false,
"object": "list",
"total_count": 1,
"url": "/v1/charges?payment_intent=pi_1HUSoWCfZ37XLQD82vnE1yQT"
},
"client_secret": "pi_1HUSoWCfZ37XLQD82vnE1yQT_secret_XXX",
"confirmation_method": "automatic",
"created": 1600847696,
"currency": "jpy",
"customer": "cus_I4c27DIUQuvAHQ",
"description": null,
"id": "pi_1HUSoWCfZ37XLQD82vnE1yQT",
"invoice": null,
"last_payment_error": null,
"livemode": false,
"metadata": {},
"next_action": null,
"object": "payment_intent",
"on_behalf_of": null,
"payment_method": "pm_1HUSolCfZ37XLQD8gSn0oy4x",
"payment_method_options": {
"card": {
"installments": null,
"network": null,
"request_three_d_secure": "automatic"
}
},
"payment_method_types": [
"card"
],
"receipt_email": null,
"review": null,
"setup_future_usage": null,
"shipping": null,
"source": null,
"statement_descriptor": null,
"statement_descriptor_suffix": null,
"status": "succeeded",
"transfer_data": null,
"transfer_group": null
}
Assuming you've put the product details in the line_items of the Checkout session you created (see guide step), then what you're looking for is how to "fulfill the order" (see guide step), which you can do by listening to checkout.session.completed events.
When you receive an event, the event data will be a Checkout session by id, and you can then retrieve that session and specify expand\[\]=line_items to be able to inspect the line_items for the session.
Update: I modified the above to reflect that line_items is not included by default. You must retrieve the session and include it in an expand.

Nodejs 2nd call on same external API return previous result

I am writing a service In which I have to register an order tracking number to an external source to track my order automatically.
let trackingObj = {
tracking: {
tracking_number: params.trackingNumber,
order_id: params.orderId,
emails: params.email,
smses: params.phoneNumber,
note: params.optIn
}
}
const aftershipTracking = await AftershipService.postTrackingInfo(trackingObj);
postTrackingInfo: async (body) => {
let _URL = helper.env('AFTER_SHIP_API_URL') + 'trackings';
return await ((await fetch(_URL, {
method: 'POST',
body: JSON.stringify(body),
headers: {
'Content-Type': 'application/json',
'Cache-Control': 'no-cache',
'aftership-api-key': helper.env('AFTER_SHIP_API_KEY')
},
})).json());
}
When I make the first call to register the tracking number, it returns an immediate default object with tag pending.
This returns me which is expected behavior
{
"meta": {
"code": 201
},
"data": {
"tracking": {
"id": "xyzxyzxyzxyzxyzxyxxyzxyxzxyz",
"created_at": "2020-06-25T14:22:09+00:00",
"updated_at": "2020-06-25T14:22:09+00:00",
"last_updated_at": "2020-06-25T14:22:09+00:00",
"tracking_number": "xxxxxxxxxxxxxxxxxx",
"slug": "fedex",
"active": true,
"android": [],
"custom_fields": null,
"customer_name": null,
"delivery_time": null,
"destination_country_iso3": null,
"courier_destination_country_iso3": null,
"emails": [],
"expected_delivery": null,
"ios": [],
"note": null,
"order_id": null,
"order_id_path": null,
"origin_country_iso3": null,
"shipment_package_count": null,
"shipment_pickup_date": null,
"shipment_delivery_date": null,
"shipment_type": null,
"shipment_weight": null,
"shipment_weight_unit": null,
"signed_by": null,
"smses": [],
"source": "api",
"tag": "Pending",
"subtag": "Pending_001",
"subtag_message": "Pending",
"title": "642028981335",
"tracked_count": 0,
"last_mile_tracking_supported": null,
"language": null,
"unique_token": "deprecated",
"checkpoints": [],
"subscribed_smses": [],
"subscribed_emails": [],
"return_to_sender": false,
"order_promised_delivery_date": null,
"delivery_type": null,
"pickup_location": null,
"pickup_note": null,
"courier_tracking_link": "https://www.fedex.com/apps/fedextrack/?tracknumbers=642028981335&cntry_code=US",
"first_attempted_at": null,
"courier_redirect_link": "https://www.fedex.com/apps/fedextrack/?action=track&tracknumbers=642028981335&cntry_code=US",
"tracking_account_number": null,
"tracking_origin_country": null,
"tracking_destination_country": null,
"tracking_key": null,
"tracking_postal_code": null,
"tracking_ship_date": null,
"tracking_state": null
}
}
}
To get the latest or current tag of a tracking number, I have to make back to back the second request to the same external source with the different endpoint. This has to return the latest information this is what happening in Postman but not happening in Nodejs.
const aftershipTrackingStatus = await AftershipService.getTrackingInfo(aftershipTracking.data.tracking.slug, params.trackingNumber);
getTrackingInfo: async (slug, trackingNumber) => {
let _URL = helper.env('AFTER_SHIP_API_URL') + 'trackings/' + slug + '/' + trackingNumber;
return await ((await fetch(_URL, {
method: 'GET',
body: null,
headers: {
'aftership-api-key': helper.env('AFTER_SHIP_API_KEY')
},
})).json());
},
This again returns me the same result as above in 2nd block which is not expected.
As per Postman, it should return this.
{
"meta": {
"code": 200
},
"data": {
"tracking": {
"id": "xyzxyzxyzxyzxyzxyzxyzxyzxyzxyz",
"created_at": "2020-06-25T06:09:07+00:00",
"updated_at": "2020-06-25T06:09:41+00:00",
"last_updated_at": "2020-06-25T06:09:41+00:00",
"tracking_number": "xxxxxxxxxxxxxxxxx",
"slug": "fedex",
"active": false,
"android": [],
"custom_fields": null,
"customer_name": null,
"delivery_time": 7,
"destination_country_iso3": "USA",
"courier_destination_country_iso3": "USA",
"emails": [],
"expected_delivery": null,
"ios": [],
"note": null,
"order_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"order_id_path": null,
"origin_country_iso3": "USA",
"shipment_package_count": 1,
"shipment_pickup_date": "2020-06-03T06:00:00",
"shipment_delivery_date": "2020-06-09T21:17:56",
"shipment_type": "FedEx Ground",
"shipment_weight": 11.3,
"shipment_weight_unit": "lb",
"signed_by": "Signature not required",
"smses": [],
"source": "api",
"tag": "Delivered",
"subtag": "Delivered_001",
"subtag_message": "Delivered",
"title": "642028981335",
"tracked_count": 1,
"last_mile_tracking_supported": null,
"language": null,
"unique_token": "deprecated",
"checkpoints": [
{
"slug": "fedex",
"city": null,
"created_at": "2020-06-25T06:09:41+00:00",
"location": null,
"country_name": null,
"message": "Shipment information sent to FedEx",
"country_iso3": null,
"tag": "InfoReceived",
"subtag": "InfoReceived_001",
"subtag_message": "Info Received",
"checkpoint_time": "2020-06-03T12:48:00-04:00",
"coordinates": [],
"state": null,
"zip": null,
"raw_tag": "OC"
},
{
"slug": "fedex",
"city": "AUSTELL",
"created_at": "2020-06-25T06:09:41+00:00",
"location": "AUSTELL, GA",
"country_name": null,
"message": "Picked up",
"country_iso3": null,
"tag": "InTransit",
"subtag": "InTransit_002",
"subtag_message": "Acceptance scan",
"checkpoint_time": "2020-06-03T15:37:00-04:00",
"coordinates": [],
"state": "GA",
"zip": null,
"raw_tag": "PU"
},
{
"slug": "fedex",
"city": "AUSTELL",
"created_at": "2020-06-25T06:09:41+00:00",
"location": "AUSTELL, GA",
"country_name": null,
"message": "Arrived at FedEx location",
"country_iso3": null,
"tag": "InTransit",
"subtag": "InTransit_003",
"subtag_message": "Arrival scan",
"checkpoint_time": "2020-06-03T17:52:00-04:00",
"coordinates": [],
"state": "GA",
"zip": null,
"raw_tag": "AR"
},
{
"slug": "fedex",
"city": "AUSTELL",
"created_at": "2020-06-25T06:09:41+00:00",
"location": "AUSTELL, GA",
"country_name": null,
"message": "Left FedEx origin facility",
"country_iso3": null,
"tag": "InTransit",
"subtag": "InTransit_007",
"subtag_message": "Departure Scan",
"checkpoint_time": "2020-06-04T01:13:35-04:00",
"coordinates": [],
"state": "GA",
"zip": null,
"raw_tag": "DP"
},
{
"slug": "fedex",
"city": "POWDER SPRINGS",
"created_at": "2020-06-25T06:09:41+00:00",
"location": "POWDER SPRINGS, GA",
"country_name": null,
"message": "In transit",
"country_iso3": null,
"tag": "InTransit",
"subtag": "InTransit_001",
"subtag_message": "In Transit",
"checkpoint_time": "2020-06-04T13:19:27-04:00",
"coordinates": [],
"state": "GA",
"zip": null,
"raw_tag": "IT"
},
{
"slug": "fedex",
"city": "FORREST CITY",
"created_at": "2020-06-25T06:09:41+00:00",
"location": "FORREST CITY, AR",
"country_name": null,
"message": "In transit",
"country_iso3": null,
"tag": "InTransit",
"subtag": "InTransit_001",
"subtag_message": "In Transit",
"checkpoint_time": "2020-06-05T00:19:37-05:00",
"coordinates": [],
"state": "AR",
"zip": null,
"raw_tag": "IT"
},
{
"slug": "fedex",
"city": "PANHANDLE",
"created_at": "2020-06-25T06:09:41+00:00",
"location": "PANHANDLE, TX",
"country_name": null,
"message": "In transit",
"country_iso3": null,
"tag": "InTransit",
"subtag": "InTransit_001",
"subtag_message": "In Transit",
"checkpoint_time": "2020-06-05T12:21:24-05:00",
"coordinates": [],
"state": "TX",
"zip": null,
"raw_tag": "IT"
},
{
"slug": "fedex",
"city": "WILLIAMS",
"created_at": "2020-06-25T06:09:41+00:00",
"location": "WILLIAMS, AZ",
"country_name": null,
"message": "In transit",
"country_iso3": null,
"tag": "InTransit",
"subtag": "InTransit_001",
"subtag_message": "In Transit",
"checkpoint_time": "2020-06-05T22:24:11-07:00",
"coordinates": [],
"state": "AZ",
"zip": null,
"raw_tag": "IT"
},
{
"slug": "fedex",
"city": "TRACY",
"created_at": "2020-06-25T06:09:41+00:00",
"location": "TRACY, CA",
"country_name": null,
"message": "In transit",
"country_iso3": null,
"tag": "InTransit",
"subtag": "InTransit_001",
"subtag_message": "In Transit",
"checkpoint_time": "2020-06-06T17:25:49-07:00",
"coordinates": [],
"state": "CA",
"zip": null,
"raw_tag": "IT"
},
{
"slug": "fedex",
"city": "TRACY",
"created_at": "2020-06-25T06:09:41+00:00",
"location": "TRACY, CA",
"country_name": null,
"message": "In transit",
"country_iso3": null,
"tag": "InTransit",
"subtag": "InTransit_001",
"subtag_message": "In Transit",
"checkpoint_time": "2020-06-07T06:03:27-07:00",
"coordinates": [],
"state": "CA",
"zip": null,
"raw_tag": "IT"
},
{
"slug": "fedex",
"city": "TRACY",
"created_at": "2020-06-25T06:09:41+00:00",
"location": "TRACY, CA",
"country_name": null,
"message": "In transit",
"country_iso3": null,
"tag": "InTransit",
"subtag": "InTransit_001",
"subtag_message": "In Transit",
"checkpoint_time": "2020-06-07T18:03:54-07:00",
"coordinates": [],
"state": "CA",
"zip": null,
"raw_tag": "IT"
},
{
"slug": "fedex",
"city": "TRACY",
"created_at": "2020-06-25T06:09:41+00:00",
"location": "TRACY, CA",
"country_name": null,
"message": "In transit",
"country_iso3": null,
"tag": "InTransit",
"subtag": "InTransit_001",
"subtag_message": "In Transit",
"checkpoint_time": "2020-06-08T06:04:14-07:00",
"coordinates": [],
"state": "CA",
"zip": null,
"raw_tag": "IT"
},
{
"slug": "fedex",
"city": "TRACY",
"created_at": "2020-06-25T06:09:41+00:00",
"location": "TRACY, CA",
"country_name": null,
"message": "Arrived at FedEx location",
"country_iso3": null,
"tag": "InTransit",
"subtag": "InTransit_003",
"subtag_message": "Arrival scan",
"checkpoint_time": "2020-06-08T21:04:00-07:00",
"coordinates": [],
"state": "CA",
"zip": null,
"raw_tag": "AR"
},
{
"slug": "fedex",
"city": "TRACY",
"created_at": "2020-06-25T06:09:41+00:00",
"location": "TRACY, CA",
"country_name": null,
"message": "Departed FedEx location",
"country_iso3": null,
"tag": "InTransit",
"subtag": "InTransit_007",
"subtag_message": "Departure Scan",
"checkpoint_time": "2020-06-08T23:34:27-07:00",
"coordinates": [],
"state": "CA",
"zip": null,
"raw_tag": "DP"
},
{
"slug": "fedex",
"city": "SAN LEANDRO",
"created_at": "2020-06-25T06:09:41+00:00",
"location": "SAN LEANDRO, CA",
"country_name": null,
"message": "At local FedEx facility",
"country_iso3": null,
"tag": "InTransit",
"subtag": "InTransit_007",
"subtag_message": "Departure Scan",
"checkpoint_time": "2020-06-09T04:36:00-07:00",
"coordinates": [],
"state": "CA",
"zip": null,
"raw_tag": "AR"
},
{
"slug": "fedex",
"city": "SAN LEANDRO",
"created_at": "2020-06-25T06:09:41+00:00",
"location": "SAN LEANDRO, CA",
"country_name": null,
"message": "On FedEx vehicle for delivery",
"country_iso3": null,
"tag": "OutForDelivery",
"subtag": "OutForDelivery_001",
"subtag_message": "Out for Delivery",
"checkpoint_time": "2020-06-09T04:48:00-07:00",
"coordinates": [],
"state": "CA",
"zip": null,
"raw_tag": "OD"
},
{
"slug": "fedex",
"city": "Oakland",
"created_at": "2020-06-25T06:09:41+00:00",
"location": "Oakland, CA",
"country_name": null,
"message": "Delivered - Left at front door. Signature Service not requested.",
"country_iso3": null,
"tag": "Delivered",
"subtag": "Delivered_001",
"subtag_message": "Delivered",
"checkpoint_time": "2020-06-09T14:17:56-07:00",
"coordinates": [],
"state": "CA",
"zip": null,
"raw_tag": "DL"
}
],
"subscribed_smses": [],
"subscribed_emails": [],
"return_to_sender": false,
"order_promised_delivery_date": null,
"delivery_type": null,
"pickup_location": null,
"pickup_note": null,
"courier_tracking_link": "https://www.fedex.com/apps/fedextrack/?tracknumbers=642028981335&cntry_code=US",
"first_attempted_at": "2020-06-09T14:17:56-07:00",
"courier_redirect_link": "https://www.fedex.com/apps/fedextrack/?action=track&tracknumbers=642028981335&cntry_code=US",
"tracking_account_number": null,
"tracking_origin_country": null,
"tracking_destination_country": null,
"tracking_key": null,
"tracking_postal_code": null,
"tracking_ship_date": null,
"tracking_state": null
}
}
}

Not Able to add TextTab

Hi I am able to send envelope by adding signhere tab but when i am trying to add TextTabs it is giving below error(I am using rest API's)
INVALID_REQUEST_BODY The request body is missing or improperly formatted. Null object cannot be converted to a value type.
Below is my request JSON of envelope definition
{
"documents": [{
"documentId": "1136641236",
"uri": null,
"remoteUrl": null,
"name": "ABC Merchant Agreement",
"password": null,
"transformPdfFields": null,
"fileExtension": null,
"matchBoxes": null,
"order": null,
"pages": null,
"documentFields": null,
"encryptedWithKeyManager": null,
"documentBase64": "documentBase64",
"applyAnchorTabs": null
}
],
"recipients": {
"signers": [{
"signatureInfo": null,
"defaultRecipient": null,
"tabs": {
"signHereTabs": [{
"name": null,
"tabLabel": null,
"scaleValue": null,
"optional": null,
"documentId": "1136641236",
"recipientId": "2044556663",
"pageNumber": "1",
"xPosition": null,
"yPosition": null,
"anchorString": "SIGNATUREOWNER1",
"anchorXOffset": null,
"anchorYOffset": null,
"anchorUnits": null,
"anchorIgnoreIfNotPresent": null,
"anchorCaseSensitive": "True",
"anchorMatchWholeWord": "True",
"anchorHorizontalAlignment": null,
"tabId": null,
"templateLocked": null,
"templateRequired": null,
"conditionalParentLabel": null,
"conditionalParentValue": null,
"customTabId": null,
"mergeField": null,
"status": null,
"errorDetails": null
}
],
"initialHereTabs": null,
"signerAttachmentTabs": null,
"approveTabs": null,
"declineTabs": null,
"fullNameTabs": null,
"dateSignedTabs": null,
"envelopeIdTabs": null,
"companyTabs": null,
"titleTabs": null,
"textTabs": [{
"height": null,
"isPaymentAmount": null,
"formula": null,
"validationPattern": null,
"validationMessage": null,
"shared": null,
"requireInitialOnSharedChange": null,
"senderRequired": null,
"requireAll": null,
"name": "TextTab",
"value": null,
"originalValue": null,
"width": null,
"required": "true",
"locked": "false",
"concealValueOnDocument": null,
"disableAutoSize": null,
"maxLength": null,
"tabLabel": "gjk",
"font": null,
"bold": null,
"italic": null,
"underline": null,
"fontColor": null,
"fontSize": "Size12",
"documentId": "1136641236",
"recipientId": "2044556663",
"pageNumber": "1",
"xPosition": null,
"yPosition": null,
"anchorString": "TEXTTABPLACEHOLDER",
"anchorXOffset": null,
"anchorYOffset": null,
"anchorUnits": null,
"anchorIgnoreIfNotPresent": null,
"anchorCaseSensitive": "True",
"anchorMatchWholeWord": "True",
"anchorHorizontalAlignment": null,
"tabId": null,
"templateLocked": null,
"templateRequired": null,
"conditionalParentLabel": null,
"conditionalParentValue": null,
"customTabId": null,
"mergeField": null,
"status": null,
"errorDetails": null
}
],
"numberTabs": null,
"ssnTabs": null,
"dateTabs": null,
"zipTabs": null,
"emailTabs": null,
"noteTabs": null,
"checkboxTabs": null,
"radioGroupTabs": null,
"listTabs": null,
"firstNameTabs": null,
"lastNameTabs": null,
"emailAddressTabs": null,
"formulaTabs": null
},
"signInEachLocation": null,
"offlineAttributes": null,
"requireSignerCertificate": null,
"requireSignOnPaper": null,
"canSignOffline": null,
"isBulkRecipient": null,
"bulkRecipientsUri": null,
"recipientSuppliesTabs": null,
"excludedDocuments": null,
"name": "name",
"email": "emailid",
"emailRecipientPostSigningURL": null,
"signingGroupId": null,
"signingGroupName": null,
"signingGroupUsers": null,
"recipientId": "2044556663",
"recipientIdGuid": null,
"accessCode": null,
"addAccessCodeToEmail": null,
"requireIdLookup": null,
"idCheckConfigurationName": null,
"socialAuthentications": null,
"phoneAuthentication": null,
"samlAuthentication": null,
"smsAuthentication": null,
"userId": null,
"clientUserId": null,
"embeddedRecipientStartURL": null,
"customFields": null,
"routingOrder": "1",
"idCheckInformationInput": null,
"recipientAttachments": null,
"note": null,
"roleName": null,
"status": null,
"signedDateTime": null,
"deliveredDateTime": null,
"declinedDateTime": null,
"sentDateTime": null,
"declinedReason": null,
"deliveryMethod": null,
"faxNumber": null,
"templateLocked": null,
"templateRequired": null,
"emailNotification": null,
"inheritEmailNotificationConfiguration": null,
"errorDetails": null,
"recipientAuthenticationStatus": null,
"totalTabCount": null
}
],
"agents": null,
"editors": null,
"intermediaries": null,
"carbonCopies": null,
"certifiedDeliveries": null,
"inPersonSigners": null,
"recipientCount": null,
"currentRoutingOrder": null,
"errorDetails": null
},
"customFields": {
"textCustomFields": [{
"fieldId": "788788",
"name": "AppNumber",
"show": "false",
"required": "false",
"value": "788788",
"configurationType": null,
"errorDetails": null
}
],
"listCustomFields": null
},
"eventNotification": null,
"brandId": "BrandId",
"allowRecipientRecursion": null,
"templateId": null,
"templateRoles": null,
"compositeTemplates": null,
"accessibility": null,
"transactionId": null,
"status": "sent",
"documentsUri": null,
"recipientsUri": null,
"asynchronous": null,
"envelopeUri": null,
"emailSubject": "ABC Agreement",
"emailBlurb": "Please Sign",
"envelopeId": null,
"signingLocation": null,
"customFieldsUri": null,
"envelopeIdStamping": null,
"authoritativeCopy": null,
"notification": {
"useAccountDefaults": null,
"reminders": {
"reminderEnabled": "true",
"reminderDelay": "1",
"reminderFrequency": "2"
},
"expirations": {
"expireEnabled": "true",
"expireAfter": "2",
"expireWarn": "1"
}
},
"notificationUri": null,
"enforceSignerVisibility": null,
"enableWetSign": null,
"allowMarkup": null,
"allowReassign": null,
"createdDateTime": null,
"lastModifiedDateTime": null,
"deliveredDateTime": null,
"sentDateTime": null,
"completedDateTime": null,
"voidedDateTime": null,
"voidedReason": null,
"deletedDateTime": null,
"declinedDateTime": null,
"statusChangedDateTime": null,
"documentsCombinedUri": null,
"certificateUri": null,
"templatesUri": null,
"messageLock": null,
"recipientsLock": null,
"useDisclosure": null,
"emailSettings": null,
"purgeState": null,
"lockInformation": null,
"is21CFRPart11": null
}
The error message says it all
Null object cannot be converted to a value type.
Remove the properties which have null value assigned to them. The following JSON should work.
{
"documents": [
{
"documentId": "1136641236",
"name": "ABC Merchant Agreement",
"documentBase64": "documentBase64"
}
],
"recipients": {
"signers": [
{
"tabs": {
"signHereTabs": [
{
"documentId": "1136641236",
"pageNumber": "1",
"anchorString": "SIGNATUREOWNER1",
"anchorCaseSensitive": "True",
"anchorMatchWholeWord": "True"
}
],
"textTabs": [
{
"name": "TextTab",
"required": "true",
"locked": "false",
"tabLabel": "gjk",
"fontSize": "Size12",
"documentId": "1136641236",
"pageNumber": "1",
"anchorString": "TEXTTABPLACEHOLDER",
"anchorCaseSensitive": "True",
"anchorMatchWholeWord": "True"
}
]
},
"name": "name",
"email": "emailid",
"recipientId": "2044556663",
"routingOrder": "1"
}
]
},
"customFields": {
"textCustomFields": [
{
"fieldId": "788788",
"name": "AppNumber",
"show": "false",
"required": "false",
"value": "788788"
}
]
},
"brandId": "BrandId",
"status": "sent",
"emailSubject": "ABC Agreement",
"emailBlurb": "Please Sign",
"notification": {
"reminders": {
"reminderEnabled": "true",
"reminderDelay": "1",
"reminderFrequency": "2"
},
"expirations": {
"expireEnabled": "true",
"expireAfter": "2",
"expireWarn": "1"
}
}
}

Resources