Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update error handling #9

Merged
merged 1 commit into from Feb 6, 2014
Merged

Update error handling #9

merged 1 commit into from Feb 6, 2014

Conversation

ivank
Copy link
Contributor

@ivank ivank commented Feb 6, 2014

Now fails if the payment exec status is not successful status:
CREATED
COMPLETED
INCOMPLETE
PROCESSING
PENDING

Add test

@@ -54,7 +54,8 @@ public static function parse_response($response_string, $url, $request_data)
$response = Util::parse_str($response_string);

if ((empty($response['responseEnvelope.ack'])
OR strpos($response['responseEnvelope.ack'], 'Success') === FALSE))
OR strpos($response['responseEnvelope.ack'], 'Success') === FALSE
OR ! in_array($response['paymentExecStatus'], array('CREATED', 'COMPLETED', 'INCOMPLETE', 'PROCESSING', 'PENDING'))))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$response['paymentExecStatus'] could be undefined in other API operations. If it's missing, this does not mean the operation was not successful contrary to the acknowledgement field.

Now fails if the payment exec status is not successful status:
CREATED
COMPLETED
INCOMPLETE
PROCESSING
PENDING

Add test
hkdobrev added a commit that referenced this pull request Feb 6, 2014
Previously we've only checked the acknowledgement field to determine if the operation is successful.

[According to the `ExecutePayment` API reference](https://developer.paypal.com/webapps/developer/docs/classic/api/adaptive-payments/ExecutePayment_API_Operation/#id092PA0EE05Z__id092PAL000UI) we must check the `paymentExecStatus` as well.
@hkdobrev hkdobrev merged commit 130e357 into master Feb 6, 2014
@ivank ivank deleted the fix-error-handling branch February 6, 2014 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants