SendGrid response status code 0 no further information - sendgrid

I am trying to send a mail using the SendGrid PHP API library. It worked when I tried it yesterday but today the reponse just has zero information:
SendGrid\Response Object
(
[statusCode:protected] => 0
[body:protected] =>
[headers:protected] => Array
(
[0] =>
)
)
The following object is being used in the \SendGrid\SendGrid()->send() method:
SendGrid\Mail\Mail Object
(
[from:SendGrid\Mail\Mail:private] => SendGrid\Mail\From Object
(
[name:SendGrid\Mail\EmailAddress:private] => test1
[email:SendGrid\Mail\EmailAddress:private] => test#example.com
[substitutions:SendGrid\Mail\EmailAddress:private] =>
[subject:SendGrid\Mail\EmailAddress:private] =>
)
[subject:SendGrid\Mail\Mail:private] => SendGrid\Mail\Subject Object
(
[subject:SendGrid\Mail\Subject:private] => this is a test
)
[contents:SendGrid\Mail\Mail:private] => Array
(
[0] => SendGrid\Mail\Content Object
(
[type:SendGrid\Mail\Content:private] => text/html
[value:SendGrid\Mail\Content:private] =>
<h1>sending mails</h1>
)
)
[attachments:SendGrid\Mail\Mail:private] =>
[reply_to:SendGrid\Mail\Mail:private] =>
[personalization:SendGrid\Mail\Mail:private] => Array
(
[0] => SendGrid\Mail\Personalization Object
(
[tos:SendGrid\Mail\Personalization:private] => Array
(
[0] => SendGrid\Mail\To Object
(
[name:SendGrid\Mail\EmailAddress:private] => mr test
[email:SendGrid\Mail\EmailAddress:private] => testtest#example.com
[substitutions:SendGrid\Mail\EmailAddress:private] =>
[subject:SendGrid\Mail\EmailAddress:private] =>
)
)
[ccs:SendGrid\Mail\Personalization:private] => Array
(
[0] => SendGrid\Mail\Cc Object
(
[name:SendGrid\Mail\EmailAddress:private] =>
[email:SendGrid\Mail\EmailAddress:private] => testtest1#example.com
[substitutions:SendGrid\Mail\EmailAddress:private] =>
[subject:SendGrid\Mail\EmailAddress:private] =>
)
)
[bccs:SendGrid\Mail\Personalization:private] =>
[subject:SendGrid\Mail\Personalization:private] =>
)
)
)
Obviously I used correct addresses in the tos and ccs sections.
Is something wrong with the sent object?

Apart from the code if there are any other problems in sending mail the send-grid library remains silent without throwing any exceptions and just returns the response 0. I would suggest you to
visit this link
In php-http-client\lib create a folder Exception.
Copy lib/Exception/InvalidRequest.php into the folder.
Modify lib/Client.php
These modifications are to throw appropriate exceptions which will help you to find what could be the problem in your case and be able to take it further.

Related

PayPal pre-approval giving error

