forked from ranjithinnergys/rest-api-sdk-php
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix for ValidateWebhookEvent - Fatal error (#1300)
* Test against php 7.3 * fix for ValidateWebhookEvent - Fatal error * fixed typo
- Loading branch information
1 parent
647c8c4
commit 4ddb1de
Showing
6 changed files
with
11 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ php: | |
- 7.0 | ||
- 7.1 | ||
- 7.2 | ||
- 7.3 | ||
- hhvm | ||
matrix: | ||
allow_failures: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ | |
* Just uncomment the below line to read the data from actual request. | ||
*/ | ||
/** @var String $requestBody */ | ||
$requestBody = '{"id":"WH-9UG43882HX7271132-6E0871324L7949614","event_version":"1.0","create_time":"2016-09-21T22:00:45Z","resource_type":"sale","event_type":"PAYMENT.SALE.COMPLETED","summary":"Payment completed for $ 21.0 USD","resource":{"id":"80F85758S3080410K","state":"completed","amount":{"total":"21.00","currency":"USD","details":{"subtotal":"17.50","tax":"1.30","shipping":"2.20"}},"payment_mode":"INSTANT_TRANSFER","protection_eligibility":"ELIGIBLE","protection_eligibility_type":"ITEM_NOT_RECEIVED_ELIGIBLE,UNAUTHORIZED_PAYMENT_ELIGIBLE","transaction_fee":{"value":"0.91","currency":"USD"},"invoice_number":"57e3028db8d1b","custom":"","parent_payment":"PAY-7F371669SL612941HK7RQFDQ","create_time":"2016-09-21T21:59:02Z","update_time":"2016-09-21T22:00:06Z","links":[{"href":"https://api.sandbox.paypal.com/v1/payments/sale/80F85758S3080410K","rel":"self","method":"GET"},{"href":"https://api.sandbox.paypal.com/v1/payments/sale/80F85758S3080410K/refund","rel":"refund","method":"POST"},{"href":"https://api.sandbox.paypal.com/v1/payments/payment/PAY-7F371669SL612941HK7RQFDQ","rel":"parent_payment","method":"GET"}]},"links":[{"href":"https://api.sandbox.paypal.com/v1/notifications/webhooks-events/WH-9UG43882HX7271132-6E0871324L7949614","rel":"self","method":"GET"},{"href":"https://api.sandbox.paypal.com/v1/notifications/webhooks-events/WH-9UG43882HX7271132-6E0871324L7949614/resend","rel":"resend","method":"POST"}]}'; | ||
$requestBody = '{"id":"WH-7MU294299R542214K-4N1831857K851783H","event_version":"1.0","create_time":"2019-08-29T10:49:03.439Z","resource_type":"payment","event_type":"PAYMENTS.PAYMENT.CREATED","summary":"Checkout payment is created and approved by buyer","resource":{"update_time":"2019-08-29T10:48:54Z","create_time":"2019-08-29T10:47:51Z","links":[{"href":"https://api.sandbox.paypal.com/v1/payments/payment/PAYID-LVT22VY7N839502VJ678725M","rel":"self","method":"GET"}],"id":"PAYID-LVT22VY7N839502VJ678725M","state":"approved","transactions":[{"amount":{"total":"30.11","currency":"USD","details":{"subtotal":"30.00","tax":"0.07","shipping":"0.03","insurance":"0.01","handling_fee":"1.00","shipping_discount":"-1.00"}},"payee":{"merchant_id":"2BP3WP8PK6566","email":"[email protected]"},"description":"The payment transaction description.","custom":"EBAY_EMS_90048630024435","invoice_number":"48787589673111","item_list":{"items":[{"name":"hat","sku":"1","description":"Brown hat.","price":"3.00","currency":"USD","tax":"0.01","quantity":5},{"name":"handbag","sku":"product34","description":"Black handbag.","price":"15.00","currency":"USD","tax":"0.02","quantity":1}],"shipping_address":{"recipient_name":"Brian Robinson","line1":"4th Floor","line2":"Unit #34","city":"San Jose","state":"CA","postal_code":"95131","country_code":"US","default_address":false,"preferred_address":false,"primary_address":false,"disable_for_transaction":false}},"related_resources":[{"sale":{"id":"08U30449S6662931K","state":"completed","amount":{"total":"30.11","currency":"USD","details":{"subtotal":"30.00","tax":"0.07","shipping":"0.03","insurance":"0.01","handling_fee":"1.00","shipping_discount":"-1.00"}},"payment_mode":"INSTANT_TRANSFER","protection_eligibility":"ELIGIBLE","protection_eligibility_type":"ITEM_NOT_RECEIVED_ELIGIBLE,UNAUTHORIZED_PAYMENT_ELIGIBLE","transaction_fee":{"value":"1.17","currency":"USD"},"parent_payment":"PAYID-LVT22VY7N839502VJ678725M","create_time":"2019-08-29T10:48:54Z","update_time":"2019-08-29T10:48:54Z","links":[{"href":"https://api.sandbox.paypal.com/v1/payments/sale/08U30449S6662931K","rel":"self","method":"GET"},{"href":"https://api.sandbox.paypal.com/v1/payments/sale/08U30449S6662931K/refund","rel":"refund","method":"POST"},{"href":"https://api.sandbox.paypal.com/v1/payments/payment/PAYID-LVT22VY7N839502VJ678725M","rel":"parent_payment","method":"GET"}]}}]}],"intent":"sale","payer":{"payment_method":"paypal","status":"VERIFIED","payer_info":{"email":"[email protected]","first_name":"John","last_name":"Doe","payer_id":"WZH5NSHUBE63W","shipping_address":{"recipient_name":"Brian Robinson","line1":"4th Floor","line2":"Unit #34","city":"San Jose","state":"CA","postal_code":"95131","country_code":"US","default_address":false,"preferred_address":false,"primary_address":false,"disable_for_transaction":false},"phone":"4084959323","country_code":"US"}},"cart":"1R7827981J4260732"},"links":[{"href":"https://api.sandbox.paypal.com/v1/notifications/webhooks-events/WH-7MU294299R542214K-4N1831857K851783H","rel":"self","method":"GET"},{"href":"https://api.sandbox.paypal.com/v1/notifications/webhooks-events/WH-7MU294299R542214K-4N1831857K851783H/resend","rel":"resend","method":"POST"}]}'; | ||
/** | ||
* Receive the entire body that you received from PayPal webhook. | ||
* Just uncomment the below line to read the data from actual request. | ||
|
@@ -28,11 +28,11 @@ | |
'Host' => 'shiparound-dev.de', | ||
'User-Agent' => 'PayPal/AUHD-208.0-25552773', | ||
'Paypal-Auth-Algo' => 'SHA256withRSA', | ||
'Paypal-Cert-Url' => 'https://api.sandbox.paypal.com/v1/notifications/certs/CERT-360caa42-fca2a594-a5cafa77', | ||
'Paypal-Cert-Url' => 'https://api.sandbox.paypal.com/v1/notifications/certs/CERT-360caa42-fca2a594-1d93a270', | ||
'Paypal-Auth-Version' => 'v2', | ||
'Paypal-Transmission-Sig' => 'eDOnWUj9FXOnr2naQnrdL7bhgejVSTwRbwbJ0kuk5wAtm2ZYkr7w5BSUDO7e5ZOsqLwN3sPn3RV85Jd9pjHuTlpuXDLYk+l5qiViPbaaC0tLV+8C/zbDjg2WCfvtf2NmFT8CHgPPQAByUqiiTY+RJZPPQC5np7j7WuxcegsJLeWStRAofsDLiSKrzYV3CKZYtNoNnRvYmSFMkYp/5vk4xGcQLeYNV1CC2PyqraZj8HGG6Y+KV4trhreV9VZDn+rPtLDZTbzUohie1LpEy31k2dg+1szpWaGYOz+MRb40U04oD7fD69vghCrDTYs5AsuFM2+WZtsMDmYGI0pxLjn2yw==', | ||
'Paypal-Transmission-Time' => '2016-09-21T22:00:46Z', | ||
'Paypal-Transmission-Id' => 'd938e770-8046-11e6-8103-6b62a8a99ac4', | ||
'Paypal-Transmission-Sig' => 'K7DF5+hOyGS6v0xTZ9PkEO+BFNQmpryxw2hFlXbHgmxpu+883ldEC9HcL6ccEmB8sfy80y/Q3qcZZL1MR8Qi0e1ysylVj/yROgKK6zBsQPoNmgXC8yTiNoAjULuhk5Aoau0Itk3nrkgAfji1zvADlErMFM9VZe2nDvhM3nDMLjCi/K5fRjWp3eGo6Nx17GX/WIEibeKDyS+YdJMex3i+KO4aWmm9zznC/FJ5Y/ntd0MxOJNrM0r0f3y7c3e3sO5pB3oPgN6KzKVS5P6AWHqtS8acD3DjgCKZ1uqKz7q954G1aBz2/m0wRGOFFsv0/D3FE2uIheRRmoQtVSOAX7Aupg==', | ||
'Paypal-Transmission-Time' => '2019-08-29T10:49:33Z', | ||
'Paypal-Transmission-Id' => 'afa30d40-ca4a-11e9-ab68-7d4e2605c70c', | ||
'Accept' => '*/*', | ||
); | ||
|
||
|
@@ -53,7 +53,7 @@ | |
$signatureVerification->setAuthAlgo($headers['PAYPAL-AUTH-ALGO']); | ||
$signatureVerification->setTransmissionId($headers['PAYPAL-TRANSMISSION-ID']); | ||
$signatureVerification->setCertUrl($headers['PAYPAL-CERT-URL']); | ||
$signatureVerification->setWebhookId("9XL90610J3647323C"); // Note that the Webhook ID must be a currently valid Webhook that you created with your client ID/secret. | ||
$signatureVerification->setWebhookId("0FV983392A0531201"); // Note that the Webhook ID must be a currently valid Webhook that you created with your client ID/secret. | ||
$signatureVerification->setTransmissionSig($headers['PAYPAL-TRANSMISSION-SIG']); | ||
$signatureVerification->setTransmissionTime($headers['PAYPAL-TRANSMISSION-TIME']); | ||
|
||
|