Payment Experience(Web profiles) handling

This commit is contained in:
Eric Dion
2014-10-05 21:25:34 -04:00
parent d42e6ee541
commit 318504e1dc
6 changed files with 474 additions and 2 deletions

View File

@@ -0,0 +1,52 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PPModel;
use PayPal\Rest\ApiContext;
/**
* Class FlowConfig
*
* @property string landing_page_type
* @property string bank_txn_pending_url
*/
class FlowConfig extends PPModel {
/**
*
* @return string landing_page_type
*/
public function getLandingPageType() {
return $this->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;
}
}

View File

@@ -0,0 +1,68 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PPModel;
use PayPal\Rest\ApiContext;
/**
* Class InputFields
*
* @property integer no_shipping
* @property integer address_override
* @property boolean allow-note
*/
class InputFields extends PPModel {
/**
*
* @return integer no_shipping
*/
public function getNoShipping() {
return $this->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;
}
}

View File

@@ -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
*

View File

@@ -0,0 +1,68 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PPModel;
use PayPal\Rest\ApiContext;
/**
* Class Presentation
*
* @property string brand_name
* @property string logo_image
* @property string locale_code
*/
class Presentation extends PPModel {
/**
*
* @return string brand_name
*/
public function getBrandName() {
return $this->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;
}
}

View File

@@ -0,0 +1,223 @@
<?php
namespace PayPal\Api;
use PayPal\Common\PPModel;
use PayPal\Rest\ApiContext;
use PayPal\Rest\IResource;
use PayPal\Transport\PPRestCall;
/**
* Class WebProfile
*
* @property string id
* @property string name
* @property InputFields input_fields
* @property FlowConfig flow_config
* @property Presentation presentation
*/
class WebProfile extends PPModel implements IResource
{
/**
* @var
*/
private static $credential;
function __construct() {
$this->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;
}
}

View File

@@ -0,0 +1,37 @@
<?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;
}
}