Docusign not prefilling documents before sending - php

I am having issues when sending documents for a recipient to sign it. The documents should be prefilled using the data from my database which works fine. I know this because when I var_dump $this->textTabs I can see the data. $global is false.
The issue I am having is that when the recipient receives an email to sign the document, the fields which should be prefilled are blank. The Data Label matches the tabLabel in the code below and image
$this->textTabs = [
[
'tabLabel' => 'RegisteredName',
'value' => $contactData->company->name,
'global' => $global,
],
[
'tabLabel' => 'NumberOfEmployees',
'value' => $contactData->company->employee_size,
'global' => $global,
],
[
'tabLabel' => 'RegisteredNumber',
'value' => $contactData->company->reg_no,
'global' => $global,
],
[
'tabLabel' => 'SupplyAddress',
'value' => $supplyAddress_1 . $supplyAddress_2 . $supplyCity . $supplyTown . $supplyCounty . $supplyPostcode,
'global' => $global,
],
[
'tabLabel' => 'SicCode',
'value' => $contactData->company->gapSite->scat_code,
'global' => $global,
],
[
'tabLabel' => 'Recipient_UserTitle',
'value' => $title,
'global' => $global,
],
[
'tabLabel' => 'Recipient_UserName',
'value' => $title . $firstName . $lastName,
'global' => $global,
],
[
'tabLabel' => 'Recipient_Email',
'value' => $contactData->email,
'global' => $global,
],
[
'tabLabel' => 'ContactTelephone',
'value' => $contactData->telephone,
'global' => $global,
],
];
private function send(string $status): ?array
{
try {
return Docusign::createEnvelope([
'templateId' => $this->templateId,
'emailSubject' => $this->emailSubject,
'status' => $status,
'templateRoles' => [
[
'name' => $this->recipient['name'],
'email' => $this->recipient['email'],
'roleName' => 'Client',
'tabs' => [
'textTabs' => $this->textTabs,
/* 'signHereTabs' => [
[
"xPosition" => 400,
"yPosition" => 263,
"documentId" => 1,
"pageNumber" => 6
]
],
*/
]
]
],
'eventNotification' => [
'url' => 'https://webhook.site/697fabec-145a-491f-87ce-1d62be82b298',
'LoggingEnabled' => true,
'RequireAcknowledgment' => true,
'UseSoapInterface' => false,
'IncludeCertificateWithSoap' => false,
'SignMessageWithX509Cert' => false,
'includeDocuments' => true,
'includeEnvelopeVoidReason' => true,
'includeTimeZone' => true,
'includeSenderAccountAsCustomField' => true,
'includeDocumentFields' => true,
'includeCertificateOfCompletion' => true,
'envelopeEventStatusCode' => $this->getRecipientEvents(),
'recipientEvents' => $this->getEventNotification(),
]
]);
} catch (\Exception $e) {
}
}
The fact That recipient receives the email to sign the document, already eliminate any issue to do with my code but why is it not prefilling with the data?

After a while, I decided to create a new docusign account and this seems to have solved the issue. I believe my account was bugger or maybe some technical issue on docusign,

Related

Notice: Undefined index: content in onboarding.php on line 43

