From d42e6ee5415dd81477179fe0425d30742c5efde3 Mon Sep 17 00:00:00 2001 From: ultimatedion Date: Fri, 3 Oct 2014 12:25:20 -0400 Subject: [PATCH 1/2] Update Payment.php Added property experience_profile_id to Payment.php --- lib/PayPal/Api/Payment.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/PayPal/Api/Payment.php b/lib/PayPal/Api/Payment.php index b601cef..87b4beb 100644 --- a/lib/PayPal/Api/Payment.php +++ b/lib/PayPal/Api/Payment.php @@ -20,6 +20,7 @@ use PayPal\Transport\PPRestCall; * @property string state * @property \PayPal\Api\RedirectUrls redirect_urls * @property \PayPal\Api\Links links + * @property string experience_profile_id */ class Payment extends PPModel implements IResource { From 318504e1dc38c16c391b36c534214704b6352354 Mon Sep 17 00:00:00 2001 From: Eric Dion Date: Sun, 5 Oct 2014 21:25:34 -0400 Subject: [PATCH 2/2] Payment Experience(Web profiles) handling --- lib/PayPal/Api/FlowConfig.php | 52 ++++++++ lib/PayPal/Api/InputFields.php | 68 ++++++++++ lib/PayPal/Api/Payment.php | 28 +++- lib/PayPal/Api/Presentation.php | 68 ++++++++++ lib/PayPal/Api/WebProfile.php | 223 ++++++++++++++++++++++++++++++++ lib/PayPal/Api/WebProfiles.php | 37 ++++++ 6 files changed, 474 insertions(+), 2 deletions(-) create mode 100644 lib/PayPal/Api/FlowConfig.php create mode 100644 lib/PayPal/Api/InputFields.php create mode 100644 lib/PayPal/Api/Presentation.php create mode 100644 lib/PayPal/Api/WebProfile.php create mode 100644 lib/PayPal/Api/WebProfiles.php diff --git a/lib/PayPal/Api/FlowConfig.php b/lib/PayPal/Api/FlowConfig.php new file mode 100644 index 0000000..7fba2d8 --- /dev/null +++ b/lib/PayPal/Api/FlowConfig.php @@ -0,0 +1,52 @@ +landing_page_type; + } + + /* + * @param string landing_page_type * + */ + + 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; + } + + +} diff --git a/lib/PayPal/Api/InputFields.php b/lib/PayPal/Api/InputFields.php new file mode 100644 index 0000000..85d8c38 --- /dev/null +++ b/lib/PayPal/Api/InputFields.php @@ -0,0 +1,68 @@ +no_shipping; + } + + /* + * @param integer no_shipping * + */ + + public function setNoShipping($no_shipping){ + $this->no_shipping = $no_shipping; + return $this; + } + + + /** + * + * @return integer address_override + */ + public function getAddressOverride() { + return $this->address_override; + } + + /* + * @param integer address_override * + */ + + public function setAddressOverride($address_override){ + $this->address_override = $address_override; + return $this; + } + + /** + * + * @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; + } +} diff --git a/lib/PayPal/Api/Payment.php b/lib/PayPal/Api/Payment.php index 87b4beb..23faf4e 100644 --- a/lib/PayPal/Api/Payment.php +++ b/lib/PayPal/Api/Payment.php @@ -5,7 +5,6 @@ namespace PayPal\Api; use PayPal\Common\PPModel; use PayPal\Rest\ApiContext; use PayPal\Rest\IResource; -use PayPal\Api\PaymentHistory; use PayPal\Transport\PPRestCall; /** @@ -363,7 +362,32 @@ class Payment extends PPModel implements IResource return $this->links; } - + /** + * Set Experience_profile_id + * experience_profile_id of the payment + * + * @param string $experience_profile_id + * + * @return $this + */ + public function setExperienceProfileId($experience_profile_id) + { + $this->experience_profile_id = $experience_profile_id; + + return $this; + } + + /** + * Get Experience_profile_id + * Experience_profile_id of the payment + * + * @return string + */ + public function getExperienceProfileId() + { + return $this->experience_profile_id; + } + /** * Create * diff --git a/lib/PayPal/Api/Presentation.php b/lib/PayPal/Api/Presentation.php new file mode 100644 index 0000000..534a0c4 --- /dev/null +++ b/lib/PayPal/Api/Presentation.php @@ -0,0 +1,68 @@ +brand_name; + } + + /* + * @param string brand_name * + */ + + public function setBrandName($brand_name){ + $this->brand_name = $brand_name; + return $this; + } + + + /** + * + * @return string logo_image + */ + public function getLogoImage() { + return $this->logo_image; + } + + /* + * @param string logo_image * + */ + + public function setLogoImage($logo_image){ + $this->logo_image = $logo_image; + return $this; + } + + /** + * + * @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; + } +} diff --git a/lib/PayPal/Api/WebProfile.php b/lib/PayPal/Api/WebProfile.php new file mode 100644 index 0000000..b32467d --- /dev/null +++ b/lib/PayPal/Api/WebProfile.php @@ -0,0 +1,223 @@ +input_fields = new InputFields(); + } + //private $input_fields = array(); + /** + * Set ID + * ID of the web experience profile. + * + * @param string $id + * + * @return $this + */ + public function setId($id) + { + $this->id = $id; + + return $this; + } + + /** + * Get ID + * ID of the web experience profile. + * + * @return string + */ + public function getId() + { + return $this->id; + } + + /** + * Set ID + * Name of the web experience profile. + * + * @param string $name + * + * @return $this + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } + + /** + * Get name + * Name of the web experience profile. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + + + + /** + * + * @param InputFields $input_fields + */ + public function setInputFields($input_fields) { + $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; + return $this; + } + + /** + * + * @return FlowConfig + */ + public function getFlowConfig() { + return $this->flow_config; + } + + + /** + * + * @param Presentation $presentation + */ + public function setPresentation($presentation) { + $this->presentation = $presentation; + return $this; + } + + /** + * + * @return Presentation + */ + public function getPresentation() { + return $this->presentation; + } + + + /** + * Create + * + * @param \PayPal\Rest\ApiContext|null $apiContext + * + * @return $this + */ + public function create($apiContext = null) + { + + $payLoad = $this->toJSON(); + + if ($apiContext == null) { + $apiContext = new ApiContext(self::$credential); + } + + $call = new PPRestCall($apiContext); + $json = $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payment-experience/web-profiles", "POST", $payLoad); + $this->fromJson($json); + + return $this; + } + + public function update($apiContext = null) + { + $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) { + $apiContext = new ApiContext(self::$credential); + } + $call = new PPRestCall($apiContext); + $call->execute(array('PayPal\Rest\RestHandler'), "/v1/payment-experience/web-profiles/{$this->getId()}", "DELETE", $payLoad); + return true; + } + + /** + * Get all webProfiles of a merchant. + * + * @param \PayPal\Rest\ApiContext|null $apiContext + * + * @return WebProfiles + */ + public static function get_all($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); + $json = '{"web_profiles":'.$json.'}'; + + $ret = new WebProfiles(); + $ret->fromJson($json); + return $ret; + + } + + + +} diff --git a/lib/PayPal/Api/WebProfiles.php b/lib/PayPal/Api/WebProfiles.php new file mode 100644 index 0000000..0523ab2 --- /dev/null +++ b/lib/PayPal/Api/WebProfiles.php @@ -0,0 +1,37 @@ +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; + } + + + + + + +}