Skip to content

v1.5.0

Choose a tag to compare

@lepresk lepresk released this 07 Oct 14:37
· 6 commits to main since this release
46d36c8

Caller-supplied reference ids, and transfer and refund statuses that no longer
warn. Anyone who retries writes after a timeout or 5xx should upgrade: with a
random id, a lost response could not be queried and a retry could pay twice.

Added

  • Write methods take an optional caller-supplied id: $referenceId on MTN
    requestToPay(), quickPay(), deposit(), transfer() and refund()
    (sent as X-Reference-Id), $transactionId on Airtel requestToPay() and
    transfer() (sent as transaction.id). The id is returned and is what the
    status methods take, so after a timeout or 5xx you can query a payment whose
    response you never saw, and retry with the same id instead of risking a second
    payment (#22). It must be a
    UUID; anything else throws an InvalidArgumentException before a request is
    sent. Omitting it keeps the random UUID, so existing code is unaffected
  • Uuid::assert() to check a value is a UUID

Fixed

  • Reading the status of a transfer or refund raised Undefined array key
    warnings. MTN leaves payerMessage and payeeNote out of those bodies, and
    Transaction::parse() read them unguarded; under an error handler that turns
    warnings into exceptions, the status call threw. Missing externalId,
    amount, payerMessage and payeeNote now parse as null