Skip to content
This repository has been archived by the owner on Mar 29, 2022. It is now read-only.

Commit

Permalink
Merge pull request #189 from bleenders/develop
Browse files Browse the repository at this point in the history
Added the possibility to add custom css to the payment page
  • Loading branch information
Ryouzanpaku authored Jul 23, 2020
2 parents 4ad457b + bae1b7f commit 7c4154e
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
23 changes: 23 additions & 0 deletions src/Resources/PaymentTypes/Paypage.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ class Paypage extends BasePaymentType
/** @var bool $card3ds */
protected $card3ds;

/** @var array $css */
protected $css = [];

/**
* Paypage constructor.
*
Expand Down Expand Up @@ -536,6 +539,26 @@ public function setCard3ds($card3ds): Paypage
return $this;
}

/**
* @return array|null
*/
public function getCss(): ?array
{
return $this->css;
}

/**
* @param array $styles
* @return Paypage
*/
public function setCss($styles): Paypage
{
foreach ($styles as $element => $css) {
$this->css[$element] = $css;
}
return $this;
}

/**
* @param float|null $effectiveInterestRate
*
Expand Down
16 changes: 14 additions & 2 deletions test/integration/PaymentTypes/PaypageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,13 @@ public function maximumPaypageChargeShouldBeCreatable(): void
->setContactUrl('https://www.heidelpay.com/en/about-us/about-heidelpay/')
->setInvoiceId($invoiceId)
->setCard3ds(true)
->setEffectiveInterestRate(4.99);
->setEffectiveInterestRate(4.99)
->setCss([
'shopDescription' => 'color: purple',
'header' => 'background-color: red',
'helpUrl' => 'color: blue',
'contactUrl' => 'color: green',
]);
$this->assertEmpty($paypage->getId());
$paypage = $this->heidelpay->initPayPageCharge($paypage, $customer, $basket);
$this->assertNotEmpty($paypage->getId());
Expand Down Expand Up @@ -121,7 +127,13 @@ public function maximumPaypageAuthorizeShouldBeCreatable(): void
->setContactUrl('https://www.heidelpay.com/en/about-us/about-heidelpay/')
->setInvoiceId($invoiceId)
->setCard3ds(true)
->setEffectiveInterestRate(4.99);
->setEffectiveInterestRate(4.99)
->setCss([
'shopDescription' => 'color: purple',
'header' => 'background-color: red',
'helpUrl' => 'color: blue',
'contactUrl' => 'color: green',
]);
$paypage->addExcludeType(Card::getResourceName());
$this->assertEmpty($paypage->getId());
$paypage = $this->heidelpay->initPayPageAuthorize($paypage, $customer, $basket);
Expand Down

0 comments on commit 7c4154e

Please sign in to comment.