Commit 4fc8707
Add supportsRefund/doRefund for gateways whose Omnipay driver implements refund()
Implements CiviCRM's refund contract (PaymentProcessor.refund API /
supportsRefund capability) generically: supportsRefund() resolves the
Omnipay gateway class without instantiating it and reports TRUE only when
that class exposes a refund() method. doRefund() sends the refund via the
gateway (transactionReference = original trxn_id) and returns
refund_trxn_id / refund_status per the core contract. Failures throw
PaymentProcessorException so CiviCRM never records a refund the gateway
rejected.
Details:
- A description is always sent: Mollie's create-refund API requires one
and it may be shown to the customer (e.g. on their bank statement).
Callers can pass their own via $params['description'].
- The existing alterPaymentProcessorParams hook fires before sending,
with an 'action' => 'Refund' marker (removed after the hook), so
extensions can customise refund parameters the same way they already
can for purchases.
- The fallback currency is resolved from the original transaction via
APIv4 FinancialTrxn::get, defaulting to the processor currency.
- refund_trxn_id prefers getTransactionId() (Mollie exposes the new
re_... id there) and falls back to getTransactionReference(), which is
where most other Omnipay drivers expose the refund reference.
Verified live against Mollie (iDeal) on CiviCRM 6.x: refund accepted and
the re_... id recorded as refund_trxn_id.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>1 parent c717bad commit 4fc8707
1 file changed
Lines changed: 94 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
271 | 271 | | |
272 | 272 | | |
273 | 273 | | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
274 | 368 | | |
275 | 369 | | |
276 | 370 | | |
| |||
0 commit comments