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
@@ -3,46 +3,46 @@
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PayPalResourceModel;
|
||||
use PayPal\Rest\ApiContext;
|
||||
use PayPal\Validation\ArgumentValidator;
|
||||
use PayPal\Rest\ApiContext;
|
||||
|
||||
/**
|
||||
* Class Sale
|
||||
*
|
||||
* A sale transaction.
|
||||
* A sale transaction. This is the resource that is returned as a part related resources in Payment
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @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 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
|
||||
* @property string billing_agreement_id
|
||||
* @property string create_time
|
||||
* @property string update_time
|
||||
* @property \PayPal\Api\Links[] links
|
||||
*/
|
||||
class Sale extends PayPalResourceModel
|
||||
{
|
||||
/**
|
||||
* ID of the sale transaction.
|
||||
* Identifier of the sale transaction.
|
||||
*
|
||||
* @param string $id
|
||||
*
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setId($id)
|
||||
@@ -52,7 +52,7 @@ class Sale extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* ID of the sale transaction.
|
||||
* Identifier of the sale transaction.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -62,10 +62,10 @@ class Sale extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Identifier of the purchased unit associated with this object.
|
||||
* Identifier to the purchase or transaction unit corresponding to this sale transaction.
|
||||
*
|
||||
* @param string $purchase_unit_reference_id
|
||||
*
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPurchaseUnitReferenceId($purchase_unit_reference_id)
|
||||
@@ -75,7 +75,7 @@ class Sale extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Identifier of the purchased unit associated with this object.
|
||||
* Identifier to the purchase or transaction unit corresponding to this sale transaction.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -88,7 +88,7 @@ class Sale extends PayPalResourceModel
|
||||
* Amount being collected.
|
||||
*
|
||||
* @param \PayPal\Api\Amount $amount
|
||||
*
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setAmount($amount)
|
||||
@@ -112,7 +112,7 @@ class Sale extends PayPalResourceModel
|
||||
* Valid Values: ["INSTANT_TRANSFER", "MANUAL_BANK_TRANSFER", "DELAYED_TRANSFER", "ECHECK"]
|
||||
*
|
||||
* @param string $payment_mode
|
||||
*
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPaymentMode($payment_mode)
|
||||
@@ -132,11 +132,11 @@ class Sale extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* State of the sale.
|
||||
* Valid Values: ["completed", "partially_refunded", "pending", "refunded"]
|
||||
* State of the sale transaction.
|
||||
* Valid Values: ["completed", "partially_refunded", "pending", "refunded", "denied"]
|
||||
*
|
||||
* @param string $state
|
||||
*
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setState($state)
|
||||
@@ -146,7 +146,7 @@ class Sale extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* State of the sale.
|
||||
* State of the sale transaction.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -157,10 +157,10 @@ class Sale extends PayPalResourceModel
|
||||
|
||||
/**
|
||||
* 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"]
|
||||
* 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", "TRANSACTION_APPROVED_AWAITING_FUNDING"]
|
||||
*
|
||||
* @param string $reason_code
|
||||
*
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setReasonCode($reason_code)
|
||||
@@ -180,11 +180,11 @@ class Sale extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* The level of seller protection in force for the transaction. Only supported when the `payment_method` is set to `paypal`.
|
||||
* 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)
|
||||
@@ -194,7 +194,7 @@ class Sale extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* The level of seller protection in force for the transaction. Only supported when the `payment_method` is set to `paypal`.
|
||||
* The level of seller protection in force for the transaction. Only supported when the `payment_method` is set to `paypal`.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -208,7 +208,7 @@ class Sale extends PayPalResourceModel
|
||||
* 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)
|
||||
@@ -228,10 +228,10 @@ class Sale extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Expected clearing time for eCheck transactions. Only supported when the `payment_method` is set to `paypal`.
|
||||
* Expected clearing time for eCheck Transactions. Returned when payment is made with eCheck. Only supported when the `payment_method` is set to `paypal`.
|
||||
*
|
||||
* @param string $clearing_time
|
||||
*
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setClearingTime($clearing_time)
|
||||
@@ -241,7 +241,7 @@ class Sale extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Expected clearing time for eCheck transactions. Only supported when the `payment_method` is set to `paypal`.
|
||||
* Expected clearing time for eCheck Transactions. Returned when payment is made with eCheck. Only supported when the `payment_method` is set to `paypal`.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -255,7 +255,7 @@ class Sale extends PayPalResourceModel
|
||||
* Valid Values: ["HELD"]
|
||||
*
|
||||
* @param string $payment_hold_status
|
||||
*
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPaymentHoldStatus($payment_hold_status)
|
||||
@@ -278,7 +278,7 @@ class Sale extends PayPalResourceModel
|
||||
* Reasons for PayPal holding recipient fund. It is set only if payment hold status is held
|
||||
*
|
||||
* @param string[] $payment_hold_reasons
|
||||
*
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPaymentHoldReasons($payment_hold_reasons)
|
||||
@@ -328,10 +328,10 @@ class Sale extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Transaction fee charged by PayPal for this transaction.
|
||||
* Transaction fee applicable for this payment.
|
||||
*
|
||||
* @param \PayPal\Api\Currency $transaction_fee
|
||||
*
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setTransactionFee($transaction_fee)
|
||||
@@ -341,7 +341,7 @@ class Sale extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Transaction fee charged by PayPal for this transaction.
|
||||
* Transaction fee applicable for this payment.
|
||||
*
|
||||
* @return \PayPal\Api\Currency
|
||||
*/
|
||||
@@ -354,7 +354,7 @@ class Sale extends PayPalResourceModel
|
||||
* 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)
|
||||
@@ -377,7 +377,7 @@ class Sale extends PayPalResourceModel
|
||||
* 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)
|
||||
@@ -400,7 +400,7 @@ class Sale extends PayPalResourceModel
|
||||
* 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)
|
||||
@@ -423,7 +423,7 @@ class Sale extends PayPalResourceModel
|
||||
* 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)
|
||||
@@ -446,7 +446,7 @@ class Sale extends PayPalResourceModel
|
||||
* ID of the payment resource on which this transaction is based.
|
||||
*
|
||||
* @param string $parent_payment
|
||||
*
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setParentPayment($parent_payment)
|
||||
@@ -469,7 +469,7 @@ class Sale extends PayPalResourceModel
|
||||
* 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)
|
||||
@@ -492,7 +492,7 @@ class Sale extends PayPalResourceModel
|
||||
* 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)
|
||||
@@ -515,7 +515,7 @@ class Sale extends PayPalResourceModel
|
||||
* 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)
|
||||
@@ -538,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)
|
||||
@@ -558,11 +558,11 @@ 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.
|
||||
* Shows details for a sale, by ID. Returns only sales that were created through 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)
|
||||
@@ -585,6 +585,7 @@ 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.
|
||||
*
|
||||
* @deprecated Please use #refundSale instead.
|
||||
* @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
|
||||
@@ -608,4 +609,29 @@ class Sale extends PayPalResourceModel
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Refunds a sale, by ID. For a full refund, include an empty payload in the JSON request body. For a partial refund, include an `amount` object in the JSON request body.
|
||||
*
|
||||
* @param RefundRequest $refundRequest
|
||||
* @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 DetailedRefund
|
||||
*/
|
||||
public function refundSale($refundRequest, $apiContext = null, $restCall = null)
|
||||
{
|
||||
ArgumentValidator::validate($this->getId(), "Id");
|
||||
ArgumentValidator::validate($refundRequest, 'refundRequest');
|
||||
$payLoad = $refundRequest->toJSON();
|
||||
$json = self::executeCall(
|
||||
"/v1/payments/sale/{$this->getId()}/refund",
|
||||
"POST",
|
||||
$payLoad,
|
||||
null,
|
||||
$apiContext,
|
||||
$restCall
|
||||
);
|
||||
$ret = new DetailedRefund();
|
||||
$ret->fromJson($json);
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user