Enabled Payment Experience

- Updated Api to enabled Payment Experience
- Updated Tests and Samples
- Added Json Validator
- Ability for PPModel to return array of self objects
This commit is contained in:
japatel
2014-10-13 12:00:31 -05:00
parent 792cdc2b93
commit 0cb302326a
55 changed files with 1936 additions and 654 deletions

View File

@@ -0,0 +1,43 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PPModel;
use PayPal\Rest\ApiContext;
/**
* Class CreateProfileResponse
*
* Response schema for create profile api
*
* @package PayPal\Api
*
* @property string id
*/
class CreateProfileResponse extends PPModel
{
/**
* ID of the payment web experience profile.
*
*
* @param string $id
*
* @return $this
*/
public function setId($id)
{
$this->id = $id;
return $this;
}
/**
* ID of the payment web experience profile.
*
* @return string
*/
public function getId()
{
return $this->id;
}
}

View File

@@ -1,52 +1,120 @@
<?php <?php
namespace PayPal\Api; namespace PayPal\Api;
use PayPal\Common\PPModel; use PayPal\Common\PPModel;
use PayPal\Rest\ApiContext; use PayPal\Rest\ApiContext;
use PayPal\Validation\UrlValidator;
/** /**
* Class FlowConfig * Class FlowConfig
* *
* Parameters for flow configuration.
*
* @package PayPal\Api
*
* @property string landing_page_type * @property string landing_page_type
* @property string bank_txn_pending_url * @property string bank_txn_pending_url
*/ */
class FlowConfig extends PPModel { class FlowConfig extends PPModel
{
/**
/** * Type of PayPal page to be displayed when a user lands on the PayPal site for checkout. Allowed values: `Billing` or `Login`. When set to `Billing`, the Non-PayPal account landing page is used. When set to `Login`, the PayPal account login landing page is used.
* *
* @return string landing_page_type *
*/ * @param string $landing_page_type
public function getLandingPageType() { *
return $this->landing_page_type; * @return $this
} */
public function setLandingPageType($landing_page_type)
/* {
* @param string landing_page_type * $this->landing_page_type = $landing_page_type;
*/ return $this;
}
public function setLandingPageType($landing_page_type){
$this->landing_page_type = $landing_page_type;
return $this;
}
/**
*
* @return string bank_txn_pending_url
*/
public function getBankTxnPendingUrl() {
return $this->bank_txn_pending_url;
}
/*
* @param string bank_txn_pending_url *
*/
public function setBankTxnPendingUrl($bank_txn_pending_url){
$this->bank_txn_pending_url = $bank_txn_pending_url;
return $this;
}
/**
* Type of PayPal page to be displayed when a user lands on the PayPal site for checkout. Allowed values: `Billing` or `Login`. When set to `Billing`, the Non-PayPal account landing page is used. When set to `Login`, the PayPal account login landing page is used.
*
* @return string
*/
public function getLandingPageType()
{
return $this->landing_page_type;
}
/**
* Type of PayPal page to be displayed when a user lands on the PayPal site for checkout. Allowed values: `Billing` or `Login`. When set to `Billing`, the Non-PayPal account landing page is used. When set to `Login`, the PayPal account login landing page is used.
*
* @deprecated Instead use setLandingPageType
*
* @param string $landing_page_type
* @return $this
*/
public function setLanding_page_type($landing_page_type)
{
$this->landing_page_type = $landing_page_type;
return $this;
}
/**
* Type of PayPal page to be displayed when a user lands on the PayPal site for checkout. Allowed values: `Billing` or `Login`. When set to `Billing`, the Non-PayPal account landing page is used. When set to `Login`, the PayPal account login landing page is used.
* @deprecated Instead use getLandingPageType
*
* @return string
*/
public function getLanding_page_type()
{
return $this->landing_page_type;
}
/**
* The URL on the merchant site for transferring to after a bank transfer payment.
*
*
* @param string $bank_txn_pending_url
* @throws InvalidArgumentException
* @return $this
*/
public function setBankTxnPendingUrl($bank_txn_pending_url)
{
UrlValidator::validate($bank_txn_pending_url, "BankTxnPendingUrl");
$this->bank_txn_pending_url = $bank_txn_pending_url;
return $this;
}
/**
* The URL on the merchant site for transferring to after a bank transfer payment.
*
* @return string
*/
public function getBankTxnPendingUrl()
{
return $this->bank_txn_pending_url;
}
/**
* The URL on the merchant site for transferring to after a bank transfer payment.
*
* @deprecated Instead use setBankTxnPendingUrl
*
* @param string $bank_txn_pending_url
* @return $this
*/
public function setBank_txn_pending_url($bank_txn_pending_url)
{
$this->bank_txn_pending_url = $bank_txn_pending_url;
return $this;
}
/**
* The URL on the merchant site for transferring to after a bank transfer payment.
* @deprecated Instead use getBankTxnPendingUrl
*
* @return string
*/
public function getBank_txn_pending_url()
{
return $this->bank_txn_pending_url;
}
} }

View File

@@ -1,4 +1,5 @@
<?php <?php
namespace PayPal\Api; namespace PayPal\Api;
use PayPal\Common\PPModel; use PayPal\Common\PPModel;
@@ -7,62 +8,161 @@ use PayPal\Rest\ApiContext;
/** /**
* Class InputFields * Class InputFields
* *
* @property integer no_shipping * Parameters for input fields customization.
* @property integer address_override *
* @property boolean allow-note * @package PayPal\Api
*
* @property bool allow_note
* @property int no_shipping
* @property int address_override
*/ */
class InputFields extends PPModel { class InputFields extends PPModel
{
/**
/** * Enables the buyer to enter a note to the merchant on the PayPal page during checkout.
* *
* @return integer no_shipping *
*/ * @param bool $allow_note
public function getNoShipping() { *
return $this->no_shipping; * @return $this
} */
public function setAllowNote($allow_note)
/* {
* @param integer no_shipping * $this->allow_note = $allow_note;
*/ return $this;
}
public function setNoShipping($no_shipping){
$this->no_shipping = $no_shipping; /**
return $this; * Enables the buyer to enter a note to the merchant on the PayPal page during checkout.
} *
* @return bool
*/
/** public function getAllowNote()
* {
* @return integer address_override return $this->allow_note;
*/ }
public function getAddressOverride() {
return $this->address_override; /**
} * Enables the buyer to enter a note to the merchant on the PayPal page during checkout.
*
/* * @deprecated Instead use setAllowNote
* @param integer address_override * *
*/ * @param bool $allow_note
* @return $this
public function setAddressOverride($address_override){ */
$this->address_override = $address_override; public function setAllow_note($allow_note)
return $this; {
} $this->allow_note = $allow_note;
return $this;
}
/**
* Enables the buyer to enter a note to the merchant on the PayPal page during checkout.
* @deprecated Instead use getAllowNote
*
* @return bool
*/
public function getAllow_note()
{
return $this->allow_note;
}
/**
* Determines whether or not PayPal displays shipping address fields on the experience pages. Allowed values: `0`, `1`, or `2`. When set to `0`, PayPal displays the shipping address on the PayPal pages. When set to `1`, PayPal does not display shipping address fields whatsoever. When set to `2`, if you do not pass the shipping address, PayPal obtains it from the buyer's account profile. For digital goods, this field is required, and you must set it to `1`.
*
*
* @param int $no_shipping
*
* @return $this
*/
public function setNoShipping($no_shipping)
{
$this->no_shipping = $no_shipping;
return $this;
}
/**
* Determines whether or not PayPal displays shipping address fields on the experience pages. Allowed values: `0`, `1`, or `2`. When set to `0`, PayPal displays the shipping address on the PayPal pages. When set to `1`, PayPal does not display shipping address fields whatsoever. When set to `2`, if you do not pass the shipping address, PayPal obtains it from the buyer's account profile. For digital goods, this field is required, and you must set it to `1`.
*
* @return int
*/
public function getNoShipping()
{
return $this->no_shipping;
}
/**
* Determines whether or not PayPal displays shipping address fields on the experience pages. Allowed values: `0`, `1`, or `2`. When set to `0`, PayPal displays the shipping address on the PayPal pages. When set to `1`, PayPal does not display shipping address fields whatsoever. When set to `2`, if you do not pass the shipping address, PayPal obtains it from the buyer's account profile. For digital goods, this field is required, and you must set it to `1`.
*
* @deprecated Instead use setNoShipping
*
* @param int $no_shipping
* @return $this
*/
public function setNo_shipping($no_shipping)
{
$this->no_shipping = $no_shipping;
return $this;
}
/**
* Determines whether or not PayPal displays shipping address fields on the experience pages. Allowed values: `0`, `1`, or `2`. When set to `0`, PayPal displays the shipping address on the PayPal pages. When set to `1`, PayPal does not display shipping address fields whatsoever. When set to `2`, if you do not pass the shipping address, PayPal obtains it from the buyer's account profile. For digital goods, this field is required, and you must set it to `1`.
* @deprecated Instead use getNoShipping
*
* @return int
*/
public function getNo_shipping()
{
return $this->no_shipping;
}
/**
* Determines whether or not the PayPal pages should display the shipping address and not the shipping address on file with PayPal for this buyer. Displaying the PayPal street address on file does not allow the buyer to edit that address. Allowed values: `0` or `1`. When set to `0`, the PayPal pages should not display the shipping address. When set to `1`, the PayPal pages should display the shipping address.
*
*
* @param int $address_override
*
* @return $this
*/
public function setAddressOverride($address_override)
{
$this->address_override = $address_override;
return $this;
}
/**
* Determines whether or not the PayPal pages should display the shipping address and not the shipping address on file with PayPal for this buyer. Displaying the PayPal street address on file does not allow the buyer to edit that address. Allowed values: `0` or `1`. When set to `0`, the PayPal pages should not display the shipping address. When set to `1`, the PayPal pages should display the shipping address.
*
* @return int
*/
public function getAddressOverride()
{
return $this->address_override;
}
/**
* Determines whether or not the PayPal pages should display the shipping address and not the shipping address on file with PayPal for this buyer. Displaying the PayPal street address on file does not allow the buyer to edit that address. Allowed values: `0` or `1`. When set to `0`, the PayPal pages should not display the shipping address. When set to `1`, the PayPal pages should display the shipping address.
*
* @deprecated Instead use setAddressOverride
*
* @param int $address_override
* @return $this
*/
public function setAddress_override($address_override)
{
$this->address_override = $address_override;
return $this;
}
/**
* Determines whether or not the PayPal pages should display the shipping address and not the shipping address on file with PayPal for this buyer. Displaying the PayPal street address on file does not allow the buyer to edit that address. Allowed values: `0` or `1`. When set to `0`, the PayPal pages should not display the shipping address. When set to `1`, the PayPal pages should display the shipping address.
* @deprecated Instead use getAddressOverride
*
* @return int
*/
public function getAddress_override()
{
return $this->address_override;
}
/**
*
* @return boolean allow_note
*/
public function getAllowNote() {
return $this->allow_note;
}
/*
* @param boolean allow_note *
*/
public function setAllowNote($allow_note){
$this->allow_note = $allow_note;
return $this;
}
} }

118
lib/PayPal/Api/Patch.php Normal file
View File

@@ -0,0 +1,118 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PPModel;
use PayPal\Rest\ApiContext;
/**
* Class Patch
*
* A JSON patch object used for applying partial updates to resources.
*
* @package PayPal\Api
*
* @property string op
* @property string path
* @property \PayPal\Api\object value
* @property string from
*/
class Patch extends PPModel
{
/**
* The operation to perform.
* Valid Values: ["add", "remove", "replace", "move", "copy", "test"]
*
* @param string $op
*
* @return $this
*/
public function setOp($op)
{
$this->op = $op;
return $this;
}
/**
* The operation to perform.
*
* @return string
*/
public function getOp()
{
return $this->op;
}
/**
* String containing a JSON-Pointer value that references a location within the target document where the operation is performed.
*
*
* @param string $path
*
* @return $this
*/
public function setPath($path)
{
$this->path = $path;
return $this;
}
/**
* String containing a JSON-Pointer value that references a location within the target document where the operation is performed.
*
* @return string
*/
public function getPath()
{
return $this->path;
}
/**
* New value to apply based on the operation. op=remove does not require value.
*
*
* @param \PayPal\Api\object $value
*
* @return $this
*/
public function setValue($value)
{
$this->value = $value;
return $this;
}
/**
* New value to apply based on the operation. op=remove does not require value.
*
* @return \PayPal\Api\object
*/
public function getValue()
{
return $this->value;
}
/**
* A string containing a JSON Pointer value that references the location in the target document from which to move the value. Required for use where op=move.
*
*
* @param string $from
*
* @return $this
*/
public function setFrom($from)
{
$this->from = $from;
return $this;
}
/**
* A string containing a JSON Pointer value that references the location in the target document from which to move the value. Required for use where op=move.
*
* @return string
*/
public function getFrom()
{
return $this->from;
}
}

View File

@@ -374,7 +374,6 @@ class Payment extends PPModel implements IResource
public function setExperienceProfileId($experience_profile_id) public function setExperienceProfileId($experience_profile_id)
{ {
$this->experience_profile_id = $experience_profile_id; $this->experience_profile_id = $experience_profile_id;
return $this; return $this;
} }

View File

