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

cancelled transaction is marked as paid #10

Open
wernerkrauss opened this issue Jun 15, 2020 · 2 comments
Open

cancelled transaction is marked as paid #10

wernerkrauss opened this issue Jun 15, 2020 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@wernerkrauss
Copy link

When I cancel a payment, mpay sends something like this to my notify endpoint:

$_GET = {array} [18]
 OPERATION = "CONFIRMATION"
 TID = "12345aa33"
 STATUS = "ERROR"
 PRICE = "15000"
 CURRENCY = "EUR"
 P_TYPE = "EPS"
 BRAND = "EPS"
 MPAYTID = "1234"
 USER_FIELD = ""
 ORDERDESC = "some nice description"
 CUSTOMER = "Werner Krauss"
 CUSTOMER_EMAIL = "[email protected]"
 LANGUAGE = "DE"
 CUSTOMER_ID = ""
 PROFILE_ID = ""
 PROFILE_STATUS = "IGNORED"
 FILTER_STATUS = ""
 APPR_CODE = ""

Silverstripe-Omnipay then creates a CompletePurchaseRequest, which tries to grab the transaction with the given TID from mpay24.

This results in an object like:

$params = {array} [20]
 OPERATION = "CONFIRMATION"
 TID = "12345aa33"
 STATUS = "ERROR"
 PRICE = "15000"
 CURRENCY = "EUR"
 P_TYPE = "EPS"
 BRAND = "EPS"
 MPAYTID = "1234"
 USER_FIELD = ""
 ORDERDESC = "some nice description"
 CUSTOMER = "Werner Krauss"
 CUSTOMER_EMAIL = "[email protected]"
 LANGUAGE = "DE"
 CUSTOMER_ID = ""
 PROFILE_ID = ""
 PROFILE_STATUS = "IGNORED"
 FILTER_STATUS = ""
 APPR_CODE = ""
 operationStatus = "OK"
 returnCode = "OK"

In ComplaetePurchaseRequest::sendData() I get this result:

$result = {Mpay24\Responses\TransactionStatusResponse} [7]
 paramCount = {int} 18
 transaction = {array} [18]
  OPERATION = "CONFIRMATION"
  TID = "12345aa33"
  STATUS = "ERROR"
  PRICE = "15000"
  CURRENCY = "EUR"
  P_TYPE = "EPS"
  BRAND = "EPS"
  MPAYTID = "1234"
  USER_FIELD = ""
  ORDERDESC = "some nice description"
  CUSTOMER = "Werner Krauss"
  CUSTOMER_EMAIL = "[email protected]"
  LANGUAGE = "DE"
  CUSTOMER_ID = ""
  PROFILE_ID = ""
  PROFILE_STATUS = "IGNORED"
  FILTER_STATUS = ""
  APPR_CODE = ""
 responseAsDom = {DOMDocument} [35]
 status = "OK"
 returnCode = "OK"
 createdAt = {int} 1592214783
 exception = null

which means, the TransactionStatusResponse was fine, but the transaction itself is bogus.

IMHO this code

        $params['operationStatus'] = $result->getStatus();
        $params['returnCode'] = $result->getReturnCode();

should not only check if the TransactionStatusResponse was OK, but also check the actual status via $result->getParams()

@wernerkrauss
Copy link
Author

related: NotificationsValuesTrait::isSuccessful returns true, when TransactionState is "ERROR" and OperationStatus is OK.

@wernerkrauss
Copy link
Author

The comment above is fixed by an update to 1.1.3 (#9); You might close this issue if you think the original issue is also fixed.

@judgej judgej added the bug Something isn't working label Jul 9, 2020
@judgej judgej self-assigned this Jul 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants