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