@@ -1,4 +1,5 @@
<?php <?php
namespace PayPal\Api; namespace PayPal\Api;
use PayPal\Common\PPModel; use PayPal\Common\PPModel;
@@ -7,62 +8,161 @@ use PayPal\Rest\ApiContext;
/** /**
* Class Presentation * Class Presentation
* *
* Parameters for style and presentation.
*
* @package PayPal\Api
*
* @property string brand_name * @property string brand_name
* @property string logo_image * @property string logo_image
* @property string locale_code * @property string locale_code
*/ */
class Presentation extends PPModel { class Presentation extends PPModel
{
/**
/** * A label that overrides the business name in the PayPal account on the PayPal pages.
* *
* @return string brand_name *
*/ * @param string $brand_name
public function getBrandName() { *
return $this->brand_name; * @return $this
} */
public function setBrandName($brand_name)
/* {
* @param string brand_name * $this->brand_name = $brand_name;
*/ return $this;
}
public function setBrandName($brand_name){
$this->brand_name = $brand_name; /**
return $this; * A label that overrides the business name in the PayPal account on the PayPal pages.
} *
* @return string
*/
/** public function getBrandName()
* {
* @return string logo_image return $this->brand_name;
*/ }
public function getLogoImage() {
return $this->logo_image; /**
} * A label that overrides the business name in the PayPal account on the PayPal pages.
*
/* * @deprecated Instead use setBrandName
* @param string logo_image * *
*/ * @param string $brand_name
* @return $this
public function setLogoImage($logo_image){ */
$this->logo_image = $logo_image; public function setBrand_name($brand_name)
return $this; {
} $this->brand_name = $brand_name;
return $this;
}
/**
* A label that overrides the business name in the PayPal account on the PayPal pages.
* @deprecated Instead use getBrandName
*
* @return string
*/
public function getBrand_name()
{
return $this->brand_name;
}
/**
* A URL to logo image. Allowed vaues: `.gif`, `.jpg`, or `.png`.
*
*
* @param string $logo_image
*
* @return $this
*/
public function setLogoImage($logo_image)
{
$this->logo_image = $logo_image;
return $this;
}
/**
* A URL to logo image. Allowed vaues: `.gif`, `.jpg`, or `.png`.
*
* @return string
*/
public function getLogoImage()
{
return $this->logo_image;
}
/**
* A URL to logo image. Allowed vaues: `.gif`, `.jpg`, or `.png`.
*
* @deprecated Instead use setLogoImage
*
* @param string $logo_image
* @return $this
*/
public function setLogo_image($logo_image)
{
$this->logo_image = $logo_image;
return $this;
}
/**
* A URL to logo image. Allowed vaues: `.gif`, `.jpg`, or `.png`.
* @deprecated Instead use getLogoImage
*
* @return string
*/
public function getLogo_image()
{
return $this->logo_image;
}
/**
* Locale of pages displayed by PayPal payment experience.
*
*
* @param string $locale_code
*
* @return $this
*/
public function setLocaleCode($locale_code)
{
$this->locale_code = $locale_code;
return $this;
}
/**
* Locale of pages displayed by PayPal payment experience.
*
* @return string
*/
public function getLocaleCode()
{
return $this->locale_code;
}
/**
* Locale of pages displayed by PayPal payment experience.
*
* @deprecated Instead use setLocaleCode
*
* @param string $locale_code
* @return $this
*/
public function setLocale_code($locale_code)
{
$this->locale_code = $locale_code;
return $this;
}
/**
* Locale of pages displayed by PayPal payment experience.
* @deprecated Instead use getLocaleCode
*
* @return string
*/
public function getLocale_code()
{
return $this->locale_code;
}
/**
*
* @return string locale_code
*/
public function getLocaleCode() {
return $this->logo_image;
}
/*
* @param string locale_code *
*/
public function setLocaleCode($locale_code){
$this->locale_code = $locale_code;
return $this;
}
} }

View File

@@ -5,46 +5,58 @@ namespace PayPal\Api;
use PayPal\Common\PPModel; use PayPal\Common\PPModel;
use PayPal\Rest\ApiContext; use PayPal\Rest\ApiContext;
use PayPal\Rest\IResource; use PayPal\Rest\IResource;
use PayPal\Api\CreateProfileResponse;
use PayPal\Transport\PPRestCall; use PayPal\Transport\PPRestCall;
use PayPal\Validation\ArgumentValidator;
/** /**
* Class WebProfile * Class WebProfile
* *
* @property string id * Payment Web experience profile resource
* @property string name *
* @property InputFields input_fields * @package PayPal\Api
* @property FlowConfig flow_config *
* @property Presentation presentation * @property string id
* @property string name
* @property \PayPal\Api\FlowConfig flow_config
* @property \PayPal\Api\InputFields input_fields
* @property \PayPal\Api\Presentation presentation
*/ */
class WebProfile extends PPModel implements IResource class WebProfile extends PPModel implements IResource
{ {
/** /**
* @var * OAuth Credentials to use for this call
*
* @var \PayPal\Auth\OAuthTokenCredential $credential
*/ */
private static $credential; protected static $credential;
/**
* Sets Credential
*
* @deprecated Pass ApiContext to create/get methods instead
* @param \PayPal\Auth\OAuthTokenCredential $credential
*/
public static function setCredential($credential)
{
self::$credential = $credential;
}
function __construct() {
$this->input_fields = new InputFields();
}
//private $input_fields = array();
/** /**
* Set ID
* ID of the web experience profile. * ID of the web experience profile.
*
* *
* @param string $id * @param string $id
* *
* @return $this * @return $this
*/ */
public function setId($id) public function setId($id)
{ {
$this->id = $id; $this->id = $id;
return $this; return $this;
} }
/** /**
* Get ID
* ID of the web experience profile. * ID of the web experience profile.
* *
* @return string * @return string
@@ -55,22 +67,20 @@ class WebProfile extends PPModel implements IResource
} }
/** /**
* Set ID
* Name of the web experience profile. * Name of the web experience profile.
*
* *
* @param string $name * @param string $name
* *
* @return $this * @return $this
*/ */
public function setName($name) public function setName($name)
{ {
$this->name = $name; $this->name = $name;
return $this; return $this;
} }
/** /**
* Get name
* Name of the web experience profile. * Name of the web experience profile.
* *
* @return string * @return string
@@ -80,144 +90,243 @@ class WebProfile extends PPModel implements IResource
return $this->name; return $this->name;
} }
/** /**
* Parameters for flow configuration.
*
* *
* @param InputFields $input_fields * @param \PayPal\Api\FlowConfig $flow_config
*
* @return $this
*/ */
public function setInputFields($input_fields) { public function setFlowConfig($flow_config)
$this->input_fields = $input_fields; {
return $this;
}
/**
*
* @return InputFields
*/
public function getInputFields() {
return $this->input_fields;
}
/**
*
* @param FlowConfig $flow_config
*/
public function setFlowConfig($flow_config) {
$this->flow_config = $flow_config; $this->flow_config = $flow_config;
return $this; return $this;
} }
/** /**
* Parameters for flow configuration.
* *
* @return FlowConfig * @return \PayPal\Api\FlowConfig
*/ */
public function getFlowConfig() { public function getFlowConfig()
{
return $this->flow_config; return $this->flow_config;
} }
/**
* Parameters for flow configuration.
*
* @deprecated Instead use setFlowConfig
*
* @param \PayPal\Api\FlowConfig $flow_config
* @return $this
*/
public function setFlow_config($flow_config)
{
$this->flow_config = $flow_config;
return $this;
}
/** /**
* Parameters for flow configuration.
* @deprecated Instead use getFlowConfig
* *
* @param Presentation $presentation * @return \PayPal\Api\FlowConfig
*/ */
public function setPresentation($presentation) { public function getFlow_config()
{
return $this->flow_config;
}
/**
* Parameters for input fields customization.
*
*
* @param \PayPal\Api\InputFields $input_fields
*
* @return $this
*/
public function setInputFields($input_fields)
{
$this->input_fields = $input_fields;
return $this;
}
/**
* Parameters for input fields customization.
*
* @return \PayPal\Api\InputFields
*/
public function getInputFields()
{
return $this->input_fields;
}
/**
* Parameters for input fields customization.
*
* @deprecated Instead use setInputFields
*
* @param \PayPal\Api\InputFields $input_fields
* @return $this
*/
public function setInput_fields($input_fields)
{
$this->input_fields = $input_fields;
return $this;
}
/**
* Parameters for input fields customization.
* @deprecated Instead use getInputFields
*
* @return \PayPal\Api\InputFields
*/
public function getInput_fields()
{
return $this->input_fields;
}
/**
* Parameters for style and presentation.
*
*
* @param \PayPal\Api\Presentation $presentation
*
* @return $this
*/
public function setPresentation($presentation)
{
$this->presentation = $presentation; $this->presentation = $presentation;
return $this; return $this;
} }
/** /**
* Parameters for style and presentation.
* *
* @return Presentation * @return \PayPal\Api\Presentation
*/ */
public function getPresentation() { public function getPresentation()
{
return $this->presentation; return $this->presentation;
} }
/** /**
* Create * Create a web experience profile by passing the name of the profile and other profile details in the request JSON to the request URI.
* *
* @param \PayPal\Rest\ApiContext|null $apiContext * @param \PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
* * @return CreateProfileResponse
* @return $this
*/ */
public function create($apiContext = null) public function create($apiContext = null)
{ {
$payLoad = $this->toJSON(); $payLoad = $this->toJSON();
if ($apiContext == null) { if ($apiContext == null) {
$apiContext = new ApiContext(self::$credential); $apiContext = new ApiContext(self::$credential);
} }
$call = new PPRestCall($apiContext); $call = new PPRestCall($apiContext);
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payment-experience/web-profiles", "POST", $payLoad); $json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payment-experience/web-profiles/", "POST", $payLoad);
$this->fromJson($json); $ret = new CreateProfileResponse();
$ret->fromJson($json);
return $this; return $ret;
} }
/**
* Update a web experience profile by passing the ID of the profile to the request URI. In addition, pass the profile details in the request JSON. If your request does not include values for all profile detail fields, the previously set values for the omitted fields are removed by this operation.
*
* @param \PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
* @return bool
*/
public function update($apiContext = null) public function update($apiContext = null)
{ {
ArgumentValidator::validate($this->getId(), "Id");
$payLoad = $this->toJSON(); $payLoad = $this->toJSON();
if ($apiContext == null) {
$apiContext = new ApiContext(self::$credential);
}
$call = new PPRestCall($apiContext);
$call->execute(array('PayPal\Rest\RestHandler'), "/v1/payment-experience/web-profiles/".$this->getId(), "PUT", $payLoad);
return true;
}
/*
* Delete WebProfile resource for the given identifier.
*
* @param PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
* @return void
*/
public function delete($apiContext = null) {
if ($this->getId() == null) {
throw new \InvalidArgumentException("Id cannot be null");
}
$payLoad = "";
if ($apiContext == null) { if ($apiContext == null) {
$apiContext = new ApiContext(self::$credential); $apiContext = new ApiContext(self::$credential);
} }
$call = new PPRestCall($apiContext); $call = new PPRestCall($apiContext);
$call->execute(array('PayPal\Rest\RestHandler'), "/v1/payment-experience/web-profiles/{$this->getId()}", "DELETE", $payLoad); $json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payment-experience/web-profiles/{$this->getId()}", "PUT", $payLoad);
return true; return true;
} }
/** /**
* Get all webProfiles of a merchant. * Partially update an existing web experience profile by passing the ID of the profile to the request URI. In addition, pass a patch object in the request JSON that specifies the operation to perform, path of the profile location to update, and a new value if needed to complete the operation.
* *
* @param \PayPal\Rest\ApiContext|null $apiContext * @param Patch[] $patch
* * @param \PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
* @return WebProfiles * @return bool
*/ */
public static function get_all($apiContext = null) public function partial_update($patch, $apiContext = null)
{ {
$payLoad = ""; ArgumentValidator::validate($this->getId(), "Id");
ArgumentValidator::validate($patch, 'patch');
foreach ($patch as $patchObject) {
$payload[] = $patchObject->toArray();
}
$payLoad = json_encode($payload);
if ($apiContext == null) { if ($apiContext == null) {
$apiContext = new ApiContext(self::$credential); $apiContext = new ApiContext(self::$credential);
} }
$call = new PPRestCall($apiContext); $call = new PPRestCall($apiContext);
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payment-experience/web-profiles", "GET", $payLoad); $json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payment-experience/web-profiles/{$this->getId()}", "PATCH", $payLoad);
$json = '{"web_profiles":'.$json.'}'; return true;
$ret = new WebProfiles();
$ret->fromJson($json);
return $ret;
} }
/**
* Retrieve the details of a particular web experience profile by passing the ID of the profile to the request URI.
*
* @param string $profileId
* @param \PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
* @return WebProfile
*/
public static function get($profileId, $apiContext = null)
{
ArgumentValidator::validate($profileId, 'profileId');
$payLoad = "";
if ($apiContext == null) {
$apiContext = new ApiContext(self::$credential);
}
$call = new PPRestCall($apiContext);
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payment-experience/web-profiles/$profileId", "GET", $payLoad);
$ret = new WebProfile();
$ret->fromJson($json);
return $ret;
}
/**
* Lists all web experience profiles that exist for a merchant (or subject).
*
* @param \PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
* @return WebProfile[]
*/
public static function get_list($apiContext = null)
{
$payLoad = "";
if ($apiContext == null) {
$apiContext = new ApiContext(self::$credential);
}
$call = new PPRestCall($apiContext);
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payment-experience/web-profiles/", "GET", $payLoad);
return WebProfile::getList($json);
}
/**
* Delete an existing web experience profile by passing the profile ID to the request URI.
*
* @param \PayPal\Rest\ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
* @return bool
*/
public function delete($apiContext = null)
{
ArgumentValidator::validate($this->getId(), "Id");
$payLoad = "";
if ($apiContext == null) {
$apiContext = new ApiContext(self::$credential);
}
$call = new PPRestCall($apiContext);
$json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payment-experience/web-profiles/{$this->getId()}", "DELETE", $payLoad);
return true;
}
} }

View File

@@ -1,37 +0,0 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PPModel;
use PayPal\Rest\ApiContext;
/**
* Class WebProfiles
*
* @property array|\PayPal\Api\WebProfile $web_profiles
*/
class WebProfiles extends PPModel {
/**
* List of WebProfiles belonging to a merchant.
*
* @param array|\PayPal\Api\WebProfile $web_profiles
*/
public function setWebProfiles($web_profiles) {
$this->web_profiles = $web_profiles;
return $this;
}
/**
* List of web profiles belonging to a merchant.
*
* @return \PayPal\Api\WebProfile
*/
public function getWebProfiles() {
return $this->web_profiles;
}
}

View File

