Skip to content

Added Header Image Support #55

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/Omnipay/PayPal/ExpressGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ public function getDefaultParameters()
$settings['solutionType'] = array('Sole', 'Mark');
$settings['landingPage'] = array('Billing', 'Login');

/**
*
* (Optional) URL for the image you want to appear at the top left of the payment page.
* The image has a maximum size of 750 pixels wide by 90 pixels high.
* PayPal recommends that you provide an image that is stored on a secure (https) server.
* If you do not specify an image, the business name displays.
* Character length and limitations: 127 single-byte alphanumeric characters
*/
$settings['headerImage'] = '';

return $settings;
}

Expand Down
10 changes: 10 additions & 0 deletions src/Omnipay/PayPal/Message/AbstractRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,16 @@ public function setLandingPage($value)
return $this->setParameter('landingPage', $value);
}

public function getHeaderImage()
{
return $this->getParameter('headerImage');
}

public function setHeaderImage($value)
{
return $this->setParameter('headerImage', $value);
}

protected function getBaseData($method)
{
$data = array();
Expand Down
16 changes: 16 additions & 0 deletions src/Omnipay/PayPal/Message/ExpressAuthorizeRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ public function getData()
$data['RETURNURL'] = $this->getReturnUrl();
$data['CANCELURL'] = $this->getCancelUrl();

// Add optional header image
if ($headerImage = $this->getHeaderImage()) {
$data['HDRIMG'] = $headerImage;
}

if ($card = $this->getCard()) {
$data['PAYMENTREQUEST_0_SHIPTONAME'] = $card->getName();
$data['PAYMENTREQUEST_0_SHIPTOSTREET'] = $card->getAddress1();
Expand All @@ -55,4 +60,15 @@ protected function createResponse($data)
{
return $this->response = new ExpressAuthorizeResponse($this, $data);
}

public function getHeaderImage()
{
return $this->getParameter('headerImage');
}

public function setHeaderImage($value)
{
return $this->setParameter('headerImage', $value);
}

}