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

Commit

Permalink
Revert "Merge remote-tracking branch 'remotes/github/develop' into PH…
Browse files Browse the repository at this point in the history
…PLIB-345/change/release-and-merge-external-pr (#191)" (#198)

This reverts commit b070633.
  • Loading branch information
Simon Gabriel authored and sixer1182 committed Jul 24, 2020
1 parent 11d637b commit 9cb52ca
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 42 deletions.
5 changes: 2 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
## [1.2.8.0][1.2.8.0]

### Add
* Curl error string to debug log.
* Environment variable to enable/disable verbose curl output.
* Add curl error string to debug log.
* Add environment variable to enable/disable verbose curl output.
* Method to get the initial transaction from a payment.
* Parameter `css` to `Paypage` to enable custom styling. Special thanks to github user [bleenders](https://github.com/bleenders).

### Change
* Mask auth header in debug log.
Expand Down
11 changes: 6 additions & 5 deletions src/Resources/PaymentTypes/Paypage.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ class Paypage extends BasePaymentType
/** @var bool $card3ds */
protected $card3ds;

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

/**
* Paypage constructor.
Expand Down Expand Up @@ -548,13 +548,14 @@ public function getCss(): ?array
}

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

Expand Down
13 changes: 0 additions & 13 deletions test/integration/PaymentTypes/PaypageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,17 +145,4 @@ public function maximumPaypageAuthorizeShouldBeCreatable(): void
$this->assertNotNull($payment->getId());
$this->assertNotEmpty($paypage->getRedirectUrl());
}

/**
* Validate paypage css can be set empty array.
*
* @test
*/
public function cssShouldAllowForEmptyArray(): void
{
$paypage = new Paypage(100.0, 'EUR', self::RETURN_URL);
$this->assertEmpty($paypage->getId());
$paypage = $this->heidelpay->initPayPageAuthorize($paypage->setCss([]));
$this->assertNotEmpty($paypage->getId());
}
}
24 changes: 3 additions & 21 deletions test/unit/Resources/PaymentTypes/PayPageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ public function getterAndSetterWorkAsExpected(): void
$this->assertNull($paypage->getShopDescription());
$this->assertNull($paypage->getShopName());
$this->assertNull($paypage->getTagline());
$this->assertNull($paypage->getCss());

// link urls
$this->assertNull($paypage->getContactUrl());
Expand Down Expand Up @@ -103,13 +102,7 @@ public function getterAndSetterWorkAsExpected(): void
->setPayment($payment)
->setRedirectUrl('https://redirect.url')
->addExcludeType(SepaDirectDebit::getResourceName())
->setCard3ds(true)
->setCss([
'shopDescription' => 'color: purple',
'header' => 'background-color: red',
'helpUrl' => 'color: blue',
'contactUrl' => 'color: green',
]);
->setCard3ds(true);

// ----------- VERIFY test values ------------
$this->assertEquals(321.0, $paypage->getAmount());
Expand All @@ -128,12 +121,6 @@ public function getterAndSetterWorkAsExpected(): void
$this->assertEquals('my shop description', $paypage->getShopDescription());
$this->assertEquals('my shop name', $paypage->getShopName());
$this->assertEquals('my shops tag line', $paypage->getTagline());
$this->assertEquals([
'shopDescription' => 'color: purple',
'header' => 'background-color: red',
'helpUrl' => 'color: blue',
'contactUrl' => 'color: green',
], $paypage->getCss());

// link urls
$this->assertEquals('my contact url', $paypage->getContactUrl());
Expand Down Expand Up @@ -180,7 +167,6 @@ public function responseHandlingShouldWorkProperly(): void
$this->assertNull($paypage->getShopDescription());
$this->assertNull($paypage->getShopName());
$this->assertNull($paypage->getTagline());
$this->assertNull($paypage->getCss());

$this->assertNull($paypage->getContactUrl());
$this->assertNull($paypage->getHelpUrl());
Expand All @@ -205,7 +191,6 @@ public function responseHandlingShouldWorkProperly(): void
$response->imprintUrl = 'imprint url';
$response->privacyPolicyUrl = 'privacy policy url';
$response->termsAndConditionUrl = 'tac url';
$response->css = ['my'=> 'styles'];
$paypage->handleResponse($response);

// then
Expand All @@ -222,7 +207,6 @@ public function responseHandlingShouldWorkProperly(): void
$this->assertEquals('shop description', $paypage->getShopDescription());
$this->assertEquals('shop name', $paypage->getShopName());
$this->assertEquals('tagline', $paypage->getTagline());
$this->assertEquals(['my' => 'styles'], $paypage->getCss());

$this->assertEquals('contact url', $paypage->getContactUrl());
$this->assertEquals('help url', $paypage->getHelpUrl());
Expand Down Expand Up @@ -346,8 +330,7 @@ public function exposeShouldSetBasicParams(): void
->setRedirectUrl('https://redirect.url')
->setOrderId('my order id')
->setInvoiceId('my invoice id')
->setEffectiveInterestRate(4.99)
->setCss(['my' => 'style']);
->setEffectiveInterestRate(4.99);

// then
$expected = [
Expand All @@ -373,8 +356,7 @@ public function exposeShouldSetBasicParams(): void
'orderId' => 'my order id',
'invoiceId' => 'my invoice id',
'excludeTypes' => [],
'additionalAttributes' => ['effectiveInterestRate' => 4.99],
'css' => ['my' => 'style']
'additionalAttributes' => ['effectiveInterestRate' => 4.99]
];
$this->assertEquals($expected, $paypage->expose());
}
Expand Down

0 comments on commit 9cb52ca

Please sign in to comment.