@@ -1,6 +1,7 @@
<?php <?php
namespace PayPal\Common; namespace PayPal\Common;
use PayPal\Validation\JsonValidator;
use PayPal\Validation\ModelAccessorValidator; use PayPal\Validation\ModelAccessorValidator;
/** /**
@@ -28,9 +29,7 @@ class PPModel
case "NULL": case "NULL":
break; break;
case "string": case "string":
if (!$this->isJson($data)) { JsonValidator::validate($data);
throw new \InvalidArgumentException("data should be either json or array representation of object");
}
$this->fromJson($data); $this->fromJson($data);
break; break;
case "array": case "array":
@@ -41,15 +40,28 @@ class PPModel
} }
/** /**
* Tests if the string provided is json representation or not. * Returns a list of Object from Array or Json String. It is generally used when you json
* contains an array of this object
* *
* @param $string * @param mixed $data Array object or json string representation
* @return bool * @return array
*/ */
private function isJson($string) public static function getList($data)
{ {
json_decode($string); if (!is_array($data) && JsonValidator::validate($data)) {
return (json_last_error() == JSON_ERROR_NONE); //Convert to Array if Json Data Sent
$data = json_decode($data, true);
}
if (!PPArrayUtil::isAssocArray($data)) {
$list = array();
//This means, root element is array
foreach ($data as $k => $v) {
$obj = new static;
$obj->fromArray($v);
$list[] = $obj;
}
return $list;
}
} }
/** /**
@@ -139,16 +151,14 @@ class PPModel
*/ */
public function fromArray($arr) public function fromArray($arr)
{ {
foreach ($arr as $k => $v) { foreach ($arr as $k => $v) {
if (is_array($v)) { if (is_array($v)) {
$clazz = PPReflectionUtil::getPropertyClass(get_class($this), $k); $clazz = PPReflectionUtil::getPropertyClass(get_class($this), $k);
if (PPArrayUtil::isAssocArray($v)) { if (PPArrayUtil::isAssocArray($v)) {
/** @var self $o */ /** @var self $o */
$o = new $clazz(); $o = new $clazz();
$o->fromArray($v); $o->fromArray($v);
$this->__set($k, $o); $this->setValue($k, $o);
} else { } else {
$arr = array(); $arr = array();
foreach ($v as $nk => $nv) { foreach ($v as $nk => $nv) {
@@ -160,15 +170,25 @@ class PPModel
$arr[$nk] = $nv; $arr[$nk] = $nv;
} }
} }
$this->__set($k, $arr); $this->setValue($k, $arr);
} }
} else { } else {
$this->$k = $v; $this->$k = $v;
} }
} }
return $this; return $this;
} }
private function setValue($key, $value)
{
if (ModelAccessorValidator::validate($this, $this->convertToCamelCase($key))) {
$setter = "set" . $this->convertToCamelCase($key);
$this->$setter($value);
} else {
$this->__set($key, $value);
}
}
/** /**
* Fills object value from Json string * Fills object value from Json string
* *
@@ -200,4 +220,4 @@ class PPModel
{ {
return json_encode($this->toArray(), $options); return json_encode($this->toArray(), $options);
} }
} }

View File

@@ -151,7 +151,8 @@ class PPCredentialManager
} }
if (empty($credObj)) { if (empty($credObj)) {
throw new PPInvalidCredentialException("Invalid userId $userId"); throw new PPInvalidCredentialException("Credential not found for " . ($userId ? $userId : " default user") .
". Please make sure your configuration/APIContext has credential information");
} }
return $credObj; return $credObj;
} }

View File

@@ -88,7 +88,6 @@ class PPHttpConnection
curl_setopt($ch, CURLOPT_URL, $this->httpConfig->getUrl()); curl_setopt($ch, CURLOPT_URL, $this->httpConfig->getUrl());
curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, $this->getHttpHeaders()); curl_setopt($ch, CURLOPT_HTTPHEADER, $this->getHttpHeaders());
//Determine Curl Options based on Method //Determine Curl Options based on Method
switch ($this->httpConfig->getMethod()) { switch ($this->httpConfig->getMethod()) {
case 'POST': case 'POST':
@@ -101,6 +100,7 @@ class PPHttpConnection
//Default Option if Method not of given types in switch case //Default Option if Method not of given types in switch case
if ($this->httpConfig->getMethod() != NULL) { if ($this->httpConfig->getMethod() != NULL) {
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $this->httpConfig->getMethod()); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $this->httpConfig->getMethod());
$this->logger->info("Method : " . $this->httpConfig->getMethod());
} }
//Logging Each Headers for debugging purposes //Logging Each Headers for debugging purposes
@@ -142,10 +142,8 @@ class PPHttpConnection
curl_close($ch); curl_close($ch);
throw $ex; throw $ex;
} }
//Close the curl request //Close the curl request
curl_close($ch); curl_close($ch);
//More Exceptions based on HttpStatus Code //More Exceptions based on HttpStatus Code
if (in_array($httpStatus, self::$retryCodes)) { if (in_array($httpStatus, self::$retryCodes)) {
$ex = new PPConnectionException( $ex = new PPConnectionException(
@@ -158,7 +156,8 @@ class PPHttpConnection
} else if ($httpStatus < 200 || $httpStatus >= 300) { } else if ($httpStatus < 200 || $httpStatus >= 300) {
$ex = new PPConnectionException( $ex = new PPConnectionException(
$this->httpConfig->getUrl(), $this->httpConfig->getUrl(),
"Got Http response code $httpStatus when accessing {$this->httpConfig->getUrl()}." "Got Http response code $httpStatus when accessing {$this->httpConfig->getUrl()}.",
$httpStatus
); );
$ex->setData($result); $ex->setData($result);
throw $ex; throw $ex;

View File

@@ -0,0 +1,28 @@
<?php
namespace PayPal\Validation;
/**
* Class JsonValidator
*
* @package PayPal\Validation
*/
class JsonValidator
{
/**
* Helper method for validating if string provided is a valid json.
*
* @param string $string String representation of Json object
* @return bool
*/
public static function validate($string)
{
json_decode($string);
if (json_last_error() != JSON_ERROR_NONE) {
//Throw an Exception for string or array
throw new \InvalidArgumentException("Invalid JSON String");
}
return true;
}
}

View File

@@ -1,6 +1,10 @@
PayPal PHP SDK release notes PayPal PHP SDK release notes
============================ ============================
v0.13.0
----
* Enabled Payment Experience
v0.12.0 v0.12.0
---- ----
* Enabled EC Parameters Support for Payment APIs * Enabled EC Parameters Support for Payment APIs

View File

@@ -1,79 +1,79 @@
<?php <?php
/* /*
* Sample bootstrap file. * Sample bootstrap file.
*/ */
// Include the composer autoloader // Include the composer autoloader
// The location of your project's vendor autoloader. // The location of your project's vendor autoloader.
$composerAutoload = dirname(dirname(dirname(__DIR__))) . '/autoload.php'; $composerAutoload = dirname(dirname(dirname(__DIR__))) . '/autoload.php';
if (!file_exists($composerAutoload)) { if (!file_exists($composerAutoload)) {
//If the project is used as its own project, it would use rest-api-sdk-php composer autoloader. //If the project is used as its own project, it would use rest-api-sdk-php composer autoloader.
$composerAutoload = dirname(__DIR__) . '/vendor/autoload.php'; $composerAutoload = dirname(__DIR__) . '/vendor/autoload.php';
if (!file_exists($composerAutoload)) { if (!file_exists($composerAutoload)) {
echo "The 'vendor' folder is missing. You must run 'composer update' to resolve application dependencies.\nPlease see the README for more information.\n"; echo "The 'vendor' folder is missing. You must run 'composer update' to resolve application dependencies.\nPlease see the README for more information.\n";
exit(1); exit(1);
} }
} }
require $composerAutoload; require $composerAutoload;
require __DIR__ . '/common.php'; require __DIR__ . '/common.php';
use PayPal\Rest\ApiContext; use PayPal\Rest\ApiContext;
use PayPal\Auth\OAuthTokenCredential; use PayPal\Auth\OAuthTokenCredential;
error_reporting(E_ALL); error_reporting(E_ALL);
/** @var \Paypal\Rest\ApiContext $apiContext */ /** @var \Paypal\Rest\ApiContext $apiContext */
$apiContext = getApiContext(); $apiContext = getApiContext();
return $apiContext;
/** /**
* Helper method for getting an APIContext for all calls * Helper method for getting an APIContext for all calls
* *
* @return PayPal\Rest\ApiContext * @return PayPal\Rest\ApiContext
*/ */
function getApiContext() function getApiContext()
{ {
// ### Api context // ### Api context
// Use an ApiContext object to authenticate // Use an ApiContext object to authenticate
// API calls. The clientId and clientSecret for the // API calls. The clientId and clientSecret for the
// OAuthTokenCredential class can be retrieved from // OAuthTokenCredential class can be retrieved from
// developer.paypal.com // developer.paypal.com
$apiContext = new ApiContext( $apiContext = new ApiContext(
new OAuthTokenCredential( new OAuthTokenCredential(
'EBWKjlELKMYqRNQ6sYvFo64FtaRLRR5BdHEESmha49TM', 'EBWKjlELKMYqRNQ6sYvFo64FtaRLRR5BdHEESmha49TM',
'EO422dn3gQLgDbuwqTjzrFgFtaRLRR5BdHEESmha49TM' 'EO422dn3gQLgDbuwqTjzrFgFtaRLRR5BdHEESmha49TM'
) )
); );
// #### SDK configuration // #### SDK configuration
// Comment this line out and uncomment the PP_CONFIG_PATH // Comment this line out and uncomment the PP_CONFIG_PATH
// 'define' block if you want to use static file // 'define' block if you want to use static file
// based configuration // based configuration
$apiContext->setConfig( $apiContext->setConfig(
array( array(
'mode' => 'sandbox', 'mode' => 'sandbox',
'http.ConnectionTimeOut' => 30, 'http.ConnectionTimeOut' => 30,
'log.LogEnabled' => true, 'log.LogEnabled' => true,
'log.FileName' => '../PayPal.log', 'log.FileName' => '../PayPal.log',
'log.LogLevel' => 'FINE', 'log.LogLevel' => 'FINE',
'validation.level' => 'log' 'validation.level' => 'log'
) )
); );
/* /*
// Register the sdk_config.ini file in current directory // Register the sdk_config.ini file in current directory
// as the configuration source. // as the configuration source.
if(!defined("PP_CONFIG_PATH")) { if(!defined("PP_CONFIG_PATH")) {
define("PP_CONFIG_PATH", __DIR__); define("PP_CONFIG_PATH", __DIR__);
} }
*/ */
return $apiContext; return $apiContext;
} }

View File

@@ -13,26 +13,48 @@ use PayPal\Api\Transaction;
use PayPal\Api\FundingInstrument; use PayPal\Api\FundingInstrument;
function print_result($title, $objectName, $objectId = null, $output = null)
{
echo "<h3>$title</h3>";
if ($objectId) {
echo "<div> Created " . ($objectName ? $objectName : "Object") . " with ID: $objectId</div>";
}
if ($output) {
if (is_a($output, 'PayPal\Common\PPModel')) {
/** @var $output \PayPal\Common\PPModel */
echo "<pre>" . $output->toJSON(JSON_PRETTY_PRINT) . "</pre>";
} elseif (is_string($output)) {
echo "<pre>$output</pre>";
}
}
echo "<hr />";
}
/** /**
* ### getBaseUrl function * ### getBaseUrl function
* // utility function that returns base url for * // utility function that returns base url for
* // determining return/cancel urls * // determining return/cancel urls
*
* @return string * @return string
*/ */
function getBaseUrl() { function getBaseUrl()
{
$protocol = 'http'; $protocol = 'http';
if ($_SERVER['SERVER_PORT'] == 443 || (!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on')) { if ($_SERVER['SERVER_PORT'] == 443 || (!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on')) {
$protocol .= 's'; $protocol .= 's';
$protocol_port = $_SERVER['SERVER_PORT']; $protocol_port = $_SERVER['SERVER_PORT'];
} else { } else {
$protocol_port = 80; $protocol_port = 80;
} }
$host = $_SERVER['HTTP_HOST']; $host = $_SERVER['HTTP_HOST'];
$port = $_SERVER['SERVER_PORT']; $port = $_SERVER['SERVER_PORT'];
$request = $_SERVER['PHP_SELF']; $request = $_SERVER['PHP_SELF'];
return dirname($protocol . '://' . $host . ($port == $protocol_port ? '' : ':' . $port) . $request); return dirname($protocol . '://' . $host . ($port == $protocol_port ? '' : ':' . $port) . $request);
} }
/** /**
@@ -41,51 +63,52 @@ function getBaseUrl() {
* @param PayPal\Api\ApiContext apiContext * @param PayPal\Api\ApiContext apiContext
* @return PayPal\Api\Authorization * @return PayPal\Api\Authorization
*/ */
function createAuthorization($apiContext) { function createAuthorization($apiContext)
$addr = new Address(); {
$addr->setLine1("3909 Witmer Road") $addr = new Address();
->setLine2("Niagara Falls") $addr->setLine1("3909 Witmer Road")
->setCity("Niagara Falls") ->setLine2("Niagara Falls")
->setState("NY") ->setCity("Niagara Falls")
->setPostalCode("14305") ->setState("NY")
->setCountryCode("US") ->setPostalCode("14305")
->setPhone("716-298-1822"); ->setCountryCode("US")
->setPhone("716-298-1822");
$card = new CreditCard();
$card->setType("visa")
->setNumber("4417119669820331")
->setExpireMonth("11")
->setExpireYear("2019")
->setCvv2("012")
->setFirstName("Joe")
->setLastName("Shopper")
->setBillingAddress($addr);
$fi = new FundingInstrument();
$fi->setCreditCard($card);
$payer = new Payer();
$payer->setPaymentMethod("credit_card")
->setFundingInstruments(array($fi));
$amount = new Amount();
$amount->setCurrency("USD")
->setTotal("1.00");
$transaction = new Transaction();
$transaction->setAmount($amount)
->setDescription("Payment description.");
$payment = new Payment();
// Setting intent to authorize creates a payment $card = new CreditCard();
// authorization. Setting it to sale creates actual payment $card->setType("visa")
$payment->setIntent("authorize") ->setNumber("4417119669820331")
->setPayer($payer) ->setExpireMonth("11")
->setTransactions(array($transaction)); ->setExpireYear("2019")
->setCvv2("012")
$paymnt = $payment->create($apiContext); ->setFirstName("Joe")
$resArray = $paymnt->toArray(); ->setLastName("Shopper")
->setBillingAddress($addr);
return $authId = $resArray['transactions'][0]['related_resources'][0]['authorization']['id'];
$fi = new FundingInstrument();
$fi->setCreditCard($card);
$payer = new Payer();
$payer->setPaymentMethod("credit_card")
->setFundingInstruments(array($fi));
$amount = new Amount();
$amount->setCurrency("USD")
->setTotal("1.00");
$transaction = new Transaction();
$transaction->setAmount($amount)
->setDescription("Payment description.");
$payment = new Payment();
// Setting intent to authorize creates a payment
// authorization. Setting it to sale creates actual payment
$payment->setIntent("authorize")
->setPayer($payer)
->setTransactions(array($transaction));
$paymnt = $payment->create($apiContext);
$resArray = $paymnt->toArray();
return $authId = $resArray['transactions'][0]['related_resources'][0]['authorization']['id'];
} }

View File

