forked from LiveCarta/PayPal-PHP-SDK
Update payments API to v1.9
This commit is contained in:
committed by
jaypatel512 and sdcoffey
parent
7c5ea8b997
commit
c2947ff409
@@ -4,9 +4,8 @@ namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PayPalResourceModel;
|
||||
use PayPal\Core\PayPalConstants;
|
||||
use PayPal\Rest\ApiContext;
|
||||
use PayPal\Transport\PayPalRestCall;
|
||||
use PayPal\Validation\ArgumentValidator;
|
||||
use PayPal\Rest\ApiContext;
|
||||
|
||||
/**
|
||||
* Class Payment
|
||||
@@ -15,30 +14,27 @@ use PayPal\Validation\ArgumentValidator;
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @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
|
||||
* @property string id
|
||||
* @property string intent
|
||||
* @property \PayPal\Api\Payer payer
|
||||
* @property \PayPal\Api\Transaction[] transactions
|
||||
* @property string state
|
||||
* @property string experience_profile_id
|
||||
* @property string note_to_payer
|
||||
* @property \PayPal\Api\Payee $payee
|
||||
* @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
|
||||
{
|
||||
/**
|
||||
* ID of the created payment, the 'transaction ID'
|
||||
* Identifier of the payment resource created.
|
||||
*
|
||||
* @param string $id
|
||||
*
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setId($id)
|
||||
@@ -48,7 +44,7 @@ class Payment extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* ID of the created payment, the 'transaction ID'
|
||||
* Identifier of the payment resource created.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -62,7 +58,7 @@ class Payment extends PayPalResourceModel
|
||||
* Valid Values: ["sale", "authorize", "order"]
|
||||
*
|
||||
* @param string $intent
|
||||
*
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setIntent($intent)
|
||||
@@ -85,7 +81,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)
|
||||
@@ -106,9 +102,9 @@ 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.
|
||||
*
|
||||
* @deprecated Not publicly available
|
||||
* @param \PayPal\Api\PotentialPayerInfo $potential_payer_info
|
||||
*
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPotentialPayerInfo($potential_payer_info)
|
||||
@@ -119,7 +115,7 @@ 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.
|
||||
*
|
||||
* @deprecated Not publicly available
|
||||
* @return \PayPal\Api\PotentialPayerInfo
|
||||
*/
|
||||
public function getPotentialPayerInfo()
|
||||
@@ -128,10 +124,9 @@ class Payment extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Receiver of funds for this payment. **Readonly for PayPal external REST payments.**
|
||||
*
|
||||
* Receiver of funds for this payment.
|
||||
* @param \PayPal\Api\Payee $payee
|
||||
*
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPayee($payee)
|
||||
@@ -141,8 +136,7 @@ class Payment extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Receiver of funds for this payment. **Readonly for PayPal external REST payments.**
|
||||
*
|
||||
* Receiver of funds for this payment.
|
||||
* @return \PayPal\Api\Payee
|
||||
*/
|
||||
public function getPayee()
|
||||
@@ -152,10 +146,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)
|
||||
@@ -166,7 +159,6 @@ class Payment extends PayPalResourceModel
|
||||
|
||||
/**
|
||||
* ID of the cart to execute the payment.
|
||||
*
|
||||
* @deprecated Not publicly available
|
||||
* @return string
|
||||
*/
|
||||
@@ -179,7 +171,7 @@ class Payment extends PayPalResourceModel
|
||||
* Transactional details including the amount and item details.
|
||||
*
|
||||
* @param \PayPal\Api\Transaction[] $transactions
|
||||
*
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setTransactions($transactions)
|
||||
@@ -230,10 +222,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)
|
||||
@@ -244,7 +235,6 @@ 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[]
|
||||
*/
|
||||
@@ -255,7 +245,6 @@ class Payment extends PayPalResourceModel
|
||||
|
||||
/**
|
||||
* Append FailedTransactions to the list.
|
||||
*
|
||||
* @deprecated Not publicly available
|
||||
* @param \PayPal\Api\Error $error
|
||||
* @return $this
|
||||
@@ -273,7 +262,6 @@ class Payment extends PayPalResourceModel
|
||||
|
||||
/**
|
||||
* Remove FailedTransactions from the list.
|
||||
*
|
||||
* @deprecated Not publicly available
|
||||
* @param \PayPal\Api\Error $error
|
||||
* @return $this
|
||||
@@ -287,9 +275,9 @@ class Payment extends PayPalResourceModel
|
||||
|
||||
/**
|
||||
* Collection of PayPal generated billing agreement tokens.
|
||||
*
|
||||
* @deprecated Not publicly available
|
||||
* @param string[] $billing_agreement_tokens
|
||||
*
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setBillingAgreementTokens($billing_agreement_tokens)
|
||||
@@ -300,7 +288,7 @@ class Payment extends PayPalResourceModel
|
||||
|
||||
/**
|
||||
* Collection of PayPal generated billing agreement tokens.
|
||||
*
|
||||
* @deprecated Not publicly available
|
||||
* @return string[]
|
||||
*/
|
||||
public function getBillingAgreementTokens()
|
||||
@@ -310,7 +298,7 @@ class Payment extends PayPalResourceModel
|
||||
|
||||
/**
|
||||
* Append BillingAgreementTokens to the list.
|
||||
*
|
||||
* @deprecated Not publicly available
|
||||
* @param string $billingAgreementToken
|
||||
* @return $this
|
||||
*/
|
||||
@@ -327,7 +315,7 @@ class Payment extends PayPalResourceModel
|
||||
|
||||
/**
|
||||
* Remove BillingAgreementTokens from the list.
|
||||
*
|
||||
* @deprecated Not publicly available
|
||||
* @param string $billingAgreementToken
|
||||
* @return $this
|
||||
*/
|
||||
@@ -340,10 +328,9 @@ class Payment extends PayPalResourceModel
|
||||
|
||||
/**
|
||||
* 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)
|
||||
@@ -354,7 +341,6 @@ class Payment extends PayPalResourceModel
|
||||
|
||||
/**
|
||||
* Credit financing offered to payer on PayPal side. Returned in payment after payer opts-in
|
||||
*
|
||||
* @deprecated Not publicly available
|
||||
* @return \PayPal\Api\CreditFinancingOffered
|
||||
*/
|
||||
@@ -365,9 +351,9 @@ class Payment extends PayPalResourceModel
|
||||
|
||||
/**
|
||||
* Instructions for the payer to complete this payment.
|
||||
*
|
||||
* @deprecated Not publicly available
|
||||
* @param \PayPal\Api\PaymentInstruction $payment_instruction
|
||||
*
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPaymentInstruction($payment_instruction)
|
||||
@@ -378,7 +364,7 @@ class Payment extends PayPalResourceModel
|
||||
|
||||
/**
|
||||
* Instructions for the payer to complete this payment.
|
||||
*
|
||||
* @deprecated Not publicly available
|
||||
* @return \PayPal\Api\PaymentInstruction
|
||||
*/
|
||||
public function getPaymentInstruction()
|
||||
@@ -387,11 +373,11 @@ class Payment extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Payment state.
|
||||
* The state of the payment, authorization, or order transaction. The value is:<ul><li><code>created</code>. The transaction was successfully created.</li><li><code>approved</code>. The buyer approved the transaction.</li><li><code>failed</code>. The transaction request failed.</li></ul>
|
||||
* Valid Values: ["created", "approved", "failed", "partially_completed", "in_progress"]
|
||||
*
|
||||
* @param string $state
|
||||
*
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setState($state)
|
||||
@@ -401,7 +387,7 @@ class Payment extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Payment state.
|
||||
* The state of the payment, authorization, or order transaction. The value is:<ul><li><code>created</code>. The transaction was successfully created.</li><li><code>approved</code>. The buyer approved the transaction.</li><li><code>failed</code>. The transaction request failed.</li></ul>
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -411,10 +397,10 @@ class Payment extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* PayPal generated identifier for the merchant's payment experience profile. Refer to [this](https://developer.paypal.com/docs/api/#payment-experience) link to create experience profile ID.
|
||||
*
|
||||
* @param string $experience_profile_id
|
||||
*
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setExperienceProfileId($experience_profile_id)
|
||||
@@ -424,7 +410,7 @@ class Payment extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* PayPal generated identifier for the merchant's payment experience profile. Refer to [this](https://developer.paypal.com/docs/api/#payment-experience) link to create experience profile ID.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -437,7 +423,7 @@ class Payment extends PayPalResourceModel
|
||||
* 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)
|
||||
@@ -460,7 +446,7 @@ class Payment extends PayPalResourceModel
|
||||
* Set of redirect URLs you provide only for PayPal-based payments.
|
||||
*
|
||||
* @param \PayPal\Api\RedirectUrls $redirect_urls
|
||||
*
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setRedirectUrls($redirect_urls)
|
||||
@@ -484,7 +470,7 @@ class Payment extends PayPalResourceModel
|
||||
* 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)
|
||||
@@ -507,7 +493,7 @@ class Payment extends PayPalResourceModel
|
||||
* 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)
|
||||
@@ -530,7 +516,7 @@ class Payment extends PayPalResourceModel
|
||||
* 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)
|
||||
@@ -560,10 +546,10 @@ 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.
|
||||
* Creates and processes a payment. In the JSON request body, include a `payment` object with the intent, payer, and transactions. 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)
|
||||
@@ -582,11 +568,11 @@ class Payment extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Look up a particular payment resource by passing the payment_id in the request URI.
|
||||
* Shows details for a payment, by ID.
|
||||
*
|
||||
* @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)
|
||||
@@ -607,11 +593,11 @@ class Payment extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* Partially updates a payment, by ID. You can update the amount, shipping address, invoice ID, and custom data. You cannot 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)
|
||||
@@ -631,11 +617,11 @@ class Payment extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute (complete) a PayPal payment that has been approved by the payer. Optionally update selective payment information when executing the payment.
|
||||
* Executes, or completes, a PayPal payment that the payer has approved. You can optionally update selective payment information when you execute a 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)
|
||||
@@ -656,11 +642,11 @@ 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.
|
||||
* List payments that were made to the merchant who issues the request. Payments can be in any state.
|
||||
*
|
||||
* @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)
|
||||
@@ -668,14 +654,14 @@ class Payment extends PayPalResourceModel
|
||||
ArgumentValidator::validate($params, 'params');
|
||||
$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,
|
||||
);
|
||||
$json = self::executeCall(
|
||||
"/v1/payments/payment?" . http_build_query(array_intersect_key($params, $allowedParams)),
|
||||
|
||||
Reference in New Issue
Block a user