|
27 | 27 | use Adyen\Model\ManagementWebhooks\PaymentMethodCreatedNotificationRequest; |
28 | 28 | use Adyen\Model\AcsWebhooks\AuthenticationNotificationRequest; |
29 | 29 | use Adyen\Model\AcsWebhooks\RelayedAuthenticationRequest; |
| 30 | +use Adyen\Model\RelayedAuthorizationWebhooks\RelayedAuthorisationRequest; |
30 | 31 | use Adyen\Model\TokenizationWebhooks\TokenizationAlreadyExistingDetailsNotificationRequest; |
31 | 32 | use Adyen\Model\TokenizationWebhooks\TokenizationCreatedDetailsNotificationRequest; |
32 | 33 | use Adyen\Model\TokenizationWebhooks\TokenizationDisabledDetailsNotificationRequest; |
@@ -559,4 +560,172 @@ public function testBankingWebhookParserReleasedBlockedBalanceNotificationReques |
559 | 560 | self::assertEquals("AH00000000000000000001", $result->getData()->getAccountHolder()->getId()); |
560 | 561 | self::assertEquals(25000, $result->getData()->getAmount()->getValue()); |
561 | 562 | } |
| 563 | + |
| 564 | + public function testBankingWebhookParserRelayedAuthorisationRequest() |
| 565 | + { |
| 566 | + $jsonString = '{ |
| 567 | + "accountHolder": { |
| 568 | + "description": "Account holder description", |
| 569 | + "id": "AH123ABCDEFGHIJKLMN456789" |
| 570 | + }, |
| 571 | + "amount": { |
| 572 | + "currency": "EUR", |
| 573 | + "value": -2700 |
| 574 | + }, |
| 575 | + "authCode": "123456", |
| 576 | + "authorisationDecision": { |
| 577 | + "reasonCode": "APPROVED", |
| 578 | + "status": "Authorised", |
| 579 | + "statusCode": "APPROVED" |
| 580 | + }, |
| 581 | + "authorisationType": "finalAuthorisation", |
| 582 | + "balanceAccount": { |
| 583 | + "description": "Balance Account Description", |
| 584 | + "id": "BA123ABCDEFGHIJKLMN456789" |
| 585 | + }, |
| 586 | + "balanceMutations": [ |
| 587 | + { |
| 588 | + "balanceAfter": { |
| 589 | + "currency": "EUR", |
| 590 | + "value": 221163 |
| 591 | + }, |
| 592 | + "balanceBefore": { |
| 593 | + "currency": "EUR", |
| 594 | + "value": 221190 |
| 595 | + }, |
| 596 | + "currency": "EUR", |
| 597 | + "mutationAmount": { |
| 598 | + "currency": "EUR", |
| 599 | + "value": -2700 |
| 600 | + }, |
| 601 | + "type": "AuthorisedOutgoing" |
| 602 | + } |
| 603 | + ], |
| 604 | + "balancePlatform": "TestBalancePlatform", |
| 605 | + "entryMode": "contactless", |
| 606 | + "id": "2ABCBA13456ABCDE", |
| 607 | + "merchantData": { |
| 608 | + "acquirerId": "012345", |
| 609 | + "mcc": "5813", |
| 610 | + "merchantId": "000123450000123", |
| 611 | + "nameLocation": { |
| 612 | + "city": "Amsterdam", |
| 613 | + "country": "NLD", |
| 614 | + "name": "Tea Shop NLD", |
| 615 | + "rawData": "TeaShop_NLD" |
| 616 | + }, |
| 617 | + "postalCode": "3333AB" |
| 618 | + }, |
| 619 | + "originalAmount": { |
| 620 | + "currency": "EUR", |
| 621 | + "value": -2700 |
| 622 | + }, |
| 623 | + "paymentInstrument": { |
| 624 | + "balanceAccountId": "BA123ABCDEFGHIJKLMN456789", |
| 625 | + "description": "PaymentInstrument Description", |
| 626 | + "issuingCountryCode": "NL", |
| 627 | + "paymentInstrumentGroupId": "PG3123ABCDEFGHIJKLMN456789", |
| 628 | + "reference": "123456789", |
| 629 | + "status": "active", |
| 630 | + "type": "card", |
| 631 | + "card": { |
| 632 | + "authentication": { |
| 633 | + "email": "john.doe @provider.com" |
| 634 | + }, |
| 635 | + "brand": "mc", |
| 636 | + "brandVariant": "mc_debit_bpd", |
| 637 | + "cardholderName": "John Doe", |
| 638 | + "formFactor": "virtual", |
| 639 | + "bin": "555555", |
| 640 | + "expiration": { |
| 641 | + "month": "09", |
| 642 | + "year": "2027" |
| 643 | + }, |
| 644 | + "lastFour": "0000", |
| 645 | + "number": "12345ABCDE" |
| 646 | + }, |
| 647 | + "id": "PI123ABCDEFGHIJKLMN456789" |
| 648 | + }, |
| 649 | + "processingType": "token", |
| 650 | + "reference": "ABCDEFGHIJ", |
| 651 | + "schemeUniqueTransactionId": "ABCDEFU2B1305", |
| 652 | + "transactionRulesResult": { |
| 653 | + "allHardBlockRulesPassed": true, |
| 654 | + "score": 80 |
| 655 | + }, |
| 656 | + "validationResult": [ |
| 657 | + { |
| 658 | + "result": "valid", |
| 659 | + "type": "TransactionValidation" |
| 660 | + }, |
| 661 | + { |
| 662 | + "result": "valid", |
| 663 | + "type": "PaymentInstrumentExpirationCheck" |
| 664 | + }, |
| 665 | + { |
| 666 | + "result": "valid", |
| 667 | + "type": "BalanceCheck" |
| 668 | + }, |
| 669 | + { |
| 670 | + "result": "valid", |
| 671 | + "type": "Screening" |
| 672 | + }, |
| 673 | + { |
| 674 | + "result": "valid", |
| 675 | + "type": "RealBalanceAvailable" |
| 676 | + }, |
| 677 | + { |
| 678 | + "result": "notValidated", |
| 679 | + "type": "MITAllowedMerchant" |
| 680 | + }, |
| 681 | + { |
| 682 | + "result": "valid", |
| 683 | + "type": "PaymentInstrumentFound" |
| 684 | + }, |
| 685 | + { |
| 686 | + "result": "valid", |
| 687 | + "type": "TransactionRules" |
| 688 | + }, |
| 689 | + { |
| 690 | + "result": "valid", |
| 691 | + "type": "AccountLookup" |
| 692 | + }, |
| 693 | + { |
| 694 | + "result": "valid", |
| 695 | + "type": "PaymentInstrumentActive" |
| 696 | + }, |
| 697 | + { |
| 698 | + "result": "valid", |
| 699 | + "type": "CardholderAuthentication" |
| 700 | + }, |
| 701 | + { |
| 702 | + "result": "valid", |
| 703 | + "type": "PaymentInstrument" |
| 704 | + }, |
| 705 | + { |
| 706 | + "result": "valid", |
| 707 | + "type": "CardAuthentication" |
| 708 | + }, |
| 709 | + { |
| 710 | + "result": "valid", |
| 711 | + "type": "PartyScreening" |
| 712 | + }, |
| 713 | + { |
| 714 | + "result": "valid", |
| 715 | + "type": "InputExpiryDateCheck" |
| 716 | + } |
| 717 | + ], |
| 718 | + "environment": "test", |
| 719 | + "type": "balancePlatform.authorisation.relayed" |
| 720 | +}'; |
| 721 | + |
| 722 | + $webhookParser = new BankingWebhookParser($jsonString); |
| 723 | + $result = $webhookParser->getRelayedAuthorisationRequest(); |
| 724 | + self::assertEquals(RelayedAuthorisationRequest::class, get_class($result)); |
| 725 | + self::assertEquals("2ABCBA13456ABCDE", $result->getId()); |
| 726 | + self::assertEquals("ABCDEFGHIJ", $result->getReference()); |
| 727 | + self::assertEquals("Authorised", $result->getAuthorisationDecision()->getStatus()); |
| 728 | + self::assertEquals("balancePlatform.authorisation.relayed", $result->getType()); |
| 729 | + self::assertEquals("test", $result->getEnvironment()); |
| 730 | + } |
562 | 731 | } |
0 commit comments