From 81ebd73dcb5bba7650df7ce62f6fbf0127d2e94a Mon Sep 17 00:00:00 2001
From: Peter Meester
Date: Mon, 23 May 2022 20:42:49 +0200
Subject: [PATCH] Added sequenceType to Bluem configuration and unit test
---
src/Helpers/BluemConfiguration.php | 15 +++++++++------
tests/unit/BluemGenericTest.php | 4 +++-
2 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/src/Helpers/BluemConfiguration.php b/src/Helpers/BluemConfiguration.php
index acf6009..ea1c1c5 100644
--- a/src/Helpers/BluemConfiguration.php
+++ b/src/Helpers/BluemConfiguration.php
@@ -47,6 +47,11 @@ class BluemConfiguration
*/
public $IDINBrandID;
+ /**
+ * @var mixed
+ */
+ public $sequenceType;
+
/**
* @var mixed
*/
@@ -78,10 +83,6 @@ class BluemConfiguration
*/
public $merchantSubID;
- /**
- * @var BluemConfigurationValidator
- */
- private $validator;
/**
* @var string
*/
@@ -109,6 +110,7 @@ public function __construct($raw)
$this->validator = new BluemConfigurationValidator();
$raw_validated = $this->validator->validate($raw);
+
if ($raw_validated === false) {
throw new Exception('Bluem Configuration is not valid: '.$this->errorsAsString());
}
@@ -117,16 +119,17 @@ public function __construct($raw)
$this->senderID = $raw_validated->senderID;
$this->brandID = $raw_validated->brandID;
$this->accessToken = $raw_validated->accessToken;
+
$this->merchantReturnURLBase = $raw_validated->merchantReturnURLBase ?? null;
// @todo: if this is required, break. check that
$this->test_accessToken = $raw_validated->test_accessToken;
$this->IDINBrandID = $this->_assumeBrandID("Identity", $this->brandID);
- // @todo: Test it
$this->PaymentsBrandID = $this->_assumeBrandID("Payment", $this->brandID);
$this->EmandateBrandID = $this->_assumeBrandID("Mandate", $this->brandID);
- // @todo PeterMeester: create validation step for IDINBrandID
+
+ $this->sequenceType = $raw_validated->sequenceType ?? null;
$this->merchantID = $raw_validated->merchantID;
$this->production_accessToken = $raw_validated->production_accessToken;
diff --git a/tests/unit/BluemGenericTest.php b/tests/unit/BluemGenericTest.php
index 1818ceb..5835b5e 100644
--- a/tests/unit/BluemGenericTest.php
+++ b/tests/unit/BluemGenericTest.php
@@ -1,4 +1,5 @@
test_accessToken = $_ENV['BLUEM_TEST_ACCESS_TOKEN'];
$bluem_config->IDINBrandID = $_ENV['BLUEM_BRANDID'];
$bluem_config->merchantID = $_ENV['BLUEM_MERCHANTID'];
- $bluem_config->merchantReturnURLBase =$_ENV['BLUEM_MERCHANTRETURNURLBASE'];
+ $bluem_config->merchantReturnURLBase = $_ENV['BLUEM_MERCHANTRETURNURLBASE'];
$bluem_config->production_accessToken = "" ;
$bluem_config->expectedReturnStatus = "success" ;
$bluem_config->eMandateReason = "eMandateReason" ;
+ $bluem_config->sequenceType = "OOFF" ;
$bluem_config->localInstrumentCode = "B2B" ;
// @todo: create env variables for these