Payments API Updates

This commit is contained in:
Jay Patel
2015-10-02 14:25:46 -05:00
parent 02fca1bda4
commit a37b880e96
112 changed files with 3857 additions and 1495 deletions

View File

@@ -2,10 +2,7 @@
namespace PayPal\Api;
use PayPal\Common\PayPalResourceModel;
use PayPal\Rest\ApiContext;
use PayPal\Transport\PayPalRestCall;
use PayPal\Validation\ArgumentValidator;
use PayPal\Common\PayPalModel;
/**
* Class BankAccount
@@ -14,37 +11,38 @@ use PayPal\Validation\ArgumentValidator;
*
* @package PayPal\Api
*
* @property string id
* @property string account_number
* @property string account_number_type
* @property string routing_number
* @property string account_type
* @property string account_name
* @property string check_type
* @property string auth_type
* @property string auth_capture_timestamp
* @property string bank_name
* @property string country_code
* @property string first_name
* @property string last_name
* @property string birth_date
* @property string account_number
* @property string account_number_type
* @property string routing_number
* @property string account_type
* @property string account_name
* @property string check_type
* @property string auth_type
* @property string auth_capture_timestamp
* @property string bank_name
* @property string country_code
* @property string first_name
* @property string last_name
* @property string birth_date
* @property \PayPal\Api\Address billing_address
* @property string state
* @property string confirmation_status
* @property string payer_id
* @property string external_customer_id
* @property string merchant_id
* @property string create_time
* @property string update_time
* @property string valid_until
* @property string state
* @property string confirmation_status
* @property string payer_id
* @property string external_customer_id
* @property string merchant_id
* @property string create_time
* @property string update_time
* @property string valid_until
* @property \PayPal\Api\Links[] links
*/
class BankAccount extends PayPalResourceModel
class BankAccount extends PayPalModel
{
/**
* ID of the bank account being saved for later use.
*
* @deprecated Not publicly available
* @param string $id
*
*
* @return $this
*/
public function setId($id)
@@ -56,6 +54,7 @@ class BankAccount extends PayPalResourceModel
/**
* ID of the bank account being saved for later use.
*
* @deprecated Not publicly available
* @return string
*/
public function getId()
@@ -67,7 +66,7 @@ class BankAccount extends PayPalResourceModel
* Account number in either IBAN (max length 34) or BBAN (max length 17) format.
*
* @param string $account_number
*
*
* @return $this
*/
public function setAccountNumber($account_number)
@@ -91,7 +90,7 @@ class BankAccount extends PayPalResourceModel
* Valid Values: ["BBAN", "IBAN"]
*
* @param string $account_number_type
*
*
* @return $this
*/
public function setAccountNumberType($account_number_type)
@@ -114,7 +113,7 @@ class BankAccount extends PayPalResourceModel
* Routing transit number (aka Bank Code) of the bank (typically for domestic use only - for international use, IBAN includes bank code). For more information refer to http://en.wikipedia.org/wiki/Bank_code.
*
* @param string $routing_number
*
*
* @return $this
*/
public function setRoutingNumber($routing_number)
@@ -138,7 +137,7 @@ class BankAccount extends PayPalResourceModel
* Valid Values: ["CHECKING", "SAVINGS"]
*
* @param string $account_type
*
*
* @return $this
*/
public function setAccountType($account_type)
@@ -161,7 +160,7 @@ class BankAccount extends PayPalResourceModel
* A customer designated name.
*
* @param string $account_name
*
*
* @return $this
*/
public function setAccountName($account_name)
@@ -185,7 +184,7 @@ class BankAccount extends PayPalResourceModel
* Valid Values: ["PERSONAL", "COMPANY"]
*
* @param string $check_type
*
*
* @return $this
*/
public function setCheckType($check_type)
@@ -209,7 +208,7 @@ class BankAccount extends PayPalResourceModel
* Valid Values: ["CCD", "PPD", "TEL", "POP", "ARC", "RCK", "WEB"]
*
* @param string $auth_type
*
*
* @return $this
*/
public function setAuthType($auth_type)
@@ -232,7 +231,7 @@ class BankAccount extends PayPalResourceModel
* Time at which the authorization (or check) was captured. Use this field if the user authorization needs to be captured due to any privacy requirements.
*
* @param string $auth_capture_timestamp
*
*
* @return $this
*/
public function setAuthCaptureTimestamp($auth_capture_timestamp)
@@ -255,7 +254,7 @@ class BankAccount extends PayPalResourceModel
* Name of the bank.
*
* @param string $bank_name
*
*
* @return $this
*/
public function setBankName($bank_name)
@@ -278,7 +277,7 @@ class BankAccount extends PayPalResourceModel
* 2 letter country code of the Bank.
*
* @param string $country_code
*
*
* @return $this
*/
public function setCountryCode($country_code)
@@ -301,7 +300,7 @@ class BankAccount extends PayPalResourceModel
* Account holder's first name.
*
* @param string $first_name
*
*
* @return $this
*/
public function setFirstName($first_name)
@@ -324,7 +323,7 @@ class BankAccount extends PayPalResourceModel
* Account holder's last name.
*
* @param string $last_name
*
*
* @return $this
*/
public function setLastName($last_name)
@@ -347,7 +346,7 @@ class BankAccount extends PayPalResourceModel
* Birth date of the bank account holder.
*
* @param string $birth_date
*
*
* @return $this
*/
public function setBirthDate($birth_date)
@@ -370,7 +369,7 @@ class BankAccount extends PayPalResourceModel
* Billing address.
*
* @param \PayPal\Api\Address $billing_address
*
*
* @return $this
*/
public function setBillingAddress($billing_address)
@@ -394,7 +393,7 @@ class BankAccount extends PayPalResourceModel
* Valid Values: ["ACTIVE", "INACTIVE", "DELETED"]
*
* @param string $state
*
*
* @return $this
*/
public function setState($state)
@@ -418,7 +417,7 @@ class BankAccount extends PayPalResourceModel
* Valid Values: ["UNCONFIRMED", "CONFIRMED"]
*
* @param string $confirmation_status
*
*
* @return $this
*/
public function setConfirmationStatus($confirmation_status)
@@ -438,10 +437,10 @@ class BankAccount extends PayPalResourceModel
}
/**
* Deprecated - Use external_customer_id instead.
* [DEPRECATED] Use external_customer_id instead.
*
* @param string $payer_id
*
*
* @return $this
*/
public function setPayerId($payer_id)
@@ -451,7 +450,7 @@ class BankAccount extends PayPalResourceModel
}
/**
* Deprecated - Use external_customer_id instead.
* @deprecated [DEPRECATED] Use external_customer_id instead.
*
* @return string
*/
@@ -464,7 +463,7 @@ class BankAccount extends PayPalResourceModel
* A unique identifier of the customer to whom this bank account belongs to. Generated and provided by the facilitator. This is required when creating or using a stored funding instrument in vault.
*
* @param string $external_customer_id
*
*
* @return $this
*/
public function setExternalCustomerId($external_customer_id)
@@ -483,12 +482,11 @@ class BankAccount extends PayPalResourceModel
return $this->external_customer_id;
}
/**
* A unique identifier of the merchant for which this bank account has been stored for. Generated and provided by the facilitator so it can be used to restrict the usage of the bank account to the specific merchnt.
*
* @param string $merchant_id
*
*
* @return $this
*/
public function setMerchantId($merchant_id)
@@ -511,7 +509,7 @@ class BankAccount extends PayPalResourceModel
* Time the resource was created.
*
* @param string $create_time
*
*
* @return $this
*/
public function setCreateTime($create_time)
@@ -534,7 +532,7 @@ class BankAccount extends PayPalResourceModel
* Time the resource was last updated.
*
* @param string $update_time
*
*
* @return $this
*/
public function setUpdateTime($update_time)
@@ -557,7 +555,7 @@ class BankAccount extends PayPalResourceModel
* Date/Time until this resource can be used to fund a payment.
*
* @param string $valid_until
*
*
* @return $this
*/
public function setValidUntil($valid_until)
@@ -577,97 +575,56 @@ class BankAccount extends PayPalResourceModel
}
/**
* Creates a new Bank Account Resource.
* Sets Links
*
* @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
* @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls
* @return BankAccount
* @param \PayPal\Api\Links[] $links
*
* @return $this
*/
public function create($apiContext = null, $restCall = null)
public function setLinks($links)
{
$payLoad = $this->toJSON();
$json = self::executeCall(
"/v1/vault/bank-accounts",
"POST",
$payLoad,
null,
$apiContext,
$restCall
);
$this->fromJson($json);
$this->links = $links;
return $this;
}
/**
* Obtain the Bank Account resource for the given identifier.
* Gets Links
*
* @param string $bankAccountId
* @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
* @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls
* @return BankAccount
* @return \PayPal\Api\Links[]
*/
public static function get($bankAccountId, $apiContext = null, $restCall = null)
public function getLinks()
{
ArgumentValidator::validate($bankAccountId, 'bankAccountId');
$payLoad = "";
$json = self::executeCall(
"/v1/vault/bank-accounts/$bankAccountId",
"GET",
$payLoad,
null,
$apiContext,
$restCall
);
$ret = new BankAccount();
$ret->fromJson($json);
return $ret;
return $this->links;
}
/**
* Delete the bank account resource for the given identifier.
* Append Links to the list.
*
* @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
* @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls
* @return bool
* @param \PayPal\Api\Links $links
* @return $this
*/
public function delete($apiContext = null, $restCall = null)
public function addLink($links)
{
ArgumentValidator::validate($this->getId(), "Id");
$payLoad = "";
self::executeCall(
"/v1/vault/bank-accounts/{$this->getId()}",
"DELETE",
$payLoad,
null,
$apiContext,
$restCall
);
return true;
if (!$this->getLinks()) {
return $this->setLinks(array($links));
} else {
return $this->setLinks(
array_merge($this->getLinks(), array($links))
);
}
}
/**
* Update information in a previously saved bank account. Only the modified fields need to be passed in the request.
* Remove Links from the list.
*
* @param PatchRequest $patchRequest
* @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
* @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls
* @return BankAccount
* @param \PayPal\Api\Links $links
* @return $this
*/
public function update($patchRequest, $apiContext = null, $restCall = null)
public function removeLink($links)
{
ArgumentValidator::validate($this->getId(), "Id");
ArgumentValidator::validate($patchRequest, 'patchRequest');
$payLoad = $patchRequest->toJSON();
$json = self::executeCall(
"/v1/vault/bank-accounts/{$this->getId()}",
"PATCH",
$payLoad,
null,
$apiContext,
$restCall
return $this->setLinks(
array_diff($this->getLinks(), array($links))
);
$this->fromJson($json);
return $this;
}
}