forked from LiveCarta/PayPal-PHP-SDK
Merge branch 'Payment-experience' of git://github.com/ultimatedion/rest-api-sdk-php into ultimatedion-Payment-experience
Conflicts: lib/PayPal/Api/Payment.php
This commit is contained in:
52
lib/PayPal/Api/FlowConfig.php
Normal file
52
lib/PayPal/Api/FlowConfig.php
Normal 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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
68
lib/PayPal/Api/InputFields.php
Normal file
68
lib/PayPal/Api/InputFields.php
Normal 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;
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,7 @@ use PayPal\Validation\ArgumentValidator;
|
||||
* @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
|
||||
{
|
||||
@@ -49,10 +50,10 @@ class Payment extends PPModel implements IResource
|
||||
|
||||
/**
|
||||
* Identifier of the payment resource created.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param string $id
|
||||
*
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setId($id)
|
||||
@@ -73,10 +74,10 @@ class Payment extends PPModel implements IResource
|
||||
|
||||
/**
|
||||
* Time the resource was created in UTC ISO8601 format.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param string $create_time
|
||||
*
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCreateTime($create_time)
|
||||
@@ -122,10 +123,10 @@ class Payment extends PPModel implements IResource
|
||||
|
||||
/**
|
||||
* Time the resource was last updated in UTC ISO8601 format.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param string $update_time
|
||||
*
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setUpdateTime($update_time)
|
||||
@@ -171,10 +172,10 @@ class Payment extends PPModel implements IResource
|
||||
|
||||
/**
|
||||
* Intent of the payment - Sale or Authorization or Order.
|
||||
* Valid Values: ["sale", "authorize", "order"]
|
||||
* Valid Values: ["sale", "authorize", "order"]
|
||||
*
|
||||
* @param string $intent
|
||||
*
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setIntent($intent)
|
||||
@@ -195,10 +196,10 @@ class Payment extends PPModel implements IResource
|
||||
|
||||
/**
|
||||
* Source of the funds for this payment represented by a PayPal account or a direct credit card.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\Payer $payer
|
||||
*
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPayer($payer)
|
||||
@@ -219,10 +220,10 @@ class Payment extends PPModel implements IResource
|
||||
|
||||
/**
|
||||
* Cart for which the payment is done.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\object $cart
|
||||
*
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCart($cart)
|
||||
@@ -243,10 +244,10 @@ class Payment extends PPModel implements IResource
|
||||
|
||||
/**
|
||||
* A payment can have more than one transaction, with each transaction establishing a contract between the payer and a payee
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\Transaction $transactions
|
||||
*
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setTransactions($transactions)
|
||||
@@ -267,10 +268,10 @@ class Payment extends PPModel implements IResource
|
||||
|
||||
/**
|
||||
* state of the payment
|
||||
* Valid Values: ["created", "approved", "failed", "canceled", "expired"]
|
||||
* Valid Values: ["created", "approved", "failed", "canceled", "expired"]
|
||||
*
|
||||
* @param string $state
|
||||
*
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setState($state)
|
||||
@@ -291,10 +292,10 @@ class Payment extends PPModel implements IResource
|
||||
|
||||
/**
|
||||
* Redirect urls required only when using payment_method as PayPal - the only settings supported are return and cancel urls.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\RedirectUrls $redirect_urls
|
||||
*
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setRedirectUrls($redirect_urls)
|
||||
@@ -340,10 +341,10 @@ class Payment extends PPModel implements IResource
|
||||
|
||||
/**
|
||||
* Sets Links
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param \PayPal\Api\Links $links
|
||||
*
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setLinks($links)
|
||||
@@ -362,6 +363,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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates (and processes) a new Payment Resource.
|
||||
*
|
||||
@@ -438,14 +465,14 @@ class Payment extends PPModel implements IResource
|
||||
|
||||
$payLoad = "";
|
||||
$allowedParams = array(
|
||||
'count' => 1,
|
||||
'start_id' => 1,
|
||||
'start_index' => 1,
|
||||
'start_time' => 1,
|
||||
'end_time' => 1,
|
||||
'payee_id' => 1,
|
||||
'sort_by' => 1,
|
||||
'sort_order' => 1,
|
||||
'count' => 1,
|
||||
'start_id' => 1,
|
||||
'start_index' => 1,
|
||||
'start_time' => 1,
|
||||
'end_time' => 1,
|
||||
'payee_id' => 1,
|
||||
'sort_by' => 1,
|
||||
'sort_order' => 1,
|
||||
);
|
||||
if ($apiContext == null) {
|
||||
$apiContext = new ApiContext(self::$credential);
|
||||
@@ -457,4 +484,5 @@ class Payment extends PPModel implements IResource
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
68
lib/PayPal/Api/Presentation.php
Normal file
68
lib/PayPal/Api/Presentation.php
Normal 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;
|
||||
}
|
||||
}
|
||||
223
lib/PayPal/Api/WebProfile.php
Normal file
223
lib/PayPal/Api/WebProfile.php
Normal 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;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
37
lib/PayPal/Api/WebProfiles.php
Normal file
37
lib/PayPal/Api/WebProfiles.php
Normal 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user