I have used PayPal api in which first i do preapproval and then make chained payment using that approval key. Everything works fine on my local server. But as on live its giving me below error.
Preapproval
Error
PreapprovalResponse Object
(
[responseEnvelope] => ResponseEnvelope Object
(
[timestamp] => 2015-05-01T08:38:40.374-07:00
[ack] => Failure
[correlationId] => 88fffca2a737c
[build] => 15743565
)
[preapprovalKey] =>
[error] => Array
(
[0] => ErrorData Object
(
[errorId] => 580001
[domain] => PLATFORM
[subdomain] => Application
[severity] => Error
[category] => Application
[message] => Invalid request: Data validation warning(line -1, col 0): null
[exceptionId] =>
[parameter] => Array
(
[0] => ErrorParameter Object
(
[name] =>
[value] => Data validation warning(line -1, col 0): null
)
[1] => ErrorParameter Object
(
[name] =>
[value] => Data validation warning(line -1, col 0): null
)
)
)
)
)
My request is
requestEnvelope.errorLanguage=en_US&cancelUrl=http%3A%2F%2Fredesignbox.com%2Fopendemo%2Fhappyfund%2Fcheckout&currencyCode=RUB&maxAmountPerPayment=1%2C032.00&maxNumberOfPayments=1&maxTotalAmountOfAllPayments=1%2C032.00&returnUrl=http%3A%2F%2Fredesignbox.com%2Fopendemo%2Fhappyfund%2Fcheckout_action%2Faction%2FafterApproval&startingDate=2015-05-01&feesPayer=PRIMARYRECEIVER
Response is
responseEnvelope.timestamp=2015-05-01T08%3A38%3A40.374-07%3A00&responseEnvelope.ack=Failure&responseEnvelope.correlationId=88fffca2a737c&responseEnvelope.build=15743565&error(0).errorId=580001&error(0).domain=PLATFORM&error(0).subdomain=Application&error(0).severity=Error&error(0).category=Application&error(0).message=Invalid+request%3A+Data+validation+warning%28line+-1%2C+col+0%29%3A+null&error(0).parameter(0)=Data+validation+warning%28line+-1%2C+col+0%29%3A+null&error(0).parameter(1)=Data+validation+warning%28line+-1%2C+col+0%29%3A+null
What's wrong i cannot understand.
EDIT
On local my ssl version is
OpenSSL/0.9.8y and
on live its NSS/3.16.2.3 Basic ECC
$maxpaymentss = floor(2000/68.50);
$data = array(
'ClientDetails' => array(
'applicationId' => 'My_APP',
),
'returnUrl' => 'http://www.yourdomain.com/success.html',
'cancelUrl' => 'http://www.yourdomain.com/cancel.html',
'startingDate' => gmdate("Y-m-d\TH:i:s\Z"),
'endingDate' => gmdate("Y-m-d\TH:i:s\Z"),
'maxAmountPerPayment' => 68.50,
'maxNumberOfPayments' => $maxpaymentss,
'maxTotalAmountOfAllPayments' => 2000.00,
'maxNumberOfPaymentsPerPeriod' => 1,
'currencyCode' => 'USD',
'requestEnvelope' => array(
'errorLanguage' => 'en_US',
'detailLevel' => 'ReturnAll'
)
);
these are the required fields for the live mode of PayPal adaptive preapproval.
Remove the "," in the "maxAmountPerPayment" and "maxTotalAmountOfAllPayments" field and try again . It should work fine

Illuminate returns results in JSON - why?