@@ -25,7 +25,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
"name": "PHP" "name": "PHP"
}, },
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/invoice/CancelInvoice.php", "sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/invoice/CancelInvoice.php",
"projectPath": "sample/invoice/CancelInvoice.php", "projectPath": "invoice/CancelInvoice.php",
"targetPath": "invoice/CancelInvoice", "targetPath": "invoice/CancelInvoice",
"pageTitle": "invoice/CancelInvoice", "pageTitle": "invoice/CancelInvoice",
"title": "CancelInvoice" "title": "CancelInvoice"
@@ -81,7 +81,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
"name": "PHP" "name": "PHP"
}, },
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/invoice/CreateInvoice.php", "sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/invoice/CreateInvoice.php",
"projectPath": "sample/invoice/CreateInvoice.php", "projectPath": "invoice/CreateInvoice.php",
"targetPath": "invoice/CreateInvoice", "targetPath": "invoice/CreateInvoice",
"pageTitle": "invoice/CreateInvoice", "pageTitle": "invoice/CreateInvoice",
"title": "CreateInvoice" "title": "CreateInvoice"
@@ -169,7 +169,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
"name": "PHP" "name": "PHP"
}, },
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/invoice/GetInvoice.php", "sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/invoice/GetInvoice.php",
"projectPath": "sample/invoice/GetInvoice.php", "projectPath": "invoice/GetInvoice.php",
"targetPath": "invoice/GetInvoice", "targetPath": "invoice/GetInvoice",
"pageTitle": "invoice/GetInvoice", "pageTitle": "invoice/GetInvoice",
"title": "GetInvoice" "title": "GetInvoice"
@@ -209,7 +209,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
"name": "PHP" "name": "PHP"
}, },
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/invoice/ListInvoice.php", "sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/invoice/ListInvoice.php",
"projectPath": "sample/invoice/ListInvoice.php", "projectPath": "invoice/ListInvoice.php",
"targetPath": "invoice/ListInvoice", "targetPath": "invoice/ListInvoice",
"pageTitle": "invoice/ListInvoice", "pageTitle": "invoice/ListInvoice",
"title": "ListInvoice" "title": "ListInvoice"
@@ -249,7 +249,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
"name": "PHP" "name": "PHP"
}, },
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/invoice/RemindInvoice.php", "sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/invoice/RemindInvoice.php",
"projectPath": "sample/invoice/RemindInvoice.php", "projectPath": "invoice/RemindInvoice.php",
"targetPath": "invoice/RemindInvoice", "targetPath": "invoice/RemindInvoice",
"pageTitle": "invoice/RemindInvoice", "pageTitle": "invoice/RemindInvoice",
"title": "RemindInvoice" "title": "RemindInvoice"
@@ -305,7 +305,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
"name": "PHP" "name": "PHP"
}, },
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/invoice/SendInvoice.php", "sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/invoice/SendInvoice.php",
"projectPath": "sample/invoice/SendInvoice.php", "projectPath": "invoice/SendInvoice.php",
"targetPath": "invoice/SendInvoice", "targetPath": "invoice/SendInvoice",
"pageTitle": "invoice/SendInvoice", "pageTitle": "invoice/SendInvoice",
"title": "SendInvoice" "title": "SendInvoice"
@@ -343,6 +343,209 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
] ]
} }
] ]
}, {
"type": "folder",
"data": {
"path": "payment-experience",
"title": "payment-experience"
},
"depth": 1,
"children": [
{
"type": "file",
"data": {
"language": {
"nameMatchers": [{}, ".fbp"],
"pygmentsLexer": "php",
"singleLineComment": ["//"],
"ignorePrefix": "}",
"foldPrefix": "^",
"name": "PHP"
},
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/payment-experience/CreateWebProfile.php",
"projectPath": "payment-experience/CreateWebProfile.php",
"targetPath": "payment-experience/CreateWebProfile",
"pageTitle": "payment-experience/CreateWebProfile",
"title": "CreateWebProfile"
},
"depth": 2,
"outline": [
{
"type": "heading",
"data": {
"level": 3,
"title": "Create Web Profile",
"slug": "create-web-profile"
},
"depth": 3,
"children": [
{
"type": "heading",
"data": {
"level": 4,
"title": "Payment Web experience profile resource",
"slug": "payment-web-experience-profile-resource"
},
"depth": 4
}
]
}
]
}, {
"type": "file",
"data": {
"language": {
"nameMatchers": [{}, ".fbp"],
"pygmentsLexer": "php",
"singleLineComment": ["//"],
"ignorePrefix": "}",
"foldPrefix": "^",
"name": "PHP"
},
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/payment-experience/DeleteWebProfile.php",
"projectPath": "payment-experience/DeleteWebProfile.php",
"targetPath": "payment-experience/DeleteWebProfile",
"pageTitle": "payment-experience/DeleteWebProfile",
"title": "DeleteWebProfile"
},
"depth": 2,
"outline": [
{
"type": "heading",
"data": {
"level": 4,
"title": "Delete Web Profile",
"slug": "delete-web-profile"
},
"depth": 4
}
]
}, {
"type": "file",
"data": {
"language": {
"nameMatchers": [{}, ".fbp"],
"pygmentsLexer": "php",
"singleLineComment": ["//"],
"ignorePrefix": "}",
"foldPrefix": "^",
"name": "PHP"
},
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/payment-experience/GetWebProfile.php",
"projectPath": "payment-experience/GetWebProfile.php",
"targetPath": "payment-experience/GetWebProfile",
"pageTitle": "payment-experience/GetWebProfile",
"title": "GetWebProfile"
},
"depth": 2,
"outline": [
{
"type": "heading",
"data": {
"level": 3,
"title": "Get Web Profile",
"slug": "get-web-profile"
},
"depth": 3
}
]
}, {
"type": "file",
"data": {
"language": {
"nameMatchers": [{}, ".fbp"],
"pygmentsLexer": "php",
"singleLineComment": ["//"],
"ignorePrefix": "}",
"foldPrefix": "^",
"name": "PHP"
},
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/payment-experience/ListWebProfiles.php",
"projectPath": "payment-experience/ListWebProfiles.php",
"targetPath": "payment-experience/ListWebProfiles",
"pageTitle": "payment-experience/ListWebProfiles",
"title": "ListWebProfiles"
},
"depth": 2,
"outline": [
{
"type": "heading",
"data": {
"level": 3,
"title": "Retrieve List of All Web Profiles",
"slug": "retrieve-list-of-all-web-profiles"
},
"depth": 3
}
]
}, {
"type": "file",
"data": {
"language": {
"nameMatchers": [{}, ".fbp"],
"pygmentsLexer": "php",
"singleLineComment": ["//"],
"ignorePrefix": "}",
"foldPrefix": "^",
"name": "PHP"
},
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/payment-experience/PartiallyUpdateWebProfile.php",
"projectPath": "payment-experience/PartiallyUpdateWebProfile.php",
"targetPath": "payment-experience/PartiallyUpdateWebProfile",
"pageTitle": "payment-experience/PartiallyUpdateWebProfile",
"title": "PartiallyUpdateWebProfile"
},
"depth": 2,
"outline": [
{
"type": "heading",
"data": {
"level": 4,
"title": "Partially Update Web Profile",
"slug": "partially-update-web-profile"
},
"depth": 4
}, {
"type": "heading",
"data": {
"level": 3,
"title": "Create Patch Operation",
"slug": "create-patch-operation"
},
"depth": 3
}
]
}, {
"type": "file",
"data": {
"language": {
"nameMatchers": [{}, ".fbp"],
"pygmentsLexer": "php",
"singleLineComment": ["//"],
"ignorePrefix": "}",
"foldPrefix": "^",
"name": "PHP"
},
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/payment-experience/UpdateWebProfile.php",
"projectPath": "payment-experience/UpdateWebProfile.php",
"targetPath": "payment-experience/UpdateWebProfile",
"pageTitle": "payment-experience/UpdateWebProfile",
"title": "UpdateWebProfile"
},
"depth": 2,
"outline": [
{
"type": "heading",
"data": {
"level": 4,
"title": "Update Web Profile",
"slug": "update-web-profile"
},
"depth": 4
}
]
}
]
}, { }, {
"type": "folder", "type": "folder",
"data": { "data": {
@@ -363,7 +566,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
"name": "PHP" "name": "PHP"
}, },
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/payments/AuthorizationCapture.php", "sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/payments/AuthorizationCapture.php",
"projectPath": "sample/payments/AuthorizationCapture.php", "projectPath": "payments/AuthorizationCapture.php",
"targetPath": "payments/AuthorizationCapture", "targetPath": "payments/AuthorizationCapture",
"pageTitle": "payments/AuthorizationCapture", "pageTitle": "payments/AuthorizationCapture",
"title": "AuthorizationCapture" "title": "AuthorizationCapture"
@@ -403,7 +606,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
"name": "PHP" "name": "PHP"
}, },
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/payments/CreateFuturePayment.php", "sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/payments/CreateFuturePayment.php",
"projectPath": "sample/payments/CreateFuturePayment.php", "projectPath": "payments/CreateFuturePayment.php",
"targetPath": "payments/CreateFuturePayment", "targetPath": "payments/CreateFuturePayment",
"pageTitle": "payments/CreateFuturePayment", "pageTitle": "payments/CreateFuturePayment",
"title": "CreateFuturePayment" "title": "CreateFuturePayment"
@@ -491,7 +694,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
"name": "PHP" "name": "PHP"
}, },
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/payments/CreatePayment.php", "sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/payments/CreatePayment.php",
"projectPath": "sample/payments/CreatePayment.php", "projectPath": "payments/CreatePayment.php",
"targetPath": "payments/CreatePayment", "targetPath": "payments/CreatePayment",
"pageTitle": "payments/CreatePayment", "pageTitle": "payments/CreatePayment",
"title": "CreatePayment" "title": "CreatePayment"
@@ -595,7 +798,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
"name": "PHP" "name": "PHP"
}, },
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/payments/CreatePaymentUsingPayPal.php", "sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/payments/CreatePaymentUsingPayPal.php",
"projectPath": "sample/payments/CreatePaymentUsingPayPal.php", "projectPath": "payments/CreatePaymentUsingPayPal.php",
"targetPath": "payments/CreatePaymentUsingPayPal", "targetPath": "payments/CreatePaymentUsingPayPal",
"pageTitle": "payments/CreatePaymentUsingPayPal", "pageTitle": "payments/CreatePaymentUsingPayPal",
"title": "CreatePaymentUsingPayPal" "title": "CreatePaymentUsingPayPal"
@@ -707,7 +910,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
"name": "PHP" "name": "PHP"
}, },
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/payments/CreatePaymentUsingSavedCard.php", "sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/payments/CreatePaymentUsingSavedCard.php",
"projectPath": "sample/payments/CreatePaymentUsingSavedCard.php", "projectPath": "payments/CreatePaymentUsingSavedCard.php",
"targetPath": "payments/CreatePaymentUsingSavedCard", "targetPath": "payments/CreatePaymentUsingSavedCard",
"pageTitle": "payments/CreatePaymentUsingSavedCard", "pageTitle": "payments/CreatePaymentUsingSavedCard",
"title": "CreatePaymentUsingSavedCard" "title": "CreatePaymentUsingSavedCard"
@@ -811,7 +1014,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
"name": "PHP" "name": "PHP"
}, },
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/payments/ExecutePayment.php", "sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/payments/ExecutePayment.php",
"projectPath": "sample/payments/ExecutePayment.php", "projectPath": "payments/ExecutePayment.php",
"targetPath": "payments/ExecutePayment", "targetPath": "payments/ExecutePayment",
"pageTitle": "payments/ExecutePayment", "pageTitle": "payments/ExecutePayment",
"title": "ExecutePayment" "title": "ExecutePayment"
@@ -840,7 +1043,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
"name": "PHP" "name": "PHP"
}, },
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/payments/GetAuthorization.php", "sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/payments/GetAuthorization.php",
"projectPath": "sample/payments/GetAuthorization.php", "projectPath": "payments/GetAuthorization.php",
"targetPath": "payments/GetAuthorization", "targetPath": "payments/GetAuthorization",
"pageTitle": "payments/GetAuthorization", "pageTitle": "payments/GetAuthorization",
"title": "GetAuthorization" "title": "GetAuthorization"
@@ -880,7 +1083,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
"name": "PHP" "name": "PHP"
}, },
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/payments/GetCapture.php", "sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/payments/GetCapture.php",
"projectPath": "sample/payments/GetCapture.php", "projectPath": "payments/GetCapture.php",
"targetPath": "payments/GetCapture", "targetPath": "payments/GetCapture",
"pageTitle": "payments/GetCapture", "pageTitle": "payments/GetCapture",
"title": "GetCapture" "title": "GetCapture"
@@ -928,7 +1131,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
"name": "PHP" "name": "PHP"
}, },
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/payments/GetPayment.php", "sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/payments/GetPayment.php",
"projectPath": "sample/payments/GetPayment.php", "projectPath": "payments/GetPayment.php",
"targetPath": "payments/GetPayment", "targetPath": "payments/GetPayment",
"pageTitle": "payments/GetPayment", "pageTitle": "payments/GetPayment",
"title": "GetPayment" "title": "GetPayment"
@@ -968,7 +1171,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
"name": "PHP" "name": "PHP"
}, },
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/payments/ListPayments.php", "sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/payments/ListPayments.php",
"projectPath": "sample/payments/ListPayments.php", "projectPath": "payments/ListPayments.php",
"targetPath": "payments/ListPayments", "targetPath": "payments/ListPayments",
"pageTitle": "payments/ListPayments", "pageTitle": "payments/ListPayments",
"title": "ListPayments" "title": "ListPayments"
@@ -1008,7 +1211,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
"name": "PHP" "name": "PHP"
}, },
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/payments/Reauthorization.php", "sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/payments/Reauthorization.php",
"projectPath": "sample/payments/Reauthorization.php", "projectPath": "payments/Reauthorization.php",
"targetPath": "payments/Reauthorization", "targetPath": "payments/Reauthorization",
"pageTitle": "payments/Reauthorization", "pageTitle": "payments/Reauthorization",
"title": "Reauthorization" "title": "Reauthorization"
@@ -1064,7 +1267,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
"name": "PHP" "name": "PHP"
}, },
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/payments/RefundCapture.php", "sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/payments/RefundCapture.php",
"projectPath": "sample/payments/RefundCapture.php", "projectPath": "payments/RefundCapture.php",
"targetPath": "payments/RefundCapture", "targetPath": "payments/RefundCapture",
"pageTitle": "payments/RefundCapture", "pageTitle": "payments/RefundCapture",
"title": "RefundCapture" "title": "RefundCapture"
@@ -1112,7 +1315,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
"name": "PHP" "name": "PHP"
}, },
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/payments/VoidAuthorization.php", "sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/payments/VoidAuthorization.php",
"projectPath": "sample/payments/VoidAuthorization.php", "projectPath": "payments/VoidAuthorization.php",
"targetPath": "payments/VoidAuthorization", "targetPath": "payments/VoidAuthorization",
"pageTitle": "payments/VoidAuthorization", "pageTitle": "payments/VoidAuthorization",
"title": "VoidAuthorization" "title": "VoidAuthorization"
@@ -1162,7 +1365,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
"name": "PHP" "name": "PHP"
}, },
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/sale/GetSale.php", "sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/sale/GetSale.php",
"projectPath": "sample/sale/GetSale.php", "projectPath": "sale/GetSale.php",
"targetPath": "sale/GetSale", "targetPath": "sale/GetSale",
"pageTitle": "sale/GetSale", "pageTitle": "sale/GetSale",
"title": "GetSale" "title": "GetSale"
@@ -1202,7 +1405,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
"name": "PHP" "name": "PHP"
}, },
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/sale/RefundSale.php", "sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/sale/RefundSale.php",
"projectPath": "sample/sale/RefundSale.php", "projectPath": "sale/RefundSale.php",
"targetPath": "sale/RefundSale", "targetPath": "sale/RefundSale",
"pageTitle": "sale/RefundSale", "pageTitle": "sale/RefundSale",
"title": "RefundSale" "title": "RefundSale"
@@ -1268,7 +1471,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
"name": "PHP" "name": "PHP"
}, },
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/vault/CreateCreditCard.php", "sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/vault/CreateCreditCard.php",
"projectPath": "sample/vault/CreateCreditCard.php", "projectPath": "vault/CreateCreditCard.php",
"targetPath": "vault/CreateCreditCard", "targetPath": "vault/CreateCreditCard",
"pageTitle": "vault/CreateCreditCard", "pageTitle": "vault/CreateCreditCard",
"title": "CreateCreditCard" "title": "CreateCreditCard"
@@ -1316,7 +1519,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
"name": "PHP" "name": "PHP"
}, },
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/vault/DeleteCreditCard.php", "sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/vault/DeleteCreditCard.php",
"projectPath": "sample/vault/DeleteCreditCard.php", "projectPath": "vault/DeleteCreditCard.php",
"targetPath": "vault/DeleteCreditCard", "targetPath": "vault/DeleteCreditCard",
"pageTitle": "vault/DeleteCreditCard", "pageTitle": "vault/DeleteCreditCard",
"title": "DeleteCreditCard" "title": "DeleteCreditCard"
@@ -1372,7 +1575,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3
"name": "PHP" "name": "PHP"
}, },
"sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/vault/GetCreditCard.php", "sourcePath": "/Users/japatel/Documents/workspace/Server-SDK/rest-api-sdk-php/sample/vault/GetCreditCard.php",
"projectPath": "sample/vault/GetCreditCard.php", "projectPath": "vault/GetCreditCard.php",
"targetPath": "vault/GetCreditCard", "targetPath": "vault/GetCreditCard",
"pageTitle": "vault/GetCreditCard", "pageTitle": "vault/GetCreditCard",
"title": "GetCreditCard" "title": "GetCreditCard"

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><title>invoice/CancelInvoice</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="invoice/CancelInvoice"><meta name="groc-project-path" content="sample/invoice/CancelInvoice.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/invoice/CancelInvoice.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="cancel-invoice-sample">Cancel Invoice Sample</h1> <!DOCTYPE html><html lang="en"><head><title>invoice/CancelInvoice</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="invoice/CancelInvoice"><meta name="groc-project-path" content="invoice/CancelInvoice.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">invoice/CancelInvoice.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="cancel-invoice-sample">Cancel Invoice Sample</h1>
<p>This sample code demonstrate how you can cancel <p>This sample code demonstrate how you can cancel
an invoice.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>; an invoice.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><title>invoice/CreateInvoice</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="invoice/CreateInvoice"><meta name="groc-project-path" content="sample/invoice/CreateInvoice.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/invoice/CreateInvoice.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="create-invoice-sample">Create Invoice Sample</h1> <!DOCTYPE html><html lang="en"><head><title>invoice/CreateInvoice</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="invoice/CreateInvoice"><meta name="groc-project-path" content="invoice/CreateInvoice.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">invoice/CreateInvoice.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="create-invoice-sample">Create Invoice Sample</h1>
<p>This sample code demonstrate how you can create <p>This sample code demonstrate how you can create
an invoice.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>; an invoice.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Invoice</span>; <span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Invoice</span>;

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><title>invoice/GetInvoice</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="invoice/GetInvoice"><meta name="groc-project-path" content="sample/invoice/GetInvoice.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/invoice/GetInvoice.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="get-invoice-sample">Get Invoice Sample</h1> <!DOCTYPE html><html lang="en"><head><title>invoice/GetInvoice</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="invoice/GetInvoice"><meta name="groc-project-path" content="invoice/GetInvoice.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">invoice/GetInvoice.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="get-invoice-sample">Get Invoice Sample</h1>
<p>This sample code demonstrate how you can retrieve <p>This sample code demonstrate how you can retrieve
an invoice.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>; an invoice.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Invoice</span>; <span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Invoice</span>;

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><title>invoice/ListInvoice</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="invoice/ListInvoice"><meta name="groc-project-path" content="sample/invoice/ListInvoice.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/invoice/ListInvoice.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="list-invoices-sample">List Invoices Sample</h1> <!DOCTYPE html><html lang="en"><head><title>invoice/ListInvoice</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="invoice/ListInvoice"><meta name="groc-project-path" content="invoice/ListInvoice.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">invoice/ListInvoice.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="list-invoices-sample">List Invoices Sample</h1>
<p>This sample code demonstrate how you can get <p>This sample code demonstrate how you can get
all invoice from history.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>; all invoice from history.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Invoice</span>; <span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Invoice</span>;

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><title>invoice/RemindInvoice</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="invoice/RemindInvoice"><meta name="groc-project-path" content="sample/invoice/RemindInvoice.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/invoice/RemindInvoice.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="remind-invoice-sample">Remind Invoice Sample</h1> <!DOCTYPE html><html lang="en"><head><title>invoice/RemindInvoice</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="invoice/RemindInvoice"><meta name="groc-project-path" content="invoice/RemindInvoice.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">invoice/RemindInvoice.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="remind-invoice-sample">Remind Invoice Sample</h1>
<p>This sample code demonstrate how you can remind <p>This sample code demonstrate how you can remind
an invoice to the payer</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>; an invoice to the payer</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><title>invoice/SendInvoice</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="invoice/SendInvoice"><meta name="groc-project-path" content="sample/invoice/SendInvoice.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/invoice/SendInvoice.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="create-invoice-sample">Create Invoice Sample</h1> <!DOCTYPE html><html lang="en"><head><title>invoice/SendInvoice</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="invoice/SendInvoice"><meta name="groc-project-path" content="invoice/SendInvoice.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">invoice/SendInvoice.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="create-invoice-sample">Create Invoice Sample</h1>
<p>This sample code demonstrate how you can send <p>This sample code demonstrate how you can send
a legitimate invoice to the payer</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>; a legitimate invoice to the payer</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,20 @@
<!DOCTYPE html><html lang="en"><head><title>payment-experience/DeleteWebProfile</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payment-experience/DeleteWebProfile"><meta name="groc-project-path" content="payment-experience/DeleteWebProfile.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">payment-experience/DeleteWebProfile.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h4 id="delete-web-profile">Delete Web Profile</h4>
<p>Use this call to delete a web experience profile.
Documentation available at <a href="https://developer.paypal.com/webapps/developer/docs/api/#delete-a-web-experience-profile">https://developer.paypal.com/webapps/developer/docs/api/#delete-a-web-experience-profile</a></p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>We are going to re-use the sample code from CreateWebProfile.php.
If you have not visited the sample yet, please visit it before trying GetWebProfile.php
The CreateWebProfile.php will create a web profile for us, and return a CreateProfileResponse,
that contains the web profile ID.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> \PayPal\Api\CreateProfileResponse $result */</span>
<span class="hljs-variable">$createProfileResponse</span> = <span class="hljs-keyword">require_once</span> <span class="hljs-string">'CreateWebProfile.php'</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Create a new instance of web Profile ID, and set the ID.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$webProfile</span> = <span class="hljs-keyword">new</span> \PayPal\Api\WebProfile();
<span class="hljs-variable">$webProfile</span>-&gt;setId(<span class="hljs-variable">$createProfileResponse</span>-&gt;getId());
<span class="hljs-keyword">try</span> {</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Execute the delete method</p></div></div><div class="code"><div class="wrapper"> <span class="hljs-variable">$webProfile</span>-&gt;delete(<span class="hljs-variable">$apiContext</span>);
} <span class="hljs-keyword">catch</span> (\<span class="hljs-keyword">Exception</span> <span class="hljs-variable">$ex</span>) {
<span class="hljs-keyword">echo</span> <span class="hljs-string">"Exception: "</span> . <span class="hljs-variable">$ex</span>-&gt;getMessage() . PHP_EOL;
<span class="hljs-keyword">if</span> (is_a(<span class="hljs-variable">$ex</span>, <span class="hljs-string">'\PayPal\Exception\PPConnectionException'</span>)) {
<span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> $ex \PayPal\Exception\PPConnectionException */</span>
var_dump(<span class="hljs-variable">$ex</span>-&gt;getData());
}
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
}
print_result(<span class="hljs-string">"Deleted Web Profile"</span>, <span class="hljs-string">"Web Profile"</span>, <span class="hljs-variable">$createProfileResponse</span>-&gt;getId());</div></div></div></div></body></html>

