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

@@ -15,27 +15,30 @@ use PayPal\Validation\ArgumentValidator;
*
* @package PayPal\Api
*
* @property string id
* @property string create_time
* @property string update_time
* @property string intent
* @property \PayPal\Api\Payer payer
* @property \PayPal\Api\Payee payee
* @property string cart
* @property \PayPal\Api\Transaction[] transactions
* @property \PayPal\Api\Error[] failed_transactions
* @property \PayPal\Api\PaymentInstruction payment_instruction
* @property string state
* @property \PayPal\Api\RedirectUrls redirect_urls
* @property string experience_profile_id
* @property string id
* @property string intent
* @property \PayPal\Api\Payer payer
* @property \PayPal\Api\PotentialPayerInfo potential_payer_info
* @property \PayPal\Api\Payee payee
* @property \PayPal\Api\Transaction[] transactions
* @property string[] billing_agreement_tokens
* @property \PayPal\Api\PaymentInstruction payment_instruction
* @property string state
* @property string experience_profile_id
* @property string note_to_payer
* @property \PayPal\Api\RedirectUrls redirect_urls
* @property string failure_reason
* @property string create_time
* @property string update_time
* @property \PayPal\Api\Links[] links
*/
class Payment extends PayPalResourceModel
{
/**
* Identifier of the payment resource created.
* ID of the created payment, the 'transaction ID'
*
* @param string $id
*
*
* @return $this
*/
public function setId($id)
@@ -45,7 +48,7 @@ class Payment extends PayPalResourceModel
}
/**
* Identifier of the payment resource created.
* ID of the created payment, the 'transaction ID'
*
* @return string
*/
@@ -55,11 +58,11 @@ class Payment extends PayPalResourceModel
}
/**
* Intent of the payment - Sale or Authorization or Order.
* Payment intent.
* Valid Values: ["sale", "authorize", "order"]
*
* @param string $intent
*
*
* @return $this
*/
public function setIntent($intent)
@@ -69,7 +72,7 @@ class Payment extends PayPalResourceModel
}
/**
* Intent of the payment - Sale or Authorization or Order.
* Payment intent.
*
* @return string
*/
@@ -82,7 +85,7 @@ class Payment extends PayPalResourceModel
* 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)
@@ -102,10 +105,33 @@ class Payment extends PayPalResourceModel
}
/**
* .
* Information that the merchant knows about the payer. This information is not definitive and only serves as a hint to the UI or any pre-processing logic.
*
* @param \PayPal\Api\PotentialPayerInfo $potential_payer_info
*
* @return $this
*/
public function setPotentialPayerInfo($potential_payer_info)
{
$this->potential_payer_info = $potential_payer_info;
return $this;
}
/**
* Information that the merchant knows about the payer. This information is not definitive and only serves as a hint to the UI or any pre-processing logic.
*
* @return \PayPal\Api\PotentialPayerInfo
*/
public function getPotentialPayerInfo()
{
return $this->potential_payer_info;
}
/**
* Receiver of funds for this payment. **Readonly for PayPal external REST payments.**
*
* @param \PayPal\Api\Payee $payee
*
*
* @return $this
*/
public function setPayee($payee)
@@ -115,7 +141,7 @@ class Payment extends PayPalResourceModel
}
/**
* .
* Receiver of funds for this payment. **Readonly for PayPal external REST payments.**
*
* @return \PayPal\Api\Payee
*/
@@ -127,8 +153,9 @@ class Payment extends PayPalResourceModel
/**
* ID of the cart to execute the payment.
*
* @deprecated Not publicly available
* @param string $cart
*
*
* @return $this
*/
public function setCart($cart)
@@ -140,6 +167,7 @@ class Payment extends PayPalResourceModel
/**
* ID of the cart to execute the payment.
*
* @deprecated Not publicly available
* @return string
*/
public function getCart()
@@ -148,10 +176,10 @@ class Payment extends PayPalResourceModel
}
/**
* A payment can have more than one transaction, with each transaction establishing a contract between the payer and a payee
* Transactional details including the amount and item details.
*
* @param \PayPal\Api\Transaction[] $transactions
*
*
* @return $this
*/
public function setTransactions($transactions)
@@ -161,7 +189,7 @@ class Payment extends PayPalResourceModel
}
/**
* A payment can have more than one transaction, with each transaction establishing a contract between the payer and a payee
* Transactional details including the amount and item details.
*
* @return \PayPal\Api\Transaction[]
*/
@@ -203,8 +231,9 @@ class Payment extends PayPalResourceModel
/**
* Applicable for advanced payments like multi seller payment (MSP) to support partial failures
*
* @deprecated Not publicly available
* @param \PayPal\Api\Error[] $failed_transactions
*
*
* @return $this
*/
public function setFailedTransactions($failed_transactions)
@@ -216,6 +245,7 @@ class Payment extends PayPalResourceModel
/**
* Applicable for advanced payments like multi seller payment (MSP) to support partial failures
*
* @deprecated Not publicly available
* @return \PayPal\Api\Error[]
*/
public function getFailedTransactions()
@@ -226,6 +256,7 @@ class Payment extends PayPalResourceModel
/**
* Append FailedTransactions to the list.
*
* @deprecated Not publicly available
* @param \PayPal\Api\Error $error
* @return $this
*/
@@ -243,6 +274,7 @@ class Payment extends PayPalResourceModel
/**
* Remove FailedTransactions from the list.
*
* @deprecated Not publicly available
* @param \PayPal\Api\Error $error
* @return $this
*/
@@ -254,10 +286,88 @@ class Payment extends PayPalResourceModel
}
/**
* A payment instruction resource
* Collection of PayPal generated billing agreement tokens.
*
* @param string[] $billing_agreement_tokens
*
* @return $this
*/
public function setBillingAgreementTokens($billing_agreement_tokens)
{
$this->billing_agreement_tokens = $billing_agreement_tokens;
return $this;
}
/**
* Collection of PayPal generated billing agreement tokens.
*
* @return string[]
*/
public function getBillingAgreementTokens()
{
return $this->billing_agreement_tokens;
}
/**
* Append BillingAgreementTokens to the list.
*
* @param string $billingAgreementToken
* @return $this
*/
public function addBillingAgreementToken($billingAgreementToken)
{
if (!$this->getBillingAgreementTokens()) {
return $this->setBillingAgreementTokens(array($billingAgreementToken));
} else {
return $this->setBillingAgreementTokens(
array_merge($this->getBillingAgreementTokens(), array($billingAgreementToken))
);
}
}
/**
* Remove BillingAgreementTokens from the list.
*
* @param string $billingAgreementToken
* @return $this
*/
public function removeBillingAgreementToken($billingAgreementToken)
{
return $this->setBillingAgreementTokens(
array_diff($this->getBillingAgreementTokens(), array($billingAgreementToken))
);
}
/**
* Credit financing offered to payer on PayPal side. Returned in payment after payer opts-in
*
* @deprecated Not publicly available
* @param \PayPal\Api\CreditFinancingOffered $credit_financing_offered
*
* @return $this
*/
public function setCreditFinancingOffered($credit_financing_offered)
{
$this->credit_financing_offered = $credit_financing_offered;
return $this;
}
/**
* Credit financing offered to payer on PayPal side. Returned in payment after payer opts-in
*
* @deprecated Not publicly available
* @return \PayPal\Api\CreditFinancingOffered
*/
public function getCreditFinancingOffered()
{
return $this->credit_financing_offered;
}
/**
* Instructions for the payer to complete this payment.
*
* @param \PayPal\Api\PaymentInstruction $payment_instruction
*
*
* @return $this
*/
public function setPaymentInstruction($payment_instruction)
@@ -267,7 +377,7 @@ class Payment extends PayPalResourceModel
}
/**
* A payment instruction resource
* Instructions for the payer to complete this payment.
*
* @return \PayPal\Api\PaymentInstruction
*/
@@ -277,11 +387,11 @@ class Payment extends PayPalResourceModel
}
/**
* state of the payment
* Valid Values: ["created", "approved", "completed", "partially_completed", "failed", "canceled", "expired", "in_progress"]
* Payment state.
* Valid Values: ["created", "approved", "failed", "partially_completed", "in_progress"]
*
* @param string $state
*
*
* @return $this
*/
public function setState($state)
@@ -291,7 +401,7 @@ class Payment extends PayPalResourceModel
}
/**
* state of the payment
* Payment state.
*
* @return string
*/
@@ -301,10 +411,10 @@ class Payment extends PayPalResourceModel
}
/**
* Identifier for the payment experience.
* PayPal generated identifier for the merchant's payment experience profile. Refer to [this](https://developer.paypal.com/webapps/developer/docs/api/#payment-experience) link to create experience profile ID.
*
* @param string $experience_profile_id
*
*
* @return $this
*/
public function setExperienceProfileId($experience_profile_id)
@@ -314,7 +424,7 @@ class Payment extends PayPalResourceModel
}
/**
* Identifier for the payment experience.
* PayPal generated identifier for the merchant's payment experience profile. Refer to [this](https://developer.paypal.com/webapps/developer/docs/api/#payment-experience) link to create experience profile ID.
*
* @return string
*/
@@ -324,10 +434,33 @@ class Payment extends PayPalResourceModel
}
/**
* Redirect urls required only when using payment_method as PayPal - the only settings supported are return and cancel urls.
* free-form field for the use of clients to pass in a message to the payer
*
* @param string $note_to_payer
*
* @return $this
*/
public function setNoteToPayer($note_to_payer)
{
$this->note_to_payer = $note_to_payer;
return $this;
}
/**
* free-form field for the use of clients to pass in a message to the payer
*
* @return string
*/
public function getNoteToPayer()
{
return $this->note_to_payer;
}
/**
* Set of redirect URLs you provide only for PayPal-based payments.
*
* @param \PayPal\Api\RedirectUrls $redirect_urls
*
*
* @return $this
*/
public function setRedirectUrls($redirect_urls)
@@ -337,7 +470,7 @@ class Payment extends PayPalResourceModel
}
/**
* Redirect urls required only when using payment_method as PayPal - the only settings supported are return and cancel urls.
* Set of redirect URLs you provide only for PayPal-based payments.
*
* @return \PayPal\Api\RedirectUrls
*/
@@ -347,10 +480,34 @@ class Payment extends PayPalResourceModel
}
/**
* Time the resource was created in UTC ISO8601 format.
* Failure reason code returned when the payment failed for some valid reasons.
* Valid Values: ["UNABLE_TO_COMPLETE_TRANSACTION", "INVALID_PAYMENT_METHOD", "PAYER_CANNOT_PAY", "CANNOT_PAY_THIS_PAYEE", "REDIRECT_REQUIRED", "PAYEE_FILTER_RESTRICTIONS"]
*
* @param string $failure_reason
*
* @return $this
*/
public function setFailureReason($failure_reason)
{
$this->failure_reason = $failure_reason;
return $this;
}
/**
* Failure reason code returned when the payment failed for some valid reasons.
*
* @return string
*/
public function getFailureReason()
{
return $this->failure_reason;
}
/**
* Payment creation time as defined in [RFC 3339 Section 5.6](http://tools.ietf.org/html/rfc3339#section-5.6).
*
* @param string $create_time
*
*
* @return $this
*/
public function setCreateTime($create_time)
@@ -360,7 +517,7 @@ class Payment extends PayPalResourceModel
}
/**
* Time the resource was created in UTC ISO8601 format.
* Payment creation time as defined in [RFC 3339 Section 5.6](http://tools.ietf.org/html/rfc3339#section-5.6).
*
* @return string
*/
@@ -370,10 +527,10 @@ class Payment extends PayPalResourceModel
}
/**
* Time the resource was last updated in UTC ISO8601 format.
* Payment update time as defined in [RFC 3339 Section 5.6](http://tools.ietf.org/html/rfc3339#section-5.6).
*
* @param string $update_time
*
*
* @return $this
*/
public function setUpdateTime($update_time)
@@ -383,7 +540,7 @@ class Payment extends PayPalResourceModel
}
/**
* Time the resource was last updated in UTC ISO8601 format.
* Payment update time as defined in [RFC 3339 Section 5.6](http://tools.ietf.org/html/rfc3339#section-5.6).
*
* @return string
*/
@@ -405,8 +562,8 @@ class Payment extends PayPalResourceModel
/**
* Create and process a payment by passing a payment object that includes the intent, payer, and transactions in the body of the request JSON. For PayPal payments, include redirect URLs in the payment object.
*
* @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
* @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 Payment
*/
public function create($apiContext = null, $restCall = null)
@@ -427,9 +584,9 @@ class Payment extends PayPalResourceModel
/**
* Look up a particular payment resource by passing the payment_id in the request URI.
*
* @param string $paymentId
* @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
* @param string $paymentId
* @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 Payment
*/
public static function get($paymentId, $apiContext = null, $restCall = null)
@@ -450,11 +607,11 @@ class Payment extends PayPalResourceModel
}
/**
* Partially update a payment resource by by passing the payment_id in the request URI. In addition, pass a patch_request_object in the body of the request JSON that specifies the operation to perform, path of the target location, and new value to apply. Please note that it is not possible to use patch after execute has been called.
* Use this call to partially update the payment resource for the given identifier. Allowed objects are amount, shipping_address, invoice_id and custom. Please note that it is not possible to use patch after execute has been called.
*
* @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
* @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 boolean
*/
public function update($patchRequest, $apiContext = null, $restCall = null)
@@ -474,11 +631,11 @@ class Payment extends PayPalResourceModel
}
/**
* Execute (complete) a PayPal payment that has been approved by the payer by passing the payment_id in the request URI. This request only works after a buyer has approved the payment using the provided PayPal approval URL. Optionally update transaction information when executing the payment by passing in one or more transactions.
* Execute (complete) a PayPal payment that has been approved by the payer. Optionally update selective payment information when executing the payment.
*
* @param PaymentExecution $paymentExecution
* @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
* @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 Payment
*/
public function execute($paymentExecution, $apiContext = null, $restCall = null)
@@ -501,9 +658,9 @@ class Payment extends PayPalResourceModel
/**
* List payments in any state (created, approved, failed, etc.). Payments returned are the payments made to the merchant issuing the request.
*
* @param array $params
* @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
* @param array $params
* @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 PaymentHistory
*/
public static function all($params, $apiContext = null, $restCall = null)