Skip to content

Commit

Permalink
Added sequenceType to Bluem configuration and unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
petermeester committed May 23, 2022
1 parent 3eb9d59 commit 81ebd73
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
15 changes: 9 additions & 6 deletions src/Helpers/BluemConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ class BluemConfiguration
*/
public $IDINBrandID;

/**
* @var mixed
*/
public $sequenceType;

/**
* @var mixed
*/
Expand Down Expand Up @@ -78,10 +83,6 @@ class BluemConfiguration
*/
public $merchantSubID;

/**
* @var BluemConfigurationValidator
*/
private $validator;
/**
* @var string
*/
Expand Down Expand Up @@ -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());
}
Expand All @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion tests/unit/BluemGenericTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Bluem\Tests\Unit;

use Bluem\BluemPHP\Bluem;
Expand Down Expand Up @@ -40,11 +41,12 @@ protected function setUp() : void
$bluem_config->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

Expand Down

0 comments on commit 81ebd73

Please sign in to comment.