| 1: | <?php |
| 2: | |
| 3: | |
| 4: | |
| 5: | |
| 6: | namespace Worldline\Connect\Sdk\V1\Merchant\Payments; |
| 7: | |
| 8: | use Worldline\Connect\Sdk\ApiResource; |
| 9: | use Worldline\Connect\Sdk\CallContext; |
| 10: | use Worldline\Connect\Sdk\Communication\ErrorResponseException; |
| 11: | use Worldline\Connect\Sdk\Communication\InvalidResponseException; |
| 12: | use Worldline\Connect\Sdk\Communication\ResponseClassMap; |
| 13: | use Worldline\Connect\Sdk\V1\ApiException; |
| 14: | use Worldline\Connect\Sdk\V1\AuthorizationException; |
| 15: | use Worldline\Connect\Sdk\V1\DeclinedPaymentException; |
| 16: | use Worldline\Connect\Sdk\V1\DeclinedRefundException; |
| 17: | use Worldline\Connect\Sdk\V1\Domain\ApprovePaymentRequest; |
| 18: | use Worldline\Connect\Sdk\V1\Domain\CancelApprovalPaymentResponse; |
| 19: | use Worldline\Connect\Sdk\V1\Domain\CancelPaymentResponse; |
| 20: | use Worldline\Connect\Sdk\V1\Domain\CapturePaymentRequest; |
| 21: | use Worldline\Connect\Sdk\V1\Domain\CaptureResponse; |
| 22: | use Worldline\Connect\Sdk\V1\Domain\CapturesResponse; |
| 23: | use Worldline\Connect\Sdk\V1\Domain\CompletePaymentRequest; |
| 24: | use Worldline\Connect\Sdk\V1\Domain\CompletePaymentResponse; |
| 25: | use Worldline\Connect\Sdk\V1\Domain\CreateDisputeRequest; |
| 26: | use Worldline\Connect\Sdk\V1\Domain\CreatePaymentRequest; |
| 27: | use Worldline\Connect\Sdk\V1\Domain\CreatePaymentResponse; |
| 28: | use Worldline\Connect\Sdk\V1\Domain\CreateTokenResponse; |
| 29: | use Worldline\Connect\Sdk\V1\Domain\DeviceFingerprintDetails; |
| 30: | use Worldline\Connect\Sdk\V1\Domain\DisputeResponse; |
| 31: | use Worldline\Connect\Sdk\V1\Domain\DisputesResponse; |
| 32: | use Worldline\Connect\Sdk\V1\Domain\FindPaymentsResponse; |
| 33: | use Worldline\Connect\Sdk\V1\Domain\PaymentApprovalResponse; |
| 34: | use Worldline\Connect\Sdk\V1\Domain\PaymentResponse; |
| 35: | use Worldline\Connect\Sdk\V1\Domain\RefundRequest; |
| 36: | use Worldline\Connect\Sdk\V1\Domain\RefundResponse; |
| 37: | use Worldline\Connect\Sdk\V1\Domain\RefundsResponse; |
| 38: | use Worldline\Connect\Sdk\V1\Domain\ThirdPartyStatusResponse; |
| 39: | use Worldline\Connect\Sdk\V1\Domain\TokenizePaymentRequest; |
| 40: | use Worldline\Connect\Sdk\V1\ExceptionFactory; |
| 41: | use Worldline\Connect\Sdk\V1\IdempotenceException; |
| 42: | use Worldline\Connect\Sdk\V1\PlatformException; |
| 43: | use Worldline\Connect\Sdk\V1\ReferenceException; |
| 44: | use Worldline\Connect\Sdk\V1\ValidationException; |
| 45: | |
| 46: | |
| 47: | |
| 48: | |
| 49: | |
| 50: | |
| 51: | class PaymentsClient extends ApiResource |
| 52: | { |
| 53: | |
| 54: | |
| 55: | |
| 56: | private ?ExceptionFactory $responseExceptionFactory = null; |
| 57: | |
| 58: | |
| 59: | |
| 60: | |
| 61: | |
| 62: | |
| 63: | |
| 64: | |
| 65: | |
| 66: | |
| 67: | |
| 68: | |
| 69: | |
| 70: | |
| 71: | |
| 72: | |
| 73: | |
| 74: | |
| 75: | public function create(CreatePaymentRequest $body, ?CallContext $callContext = null): CreatePaymentResponse |
| 76: | { |
| 77: | $responseClassMap = new ResponseClassMap(); |
| 78: | $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\CreatePaymentResponse'; |
| 79: | $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\PaymentErrorResponse'; |
| 80: | try { |
| 81: | return $this->getCommunicator()->post( |
| 82: | $responseClassMap, |
| 83: | $this->instantiateUri('/v1/{merchantId}/payments'), |
| 84: | $this->getClientMetaInfo(), |
| 85: | $body, |
| 86: | null, |
| 87: | $callContext |
| 88: | ); |
| 89: | } catch (ErrorResponseException $e) { |
| 90: | throw $this->getResponseExceptionFactory()->createException( |
| 91: | $e->getHttpStatusCode(), |
| 92: | $e->getErrorResponse(), |
| 93: | $callContext |
| 94: | ); |
| 95: | } |
| 96: | } |
| 97: | |
| 98: | |
| 99: | |
| 100: | |
| 101: | |
| 102: | |
| 103: | |
| 104: | |
| 105: | |
| 106: | |
| 107: | |
| 108: | |
| 109: | |
| 110: | |
| 111: | |
| 112: | |
| 113: | |
| 114: | public function find(FindPaymentsParams $query, ?CallContext $callContext = null): FindPaymentsResponse |
| 115: | { |
| 116: | $responseClassMap = new ResponseClassMap(); |
| 117: | $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\FindPaymentsResponse'; |
| 118: | $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; |
| 119: | try { |
| 120: | return $this->getCommunicator()->get( |
| 121: | $responseClassMap, |
| 122: | $this->instantiateUri('/v1/{merchantId}/payments'), |
| 123: | $this->getClientMetaInfo(), |
| 124: | $query, |
| 125: | $callContext |
| 126: | ); |
| 127: | } catch (ErrorResponseException $e) { |
| 128: | throw $this->getResponseExceptionFactory()->createException( |
| 129: | $e->getHttpStatusCode(), |
| 130: | $e->getErrorResponse(), |
| 131: | $callContext |
| 132: | ); |
| 133: | } |
| 134: | } |
| 135: | |
| 136: | |
| 137: | |
| 138: | |
| 139: | |
| 140: | |
| 141: | |
| 142: | |
| 143: | |
| 144: | |
| 145: | |
| 146: | |
| 147: | |
| 148: | |
| 149: | |
| 150: | |
| 151: | |
| 152: | |
| 153: | public function get(string $paymentId, GetPaymentParams $query, ?CallContext $callContext = null): PaymentResponse |
| 154: | { |
| 155: | $this->context['paymentId'] = $paymentId; |
| 156: | $responseClassMap = new ResponseClassMap(); |
| 157: | $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\PaymentResponse'; |
| 158: | $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; |
| 159: | try { |
| 160: | return $this->getCommunicator()->get( |
| 161: | $responseClassMap, |
| 162: | $this->instantiateUri('/v1/{merchantId}/payments/{paymentId}'), |
| 163: | $this->getClientMetaInfo(), |
| 164: | $query, |
| 165: | $callContext |
| 166: | ); |
| 167: | } catch (ErrorResponseException $e) { |
| 168: | throw $this->getResponseExceptionFactory()->createException( |
| 169: | $e->getHttpStatusCode(), |
| 170: | $e->getErrorResponse(), |
| 171: | $callContext |
| 172: | ); |
| 173: | } |
| 174: | } |
| 175: | |
| 176: | |
| 177: | |
| 178: | |
| 179: | |
| 180: | |
| 181: | |
| 182: | |
| 183: | |
| 184: | |
| 185: | |
| 186: | |
| 187: | |
| 188: | |
| 189: | |
| 190: | |
| 191: | |
| 192: | |
| 193: | public function complete(string $paymentId, CompletePaymentRequest $body, ?CallContext $callContext = null): CompletePaymentResponse |
| 194: | { |
| 195: | $this->context['paymentId'] = $paymentId; |
| 196: | $responseClassMap = new ResponseClassMap(); |
| 197: | $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\CompletePaymentResponse'; |
| 198: | $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; |
| 199: | try { |
| 200: | return $this->getCommunicator()->post( |
| 201: | $responseClassMap, |
| 202: | $this->instantiateUri('/v1/{merchantId}/payments/{paymentId}/complete'), |
| 203: | $this->getClientMetaInfo(), |
| 204: | $body, |
| 205: | null, |
| 206: | $callContext |
| 207: | ); |
| 208: | } catch (ErrorResponseException $e) { |
| 209: | throw $this->getResponseExceptionFactory()->createException( |
| 210: | $e->getHttpStatusCode(), |
| 211: | $e->getErrorResponse(), |
| 212: | $callContext |
| 213: | ); |
| 214: | } |
| 215: | } |
| 216: | |
| 217: | |
| 218: | |
| 219: | |
| 220: | |
| 221: | |
| 222: | |
| 223: | |
| 224: | |
| 225: | |
| 226: | |
| 227: | |
| 228: | |
| 229: | |
| 230: | |
| 231: | |
| 232: | |
| 233: | public function thirdPartyStatus(string $paymentId, ?CallContext $callContext = null): ThirdPartyStatusResponse |
| 234: | { |
| 235: | $this->context['paymentId'] = $paymentId; |
| 236: | $responseClassMap = new ResponseClassMap(); |
| 237: | $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ThirdPartyStatusResponse'; |
| 238: | $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; |
| 239: | try { |
| 240: | return $this->getCommunicator()->get( |
| 241: | $responseClassMap, |
| 242: | $this->instantiateUri('/v1/{merchantId}/payments/{paymentId}/thirdpartystatus'), |
| 243: | $this->getClientMetaInfo(), |
| 244: | null, |
| 245: | $callContext |
| 246: | ); |
| 247: | } catch (ErrorResponseException $e) { |
| 248: | throw $this->getResponseExceptionFactory()->createException( |
| 249: | $e->getHttpStatusCode(), |
| 250: | $e->getErrorResponse(), |
| 251: | $callContext |
| 252: | ); |
| 253: | } |
| 254: | } |
| 255: | |
| 256: | |
| 257: | |
| 258: | |
| 259: | |
| 260: | |
| 261: | |
| 262: | |
| 263: | |
| 264: | |
| 265: | |
| 266: | |
| 267: | |
| 268: | |
| 269: | |
| 270: | |
| 271: | |
| 272: | |
| 273: | public function tokenize(string $paymentId, TokenizePaymentRequest $body, ?CallContext $callContext = null): CreateTokenResponse |
| 274: | { |
| 275: | $this->context['paymentId'] = $paymentId; |
| 276: | $responseClassMap = new ResponseClassMap(); |
| 277: | $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\CreateTokenResponse'; |
| 278: | $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; |
| 279: | try { |
| 280: | return $this->getCommunicator()->post( |
| 281: | $responseClassMap, |
| 282: | $this->instantiateUri('/v1/{merchantId}/payments/{paymentId}/tokenize'), |
| 283: | $this->getClientMetaInfo(), |
| 284: | $body, |
| 285: | null, |
| 286: | $callContext |
| 287: | ); |
| 288: | } catch (ErrorResponseException $e) { |
| 289: | throw $this->getResponseExceptionFactory()->createException( |
| 290: | $e->getHttpStatusCode(), |
| 291: | $e->getErrorResponse(), |
| 292: | $callContext |
| 293: | ); |
| 294: | } |
| 295: | } |
| 296: | |
| 297: | |
| 298: | |
| 299: | |
| 300: | |
| 301: | |
| 302: | |
| 303: | |
| 304: | |
| 305: | |
| 306: | |
| 307: | |
| 308: | |
| 309: | |
| 310: | |
| 311: | |
| 312: | |
| 313: | public function processchallenged(string $paymentId, ?CallContext $callContext = null): PaymentResponse |
| 314: | { |
| 315: | $this->context['paymentId'] = $paymentId; |
| 316: | $responseClassMap = new ResponseClassMap(); |
| 317: | $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\PaymentResponse'; |
| 318: | $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; |
| 319: | try { |
| 320: | return $this->getCommunicator()->post( |
| 321: | $responseClassMap, |
| 322: | $this->instantiateUri('/v1/{merchantId}/payments/{paymentId}/processchallenged'), |
| 323: | $this->getClientMetaInfo(), |
| 324: | null, |
| 325: | null, |
| 326: | $callContext |
| 327: | ); |
| 328: | } catch (ErrorResponseException $e) { |
| 329: | throw $this->getResponseExceptionFactory()->createException( |
| 330: | $e->getHttpStatusCode(), |
| 331: | $e->getErrorResponse(), |
| 332: | $callContext |
| 333: | ); |
| 334: | } |
| 335: | } |
| 336: | |
| 337: | |
| 338: | |
| 339: | |
| 340: | |
| 341: | |
| 342: | |
| 343: | |
| 344: | |
| 345: | |
| 346: | |
| 347: | |
| 348: | |
| 349: | |
| 350: | |
| 351: | |
| 352: | |
| 353: | |
| 354: | public function approve(string $paymentId, ApprovePaymentRequest $body, ?CallContext $callContext = null): PaymentApprovalResponse |
| 355: | { |
| 356: | $this->context['paymentId'] = $paymentId; |
| 357: | $responseClassMap = new ResponseClassMap(); |
| 358: | $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\PaymentApprovalResponse'; |
| 359: | $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; |
| 360: | try { |
| 361: | return $this->getCommunicator()->post( |
| 362: | $responseClassMap, |
| 363: | $this->instantiateUri('/v1/{merchantId}/payments/{paymentId}/approve'), |
| 364: | $this->getClientMetaInfo(), |
| 365: | $body, |
| 366: | null, |
| 367: | $callContext |
| 368: | ); |
| 369: | } catch (ErrorResponseException $e) { |
| 370: | throw $this->getResponseExceptionFactory()->createException( |
| 371: | $e->getHttpStatusCode(), |
| 372: | $e->getErrorResponse(), |
| 373: | $callContext |
| 374: | ); |
| 375: | } |
| 376: | } |
| 377: | |
| 378: | |
| 379: | |
| 380: | |
| 381: | |
| 382: | |
| 383: | |
| 384: | |
| 385: | |
| 386: | |
| 387: | |
| 388: | |
| 389: | |
| 390: | |
| 391: | |
| 392: | |
| 393: | |
| 394: | |
| 395: | public function capture(string $paymentId, CapturePaymentRequest $body, ?CallContext $callContext = null): CaptureResponse |
| 396: | { |
| 397: | $this->context['paymentId'] = $paymentId; |
| 398: | $responseClassMap = new ResponseClassMap(); |
| 399: | $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\CaptureResponse'; |
| 400: | $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; |
| 401: | try { |
| 402: | return $this->getCommunicator()->post( |
| 403: | $responseClassMap, |
| 404: | $this->instantiateUri('/v1/{merchantId}/payments/{paymentId}/capture'), |
| 405: | $this->getClientMetaInfo(), |
| 406: | $body, |
| 407: | null, |
| 408: | $callContext |
| 409: | ); |
| 410: | } catch (ErrorResponseException $e) { |
| 411: | throw $this->getResponseExceptionFactory()->createException( |
| 412: | $e->getHttpStatusCode(), |
| 413: | $e->getErrorResponse(), |
| 414: | $callContext |
| 415: | ); |
| 416: | } |
| 417: | } |
| 418: | |
| 419: | |
| 420: | |
| 421: | |
| 422: | |
| 423: | |
| 424: | |
| 425: | |
| 426: | |
| 427: | |
| 428: | |
| 429: | |
| 430: | |
| 431: | |
| 432: | |
| 433: | |
| 434: | |
| 435: | public function finalizecapture(string $paymentId, ?CallContext $callContext = null): PaymentResponse |
| 436: | { |
| 437: | $this->context['paymentId'] = $paymentId; |
| 438: | $responseClassMap = new ResponseClassMap(); |
| 439: | $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\PaymentResponse'; |
| 440: | $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; |
| 441: | try { |
| 442: | return $this->getCommunicator()->post( |
| 443: | $responseClassMap, |
| 444: | $this->instantiateUri('/v1/{merchantId}/payments/{paymentId}/finalizecapture'), |
| 445: | $this->getClientMetaInfo(), |
| 446: | null, |
| 447: | null, |
| 448: | $callContext |
| 449: | ); |
| 450: | } catch (ErrorResponseException $e) { |
| 451: | throw $this->getResponseExceptionFactory()->createException( |
| 452: | $e->getHttpStatusCode(), |
| 453: | $e->getErrorResponse(), |
| 454: | $callContext |
| 455: | ); |
| 456: | } |
| 457: | } |
| 458: | |
| 459: | |
| 460: | |
| 461: | |
| 462: | |
| 463: | |
| 464: | |
| 465: | |
| 466: | |
| 467: | |
| 468: | |
| 469: | |
| 470: | |
| 471: | |
| 472: | |
| 473: | |
| 474: | |
| 475: | public function cancelapproval(string $paymentId, ?CallContext $callContext = null): CancelApprovalPaymentResponse |
| 476: | { |
| 477: | $this->context['paymentId'] = $paymentId; |
| 478: | $responseClassMap = new ResponseClassMap(); |
| 479: | $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\CancelApprovalPaymentResponse'; |
| 480: | $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; |
| 481: | try { |
| 482: | return $this->getCommunicator()->post( |
| 483: | $responseClassMap, |
| 484: | $this->instantiateUri('/v1/{merchantId}/payments/{paymentId}/cancelapproval'), |
| 485: | $this->getClientMetaInfo(), |
| 486: | null, |
| 487: | null, |
| 488: | $callContext |
| 489: | ); |
| 490: | } catch (ErrorResponseException $e) { |
| 491: | throw $this->getResponseExceptionFactory()->createException( |
| 492: | $e->getHttpStatusCode(), |
| 493: | $e->getErrorResponse(), |
| 494: | $callContext |
| 495: | ); |
| 496: | } |
| 497: | } |
| 498: | |
| 499: | |
| 500: | |
| 501: | |
| 502: | |
| 503: | |
| 504: | |
| 505: | |
| 506: | |
| 507: | |
| 508: | |
| 509: | |
| 510: | |
| 511: | |
| 512: | |
| 513: | |
| 514: | |
| 515: | public function captures(string $paymentId, ?CallContext $callContext = null): CapturesResponse |
| 516: | { |
| 517: | $this->context['paymentId'] = $paymentId; |
| 518: | $responseClassMap = new ResponseClassMap(); |
| 519: | $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\CapturesResponse'; |
| 520: | $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; |
| 521: | try { |
| 522: | return $this->getCommunicator()->get( |
| 523: | $responseClassMap, |
| 524: | $this->instantiateUri('/v1/{merchantId}/payments/{paymentId}/captures'), |
| 525: | $this->getClientMetaInfo(), |
| 526: | null, |
| 527: | $callContext |
| 528: | ); |
| 529: | } catch (ErrorResponseException $e) { |
| 530: | throw $this->getResponseExceptionFactory()->createException( |
| 531: | $e->getHttpStatusCode(), |
| 532: | $e->getErrorResponse(), |
| 533: | $callContext |
| 534: | ); |
| 535: | } |
| 536: | } |
| 537: | |
| 538: | |
| 539: | |
| 540: | |
| 541: | |
| 542: | |
| 543: | |
| 544: | |
| 545: | |
| 546: | |
| 547: | |
| 548: | |
| 549: | |
| 550: | |
| 551: | |
| 552: | |
| 553: | |
| 554: | |
| 555: | |
| 556: | public function refund(string $paymentId, RefundRequest $body, ?CallContext $callContext = null): RefundResponse |
| 557: | { |
| 558: | $this->context['paymentId'] = $paymentId; |
| 559: | $responseClassMap = new ResponseClassMap(); |
| 560: | $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\RefundResponse'; |
| 561: | $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\RefundErrorResponse'; |
| 562: | try { |
| 563: | return $this->getCommunicator()->post( |
| 564: | $responseClassMap, |
| 565: | $this->instantiateUri('/v1/{merchantId}/payments/{paymentId}/refund'), |
| 566: | $this->getClientMetaInfo(), |
| 567: | $body, |
| 568: | null, |
| 569: | $callContext |
| 570: | ); |
| 571: | } catch (ErrorResponseException $e) { |
| 572: | throw $this->getResponseExceptionFactory()->createException( |
| 573: | $e->getHttpStatusCode(), |
| 574: | $e->getErrorResponse(), |
| 575: | $callContext |
| 576: | ); |
| 577: | } |
| 578: | } |
| 579: | |
| 580: | |
| 581: | |
| 582: | |
| 583: | |
| 584: | |
| 585: | |
| 586: | |
| 587: | |
| 588: | |
| 589: | |
| 590: | |
| 591: | |
| 592: | |
| 593: | |
| 594: | |
| 595: | |
| 596: | public function refunds(string $paymentId, ?CallContext $callContext = null): RefundsResponse |
| 597: | { |
| 598: | $this->context['paymentId'] = $paymentId; |
| 599: | $responseClassMap = new ResponseClassMap(); |
| 600: | $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\RefundsResponse'; |
| 601: | $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; |
| 602: | try { |
| 603: | return $this->getCommunicator()->get( |
| 604: | $responseClassMap, |
| 605: | $this->instantiateUri('/v1/{merchantId}/payments/{paymentId}/refunds'), |
| 606: | $this->getClientMetaInfo(), |
| 607: | null, |
| 608: | $callContext |
| 609: | ); |
| 610: | } catch (ErrorResponseException $e) { |
| 611: | throw $this->getResponseExceptionFactory()->createException( |
| 612: | $e->getHttpStatusCode(), |
| 613: | $e->getErrorResponse(), |
| 614: | $callContext |
| 615: | ); |
| 616: | } |
| 617: | } |
| 618: | |
| 619: | |
| 620: | |
| 621: | |
| 622: | |
| 623: | |
| 624: | |
| 625: | |
| 626: | |
| 627: | |
| 628: | |
| 629: | |
| 630: | |
| 631: | |
| 632: | |
| 633: | |
| 634: | |
| 635: | public function cancel(string $paymentId, ?CallContext $callContext = null): CancelPaymentResponse |
| 636: | { |
| 637: | $this->context['paymentId'] = $paymentId; |
| 638: | $responseClassMap = new ResponseClassMap(); |
| 639: | $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\CancelPaymentResponse'; |
| 640: | $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; |
| 641: | try { |
| 642: | return $this->getCommunicator()->post( |
| 643: | $responseClassMap, |
| 644: | $this->instantiateUri('/v1/{merchantId}/payments/{paymentId}/cancel'), |
| 645: | $this->getClientMetaInfo(), |
| 646: | null, |
| 647: | null, |
| 648: | $callContext |
| 649: | ); |
| 650: | } catch (ErrorResponseException $e) { |
| 651: | throw $this->getResponseExceptionFactory()->createException( |
| 652: | $e->getHttpStatusCode(), |
| 653: | $e->getErrorResponse(), |
| 654: | $callContext |
| 655: | ); |
| 656: | } |
| 657: | } |
| 658: | |
| 659: | |
| 660: | |
| 661: | |
| 662: | |
| 663: | |
| 664: | |
| 665: | |
| 666: | |
| 667: | |
| 668: | |
| 669: | |
| 670: | |
| 671: | |
| 672: | |
| 673: | |
| 674: | |
| 675: | |
| 676: | public function dispute(string $paymentId, CreateDisputeRequest $body, ?CallContext $callContext = null): DisputeResponse |
| 677: | { |
| 678: | $this->context['paymentId'] = $paymentId; |
| 679: | $responseClassMap = new ResponseClassMap(); |
| 680: | $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\DisputeResponse'; |
| 681: | $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; |
| 682: | try { |
| 683: | return $this->getCommunicator()->post( |
| 684: | $responseClassMap, |
| 685: | $this->instantiateUri('/v1/{merchantId}/payments/{paymentId}/dispute'), |
| 686: | $this->getClientMetaInfo(), |
| 687: | $body, |
| 688: | null, |
| 689: | $callContext |
| 690: | ); |
| 691: | } catch (ErrorResponseException $e) { |
| 692: | throw $this->getResponseExceptionFactory()->createException( |
| 693: | $e->getHttpStatusCode(), |
| 694: | $e->getErrorResponse(), |
| 695: | $callContext |
| 696: | ); |
| 697: | } |
| 698: | } |
| 699: | |
| 700: | |
| 701: | |
| 702: | |
| 703: | |
| 704: | |
| 705: | |
| 706: | |
| 707: | |
| 708: | |
| 709: | |
| 710: | |
| 711: | |
| 712: | |
| 713: | |
| 714: | |
| 715: | |
| 716: | public function disputes(string $paymentId, ?CallContext $callContext = null): DisputesResponse |
| 717: | { |
| 718: | $this->context['paymentId'] = $paymentId; |
| 719: | $responseClassMap = new ResponseClassMap(); |
| 720: | $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\DisputesResponse'; |
| 721: | $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; |
| 722: | try { |
| 723: | return $this->getCommunicator()->get( |
| 724: | $responseClassMap, |
| 725: | $this->instantiateUri('/v1/{merchantId}/payments/{paymentId}/disputes'), |
| 726: | $this->getClientMetaInfo(), |
| 727: | null, |
| 728: | $callContext |
| 729: | ); |
| 730: | } catch (ErrorResponseException $e) { |
| 731: | throw $this->getResponseExceptionFactory()->createException( |
| 732: | $e->getHttpStatusCode(), |
| 733: | $e->getErrorResponse(), |
| 734: | $callContext |
| 735: | ); |
| 736: | } |
| 737: | } |
| 738: | |
| 739: | |
| 740: | |
| 741: | |
| 742: | |
| 743: | |
| 744: | |
| 745: | |
| 746: | |
| 747: | |
| 748: | |
| 749: | |
| 750: | |
| 751: | |
| 752: | |
| 753: | |
| 754: | |
| 755: | public function devicefingerprint(string $paymentId, ?CallContext $callContext = null): DeviceFingerprintDetails |
| 756: | { |
| 757: | $this->context['paymentId'] = $paymentId; |
| 758: | $responseClassMap = new ResponseClassMap(); |
| 759: | $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\DeviceFingerprintDetails'; |
| 760: | $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse'; |
| 761: | try { |
| 762: | return $this->getCommunicator()->get( |
| 763: | $responseClassMap, |
| 764: | $this->instantiateUri('/v1/{merchantId}/payments/{paymentId}/devicefingerprint'), |
| 765: | $this->getClientMetaInfo(), |
| 766: | null, |
| 767: | $callContext |
| 768: | ); |
| 769: | } catch (ErrorResponseException $e) { |
| 770: | throw $this->getResponseExceptionFactory()->createException( |
| 771: | $e->getHttpStatusCode(), |
| 772: | $e->getErrorResponse(), |
| 773: | $callContext |
| 774: | ); |
| 775: | } |
| 776: | } |
| 777: | |
| 778: | |
| 779: | |
| 780: | |
| 781: | private function getResponseExceptionFactory(): ExceptionFactory |
| 782: | { |
| 783: | if (is_null($this->responseExceptionFactory)) { |
| 784: | $this->responseExceptionFactory = new ExceptionFactory(); |
| 785: | } |
| 786: | return $this->responseExceptionFactory; |
| 787: | } |
| 788: | } |
| 789: | |