Skip to content

cancelled transaction is marked as paid #10

@wernerkrauss

Description

@wernerkrauss

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@foo.com"
 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@foo.com"
 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@foo.com"
  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()

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions