Skip to content

Commit

Permalink
Added simpletype
Browse files Browse the repository at this point in the history
  • Loading branch information
DaanRijpkema committed Jun 19, 2020
1 parent adc6b97 commit 30a32b1
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
15 changes: 11 additions & 4 deletions BluemIntegration.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,11 @@ public function RequestTransactionStatus($mandateID, $entranceCode)
* @param int $customer_id The Customer ID
* @param int $order_id The Order ID
*/
public function CreateNewTransaction($customer_id, $order_id): EMandateResponse
public function CreateNewTransaction(
$customer_id, $order_id,
$transaction_type = "default",
$simple_redirect_url = ""
)
{

if (is_null($customer_id)) {
Expand All @@ -93,7 +97,9 @@ public function CreateNewTransaction($customer_id, $order_id): EMandateResponse
$this->CreateMandateID($order_id, $customer_id),
($this->configuration->environment == BLUEM_ENVIRONMENT_TESTING &&
isset($this->configuration->expected_return) ?
$this->configuration->expected_return : "")
$this->configuration->expected_return : ""),
$transaction_type,
$simple_redirect_url
);

return $this->PerformRequest($r);
Expand All @@ -115,7 +121,8 @@ public function CreateEntranceCode(): String
*/
public function CreateMandateID(String $order_id, String $customer_id): String
{
if($this->configuration->senderID === "S1300") // veteranen search team
// veteranen search team
if($this->configuration->senderID === "S1300")
{
return "M".Carbon::now()->format('YmdHis');
}
Expand Down Expand Up @@ -152,7 +159,7 @@ public function PerformRequest(EMandateRequest $transaction_request)
try {
$http_response = $req->send();
if ($http_response->getStatus() == 200) {
// echo $http_response->getBody();

$response = new EMandateResponse($http_response->getBody());
if (!$response->Status()) {

Expand Down
15 changes: 12 additions & 3 deletions EMandateRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,9 @@ class EMandateTransactionRequest extends EMandateRequest
private $purchaseID;
private $sendOption;

function __construct($config, $customer_id, $order_id, $mandateID, String $expected_return="none")
function __construct($config, $customer_id, $order_id, $mandateID, String $expected_return="none",
$transaction_type = "default",
$simple_redirect_url="")
{

parent::__construct($config,"",$expected_return);
Expand All @@ -279,6 +281,10 @@ function __construct($config, $customer_id, $order_id, $mandateID, String $expec

$this->merchantReturnURLBase = $config->merchantReturnURLBase;

$this->transaction_type = $transaction_type;
if($this->transaction_type==="simple" && $simple_redirect_url!=="") {
$this->merchantReturnURL = $simple_redirect_url."?mandateID={$this->mandateID}";
}

$now = Carbon::now();

Expand Down Expand Up @@ -309,7 +315,10 @@ function __construct($config, $customer_id, $order_id, $mandateID, String $expec
}
$this->purchaseID = "{$purchaseIDPrefix}{$this->debtorReference}-{$order_id}"; // INKOOPNUMMER




$this->automatically_redirect = "1";

}
public function XmlString()
{
Expand All @@ -329,7 +338,7 @@ public function XmlString()
language="nl"
sendOption="none">
<MandateID>'.$this->mandateID.'</MandateID>
<MerchantReturnURL automaticRedirect="1">'.$this->merchantReturnURL.'</MerchantReturnURL>
<MerchantReturnURL automaticRedirect="'.$this->automatically_redirect.'">'.$this->merchantReturnURL.'</MerchantReturnURL>
<SequenceType>'.$this->sequenceType.'</SequenceType>
<EMandateReason>'.$this->eMandateReason.'</EMandateReason>
<DebtorReference>'.$this->debtorReference.'</DebtorReference>
Expand Down

0 comments on commit 30a32b1

Please sign in to comment.