-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from Adyen/develop
Release 1.0.0
- Loading branch information
Showing
14 changed files
with
190 additions
and
56 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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Webhook Module for PHP (Beta) | ||
# Webhook Module for PHP | ||
|
||
Adyen library for handling notification webhooks. | ||
|
||
|
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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php declare(strict_types=1); | ||
/** | ||
* ###### | ||
* ###### | ||
* ############ ####( ###### #####. ###### ############ ############ | ||
* ############# #####( ###### #####. ###### ############# ############# | ||
* ###### #####( ###### #####. ###### ##### ###### ##### ###### | ||
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### | ||
* ###### ###### #####( ###### #####. ###### ##### ##### ###### | ||
* ############# ############# ############# ############# ##### ###### | ||
* ############ ############ ############# ############ ##### ###### | ||
* ###### | ||
* ############# | ||
* ############ | ||
* | ||
* Adyen Webhook Module for PHP | ||
* | ||
* Copyright (c) 2021 Adyen N.V. | ||
* This file is open source and available under the MIT license. | ||
* See the LICENSE file for more info. | ||
* | ||
*/ | ||
|
||
namespace Adyen\Webhook\Processor; | ||
|
||
use Adyen\Webhook\PaymentStates; | ||
|
||
abstract class AbstractDisputeNotificationProcessor extends Processor implements ProcessorInterface | ||
{ | ||
const DISPUTE_STATUS_UNDEFENDED = "Undefended"; | ||
const DISPUTE_STATUS_LOST = "Lost"; | ||
const DISPUTE_STATUS_ACCEPTED = "Accepted"; | ||
const FINAL_DISPUTE_STATUSES = [ | ||
self::DISPUTE_STATUS_LOST, | ||
self::DISPUTE_STATUS_ACCEPTED, | ||
self::DISPUTE_STATUS_UNDEFENDED | ||
]; | ||
const DISPUTE_STATUS = "disputeStatus"; | ||
const CHARGEBACK_ORDER_STATES = [ | ||
PaymentStates::STATE_PAID, | ||
PaymentStates::STATE_IN_PROGRESS, | ||
]; | ||
|
||
public function process(): ?string | ||
{ | ||
$state = $this->initialState; | ||
$additionalData = $this->notification->getAdditionalData(); | ||
$disputeStatus = $additionalData[self::DISPUTE_STATUS] ?? null; | ||
|
||
if ($this->notification->isSuccess() && | ||
isset($disputeStatus) && | ||
in_array($disputeStatus, self::FINAL_DISPUTE_STATUSES) && | ||
in_array($state, self::CHARGEBACK_ORDER_STATES)) { | ||
$state = PaymentStates::STATE_REFUNDED; | ||
} | ||
|
||
return $state; | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php declare(strict_types=1); | ||
/** | ||
* ###### | ||
* ###### | ||
* ############ ####( ###### #####. ###### ############ ############ | ||
* ############# #####( ###### #####. ###### ############# ############# | ||
* ###### #####( ###### #####. ###### ##### ###### ##### ###### | ||
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### | ||
* ###### ###### #####( ###### #####. ###### ##### ##### ###### | ||
* ############# ############# ############# ############# ##### ###### | ||
* ############ ############ ############# ############ ##### ###### | ||
* ###### | ||
* ############# | ||
* ############ | ||
* | ||
* Adyen Webhook Module for PHP | ||
* | ||
* Copyright (c) 2021 Adyen N.V. | ||
* This file is open source and available under the MIT license. | ||
* See the LICENSE file for more info. | ||
* | ||
*/ | ||
|
||
namespace Adyen\Webhook\Processor; | ||
|
||
class NotificationOfChargebackProcessor extends AbstractDisputeNotificationProcessor implements ProcessorInterface | ||
{ | ||
public function process(): ?string | ||
{ | ||
return $this->unchanged(); | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php declare(strict_types=1); | ||
/** | ||
* ###### | ||
* ###### | ||
* ############ ####( ###### #####. ###### ############ ############ | ||
* ############# #####( ###### #####. ###### ############# ############# | ||
* ###### #####( ###### #####. ###### ##### ###### ##### ###### | ||
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### | ||
* ###### ###### #####( ###### #####. ###### ##### ##### ###### | ||
* ############# ############# ############# ############# ##### ###### | ||
* ############ ############ ############# ############ ##### ###### | ||
* ###### | ||
* ############# | ||
* ############ | ||
* | ||
* Adyen Webhook Module for PHP | ||
* | ||
* Copyright (c) 2022 Adyen N.V. | ||
* This file is open source and available under the MIT license. | ||
* See the LICENSE file for more info. | ||
* | ||
*/ | ||
|
||
namespace Adyen\Webhook\Processor; | ||
|
||
class RequestForInformationProcessor extends AbstractDisputeNotificationProcessor implements ProcessorInterface | ||
{ | ||
public function process(): ?string | ||
{ | ||
return $this->unchanged(); | ||
} | ||
} |
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