Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: thephpleague/omnipay-paypal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: awes-io/omnipay-paypal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Able to merge. These branches can be automatically merged.
  • 4 commits
  • 2 files changed
  • 2 contributors

Commits on Sep 15, 2020

  1. Copy the full SHA
    16bbfd9 View commit details
  2. Copy the full SHA
    05201ac View commit details
  3. feat: added user_action option

    falkon committed Sep 15, 2020
    Copy the full SHA
    b86b691 View commit details
  4. Copy the full SHA
    2723246 View commit details
Showing with 46 additions and 1 deletion.
  1. +1 −1 composer.json
  2. +45 −0 src/Message/RestPurchaseRequest.php
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "omnipay/paypal",
"name": "awes-io/omnipay-paypal",
"type": "library",
"description": "PayPal gateway for Omnipay payment processing library",
"keywords": [
45 changes: 45 additions & 0 deletions src/Message/RestPurchaseRequest.php
Original file line number Diff line number Diff line change
@@ -223,10 +223,55 @@
*/
class RestPurchaseRequest extends RestAuthorizeRequest
{
const SHIPPING_PREFERENCE_NO_SHIPPING = 'NO_SHIPPING';
const SHIPPING_PREFERENCE_GET_FROM_FILE = 'GET_FROM_FILE';
const SHIPPING_PREFERENCE_SET_PROVIDED_ADDRESS= 'SET_PROVIDED_ADDRESS';

const USER_ACTION_COMMIT = 'COMMIT';
const USER_ACTION_CONTINUE= 'CONTINUE';

public function getData()
{
$data = parent::getData();
$data['intent'] = 'sale';
$data['application_context']['shipping_preference'] = $this->getShippingPreference();
$data['application_context']['user_action'] = $this->getUserAction();
return $data;
}

public function getShippingPreference()
{
return $this->getParameter('shippingPreference');
}

public function getUserAction()
{
return $this->getParameter('userAction');
}

/**
* Set the shipping preference
*
* Supported values:
* 'NO_SHIPPING': redacts shipping address fields from the PayPal pages.
* Recommended value to use for digital goods.
* 'GET_FROM_FILE': Get the shipping address selected by the buyer on PayPal pages.
* 'SET_PROVIDED_ADDRESS' (not yet fully supported by the library since shipping address can't be provided):
* Use the address provided by the merchant. Buyer is not able to change the address on the PayPal pages.
* If merchant doesn't pass an address, buyer has the option to choose the address on PayPal pages.
*
* @param string $value
* @return bool.
* @link https://developer.paypal.com/docs/api/orders/#definition-application_context
* @link https://www.paypalobjects.com/api/checkout.js
*/
public function setShippingPreference($value)
{
return $this->setParameter('shippingPreference', $value);
}

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