I'm getting this error and not sure why. Here's my code :
$genesis_sample_shared_content = genesis_get_config( 'onboarding-shared' );
return [
'starter_packs' => [
'black-white' => [
'title' => __( 'Black & White', 'genesis-sample' ),
'description' => __( 'A pack with a homepage designed with black and white images.', 'genesis-sample' ),
'thumbnail' => get_stylesheet_directory_uri() . '/config/import/images/thumbnails/home-black-white.jpg',
'demo_url' => 'https://demo.studiopress.com/genesis-sample/',
'config' => [
'dependencies' => [
'plugins' => $genesis_sample_shared_content['plugins'],
],
'content' => array_merge(
[
'homepage' => [
'post_title' => 'Homepage',
'post_content' => require dirname( __FILE__ ) . '/import/content/home-black-white.php',
'post_type' => 'page',
'post_status' => 'publish',
'comment_status' => 'closed',
'ping_status' => 'closed',
'meta_input' => [
'_genesis_layout' => 'full-width-content',
'_genesis_hide_title' => true,
'_genesis_hide_breadcrumbs' => true,
'_genesis_hide_singular_image' => true,
],
],
],
$genesis_sample_shared_content['content']
),
'navigation_menus' => $genesis_sample_shared_content['navigation_menus'],
'widgets' => $genesis_sample_shared_content['widgets'],
],
],
],
];
I have modified the onboarding-shared.php file and remove the code for the content Maybe this is the problem?
Update : Now the menu items are created on theme setup. Here's the modified code :
return [
'plugins' => [
[
'name' => __( 'Genesis Blocks', 'genesis-sample' ),
'slug' => 'genesis-blocks/genesis-blocks.php',
'public_url' => 'https://wordpress.org/plugins/genesis-blocks/',
],
],
'navigation_menus' => [
'primary' => [
'get-started' => [
'title' => 'Get Started',
],
'testimonials' => [
'title' => 'Testimonials',
],
'contact' => [
'title' => 'Contact Us',
],
],
],
'widgets' => [
'footer-1' => [
[
'type' => 'text',
'args' => [
'title' => 'Design',
'text' => '<p>With an emphasis on typography, white space, and mobile-optimized design, your website will look absolutely breathtaking.</p><p>Learn more about design.</p>',
'filter' => 1,
'visual' => 1,
],
],
],
'footer-2' => [
[
'type' => 'text',
'args' => [
'title' => 'Content',
'text' => '<p>Our team will teach you the art of writing audience-focused content that will help you achieve the success you truly deserve.</p><p>Learn more about content.</p>',
'filter' => 1,
'visual' => 1,
],
],
],
'footer-3' => [
[
'type' => 'text',
'args' => [
'title' => 'Strategy',
'text' => '<p>We help creative entrepreneurs build their digital business by focusing on three key elements of a successful online platform.</p><p>Learn more about strategy.</p>',
'filter' => 1,
'visual' => 1,
],
],
],
],
];
The menu items aren't for pages, they're linked to scroll points on the homepage. Not sure how to code that using the above PHP?
I removed $genesis_sample_shared_content['content'] and it now works except the menu items aren't created on theme setup maybe due to this error
Notice: Trying to get property 'name' of non-object in wp-admin/nav-menus.php on line 1098

Extend an assiociative Array with variable

can someone help me, how I can extend an assiociative array with a variable?
I have a loop (foreach):
foreach($this->getWarehouseListForm() as $wareHouse) {
$wareHouseList[] =
[
"title" => "wareHouse[105]",
"form" => [
"storeId[105]" => [
"type" => "inputText",
"options" => [
"name" => "TSL",
],
],
],
];
}
And I want to extend a object like this:
"sections" => [
[
"title" => 'Schuhe24Assistant.ftpServerTitle',
"description" => 'Schuhe24Assistant.ftpServerDescription',
"form" => [
"ftpServer" => [
'type' => 'text',
'defaultValue' => 'ftp.hisasp2.com',
'options' => [
'name' => 'Schuhe24Assistant.ftpServer',
'required' => true,
]
],
"ftpUser" => [
'type' => 'text',
'defaultValue' => 'username',
'options' => [
'name' => 'Schuhe24Assistant.ftpUser',
'required' => true,
]
],
"ftpPassword" => [
'type' => 'text',
'defaultValue' => 'password',
'options' => [
'name' => 'Schuhe24Assistant.ftpPassword',
#'isPassword' => true,
'required' => true,
],
],
"deleteFiles" => [
'type' => 'toggle',
'defaultValue' => true,
'options' => [
'name' => 'Schuhe24Assistant.deleteFiles',
],
],
],
],
], $wareHouseList
But this code produces nothing (no error output) and the structure check fails in this case. If I remove the variable, the structure check is OK.
Can someone help me out?
Kind regards
Henning
Push your $wareHouseList array into the $sections array in the following ways
$sections['wareHouseList'] = $wareHouseList
It should be working.