View File

@@ -0,0 +1,21 @@
<!DOCTYPE html><html lang="en"><head><title>payment-experience/GetWebProfile</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payment-experience/GetWebProfile"><meta name="groc-project-path" content="payment-experience/GetWebProfile.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">payment-experience/GetWebProfile.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="get-web-profile">Get Web Profile</h3>
<p>If your request is successful, the API returns a web_profile object response that contains the profile details.
Documentation available at <a href="https://developer.paypal.com/webapps/developer/docs/api/#retrieve-a-web-experience-profile">https://developer.paypal.com/webapps/developer/docs/api/#retrieve-a-web-experience-profile</a></p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>We are going to re-use the sample code from CreateWebProfile.php.
If you have not visited the sample yet, please visit it before trying GetWebProfile.php
The CreateWebProfile.php will create a web profile for us, and return a CreateProfileResponse,
that contains the web profile ID.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> \PayPal\Api\CreateProfileResponse $result */</span>
<span class="hljs-variable">$createProfileResponse</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'CreateWebProfile.php'</span>;
<span class="hljs-keyword">try</span> {</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>If your request is successful, the API returns a web_profile object response that contains the profile details.</p></div></div><div class="code"><div class="wrapper"> <span class="hljs-variable">$webProfile</span> = \PayPal\Api\WebProfile::get(<span class="hljs-variable">$createProfileResponse</span>-&gt;getId(), <span class="hljs-variable">$apiContext</span>);
} <span class="hljs-keyword">catch</span> (\<span class="hljs-keyword">Exception</span> <span class="hljs-variable">$ex</span>) {
<span class="hljs-keyword">echo</span> <span class="hljs-string">"Exception: "</span> . <span class="hljs-variable">$ex</span>-&gt;getMessage() . PHP_EOL;
<span class="hljs-keyword">if</span> (is_a(<span class="hljs-variable">$ex</span>, <span class="hljs-string">'\PayPal\Exception\PPConnectionException'</span>)) {
<span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> $ex \PayPal\Exception\PPConnectionException */</span>
var_dump(<span class="hljs-variable">$ex</span>-&gt;getData());
}
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
}
print_result(<span class="hljs-string">"Get Web Profile"</span>, <span class="hljs-string">"Web Profile"</span>, <span class="hljs-variable">$webProfile</span>-&gt;getId(), <span class="hljs-variable">$webProfile</span>);
<span class="hljs-keyword">return</span> <span class="hljs-variable">$webProfile</span>;</div></div></div></div></body></html>

View File

@@ -0,0 +1,23 @@
<!DOCTYPE html><html lang="en"><head><title>payment-experience/ListWebProfiles</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payment-experience/ListWebProfiles"><meta name="groc-project-path" content="payment-experience/ListWebProfiles.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">payment-experience/ListWebProfiles.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span>
<span class="hljs-variable">$apiContext</span> = <span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="retrieve-list-of-all-web-profiles">Retrieve List of All Web Profiles</h3>
<p>Documentation available at <a href="https://developer.paypal.com/webapps/developer/docs/api/#list-web-experience-profiles">https://developer.paypal.com/webapps/developer/docs/api/#list-web-experience-profiles</a></p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Retrieve the list of all web profiles by calling the
static <code>get_list</code> method on the WebProfile class.
(See bootstrap.php for more on <code>ApiContext</code>)</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">try</span> {
<span class="hljs-variable">$list</span> = \PayPal\Api\WebProfile::get_list(<span class="hljs-variable">$apiContext</span>);
} <span class="hljs-keyword">catch</span> (\<span class="hljs-keyword">Exception</span> <span class="hljs-variable">$ex</span>) {
<span class="hljs-keyword">echo</span> <span class="hljs-string">"Exception: "</span> . <span class="hljs-variable">$ex</span>-&gt;getMessage() . PHP_EOL;
<span class="hljs-keyword">if</span> (is_a(<span class="hljs-variable">$ex</span>, <span class="hljs-string">'\PayPal\Exception\PPConnectionException'</span>)) {
<span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> $ex \PayPal\Exception\PPConnectionException */</span>
var_dump(<span class="hljs-variable">$ex</span>-&gt;getData());
}
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
}
<span class="hljs-variable">$result</span> = <span class="hljs-string">''</span>;
<span class="hljs-keyword">foreach</span> (<span class="hljs-variable">$list</span> <span class="hljs-keyword">as</span> <span class="hljs-variable">$object</span>) {
<span class="hljs-variable">$result</span> .= <span class="hljs-variable">$object</span>-&gt;toJSON(JSON_PRETTY_PRINT) . PHP_EOL;
}
print_result(<span class="hljs-string">"Get List of All Web Profiles"</span>, <span class="hljs-string">"Web Profiles"</span>, <span class="hljs-keyword">null</span>, <span class="hljs-variable">$result</span>);
<span class="hljs-keyword">return</span> <span class="hljs-variable">$list</span>;</div></div></div></div></body></html>

View File

