Skip to content

Commit

Permalink
Add support to SCA exemptions
Browse files Browse the repository at this point in the history
  • Loading branch information
facine committed Sep 15, 2020
1 parent cf79ffd commit d169341
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion src/Sermepa.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ class Sermepa implements SermepaInterface {
*/
private $DsMerchantDateFrecuency;

/**
* PDS2 exemption.
*/
private $DsMerchantExcepSCA;

/**
* Optional field for commerce to indicate the associated payment group.
*/
Expand Down Expand Up @@ -395,6 +400,7 @@ private function getParameters() {
'Ds_Merchant_ConsumerLanguage' => $this->DsMerchantConsumerLanguage,
'Ds_Merchant_Currency' => $this->DsMerchantCurrency,
'Ds_Merchant_DateFrecuency' => $this->DsMerchantDateFrecuency,
'Ds_Merchant_Excep_SCA' => $this->DsMerchantExcepSCA,
'Ds_Merchant_Group' => $this->DsMerchantGroup,
'Ds_Merchant_Identifier' => $this->DsMerchantIdentifier,
'Ds_Merchant_MerchantCode' => $this->DsMerchantMerchantCode,
Expand All @@ -414,7 +420,7 @@ private function getParameters() {
);

return array_filter($parameters, function($parameter) {
return ($parameter !== NULL && $parameter !== FALSE && $parameter !== '');
return ($parameter !== NULL && $parameter !== FALSE && $parameter !== '');
});
}

Expand Down Expand Up @@ -980,6 +986,25 @@ public function getDateFrecuency() {
return $this->DsMerchantDateFrecuency;
}

/**
* {@inheritdoc}
*/
public function setExcepSCA($sca) {
$allowed_scas = array('MIT', 'LWV', 'TRA', 'COR');
if (!in_array($sca, $allowed_scas)) {
throw new SermepaException('The specified Ds_Merchant_Excep_SCA: ' . $sca . ' is not valid.', self::BAD_PARAM);
}

return $this->set('DsMerchantExcepSCA', $sca);
}

/**
* {@inheritdoc}
*/
public function getExcepSCA() {
return $this->DsMerchantExcepSCA;
}

/**
* {@inheritdoc}
*/
Expand Down

0 comments on commit d169341

Please sign in to comment.