PHP SOAP Request to Bing Ads API

I'm having a tough time figuring out how to properly code sequenced SOAP requests to the Bing Ads API. Prefer not to use their SDK, which I have used in the past.
The parameters 'Scope', 'Time', 'Filter', and 'Sort' do not affect the result. The entire account keywords are returned instead. For 'Scope', I am using the Adgroups param to select keywords in that Adgroup. Any help is greatly appreciated.
Reference: https://learn.microsoft.com/en-us/advertising/reporting-service/keywordperformancereportrequest?view=bingads-13
WSDL: https://reporting.api.bingads.microsoft.com/Api/Advertiser/Reporting/V13/ReportingService.svc?singleWsdl
$request = [
'ReportRequest' => new SoapVar(
[
'Format' => 'Csv',
'ReportName' => 'Bing Keyword Performance Report',
'ReturnOnlyCompleteData' => false,
'Aggregation' => 'Daily',
'Sort' => array('SortColumn' => 'Clicks','SortOrder' => 'Ascending'),
'Scope' => ['AdGroups' => array(array('AccountId' => $bClientId,
'AdGroupId' => $apiDBIdGroupBing,
'CampaignId' => $apiDBIdCampaignBing,
))],
'Time' => [
'CustomDateRangeStart' =>
array('Day' => $startDay,'Month' => $startMonth,'Year' => $startYear),
'CustomDateRangeEnd' =>
array('Day' => $endDay,'Month' => $endMonth,'Year' => $endYear)
],
'Filter' => ['Keywords' => array($criteriaValue)],
'Columns' => [
"TimePeriod",
"Spend",
"Clicks",
"CurrentMaxCpc",
"Impressions",
"AdGroupName"
]
],
SOAP_ENC_OBJECT,
'KeywordPerformanceReportRequest',
"https://bingads.microsoft.com/Reporting/v13"
)];
Solved:
$request = [
'ReportRequest' => new SoapVar(
[
'Format' => 'Csv',
'ReportName' => 'Bing Keyword Performance Report',
'ReturnOnlyCompleteData' => false,
'Aggregation' => 'Monthly',
'Sort' => array('SortColumn' => 'Clicks','SortOrder' => 'Ascending'),
'Scope' => ['AccountIds' => [$bClientId]],
'MaxRows' => '9000000',
'Time' => ['PredefinedTime' => $reportTimeFrame],
'Columns' => [
"Keyword",
"Spend",
"CampaignId",
"AdGroupId",
"AveragePosition",
"CurrentMaxCpc",
"KeywordId",
"BidMatchType",
"Impressions",
"Clicks",
"TimePeriod",
"QualityScore",
"ExpectedCtr",
"AdRelevance",
"LandingPageExperience",
"CampaignStatus",
"AdGroupStatus",
"KeywordStatus",
"AccountName",
"CampaignName",
"AdGroupName",
"BidStrategyType",
]
],
SOAP_ENC_OBJECT,
'KeywordPerformanceReportRequest',
"https://bingads.microsoft.com/Reporting/v13"
)];
$response = $SoapClient->SubmitGenerateReport($request);

How to update Amazon CloudFront distribution