@@ -0,0 +1,29 @@
<!DOCTYPE html><html lang="en"><head><title>payment-experience/PartiallyUpdateWebProfile</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payment-experience/PartiallyUpdateWebProfile"><meta name="groc-project-path" content="payment-experience/PartiallyUpdateWebProfile.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">payment-experience/PartiallyUpdateWebProfile.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h4 id="partially-update-web-profile">Partially Update Web Profile</h4>
<p>Use this call to partially update a web experience profile.
Documentation available at <a href="https://developer.paypal.com/webapps/developer/docs/api/#partially-update-a-web-experience-profile">https://developer.paypal.com/webapps/developer/docs/api/#partially-update-a-web-experience-profile</a></p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>We will be re-using the sample code to get a web profile. GetWebProfile.php will
create a new web profileId for sample, and return the web profile object.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> \PayPal\Api\WebProfile $webProfile */</span>
<span class="hljs-variable">$webProfile</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'GetWebProfile.php'</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="create-patch-operation">Create Patch Operation</h3>
<p>APIs allows us to pass an array of patches
to make patch operations.
Each Patch operation can be created by using Patch Class
as shown below</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$patchOperation1</span> = <span class="hljs-keyword">new</span> \PayPal\Api\Patch();</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>The operation to perform. Required. Allowed values: add, remove, replace, move, copy, test</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$patchOperation1</span>-&gt;setOp(<span class="hljs-string">"add"</span>)</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>string containing a JSON-Pointer value that references a location within the target document (the target location) where the operation is performed. Required.</p></div></div><div class="code"><div class="wrapper"> -&gt;setPath(<span class="hljs-string">"/presentation/brand_name"</span>)</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>New value to apply based on the operation.</p></div></div><div class="code"><div class="wrapper"> -&gt;setValue(<span class="hljs-string">"New Brand Name"</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Similar patch operation to remove the landing page type</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$patchOperation2</span> = <span class="hljs-keyword">new</span> \PayPal\Api\Patch();
<span class="hljs-variable">$patchOperation2</span>-&gt;setOp(<span class="hljs-string">"remove"</span>)
-&gt;setPath(<span class="hljs-string">"/flow_config/landing_page_type"</span>);
<span class="hljs-comment">//Generate an array of patch operations</span>
<span class="hljs-variable">$patches</span> = <span class="hljs-keyword">array</span>(<span class="hljs-variable">$patchOperation1</span>, <span class="hljs-variable">$patchOperation2</span>);
<span class="hljs-keyword">try</span> {</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Execute the partial update, to carry out these two operations on a given web profile object</p></div></div><div class="code"><div class="wrapper"> <span class="hljs-keyword">if</span> (<span class="hljs-variable">$webProfile</span>-&gt;partial_update(<span class="hljs-variable">$patches</span>, <span class="hljs-variable">$apiContext</span>)) {
<span class="hljs-variable">$webProfile</span> = \PayPal\Api\WebProfile::get(<span class="hljs-variable">$webProfile</span>-&gt;getId(), <span class="hljs-variable">$apiContext</span>);
}
} <span class="hljs-keyword">catch</span> (\<span class="hljs-keyword">Exception</span> <span class="hljs-variable">$ex</span>) {
<span class="hljs-keyword">echo</span> <span class="hljs-string">"Exception: "</span> . <span class="hljs-variable">$ex</span>-&gt;getMessage() . PHP_EOL;
<span class="hljs-keyword">if</span> (is_a(<span class="hljs-variable">$ex</span>, <span class="hljs-string">'\PayPal\Exception\PPConnectionException'</span>)) {
<span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> $ex \PayPal\Exception\PPConnectionException */</span>
var_dump(<span class="hljs-variable">$ex</span>-&gt;getData());
}
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
}
print_result(<span class="hljs-string">"Partially Updated Web Profile"</span>, <span class="hljs-string">"Web Profile"</span>, <span class="hljs-variable">$webProfile</span>-&gt;getId(), <span class="hljs-variable">$webProfile</span>);</div></div></div></div></body></html>

View File

@@ -0,0 +1,19 @@
<!DOCTYPE html><html lang="en"><head><title>payment-experience/UpdateWebProfile</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payment-experience/UpdateWebProfile"><meta name="groc-project-path" content="payment-experience/UpdateWebProfile.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">payment-experience/UpdateWebProfile.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h4 id="update-web-profile">Update Web Profile</h4>
<p>Use this call to update an experience profile.
Documentation available at <a href="https://developer.paypal.com/webapps/developer/docs/api/#update-a-web-experience-profile">https://developer.paypal.com/webapps/developer/docs/api/#update-a-web-experience-profile</a></p></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>We will be re-using the sample code to get a web profile. GetWebProfile.php will
create a new web profileId for sample, and return the web profile object.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> \PayPal\Api\WebProfile $webProfile */</span>
<span class="hljs-variable">$webProfile</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'GetWebProfile.php'</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Updated the logo image of presentation object in a given web profile.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$webProfile</span>-&gt;getPresentation()-&gt;setLogoImage(<span class="hljs-string">"http://www.google.com/favico.ico"</span>);
<span class="hljs-keyword">try</span> {</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Update the web profile to change the logo image.</p></div></div><div class="code"><div class="wrapper"> <span class="hljs-keyword">if</span> (<span class="hljs-variable">$webProfile</span>-&gt;update(<span class="hljs-variable">$apiContext</span>)) {</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>If the update is successfull, we can now get the object, and verify the web profile
object</p></div></div><div class="code"><div class="wrapper"> <span class="hljs-variable">$updatedWebProfile</span> = \PayPal\Api\WebProfile::get(<span class="hljs-variable">$webProfile</span>-&gt;getId(), <span class="hljs-variable">$apiContext</span>);
}
} <span class="hljs-keyword">catch</span> (\<span class="hljs-keyword">Exception</span> <span class="hljs-variable">$ex</span>) {
<span class="hljs-keyword">echo</span> <span class="hljs-string">"Exception: "</span> . <span class="hljs-variable">$ex</span>-&gt;getMessage() . PHP_EOL;
<span class="hljs-keyword">if</span> (is_a(<span class="hljs-variable">$ex</span>, <span class="hljs-string">'\PayPal\Exception\PPConnectionException'</span>)) {
<span class="hljs-comment">/**<span class="hljs-phpdoc"> @var</span> $ex \PayPal\Exception\PPConnectionException */</span>
var_dump(<span class="hljs-variable">$ex</span>-&gt;getData());
}
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
}
print_result(<span class="hljs-string">"Updated Web Profile"</span>, <span class="hljs-string">"Web Profile"</span>, <span class="hljs-variable">$updatedWebProfile</span>-&gt;getId(), <span class="hljs-variable">$updatedWebProfile</span>);</div></div></div></div></body></html>

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><title>payments/AuthorizationCapture</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/AuthorizationCapture"><meta name="groc-project-path" content="sample/payments/AuthorizationCapture.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/payments/AuthorizationCapture.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="authorizationcapture">AuthorizationCapture</h1> <!DOCTYPE html><html lang="en"><head><title>payments/AuthorizationCapture</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/AuthorizationCapture"><meta name="groc-project-path" content="payments/AuthorizationCapture.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">payments/AuthorizationCapture.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="authorizationcapture">AuthorizationCapture</h1>
<p>This sample code demonstrates how you can capture <p>This sample code demonstrates how you can capture
a previously authorized payment. a previously authorized payment.
API used: /v1/payments/payment</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>; API used: /v1/payments/payment</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><title>payments/CreateFuturePayment</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/CreateFuturePayment"><meta name="groc-project-path" content="sample/payments/CreateFuturePayment.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/payments/CreateFuturePayment.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="create-payment-using-paypal-as-payment-method">Create Payment using PayPal as payment method</h1> <!DOCTYPE html><html lang="en"><head><title>payments/CreateFuturePayment</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/CreateFuturePayment"><meta name="groc-project-path" content="payments/CreateFuturePayment.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">payments/CreateFuturePayment.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="create-payment-using-paypal-as-payment-method">Create Payment using PayPal as payment method</h1>
<p>This sample code demonstrates how you can process a <p>This sample code demonstrates how you can process a
PayPal Account based Payment. PayPal Account based Payment.
API used: /v1/payments/payment</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>; API used: /v1/payments/payment</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><title>payments/CreatePayment</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/CreatePayment"><meta name="groc-project-path" content="sample/payments/CreatePayment.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/payments/CreatePayment.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="createpaymentsample">CreatePaymentSample</h1> <!DOCTYPE html><html lang="en"><head><title>payments/CreatePayment</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/CreatePayment"><meta name="groc-project-path" content="payments/CreatePayment.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">payments/CreatePayment.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="createpaymentsample">CreatePaymentSample</h1>
<p>This sample code demonstrate how you can process <p>This sample code demonstrate how you can process
a direct credit card payment. Please note that direct a direct credit card payment. Please note that direct
credit card payment and related features using the credit card payment and related features using the

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><title>payments/CreatePaymentUsingPayPal</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/CreatePaymentUsingPayPal"><meta name="groc-project-path" content="sample/payments/CreatePaymentUsingPayPal.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/payments/CreatePaymentUsingPayPal.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="create-payment-using-paypal-as-payment-method">Create Payment using PayPal as payment method</h1> <!DOCTYPE html><html lang="en"><head><title>payments/CreatePaymentUsingPayPal</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/CreatePaymentUsingPayPal"><meta name="groc-project-path" content="payments/CreatePaymentUsingPayPal.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">payments/CreatePaymentUsingPayPal.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="create-payment-using-paypal-as-payment-method">Create Payment using PayPal as payment method</h1>
<p>This sample code demonstrates how you can process a <p>This sample code demonstrates how you can process a
PayPal Account based Payment. PayPal Account based Payment.
API used: /v1/payments/payment</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>; API used: /v1/payments/payment</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><title>payments/CreatePaymentUsingSavedCard</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/CreatePaymentUsingSavedCard"><meta name="groc-project-path" content="sample/payments/CreatePaymentUsingSavedCard.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/payments/CreatePaymentUsingSavedCard.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="create-payment-using-a-saved-credit-card">Create payment using a saved credit card</h1> <!DOCTYPE html><html lang="en"><head><title>payments/CreatePaymentUsingSavedCard</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/CreatePaymentUsingSavedCard"><meta name="groc-project-path" content="payments/CreatePaymentUsingSavedCard.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">payments/CreatePaymentUsingSavedCard.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="create-payment-using-a-saved-credit-card">Create payment using a saved credit card</h1>
<p>This sample code demonstrates how you can process a <p>This sample code demonstrates how you can process a
Payment using a previously stored credit card token. Payment using a previously stored credit card token.
API used: /v1/payments/payment</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>; API used: /v1/payments/payment</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><title>payments/ExecutePayment</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/ExecutePayment"><meta name="groc-project-path" content="sample/payments/ExecutePayment.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/payments/ExecutePayment.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="execute-payment-sample">Execute Payment Sample</h1> <!DOCTYPE html><html lang="en"><head><title>payments/ExecutePayment</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/ExecutePayment"><meta name="groc-project-path" content="payments/ExecutePayment.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">payments/ExecutePayment.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="execute-payment-sample">Execute Payment Sample</h1>
<p>This sample shows how you can complete <p>This sample shows how you can complete
a payment that has been approved by a payment that has been approved by
the buyer by logging into paypal site. the buyer by logging into paypal site.

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><title>payments/GetAuthorization</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/GetAuthorization"><meta name="groc-project-path" content="sample/payments/GetAuthorization.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/payments/GetAuthorization.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="getauthorization">GetAuthorization</h1> <!DOCTYPE html><html lang="en"><head><title>payments/GetAuthorization</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/GetAuthorization"><meta name="groc-project-path" content="payments/GetAuthorization.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">payments/GetAuthorization.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="getauthorization">GetAuthorization</h1>
<p>This sample code demonstrates how you can get details <p>This sample code demonstrates how you can get details
of an authorized payment. of an authorized payment.
API used: /v1/payments/authorization/&lt;$authorizationId&gt;</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>; API used: /v1/payments/authorization/&lt;$authorizationId&gt;</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><title>payments/GetCapture</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/GetCapture"><meta name="groc-project-path" content="sample/payments/GetCapture.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/payments/GetCapture.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="getcapture">GetCapture</h1> <!DOCTYPE html><html lang="en"><head><title>payments/GetCapture</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/GetCapture"><meta name="groc-project-path" content="payments/GetCapture.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">payments/GetCapture.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="getcapture">GetCapture</h1>
<p>This sample code demonstrates how you can lookup the details <p>This sample code demonstrates how you can lookup the details
of a captured payment. of a captured payment.
API used: /v1/payments/capture/&lt;$captureId&gt;</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>; API used: /v1/payments/capture/&lt;$captureId&gt;</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><title>payments/GetPayment</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/GetPayment"><meta name="groc-project-path" content="sample/payments/GetPayment.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/payments/GetPayment.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="getpaymentsample">GetPaymentSample</h1> <!DOCTYPE html><html lang="en"><head><title>payments/GetPayment</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/GetPayment"><meta name="groc-project-path" content="payments/GetPayment.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">payments/GetPayment.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="getpaymentsample">GetPaymentSample</h1>
<p>This sample code demonstrate how you can <p>This sample code demonstrate how you can
retrieve a list of all Payment resources retrieve a list of all Payment resources
you&#39;ve created using the Payments API. you&#39;ve created using the Payments API.

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><title>payments/ListPayments</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/ListPayments"><meta name="groc-project-path" content="sample/payments/ListPayments.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/payments/ListPayments.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="getpaymentlist">GetPaymentList</h1> <!DOCTYPE html><html lang="en"><head><title>payments/ListPayments</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/ListPayments"><meta name="groc-project-path" content="payments/ListPayments.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">payments/ListPayments.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="getpaymentlist">GetPaymentList</h1>
<p>This sample code demonstrate how you can <p>This sample code demonstrate how you can
retrieve a list of all Payment resources retrieve a list of all Payment resources
you&#39;ve created using the Payments API. you&#39;ve created using the Payments API.

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><title>payments/Reauthorization</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/Reauthorization"><meta name="groc-project-path" content="sample/payments/Reauthorization.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/payments/Reauthorization.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h2 id="reauthorization-sample">Reauthorization Sample</h2> <!DOCTYPE html><html lang="en"><head><title>payments/Reauthorization</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/Reauthorization"><meta name="groc-project-path" content="payments/Reauthorization.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">payments/Reauthorization.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h2 id="reauthorization-sample">Reauthorization Sample</h2>
<p>This sample code demonstrates how you can reauthorize a PayPal <p>This sample code demonstrates how you can reauthorize a PayPal
account payment. account payment.
API used: v1/payments/authorization/{authorization_id}/reauthorize</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>; API used: v1/payments/authorization/{authorization_id}/reauthorize</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><title>payments/RefundCapture</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/RefundCapture"><meta name="groc-project-path" content="sample/payments/RefundCapture.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/payments/RefundCapture.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="refund-capture-sample">Refund Capture Sample</h1> <!DOCTYPE html><html lang="en"><head><title>payments/RefundCapture</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/RefundCapture"><meta name="groc-project-path" content="payments/RefundCapture.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">payments/RefundCapture.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="refund-capture-sample">Refund Capture Sample</h1>
<p>This sample code demonstrates how you can <p>This sample code demonstrates how you can
process a refund on a Captured transaction. process a refund on a Captured transaction.
API used: /v1/payments/capture/{<captureID>}/refund</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>; API used: /v1/payments/capture/{<captureID>}/refund</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><title>payments/VoidAuthorization</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/VoidAuthorization"><meta name="groc-project-path" content="sample/payments/VoidAuthorization.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/payments/VoidAuthorization.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="voidauthorization">VoidAuthorization</h1> <!DOCTYPE html><html lang="en"><head><title>payments/VoidAuthorization</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="payments/VoidAuthorization"><meta name="groc-project-path" content="payments/VoidAuthorization.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">payments/VoidAuthorization.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="voidauthorization">VoidAuthorization</h1>
<p>This sample code demonstrates how you can <p>This sample code demonstrates how you can
void an authorized payment. void an authorized payment.
API used: /v1/payments/authorization/&lt;{authorizationid}&gt;/void&quot;</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>; API used: /v1/payments/authorization/&lt;{authorizationid}&gt;/void&quot;</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</span> . <span class="hljs-string">'/../bootstrap.php'</span>;

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><title>sale/GetSale</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="sale/GetSale"><meta name="groc-project-path" content="sample/sale/GetSale.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/sale/GetSale.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="get-sale-sample">Get Sale sample</h1> <!DOCTYPE html><html lang="en"><head><title>sale/GetSale</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="sale/GetSale"><meta name="groc-project-path" content="sale/GetSale.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sale/GetSale.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="get-sale-sample">Get Sale sample</h1>
<p>Sale transactions are nothing but completed payments. <p>Sale transactions are nothing but completed payments.
This sample code demonstrates how you can retrieve This sample code demonstrates how you can retrieve
details of completed Sale Transaction. details of completed Sale Transaction.

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><title>sale/RefundSale</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="sale/RefundSale"><meta name="groc-project-path" content="sample/sale/RefundSale.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/sale/RefundSale.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="sale-refund-sample">Sale Refund Sample</h1> <!DOCTYPE html><html lang="en"><head><title>sale/RefundSale</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="sale/RefundSale"><meta name="groc-project-path" content="sale/RefundSale.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sale/RefundSale.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="sale-refund-sample">Sale Refund Sample</h1>
<p>This sample code demonstrate how you can <p>This sample code demonstrate how you can
process a refund on a sale transaction created process a refund on a sale transaction created
using the Payments API. using the Payments API.

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><title>vault/CreateCreditCard</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="vault/CreateCreditCard"><meta name="groc-project-path" content="sample/vault/CreateCreditCard.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/vault/CreateCreditCard.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="create-credit-card-sample">Create Credit Card Sample</h1> <!DOCTYPE html><html lang="en"><head><title>vault/CreateCreditCard</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="vault/CreateCreditCard"><meta name="groc-project-path" content="vault/CreateCreditCard.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">vault/CreateCreditCard.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="create-credit-card-sample">Create Credit Card Sample</h1>
<p>You can store credit card details securely <p>You can store credit card details securely
with PayPal. You can then use the returned with PayPal. You can then use the returned
Credit card id to process future payments. Credit card id to process future payments.

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><title>vault/DeleteCreditCard</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="vault/DeleteCreditCard"><meta name="groc-project-path" content="sample/vault/DeleteCreditCard.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/vault/DeleteCreditCard.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="delete-creditcard-sample">Delete CreditCard Sample</h1> <!DOCTYPE html><html lang="en"><head><title>vault/DeleteCreditCard</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="vault/DeleteCreditCard"><meta name="groc-project-path" content="vault/DeleteCreditCard.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">vault/DeleteCreditCard.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="delete-creditcard-sample">Delete CreditCard Sample</h1>
<p>This sample code demonstrate how you can <p>This sample code demonstrate how you can
delete a saved credit card. delete a saved credit card.
API used: /v1/vault/credit-card/{<creditCardId>} API used: /v1/vault/credit-card/{<creditCardId>}

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><title>vault/GetCreditCard</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="vault/GetCreditCard"><meta name="groc-project-path" content="sample/vault/GetCreditCard.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">sample/vault/GetCreditCard.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="get-credit-card-sample">Get Credit Card Sample</h1> <!DOCTYPE html><html lang="en"><head><title>vault/GetCreditCard</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="vault/GetCreditCard"><meta name="groc-project-path" content="vault/GetCreditCard.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">vault/GetCreditCard.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor">&lt;?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="get-credit-card-sample">Get Credit Card Sample</h1>
<p>The CreditCard resource allows you to <p>The CreditCard resource allows you to
retrieve previously saved CreditCards. retrieve previously saved CreditCards.
API called: &#39;/v1/vault/credit-card&#39; API called: &#39;/v1/vault/credit-card&#39;

View File

@@ -235,6 +235,69 @@
</ul> </ul>
</div> </div>
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">Payment Experience</h3>
</div>
<!-- List group -->
<ul class="list-group">
<li class="list-group-item">
<div class="row">
<div class="col-md-9 "><h5>Create a web experience profile</h5></div>
<div class="col-md-3">
<a href="payment-experience/CreateWebProfile.php" class="btn btn-primary pull-left" >Execute <i class="fa fa-play-circle-o"></i></a>
<a href="doc/payment-experience/CreateWebProfile.html" class="btn btn-default pull-right" >Source <i class="fa fa-file-code-o"></i></a>
</div>
</div>
</li>
<li class="list-group-item">
<div class="row">
<div class="col-md-9 "><h5>Retrieve a web experience profile</h5></div>
<div class="col-md-3">
<a href="payment-experience/GetWebProfile.php" class="btn btn-primary pull-left" >Execute <i class="fa fa-play-circle-o"></i></a>
<a href="doc/payment-experience/GetWebProfile.html" class="btn btn-default pull-right" >Source <i class="fa fa-file-code-o"></i></a>
</div>
</div>
</li>
<li class="list-group-item">
<div class="row">
<div class="col-md-9 "><h5>List web experience profiles</h5></div>
<div class="col-md-3">
<a href="payment-experience/ListWebProfiles.php" class="btn btn-primary pull-left" >Execute <i class="fa fa-play-circle-o"></i></a>
<a href="doc/payment-experience/ListWebProfiles.html" class="btn btn-default pull-right" >Source <i class="fa fa-file-code-o"></i></a>
</div>
</div>
</li>
<li class="list-group-item">
<div class="row">
<div class="col-md-9 "><h5>Update a web experience profile</h5></div>
<div class="col-md-3">
<a href="payment-experience/UpdateWebProfile.php" class="btn btn-primary pull-left" >Execute <i class="fa fa-play-circle-o"></i></a>
<a href="doc/payment-experience/UpdateWebProfile.html" class="btn btn-default pull-right" >Source <i class="fa fa-file-code-o"></i></a>
</div>
</div>
</li>
<li class="list-group-item">
<div class="row">
<div class="col-md-9 "><h5>Partially update a web experience profile</h5></div>
<div class="col-md-3">
<a href="payment-experience/PartiallyUpdateWebProfile.php" class="btn btn-primary pull-left" >Execute <i class="fa fa-play-circle-o"></i></a>
<a href="doc/payment-experience/PartiallyUpdateWebProfile.html" class="btn btn-default pull-right" >Source <i class="fa fa-file-code-o"></i></a>
</div>
</div>
</li>
<li class="list-group-item">
<div class="row">
<div class="col-md-9 "><h5>Delete a web experience profile</h5></div>
<div class="col-md-3">
<a href="payment-experience/DeleteWebProfile.php" class="btn btn-primary pull-left" >Execute <i class="fa fa-play-circle-o"></i></a>
<a href="doc/payment-experience/DeleteWebProfile.html" class="btn btn-default pull-right" >Source <i class="fa fa-file-code-o"></i></a>
</div>
</div>
</li>
</ul>
</div>
<div class="panel panel-primary"> <div class="panel panel-primary">
<div class="panel-heading"> <div class="panel-heading">
<h3 class="panel-title">Invoice</h3> <h3 class="panel-title">Invoice</h3>

View File

@@ -0,0 +1,60 @@
<?php
require __DIR__ . '/../bootstrap.php';
// ### Create Web Profile
// Use the /web-profiles resource to create seamless payment experience profiles. See the payment experience overview for further information about using the /payment resource to create the PayPal payment and pass the experience_profile_id.
// Documentation available at https://developer.paypal.com/webapps/developer/docs/api/#create-a-web-experience-profile
// Lets create an instance of FlowConfig and add
// landing page type information
$flowConfig = new \PayPal\Api\FlowConfig();
// Type of PayPal page to be displayed when a user lands on the PayPal site for checkout. Allowed values: Billing or Login. When set to Billing, the Non-PayPal account landing page is used. When set to Login, the PayPal account login landing page is used.
$flowConfig->setLandingPageType("Billing");
// The URL on the merchant site for transferring to after a bank transfer payment.
$flowConfig->setBankTxnPendingUrl("http://www.yeowza.com/");
// Parameters for style and presentation.
$presentation = new \PayPal\Api\Presentation();
// A URL to logo image. Allowed vaues: .gif, .jpg, or .png.
$presentation->setLogoImage("http://www.yeowza.com/favico.ico")
// A label that overrides the business name in the PayPal account on the PayPal pages.
->setBrandName("YeowZa! Paypal")
// Locale of pages displayed by PayPal payment experience.
->setLocaleCode("US");
// Parameters for input fields customization.
$inputFields = new \PayPal\Api\InputFields();
// Enables the buyer to enter a note to the merchant on the PayPal page during checkout.
$inputFields->setAllowNote(true)
// Determines whether or not PayPal displays shipping address fields on the experience pages. Allowed values: 0, 1, or 2. When set to 0, PayPal displays the shipping address on the PayPal pages. When set to 1, PayPal does not display shipping address fields whatsoever. When set to 2, if you do not pass the shipping address, PayPal obtains it from the buyers account profile. For digital goods, this field is required, and you must set it to 1.
->setNoShipping(1)
// Determines whether or not the PayPal pages should display the shipping address and not the shipping address on file with PayPal for this buyer. Displaying the PayPal street address on file does not allow the buyer to edit that address. Allowed values: 0 or 1. When set to 0, the PayPal pages should not display the shipping address. When set to 1, the PayPal pages should display the shipping address.
->setAddressOverride(0);
// #### Payment Web experience profile resource
$webProfile = new \PayPal\Api\WebProfile();
// Name of the web experience profile. Required. Must be unique
$webProfile->setName("YeowZa! T-Shirt Shop" . uniqid())
// Parameters for flow configuration.
->setFlowConfig($flowConfig)
// Parameters for style and presentation.
->setPresentation($presentation);
try {
// Use this call to create a profile.
$createProfileResponse = $webProfile->create($apiContext);
} catch (\Exception $ex) {
echo "Exception: " . $ex->getMessage() . PHP_EOL;
if (is_a($ex, '\PayPal\Exception\PPConnectionException')) {
/** @var $ex \PayPal\Exception\PPConnectionException */
var_dump($ex->getData());
}
exit(1);
}
print_result("Created Web Profile", "Web Profile", $createProfileResponse->getId(), $createProfileResponse);
return $createProfileResponse;

View File

@@ -0,0 +1,30 @@
<?php
// #### Delete Web Profile
// Use this call to delete a web experience profile.
// Documentation available at https://developer.paypal.com/webapps/developer/docs/api/#delete-a-web-experience-profile
// We are going to re-use the sample code from CreateWebProfile.php.
// If you have not visited the sample yet, please visit it before trying GetWebProfile.php
// The CreateWebProfile.php will create a web profile for us, and return a CreateProfileResponse,
// that contains the web profile ID.
/** @var \PayPal\Api\CreateProfileResponse $result */
$createProfileResponse = require_once 'CreateWebProfile.php';
// Create a new instance of web Profile ID, and set the ID.
$webProfile = new \PayPal\Api\WebProfile();
$webProfile->setId($createProfileResponse->getId());
try {
// Execute the delete method
$webProfile->delete($apiContext);
} catch (\Exception $ex) {
echo "Exception: " . $ex->getMessage() . PHP_EOL;
if (is_a($ex, '\PayPal\Exception\PPConnectionException')) {
/** @var $ex \PayPal\Exception\PPConnectionException */
var_dump($ex->getData());
}
exit(1);
}
print_result("Deleted Web Profile", "Web Profile", $createProfileResponse->getId());

View File

@@ -0,0 +1,28 @@
<?php
// ### Get Web Profile
// If your request is successful, the API returns a web_profile object response that contains the profile details.
// Documentation available at https://developer.paypal.com/webapps/developer/docs/api/#retrieve-a-web-experience-profile
// We are going to re-use the sample code from CreateWebProfile.php.
// If you have not visited the sample yet, please visit it before trying GetWebProfile.php
// The CreateWebProfile.php will create a web profile for us, and return a CreateProfileResponse,
// that contains the web profile ID.
/** @var \PayPal\Api\CreateProfileResponse $result */
$createProfileResponse = require 'CreateWebProfile.php';
try {
// If your request is successful, the API returns a web_profile object response that contains the profile details.
$webProfile = \PayPal\Api\WebProfile::get($createProfileResponse->getId(), $apiContext);
} catch (\Exception $ex) {
echo "Exception: " . $ex->getMessage() . PHP_EOL;
if (is_a($ex, '\PayPal\Exception\PPConnectionException')) {
/** @var $ex \PayPal\Exception\PPConnectionException */
var_dump($ex->getData());
}
exit(1);
}
print_result("Get Web Profile", "Web Profile", $webProfile->getId(), $webProfile);
return $webProfile;

View File

@@ -0,0 +1,28 @@
<?php
$apiContext = require __DIR__ . '/../bootstrap.php';
// ### Retrieve List of All Web Profiles
// Documentation available at https://developer.paypal.com/webapps/developer/docs/api/#list-web-experience-profiles
// Retrieve the list of all web profiles by calling the
// static `get_list` method on the WebProfile class.
// (See bootstrap.php for more on `ApiContext`)
try {
$list = \PayPal\Api\WebProfile::get_list($apiContext);
} catch (\Exception $ex) {
echo "Exception: " . $ex->getMessage() . PHP_EOL;
if (is_a($ex, '\PayPal\Exception\PPConnectionException')) {
/** @var $ex \PayPal\Exception\PPConnectionException */
var_dump($ex->getData());
}
exit(1);
}
$result = '';
foreach ($list as $object) {
$result .= $object->toJSON(JSON_PRETTY_PRINT) . PHP_EOL;
}
print_result("Get List of All Web Profiles", "Web Profiles", null, $result);
return $list;

View File

@@ -0,0 +1,48 @@
<?php
// #### Partially Update Web Profile
// Use this call to partially update a web experience profile.
// Documentation available at https://developer.paypal.com/webapps/developer/docs/api/#partially-update-a-web-experience-profile
// We will be re-using the sample code to get a web profile. GetWebProfile.php will
// create a new web profileId for sample, and return the web profile object.
/** @var \PayPal\Api\WebProfile $webProfile */
$webProfile = require 'GetWebProfile.php';
// ### Create Patch Operation
// APIs allows us to pass an array of patches
// to make patch operations.
// Each Patch operation can be created by using Patch Class
// as shown below
$patchOperation1 = new \PayPal\Api\Patch();
// The operation to perform. Required. Allowed values: add, remove, replace, move, copy, test
$patchOperation1->setOp("add")
// string containing a JSON-Pointer value that references a location within the target document (the target location) where the operation is performed. Required.
->setPath("/presentation/brand_name")
// New value to apply based on the operation.
->setValue("New Brand Name");
// Similar patch operation to remove the landing page type
$patchOperation2 = new \PayPal\Api\Patch();
$patchOperation2->setOp("remove")
->setPath("/flow_config/landing_page_type");
//Generate an array of patch operations
$patches = array($patchOperation1, $patchOperation2);
try {
// Execute the partial update, to carry out these two operations on a given web profile object
if ($webProfile->partial_update($patches, $apiContext)) {
$webProfile = \PayPal\Api\WebProfile::get($webProfile->getId(), $apiContext);
}
} catch (\Exception $ex) {
echo "Exception: " . $ex->getMessage() . PHP_EOL;
if (is_a($ex, '\PayPal\Exception\PPConnectionException')) {
/** @var $ex \PayPal\Exception\PPConnectionException */
var_dump($ex->getData());
}
exit(1);
}
print_result("Partially Updated Web Profile", "Web Profile", $webProfile->getId(), $webProfile);

View File

@@ -0,0 +1,32 @@
<?php
// #### Update Web Profile
// Use this call to update an experience profile.
// Documentation available at https://developer.paypal.com/webapps/developer/docs/api/#update-a-web-experience-profile
// We will be re-using the sample code to get a web profile. GetWebProfile.php will
// create a new web profileId for sample, and return the web profile object.
/** @var \PayPal\Api\WebProfile $webProfile */
$webProfile = require 'GetWebProfile.php';
// Updated the logo image of presentation object in a given web profile.
$webProfile->getPresentation()->setLogoImage("http://www.google.com/favico.ico");
try {
// Update the web profile to change the logo image.
if ($webProfile->update($apiContext)) {
// If the update is successfull, we can now get the object, and verify the web profile
// object
$updatedWebProfile = \PayPal\Api\WebProfile::get($webProfile->getId(), $apiContext);
}
} catch (\Exception $ex) {
echo "Exception: " . $ex->getMessage() . PHP_EOL;
if (is_a($ex, '\PayPal\Exception\PPConnectionException')) {
/** @var $ex \PayPal\Exception\PPConnectionException */
var_dump($ex->getData());
}
exit(1);
}
print_result("Updated Web Profile", "Web Profile", $updatedWebProfile->getId(), $updatedWebProfile);

View File

@@ -0,0 +1,83 @@
<?php
namespace PayPal\Test\Api;
use PayPal\Api\WebProfile;
/**
* Class WebProfile
*
* @package PayPal\Test\Api
*/
class WebProfileTest extends \PHPUnit_Framework_TestCase
{
public function testCreateprofileSerialization()
{
$requestBody = '{"name":"someName2' . uniqid() . '","presentation":{"logo_image":"http://www.ebay.com"},"input_fields":{"no_shipping":1,"address_override":1},"flow_config":{"landing_page_type":"billing","bank_txn_pending_url":"http://www.ebay.com"}}';
$requestBodyEncoded = json_encode(json_decode($requestBody, true));
$object = new WebProfile($requestBodyEncoded);
$json = $object->toJson();
$this->assertEquals($requestBodyEncoded, $json);
}
/**
* @group integration
*/
public function testCreateprofileOperation()
{
$requestBody = '{"name":"someName2' . uniqid() . '","presentation":{"logo_image":"http://www.ebay.com"},"input_fields":{"no_shipping":1,"address_override":1},"flow_config":{"landing_page_type":"billing","bank_txn_pending_url":"http://www.ebay.com"}}';
$requestBodyEncoded = json_encode(json_decode($requestBody, true));
$object = new WebProfile($requestBodyEncoded);
$response = $object->create(null);
$this->assertNotNull($response);
return $response->getId();
}
/**
* @depends testCreateprofileOperation
* @group integration
*/
public function testGetprofileOperation($profileId)
{
$response = WebProfile::get($profileId, null);
$this->assertNotNull($response);
$this->assertEquals($response->getId(), $profileId);
$this->assertEquals("http://www.ebay.com", $response->getPresentation()->getLogoImage());
$this->assertEquals(1, $response->getInputFields()->getNoShipping());
$this->assertEquals(1, $response->getInputFields()->getAddressOverride());
$this->assertEquals("billing", $response->getFlowConfig()->getLandingPageType());
$this->assertEquals("http://www.ebay.com", $response->getFlowConfig()->getBankTxnPendingUrl());
return $response->getId();
}
public function testValidationerrorSerialization()
{
$requestBody = '{"name":"sampleName' . uniqid() . '","presentation":{"logo_image":"http://www.ebay.com"},"input_fields":{"no_shipping":4,"address_override":1},"flow_config":{"landing_page_type":"billing","bank_txn_pending_url":"ht//www.ebay.com"}}';
$requestBodyEncoded = json_encode(json_decode($requestBody, true));
$object = new WebProfile($requestBodyEncoded);
$json = $object->toJson();
$this->assertEquals($requestBodyEncoded, $json);
}
/**
* @group integration
* @expectedException PayPal\Exception\PPConnectionException
* @expectedExceptionCode 400
*/
public function testValidationerrorOperation()
{
$requestBody = '{"name":"sampleName' . uniqid() . '","presentation":{"logo_image":"http://www.ebay.com"},"input_fields":{"no_shipping":4,"address_override":1},"flow_config":{"landing_page_type":"billing","bank_txn_pending_url":"ht//www.ebay.com"}}';
$requestBodyEncoded = json_encode(json_decode($requestBody, true));
$object = new WebProfile($requestBodyEncoded);
$response = $object->create(null);
return $response->getId();
}
}

View File

@@ -1,167 +1,167 @@
<?php <?php
namespace PayPal\Test\Common; namespace PayPal\Test\Common;
use PayPal\Core\PPConfigManager; use PayPal\Core\PPConfigManager;
class ModelTest extends \PHPUnit_Framework_TestCase class ModelTest extends \PHPUnit_Framework_TestCase
{ {
public function testSimpleClassConversion() public function testSimpleClassConversion()
{ {
$o = new SimpleClass(); $o = new SimpleClass();
$o->setName("test"); $o->setName("test");
$o->setDescription("description"); $o->setDescription("description");
$this->assertEquals("test", $o->getName()); $this->assertEquals("test", $o->getName());
$this->assertEquals("description", $o->getDescription()); $this->assertEquals("description", $o->getDescription());
$json = $o->toJSON(); $json = $o->toJSON();
$this->assertEquals('{"name":"test","description":"description"}', $json); $this->assertEquals('{"name":"test","description":"description"}', $json);
$newO = new SimpleClass(); $newO = new SimpleClass();
$newO->fromJson($json); $newO->fromJson($json);
$this->assertEquals($o, $newO); $this->assertEquals($o, $newO);
} }
public function testConstructorJSON() public function testConstructorJSON()
{ {
$obj = new SimpleClass('{"name":"test","description":"description"}'); $obj = new SimpleClass('{"name":"test","description":"description"}');
$this->assertEquals($obj->getName(), "test"); $this->assertEquals($obj->getName(), "test");
$this->assertEquals($obj->getDescription(), "description"); $this->assertEquals($obj->getDescription(), "description");
} }
public function testConstructorArray() public function testConstructorArray()
{ {
$arr = array('name' => 'test', 'description' => 'description'); $arr = array('name' => 'test', 'description' => 'description');
$obj = new SimpleClass($arr); $obj = new SimpleClass($arr);
$this->assertEquals($obj->getName(), "test"); $this->assertEquals($obj->getName(), "test");
$this->assertEquals($obj->getDescription(), "description"); $this->assertEquals($obj->getDescription(), "description");
} }
public function testConstructorNull() public function testConstructorNull()
{ {
$obj = new SimpleClass(null); $obj = new SimpleClass(null);
$this->assertNotEquals($obj->getName(), "test"); $this->assertNotEquals($obj->getName(), "test");
$this->assertNotEquals($obj->getDescription(), "description"); $this->assertNotEquals($obj->getDescription(), "description");
$this->assertNull($obj->getName()); $this->assertNull($obj->getName());
$this->assertNull($obj->getDescription()); $this->assertNull($obj->getDescription());
} }
/** /**
* @expectedException \InvalidArgumentException * @expectedException \InvalidArgumentException
* @expectedExceptionMessage data should be either json or array representation of object * @expectedExceptionMessage Invalid JSON String
*/ */
public function testConstructorInvalidInput() public function testConstructorInvalidInput()
{ {
new SimpleClass("Something that is not even correct"); new SimpleClass("Something that is not even correct");
} }
public function testSimpleClassObjectConversion() public function testSimpleClassObjectConversion()
{ {
$json = '{"name":"test","description":"description"}'; $json = '{"name":"test","description":"description"}';
$obj = new SimpleClass(); $obj = new SimpleClass();
$obj->fromJson($json); $obj->fromJson($json);
$this->assertEquals("test", $obj->getName()); $this->assertEquals("test", $obj->getName());
$this->assertEquals("description", $obj->getDescription()); $this->assertEquals("description", $obj->getDescription());
} }
public function testSimpleClassObjectInvalidConversion() public function testSimpleClassObjectInvalidConversion()
{ {
try { try {
$json = '{"name":"test","description":"description","invalid":"value"}'; $json = '{"name":"test","description":"description","invalid":"value"}';
$obj = new SimpleClass(); $obj = new SimpleClass();
$obj->fromJson($json); $obj->fromJson($json);
$this->assertEquals("test", $obj->getName()); $this->assertEquals("test", $obj->getName());
$this->assertEquals("description", $obj->getDescription()); $this->assertEquals("description", $obj->getDescription());
} catch (\PHPUnit_Framework_Error_Notice $ex) { } catch (\PHPUnit_Framework_Error_Notice $ex) {
echo $ex->getMessage(); echo $ex->getMessage();
} }
} }
/** /**
* @outputBuffering enabled * @outputBuffering enabled
*/ */
public function testInvalidMagicMethod() public function testInvalidMagicMethod()
{ {
$obj = new SimpleClass(); $obj = new SimpleClass();
try { try {
$obj->invalid = "value2"; $obj->invalid = "value2";
$this->assertEquals($obj->invalid, "value2"); $this->assertEquals($obj->invalid, "value2");
if (PPConfigManager::getInstance()->get('validation.level') == 'strict') { if (PPConfigManager::getInstance()->get('validation.level') == 'strict') {
$this->fail("It should have thrown a Notice Error"); $this->fail("It should have thrown a Notice Error");
} }
} catch (\PHPUnit_Framework_Error_Notice $ex) { } catch (\PHPUnit_Framework_Error_Notice $ex) {
} }
} }
/** /**
* @outputBuffering enabled * @outputBuffering enabled
*/ */
public function testInvalidMagicMethodWithDisabledValidation() public function testInvalidMagicMethodWithDisabledValidation()
{ {
PPConfigManager::getInstance()->addConfigs(array('validation.level' => 'disabled')); PPConfigManager::getInstance()->addConfigs(array('validation.level' => 'disabled'));
$obj = new SimpleClass(); $obj = new SimpleClass();
try { try {
$obj->invalid = "value2"; $obj->invalid = "value2";
$this->assertEquals($obj->invalid, "value2"); $this->assertEquals($obj->invalid, "value2");
} catch (\PHPUnit_Framework_Error_Notice $ex) { } catch (\PHPUnit_Framework_Error_Notice $ex) {
$this->fail("It should not have thrown a Notice Error as it is disabled."); $this->fail("It should not have thrown a Notice Error as it is disabled.");
} }
PPConfigManager::getInstance()->addConfigs(array('validation.level' => 'strict')); PPConfigManager::getInstance()->addConfigs(array('validation.level' => 'strict'));
} }
public function testInvalidMagicMethodWithValidationLevel() public function testInvalidMagicMethodWithValidationLevel()
{ {
PPConfigManager::getInstance()->addConfigs(array('validation.level' => 'log')); PPConfigManager::getInstance()->addConfigs(array('validation.level' => 'log'));
$obj = new SimpleClass(); $obj = new SimpleClass();
$obj->invalid2 = "value2"; $obj->invalid2 = "value2";
$this->assertEquals($obj->invalid2, "value2"); $this->assertEquals($obj->invalid2, "value2");
PPConfigManager::getInstance()->addConfigs(array('validation.level' => 'strict')); PPConfigManager::getInstance()->addConfigs(array('validation.level' => 'strict'));
} }
public function testArrayClassConversion() public function testArrayClassConversion()
{ {
$o = new ArrayClass(); $o = new ArrayClass();
$o->setName("test"); $o->setName("test");
$o->setDescription("description"); $o->setDescription("description");
$o->setTags(array('payment', 'info', 'test')); $o->setTags(array('payment', 'info', 'test'));
$this->assertEquals("test", $o->getName()); $this->assertEquals("test", $o->getName());
$this->assertEquals("description", $o->getDescription()); $this->assertEquals("description", $o->getDescription());
$this->assertEquals(array('payment', 'info', 'test'), $o->getTags()); $this->assertEquals(array('payment', 'info', 'test'), $o->getTags());
$json = $o->toJSON(); $json = $o->toJSON();
$this->assertEquals('{"name":"test","description":"description","tags":["payment","info","test"]}', $json); $this->assertEquals('{"name":"test","description":"description","tags":["payment","info","test"]}', $json);
$newO = new ArrayClass(); $newO = new ArrayClass();
$newO->fromJson($json); $newO->fromJson($json);
$this->assertEquals($o, $newO); $this->assertEquals($o, $newO);
} }
public function testNestedClassConversion() public function testNestedClassConversion()
{ {
$n = new ArrayClass(); $n = new ArrayClass();
$n->setName("test"); $n->setName("test");
$n->setDescription("description"); $n->setDescription("description");
$o = new NestedClass(); $o = new NestedClass();
$o->setId('123'); $o->setId('123');
$o->setInfo($n); $o->setInfo($n);
$this->assertEquals("123", $o->getId()); $this->assertEquals("123", $o->getId());
$this->assertEquals("test", $o->getInfo()->getName()); $this->assertEquals("test", $o->getInfo()->getName());
$json = $o->toJSON(); $json = $o->toJSON();
$this->assertEquals('{"id":"123","info":{"name":"test","description":"description"}}', $json); $this->assertEquals('{"id":"123","info":{"name":"test","description":"description"}}', $json);
$newO = new NestedClass(); $newO = new NestedClass();
$newO->fromJson($json); $newO->fromJson($json);
$this->assertEquals($o, $newO); $this->assertEquals($o, $newO);
} }
} }