I'm using Illuminate to access my database
<body>
<?php
$edges = Edge::all();
foreach ($edges as $key => $value) {
print $value;
}
?>
</body>
browser returns:
{"childID":"A","parentID":"C","updated_at":null,"created_at":null}{"childID":"B","parentID":"E","updated_at":null,"created_at":null}{"childID":"C","parentID":"D","updated_at":null,"created_at":null}{"childID":"C","parentID":"F","updated_at":null,"created_at":null}{"childID":"Y","parentID":"Z","updated_at":"2014-08-07 10:26:54","created_at":"2014-08-07 10:26:54"}
What's odd or unexpected for me at least is that my results are returned in JSON. If you could
shine some light on this, i.e. why this might be, or the reason is...I'd be grateful.
If I dump the results in the browser with:
<?php
print '<pre>';print_r($edges);
?>
produces:
Illuminate\Database\Eloquent\Collection Object
(
[items:protected] => Array
(
[0] => Edge Object
(
[connection:protected] =>
[table:protected] =>
[primaryKey:protected] => id
[perPage:protected] => 15
[incrementing] => 1
[timestamps] => 1
[attributes:protected] => Array
(
[childID] => A
[parentID] => C
[updated_at] =>
[created_at] =>
)
[original:protected] => Array
(
[childID] => A
[parentID] => C
[updated_at] =>
[created_at] =>
)
[relations:protected] => Array
(
)
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[appends:protected] => Array
(
)
[fillable:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[dates:protected] => Array
(
)
[touches:protected] => Array
(
)
[observables:protected] => Array
(
)
[with:protected] => Array
(
)
[morphClass:protected] =>
[exists] => 1
)
[1] => Edge Object
(...)
...
)
In terms of the front-end results - I'm really only interested in the:
[childID] => A
[parentID] => C
[updated_at] =>
[created_at] =>
part of the object; only NOT in JSON; in plain text.

Error, Fault message used AP ID: APP-80W284485P519543T

ERROR
Array
(
[0] => Array
(
[name] => ns3:FaultMessage
[attributes] => Array
(
[xmlns:ns3] => http://svcs.paypal.com/types/common
[xmlns:ns2] => http://svcs.paypal.com/types/ap
)
[0] => Array
(
[name] => responseEnvelope
[0] => Array
(
[name] => timestamp
[value] => 2014-02-20T10:17:27.045-08:00
)
[1] => Array
(
[name] => ack
[value] => Failure
)
[2] => Array
(
[name] => correlationId
[value] => 53cf284d0847f
)
[3] => Array
(
[name] => build
[value] => 9641252
)
)
[1] => Array
(
[name] => error
[0] => Array
(
[name] => errorId
[value] => 560022
)
[1] => Array
(
[name] => domain
[value] => PLATFORM
)
[2] => Array
(
[name] => subdomain
[value] => Application
)
[3] => Array
(
[name] => severity
[value] => Error
)
[4] => Array
(
[name] => category
[value] => Application
)
[5] => Array
(
[name] => message
[value] => The X-PAYPAL-APPLICATION-ID header contains an invalid value
)
[6] => Array
(
[name] => parameter
[value] => X-PAYPAL-APPLICATION-ID
)
)
)
)
Hello,
I use the sandbox AP ID: APP-80W284485P519543T and I tried another one which called Client ID, which i got from the API credentials in the profile under sandbox test accounts, both didn't work and I got this error. What is the right api ID? Where can I find it? or is some other thing wrong? Looking forward for your answer. Thank you.
Regards
Jess
The APP ID : APP-80W284485P519543T is the default APP ID for the Sandbox.
But, you are making calls to live PayPAl.
The Endpoint should be something like : https://svcs.sandbox.paypal.com/AdaptivePayments/Pay
Also, check the if you have passed any space in your APPID.
Client ID is used for making REST API calls.
The sandbox App ID is indeed APP-80W284485P519543T, so you're good if that's the value you're using for testing. I guess you just need to make sure you're trimming any whitespace or any junk off the ends, and make sure your headers are setup correctly in general.
Are you working with PHP? If so, you might want to check out my PayPal class library. It'll make your Adaptive Payments calls very simple for you.

Search in multiple array in mongodb

I want to Search a value in an array Like
`[_id] => MongoId Object (
[$id] => 511f4ce622efc34f15000001
)
[metadata] => Array (
[filename] => 6410-funny_face.gif
[parrent] => myfolder/newfolder2
[user] => Array ( >>>>>>>> i need to fetch all users
[root] => 7
[admin] => 7
[user] => 0
)
[group] => Array (
[23] => 2
)
)
[filename] => 6410-funny_face.gif
[uploadDate] => MongoDate Object (
[sec] => 1361005798
[usec] => 799000
)
[length] => 3083
[chunkSize] => 262144
[md5] => eb3846f78f461165e5bf59a05707edd1`
I need to find the user's key and value in PHP or MongoShell
im using db.collection.find(array(metadata.filename: 6410-funny_face.gif)); gives the correct answer but while in finding db.collection.find(array(metadata.user: array(7)));
db.collection.find({"metadata.user.root":7})
This should work if I understand your question.

zend framework action name changes to 'id'

I have a zend framework application with modules 'dashboard' and 'admin' of which 'dashboard' is the default one. When I try to access a different module, I am getting the request object like this
Zend_Controller_Request_Http Object
(
[_paramSources:protected] => Array
(
[0] => _GET
[1] => _POST
)
[_requestUri:protected] => /admin/application/show/
[_baseUrl:protected] => http://local.dashmonitor.us.com
[_basePath:protected] =>
[_pathInfo:protected] => /admin/application/show/
[_params:protected] => Array
(
[module] => admin
[controller] => application
[action] => get
[id] => show
)
[_rawBody:protected] =>
[_aliases:protected] => Array
(
)
[_dispatched:protected] => 1
[_module:protected] => admin
[_moduleKey:protected] => module
[_controller:protected] => application
[_controllerKey:protected] => controller
[_action:protected] => get
[_actionKey:protected] => action
)
My real action name is 'show' but it changes to 'get' here. Can anybody please help?