I want to update the status of an Amazon CloudFront distribution using the updatedistribution method provided by AWS.
I don't know default value of all the required parameters.
My code is:
list($before, $after) = explode('.', $domain, 2);
$domain_Items = "*." . $after;
$result = $client->updateDistribution([
'DistributionConfig' =>
[
'Aliases' =>
[
'Items' => [$domain_Items, $after],
'Quantity' => 2
],
'CallerReference' => $domain,
'Comment' => 'custom domain for ' . $domain,
'Enabled' => false,
'PriceClass' => 'PriceClass_All',
'CacheBehaviors' => [
'Items' => [
[
'AllowedMethods' =>
[
'CachedMethods' =>
[
'Items' => ['HEAD', 'GET'],
'Quantity' => 2,
],
'Items' => ['HEAD', 'GET', 'OPTIONS', 'PUT', 'POST', 'PATCH', 'DELETE'],
'Quantity' => 7,
],
'Compress' => true,
'DefaultTTL' => 0,
//'FieldLevelEncryptionId' => '<string>',
'ForwardedValues' => [
'Cookies' => [
'Forward' => 'all',
'WhitelistedNames' => [
'Quantity' => 5,
'Items' => ['Host', 'Referer', 'Orign', 'User-Agent', 'HTTP_REFERER'],
],
],
'Headers' =>
[
'Items' => ['Host', 'Referer', 'Orign', 'User-Agent', 'HTTP_REFERER'],
'Quantity' => 5
],
'QueryString' => true,
'QueryStringCacheKeys' => [
'Items' => ['Host', 'Referer', 'Orign', 'User-Agent', 'HTTP_REFERER'],
'Quantity' => 5
],
],
'LambdaFunctionAssociations' => [
'Items' => [
[
'EventType' => 'viewer-request',
'IncludeBody' => true,
'LambdaFunctionARN' => '', //<string>
]
],
'Quantity' => 1,
],
'MaxTTL' => 0,
'MinTTL' => 0,
'PathPattern' => '', //<string>
'SmoothStreaming' => true,
'TargetOriginId' => 'ELB-saglus-test-uat-web-783948842',
'TrustedSigners' => [
'Enabled' => false,
//'Items' => ['<string>'],
'Quantity' => 0,
],
'ViewerProtocolPolicy' => 'redirect-to-https',
],
],
'Quantity' => 1,
],
'DefaultCacheBehavior' =>
[
'AllowedMethods' =>
[
'CachedMethods' =>
[
'Items' => ['HEAD', 'GET'],
'Quantity' => 2,
],
'Items' => ['HEAD', 'GET', 'OPTIONS', 'PUT', 'POST', 'PATCH', 'DELETE'],
'Quantity' => 7,
],
'Compress' => true,
'DefaultTTL' => 0,
'FieldLevelEncryptionId' => '',
'ForwardedValues' =>
[
'Cookies' =>
[
'Forward' => 'all'
],
'WhitelistedNames' => [
'Quantity' => 5,
'Items' => ['Host', 'Referer', 'Orign', 'User-Agent', 'HTTP_REFERER'],
],
'Headers' =>
[
'Items' => ['Host', 'Referer', 'Orign', 'User-Agent', 'HTTP_REFERER'],
'Quantity' => 5,
],
'QueryString' => true,
'QueryStringCacheKeys' => [
'Items' => ['Host', 'Referer', 'Orign', 'User-Agent', 'HTTP_REFERER'],
'Quantity' => 5, // REQUIRED
],
],
'LambdaFunctionAssociations' => [
'Items' => [
[
'EventType' => 'viewer-request',
'IncludeBody' => false,
'LambdaFunctionARN' => '', // REQUIRED <string>
]
],
'Quantity' => 1, // REQUIRED
],
'MaxTTL' => 600,
'MinTTL' => 0,
'SmoothStreaming' => false,
'TargetOriginId' => 'ELB-saglus-test-uat-web-783948842',
'TrustedSigners' =>
[
'Enabled' => false,
'Quantity' => 0
],
'ViewerProtocolPolicy' => 'redirect-to-https'
],
'DefaultRootObject' => '',
'HttpVersion' => 'http2',
'IsIPV6Enabled' => false,
'Logging' => [
'Bucket' => 'saglus-aws-logs.s3.amazonaws.com', // REQUIRED
'Enabled' => true, // REQUIRED
'IncludeCookies' => true, // REQUIRED
'Prefix' => 'logs-for-' . $domain, // REQUIRED
],
'Origins' =>
[
'Items' =>
[
[
'CustomHeaders' =>
[
'Items' =>
[
[
'HeaderName' => 'X-Origin-Verify',
'HeaderValue' => 'cnxpwcausbtobmebhebadbergdifn'
],
],
'Quantity' => 1
],
'CustomOriginConfig' =>
[
'HTTPPort' => 80,
'HTTPSPort' => 443,
'OriginKeepaliveTimeout' => 5,
'OriginProtocolPolicy' => 'http-only',
'OriginReadTimeout' => 120,
'OriginSslProtocols' =>
[
'Items' => ['TLSv1'],
'Quantity' => 1
],
],
'DomainName' => 'saglus-test-uat-web-783948842.us-east-1.elb.amazonaws.com',
'Id' => 'ELB-saglus-test-uat-web-783948842',
'OriginPath' => ''
],
],
'Quantity' => 1,
],
'WebACLId' => '108e7697-00db-4330-8d55-bbe57ca94e44'
],
'Id' => $distribution_id,
'IfMatch' => $ETag,
]);
However, I get the error:
Reference link: updatedistribution in AWS SDK for PHP 3.x
$client = new Aws\CloudFront\CloudFrontClient([
'region' => 'us-east-1',
'version' => 'latest',
'credentials' => [
'key' => $this->AcmKey,
'secret' => $this->AcmSecret
]
]);
// $id = 'E2SYUN95DWJFXC';
$id = $business_custom_data->distribution_id;
try {
$result = $client->getDistribution([
'Id' => $id,
]);
} catch (AwsException $e) {
// output error message if fails
echo $e->getMessage();
echo "\n";
}
$currentConfig = $result["Distribution"]["DistributionConfig"];
$ETag = $result["ETag"];
$distribution = [
'CallerReference' => $currentConfig["CallerReference"], // REQUIRED
'Comment' => $currentConfig["Comment"], // REQUIRED
'DefaultCacheBehavior' => $currentConfig["DefaultCacheBehavior"], // REQUIRED
'DefaultRootObject' => $currentConfig["DefaultRootObject"],
//'Enabled' => $currentConfig["Enabled"], // REQUIRED
'Enabled' => False, // REQUIRED
'Origins' => $currentConfig["Origins"], // REQUIRED
'Aliases' => $currentConfig["Aliases"],
'CustomErrorResponses' => $currentConfig["CustomErrorResponses"],
'HttpVersion' => $currentConfig["HttpVersion"],
'CacheBehaviors' => $currentConfig["CacheBehaviors"],
'Logging' => $currentConfig["Logging"],
'PriceClass' => $currentConfig["PriceClass"],
'Restrictions' => $currentConfig["Restrictions"],
'ViewerCertificate' => $currentConfig["ViewerCertificate"],
'WebACLId' => $currentConfig["WebACLId"],
];
try {
$result = $client->updateDistribution([
'DistributionConfig' => $distribution,
'Id' => $id,
'IfMatch' => $ETag
]);
$status = true;
//var_dump($result);
//die;
} catch (AwsException $e) {
// output error message if fails
echo $e->getMessage();
echo "\n";
}

Implement suggest function of elasticsearch-php client in my API

I am trying to implement the suggest function of elasticsearch-php client in my API to suggest people some already existing problems.
I have made index for my problems
'index' => 'newproblemindex',
'body' => [
'settings' => [
'number_of_shards' => 3,
'number_of_replicas' => 2
],
'mappings' => [
'newproblems' => [ // type of index
'_source' => [
'enabled' => true
],
'properties' => [
'title' => [
'type' => 'text',
'analyzer' => 'standard'
],
'description' => [
'type' => 'text',
'analyzer' => 'standard'
], 'suggest' => [
'type' => 'completion'
]
]
]
]
]
But I am unable to find which param fields to use to implement suggest function
'index' => 'newproblemindex',
'body' => [
'try' => [
'text' => $request->search_key,
'completion' => [ 'text' => 'suggest' ]
]
],
I am using laravel and taking search_key as request param but I am getting "invalid_type_name_exception" and when I tried to give the type name, it is again giving me some error.
"suggest" => [
"song-suggest" => [
"prefix" => $request->search_key,
"completion" => ["field" => "suggest"]
]
]
I am getting error "suggest is not a valid param ". Please help
and Thanks in advance.

Categories