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

Add children classes to PayboxException #29

Open
greg0ire opened this issue Apr 27, 2016 · 3 comments
Open

Add children classes to PayboxException #29

greg0ire opened this issue Apr 27, 2016 · 3 comments
Assignees

Comments

@greg0ire
Copy link
Contributor

Affected people are probably not the same depending on the origin of the exception.

  • It the exception comes from the merchant, developers are affected, because the code probably needs to be changed
  • If the exception comes from the gateway, the application should display a 502 or maybe a 503, beacuse it is probably an outage from paybox
  • If the exception comes from the bank, the financial department probably needs to be aware of that.

Likewise, error in code and validation problems should be segregated. Ideally validation problems should only happen on the merchant side, but it could happen further down the chain in case of suspicious activity of the cardholder, for example.

Here is how I organised that:

Exception
├── Error
│   ├── BankErrorException.php
│   ├── GatewayErrorException.php
│   └── MerchantErrorException.php
├── ErrorException.php
├── Validation
│   ├── BankValidationException.php
│   ├── GatewayValidationException.php
│   └── MerchantValidationException.php
├── ValidationException.php
├── Wallet
│   └── CardNotFoundException.php
└── WalletException.php
@soullivaneuh
Copy link
Contributor

Nice idea. But how would you detect different kind of error?

From this? http://www1.paybox.com/espace-integrateur-documentation/dictionnaire-des-donnees/codes-reponses/

@greg0ire
Copy link
Contributor Author

greg0ire commented Apr 27, 2016

Yes, exactly. If you get one of these codes, it is probably a BankValidationException. If you fail to contact paybox, then you should throw a GatewayErrorException.

@soullivaneuh
Copy link
Contributor

It is indeed needed, because Paybox not always result on a HTTP error.

See example:

array:8 [▼
  "NUMTRANS" => "0000000000"
  "NUMAPPEL" => "0000000000"
  "NUMQUESTION" => "1032688674"
  "SITE" => "1999888"
  "RANG" => "032"
  "AUTORISATION" => ""
  "CODEREPONSE" => "00001"
  "COMMENTAIRE" => "Mandatory+values+missing+keyword:10+Type:25"
]

This issue is accepting PR. I'll manage it later when I'll have the time for. If anyone want to do it, please comment it first.

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

No branches or pull requests

2 participants