From 0d9ed80cc1e588bcfc9e7e8ccc57e80311887404 Mon Sep 17 00:00:00 2001 From: Jason Judge Date: Mon, 20 Nov 2023 12:34:34 +0000 Subject: [PATCH] Issue #4 switch to new Opayo URLs --- README.md | 11 ++++++----- src/Model/Endpoint.php | 4 ++-- src/Request/CreateCardIdentifier.php | 4 ++-- src/Request/CreatePayment.php | 5 +++-- src/Request/Model/PersonInterface.php | 3 +++ 5 files changed, 16 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index b1acb17..5ddfce5 100644 --- a/README.md +++ b/README.md @@ -44,13 +44,14 @@ for example Guzzle (7+ or 6+HTTPlug adapter), curl or another PSR-7 library. You can use this library as a PSR-7 message generator/consumer, or go a level down and handle all the data through arrays - both are supported. -This library is fairly old, so a bit kludgy in places, but should improve over time. +> This package has been updated to use the new Elavon URLs, that will be mandatory from March 2024. ## Package Development -The Sage Pay Integration payment gateway is a RESTful API run by by [Sage Pay](https://sagepay.com/). -You can [apply for an account here](https://www.opayo.co.uk/apply?partner_id=3F7A4119-8671-464F-A091-9E59EB47B80C) -(my partner link). +The Opayo Pi payment gateway is a RESTful API run by by [Elavon](https://developer.elavon.com/products/opayo/v1/api-reference). + +> You can [apply for an account here](https://www.opayo.co.uk/apply?partner_id=3F7A4119-8671-464F-A091-9E59EB47B80C) +(partner link). From v3.0.0 this package is being rebranded for Opayo, gets a new composer name, and a new base namespace. @@ -184,7 +185,7 @@ use Academe\Opayo\Pi\Request\CreateCardIdentifier; // Create a card indentifier on the API. // Note the MMYY order is most often used for GB gateways like Sage Pay. Many European -// gateways tend to go MSN first, i.e. YYMM. +// gateways tend to go most significant number (MSN) first, i.e. YYMM. // $endpoint, $auth and $session_key from before: $cardIdentifierRequest = new CreateCardIdentifier( diff --git a/src/Model/Endpoint.php b/src/Model/Endpoint.php index 3dcbee3..3957a97 100644 --- a/src/Model/Endpoint.php +++ b/src/Model/Endpoint.php @@ -36,8 +36,8 @@ class Endpoint * @var array The endpoint URL templates, one for each mode. */ protected $urls_templates = [ - 1 => 'https://pi-live.sagepay.com/api/{version}{resource}', - 2 => 'https://pi-test.sagepay.com/api/{version}{resource}', + 1 => 'https://live.opayo.eu.elavon.com/api/{version}{resource}', + 2 => 'https://sandbox.opayo.eu.elavon.com/api/{version}{resource}', ]; /** diff --git a/src/Request/CreateCardIdentifier.php b/src/Request/CreateCardIdentifier.php index f773704..bdb48d3 100644 --- a/src/Request/CreateCardIdentifier.php +++ b/src/Request/CreateCardIdentifier.php @@ -10,7 +10,7 @@ * * With the right PCI compliance, the details could be captured * by the merchant site and sent direct to SagePay server-to-server, - * similat to how Sage Pay Direct would. + * similar to how Sage Pay Direct would. */ use Academe\Opayo\Pi\Model\Auth; @@ -143,7 +143,7 @@ public function jsonSerializePeek() * This request does not use the HTTP Basic Auth, but the temporary session * key token instead. This is because it will accessible to end users, and * the secure integration key and password cannot be exposed here. - * + * * @return array */ public function getAuthHeaders() diff --git a/src/Request/CreatePayment.php b/src/Request/CreatePayment.php index 2b1364b..403c8ca 100644 --- a/src/Request/CreatePayment.php +++ b/src/Request/CreatePayment.php @@ -76,6 +76,7 @@ class CreatePayment extends AbstractRequest const APPLY_3D_SECURE_USEMSPSETTING = 'UseMSPSetting'; // 0 const APPLY_3D_SECURE_FORCE = 'Force'; // 1 const APPLY_3D_SECURE_DISABLE = 'Disable'; // 2 + // @deprecated removed from the API spec 2023-10-26 const APPLY_3D_SECURE_FORCEIGNORINGRULES = 'ForceIgnoringRules'; // 3 /** @@ -291,7 +292,7 @@ public static function getApply3DSecures() * @param ShippingAddress $shippingAddress * @return Transaction */ - public function withShippingAddress(ShippingAddress $shippingAddress) + public function withShippingAddress(AddressInterface $shippingAddress) { $copy = clone $this; $copy->shippingAddress = $shippingAddress; @@ -302,7 +303,7 @@ public function withShippingAddress(ShippingAddress $shippingAddress) * @param ShippingRecipient $shippingRecipient * @return Transaction */ - public function withShippingRecipient(ShippingRecipient $shippingRecipient) + public function withShippingRecipient(PersonInterface $shippingRecipient) { $copy = clone $this; $copy->shippingRecipient = $shippingRecipient; diff --git a/src/Request/Model/PersonInterface.php b/src/Request/Model/PersonInterface.php index 34f1ef2..27a7701 100644 --- a/src/Request/Model/PersonInterface.php +++ b/src/Request/Model/PersonInterface.php @@ -6,6 +6,9 @@ * Value object used to define details for a person. */ +/** + * @method withFieldPrefix(string $prefix) self + */ interface PersonInterface extends \JsonSerializable { }