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

@@ -4,7 +4,6 @@ namespace PayPal\Api;
use PayPal\Common\PayPalResourceModel;
use PayPal\Rest\ApiContext;
use PayPal\Transport\PayPalRestCall;
use PayPal\Validation\ArgumentValidator;
/**
@@ -14,35 +13,36 @@ use PayPal\Validation\ArgumentValidator;
*
* @package PayPal\Api
*
* @property string id
* @property string purchase_unit_reference_id
* @property string create_time
* @property string update_time
* @property \PayPal\Api\Amount amount
* @property string payment_mode
* @property string pending_reason
* @property string state
* @property string reason_code
* @property string protection_eligibility
* @property string protection_eligibility_type
* @property string clearing_time
* @property string recipient_fund_status
* @property string hold_reason
* @property \PayPal\Api\Currency transaction_fee
* @property \PayPal\Api\Currency receivable_amount
* @property string exchange_rate
* @property \PayPal\Api\FmfDetails fmf_details
* @property string receipt_id
* @property string parent_payment
* @property \PayPal\Api\Links[] links
* @property string id
* @property string purchase_unit_reference_id
* @property \PayPal\Api\Amount amount
* @property string payment_mode
* @property string state
* @property string reason_code
* @property string protection_eligibility
* @property string protection_eligibility_type
* @property string clearing_time
* @property string payment_hold_status
* @property string[] payment_hold_reasons
* @property \PayPal\Api\Currency transaction_fee
* @property \PayPal\Api\Currency receivable_amount
* @property string exchange_rate
* @property \PayPal\Api\FmfDetails fmf_details
* @property string receipt_id
* @property string parent_payment
* @property \PayPal\Api\ProcessorResponse processor_response
* @property string billing_agreement_id
* @property string create_time
* @property string update_time
* @property \PayPal\Api\Links[] links
*/
class Sale extends PayPalResourceModel
{
/**
* Identifier of the sale transaction.
* ID of the sale transaction.
*
* @param string $id
*
*
* @return $this
*/
public function setId($id)
@@ -52,7 +52,7 @@ class Sale extends PayPalResourceModel
}
/**
* Identifier of the sale transaction.
* ID of the sale transaction.
*
* @return string
*/
@@ -62,10 +62,10 @@ class Sale extends PayPalResourceModel
}
/**
* Identifier to the purchase unit corresponding to this sale transaction.
* Identifier of the purchased unit associated with this object.
*
* @param string $purchase_unit_reference_id
*
*
* @return $this
*/
public function setPurchaseUnitReferenceId($purchase_unit_reference_id)
@@ -75,7 +75,7 @@ class Sale extends PayPalResourceModel
}
/**
* Identifier to the purchase unit corresponding to this sale transaction.
* Identifier of the purchased unit associated with this object.
*
* @return string
*/
@@ -88,7 +88,7 @@ class Sale extends PayPalResourceModel
* Amount being collected.
*
* @param \PayPal\Api\Amount $amount
*
*
* @return $this
*/
public function setAmount($amount)
@@ -108,11 +108,11 @@ class Sale extends PayPalResourceModel
}
/**
* specifies payment mode of the transaction
* Specifies payment mode of the transaction. Only supported when the `payment_method` is set to `paypal`.
* Valid Values: ["INSTANT_TRANSFER", "MANUAL_BANK_TRANSFER", "DELAYED_TRANSFER", "ECHECK"]
*
* @param string $payment_mode
*
*
* @return $this
*/
public function setPaymentMode($payment_mode)
@@ -122,7 +122,7 @@ class Sale extends PayPalResourceModel
}
/**
* specifies payment mode of the transaction
* Specifies payment mode of the transaction. Only supported when the `payment_method` is set to `paypal`.
*
* @return string
*/
@@ -132,35 +132,11 @@ class Sale extends PayPalResourceModel
}
/**
* Reason of Pending transaction.
*
*
*
* @param string $pending_reason
* @return $this
*/
public function setPendingReason($pending_reason)
{
$this->pending_reason = $pending_reason;
return $this;
}
/**
* Reason of Pending transaction.
*
* @return string
*/
public function getPendingReason()
{
return $this->pending_reason;
}
/**
* State of the sale transaction.
* State of the sale.
* Valid Values: ["completed", "partially_refunded", "pending", "refunded"]
*
* @param string $state
*
*
* @return $this
*/
public function setState($state)
@@ -170,7 +146,7 @@ class Sale extends PayPalResourceModel
}
/**
* State of the sale transaction.
* State of the sale.
*
* @return string
*/
@@ -180,11 +156,11 @@ class Sale extends PayPalResourceModel
}
/**
* Reason code for the transaction state being Pending or Reversed.
* Reason code for the transaction state being Pending or Reversed. Only supported when the `payment_method` is set to `paypal`.
* Valid Values: ["CHARGEBACK", "GUARANTEE", "BUYER_COMPLAINT", "REFUND", "UNCONFIRMED_SHIPPING_ADDRESS", "ECHECK", "INTERNATIONAL_WITHDRAWAL", "RECEIVING_PREFERENCE_MANDATES_MANUAL_ACTION", "PAYMENT_REVIEW", "REGULATORY_REVIEW", "UNILATERAL", "VERIFICATION_REQUIRED"]
*
* @param string $reason_code
*
*
* @return $this
*/
public function setReasonCode($reason_code)
@@ -194,7 +170,7 @@ class Sale extends PayPalResourceModel
}
/**
* Reason code for the transaction state being Pending or Reversed.
* Reason code for the transaction state being Pending or Reversed. Only supported when the `payment_method` is set to `paypal`.
*
* @return string
*/
@@ -204,11 +180,11 @@ class Sale extends PayPalResourceModel
}
/**
* Protection Eligibility of the Payer
* The level of seller protection in force for the transaction. Only supported when the `payment_method` is set to `paypal`.
* Valid Values: ["ELIGIBLE", "PARTIALLY_ELIGIBLE", "INELIGIBLE"]
*
* @param string $protection_eligibility
*
*
* @return $this
*/
public function setProtectionEligibility($protection_eligibility)
@@ -218,7 +194,7 @@ class Sale extends PayPalResourceModel
}
/**
* Protection Eligibility of the Payer
* The level of seller protection in force for the transaction. Only supported when the `payment_method` is set to `paypal`.
*
* @return string
*/
@@ -228,11 +204,11 @@ class Sale extends PayPalResourceModel
}
/**
* Protection Eligibility Type of the Payer
* Valid Values: ["ELIGIBLE", "ITEM_NOT_RECEIVED_ELIGIBLE", "INELIGIBLE", "UNAUTHORIZED_PAYMENT_ELIGIBLE"]
* The kind of seller protection in force for the transaction. It is returned only when protection_eligibility is ELIGIBLE or PARTIALLY_ELIGIBLE. Only supported when the `payment_method` is set to `paypal`.
* Valid Values: ["ITEM_NOT_RECEIVED_ELIGIBLE", "UNAUTHORIZED_PAYMENT_ELIGIBLE", "ITEM_NOT_RECEIVED_ELIGIBLE,UNAUTHORIZED_PAYMENT_ELIGIBLE"]
*
* @param string $protection_eligibility_type
*
*
* @return $this
*/
public function setProtectionEligibilityType($protection_eligibility_type)
@@ -242,7 +218,7 @@ class Sale extends PayPalResourceModel
}
/**
* Protection Eligibility Type of the Payer
* The kind of seller protection in force for the transaction. It is returned only when protection_eligibility is ELIGIBLE or PARTIALLY_ELIGIBLE. Only supported when the `payment_method` is set to `paypal`.
*
* @return string
*/
@@ -252,10 +228,10 @@ class Sale extends PayPalResourceModel
}
/**
* Expected clearing time for eCheck Transactions
* Expected clearing time for eCheck transactions. Only supported when the `payment_method` is set to `paypal`.
*
* @param string $clearing_time
*
*
* @return $this
*/
public function setClearingTime($clearing_time)
@@ -265,7 +241,7 @@ class Sale extends PayPalResourceModel
}
/**
* Expected clearing time for eCheck Transactions
* Expected clearing time for eCheck transactions. Only supported when the `payment_method` is set to `paypal`.
*
* @return string
*/
@@ -275,58 +251,87 @@ class Sale extends PayPalResourceModel
}
/**
* Indicates the credit status of fund to the recipient. It will be returned only when payment status is 'completed'
* Valid Values: ["COMPLETED", "HELD"]
* Status of the Recipient Fund. For now, it will be returned only when fund status is held
* Valid Values: ["HELD"]
*
* @param string $payment_hold_status
*
* @param string $recipient_fund_status
*
* @return $this
*/
public function setRecipientFundStatus($recipient_fund_status)
public function setPaymentHoldStatus($payment_hold_status)
{
$this->recipient_fund_status = $recipient_fund_status;
$this->payment_hold_status = $payment_hold_status;
return $this;
}
/**
* Indicates the credit status of fund to the recipient. It will be returned only when payment status is 'completed'
* Status of the Recipient Fund. For now, it will be returned only when fund status is held
*
* @return string
*/
public function getRecipientFundStatus()
public function getPaymentHoldStatus()
{
return $this->recipient_fund_status;
return $this->payment_hold_status;
}
/**
* Reason for holding the funds.
* Valid Values: ["NEW_SELLER_PAYMENT_HOLD", "PAYMENT_HOLD"]
* Reasons for PayPal holding recipient fund. It is set only if payment hold status is held
*
* @param string[] $payment_hold_reasons
*
* @param string $hold_reason
*
* @return $this
*/
public function setHoldReason($hold_reason)
public function setPaymentHoldReasons($payment_hold_reasons)
{
$this->hold_reason = $hold_reason;
$this->payment_hold_reasons = $payment_hold_reasons;
return $this;
}
/**
* Reason for holding the funds.
* Reasons for PayPal holding recipient fund. It is set only if payment hold status is held
*
* @return string
* @return string[]
*/
public function getHoldReason()
public function getPaymentHoldReasons()
{
return $this->hold_reason;
return $this->payment_hold_reasons;
}
/**
* Transaction fee applicable for this payment.
* Append PaymentHoldReasons to the list.
*
* @param string $string
* @return $this
*/
public function addPaymentHoldReason($string)
{
if (!$this->getPaymentHoldReasons()) {
return $this->setPaymentHoldReasons(array($string));
} else {
return $this->setPaymentHoldReasons(
array_merge($this->getPaymentHoldReasons(), array($string))
);
}
}
/**
* Remove PaymentHoldReasons from the list.
*
* @param string $string
* @return $this
*/
public function removePaymentHoldReason($string)
{
return $this->setPaymentHoldReasons(
array_diff($this->getPaymentHoldReasons(), array($string))
);
}
/**
* Transaction fee charged by PayPal for this transaction.
*
* @param \PayPal\Api\Currency $transaction_fee
*
*
* @return $this
*/
public function setTransactionFee($transaction_fee)
@@ -336,7 +341,7 @@ class Sale extends PayPalResourceModel
}
/**
* Transaction fee applicable for this payment.
* Transaction fee charged by PayPal for this transaction.
*
* @return \PayPal\Api\Currency
*/
@@ -346,10 +351,10 @@ class Sale extends PayPalResourceModel
}
/**
* Net amount payee receives for this transaction after deducting transaction fee.
* Net amount the merchant receives for this transaction in their receivable currency. Returned only in cross-currency use cases where a merchant bills a buyer in a non-primary currency for that buyer.
*
* @param \PayPal\Api\Currency $receivable_amount
*
*
* @return $this
*/
public function setReceivableAmount($receivable_amount)
@@ -359,7 +364,7 @@ class Sale extends PayPalResourceModel
}
/**
* Net amount payee receives for this transaction after deducting transaction fee.
* Net amount the merchant receives for this transaction in their receivable currency. Returned only in cross-currency use cases where a merchant bills a buyer in a non-primary currency for that buyer.
*
* @return \PayPal\Api\Currency
*/
@@ -369,10 +374,10 @@ class Sale extends PayPalResourceModel
}
/**
* Exchange rate applied for this transaction.
* Exchange rate applied for this transaction. Returned only in cross-currency use cases where a merchant bills a buyer in a non-primary currency for that buyer.
*
* @param string $exchange_rate
*
*
* @return $this
*/
public function setExchangeRate($exchange_rate)
@@ -382,7 +387,7 @@ class Sale extends PayPalResourceModel
}
/**
* Exchange rate applied for this transaction.
* Exchange rate applied for this transaction. Returned only in cross-currency use cases where a merchant bills a buyer in a non-primary currency for that buyer.
*
* @return string
*/
@@ -392,10 +397,10 @@ class Sale extends PayPalResourceModel
}
/**
* Fraud Management Filter (FMF) details applied for the payment that could result in accept/deny/pending action.
* Fraud Management Filter (FMF) details applied for the payment that could result in accept, deny, or pending action. Returned in a payment response only if the merchant has enabled FMF in the profile settings and one of the fraud filters was triggered based on those settings. See [Fraud Management Filters Summary](/docs/classic/fmf/integration-guide/FMFSummary/) for more information.
*
* @param \PayPal\Api\FmfDetails $fmf_details
*
*
* @return $this
*/
public function setFmfDetails($fmf_details)
@@ -405,7 +410,7 @@ class Sale extends PayPalResourceModel
}
/**
* Fraud Management Filter (FMF) details applied for the payment that could result in accept/deny/pending action.
* Fraud Management Filter (FMF) details applied for the payment that could result in accept, deny, or pending action. Returned in a payment response only if the merchant has enabled FMF in the profile settings and one of the fraud filters was triggered based on those settings. See [Fraud Management Filters Summary](/docs/classic/fmf/integration-guide/FMFSummary/) for more information.
*
* @return \PayPal\Api\FmfDetails
*/
@@ -415,10 +420,10 @@ class Sale extends PayPalResourceModel
}
/**
* Receipt id is 16 digit number payment identification number returned for guest users to identify the payment.
* Receipt id is a payment identification number returned for guest users to identify the payment.
*
* @param string $receipt_id
*
*
* @return $this
*/
public function setReceiptId($receipt_id)
@@ -428,7 +433,7 @@ class Sale extends PayPalResourceModel
}
/**
* Receipt id is 16 digit number payment identification number returned for guest users to identify the payment.
* Receipt id is a payment identification number returned for guest users to identify the payment.
*
* @return string
*/
@@ -438,10 +443,10 @@ class Sale extends PayPalResourceModel
}
/**
* ID of the Payment resource that this transaction is based on.
* ID of the payment resource on which this transaction is based.
*
* @param string $parent_payment
*
*
* @return $this
*/
public function setParentPayment($parent_payment)
@@ -451,7 +456,7 @@ class Sale extends PayPalResourceModel
}
/**
* ID of the Payment resource that this transaction is based on.
* ID of the payment resource on which this transaction is based.
*
* @return string
*/
@@ -461,10 +466,56 @@ class Sale extends PayPalResourceModel
}
/**
* Time the resource was created in UTC ISO8601 format.
* Response codes returned by the processor concerning the submitted payment. Only supported when the `payment_method` is set to `credit_card`.
*
* @param \PayPal\Api\ProcessorResponse $processor_response
*
* @return $this
*/
public function setProcessorResponse($processor_response)
{
$this->processor_response = $processor_response;
return $this;
}
/**
* Response codes returned by the processor concerning the submitted payment. Only supported when the `payment_method` is set to `credit_card`.
*
* @return \PayPal\Api\ProcessorResponse
*/
public function getProcessorResponse()
{
return $this->processor_response;
}
/**
* ID of the billing agreement used as reference to execute this transaction.
*
* @param string $billing_agreement_id
*
* @return $this
*/
public function setBillingAgreementId($billing_agreement_id)
{
$this->billing_agreement_id = $billing_agreement_id;
return $this;
}
/**
* ID of the billing agreement used as reference to execute this transaction.
*
* @return string
*/
public function getBillingAgreementId()
{
return $this->billing_agreement_id;
}
/**
* Time of sale 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)
@@ -474,7 +525,7 @@ class Sale extends PayPalResourceModel
}
/**
* Time the resource was created in UTC ISO8601 format.
* Time of sale as defined in [RFC 3339 Section 5.6](http://tools.ietf.org/html/rfc3339#section-5.6)
*
* @return string
*/
@@ -487,7 +538,7 @@ class Sale extends PayPalResourceModel
* Time the resource was last updated in UTC ISO8601 format.
*
* @param string $update_time
*
*
* @return $this
*/
public function setUpdateTime($update_time)
@@ -509,9 +560,9 @@ class Sale extends PayPalResourceModel
/**
* Retrieve details about a sale transaction by passing the sale_id in the request URI. This request returns only the sales that were created via the REST API.
*
* @param string $saleId
* @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 $saleId
* @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 Sale
*/
public static function get($saleId, $apiContext = null, $restCall = null)
@@ -534,9 +585,9 @@ class Sale extends PayPalResourceModel
/**
* Refund a completed payment by passing the sale_id in the request URI. In addition, include an empty JSON payload in the request body for a full refund. For a partial refund, include an amount object in the request body.
*
* @param Refund $refund
* @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 Refund $refund
* @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 Refund
*/
public function refund($refund, $apiContext = null, $restCall = null)