Вход Регистрация
Файл: sngine-v2.8/Script/includes/libs/PayPal/paypal/rest-api-sdk-php/lib/PayPal/Api/Payout.php
Строк: 145
<?php

namespace PayPalApi;

use 
PayPalCommonPayPalResourceModel;
use 
PayPalRestApiContext;
use 
PayPalTransportPayPalRestCall;
use 
PayPalValidationArgumentValidator;

/**
 * Class Payout
 *
 * This object represents a set of payouts that includes status data for the payouts. This object enables you to create a payout using a POST request.
 *
 * @package PayPalApi
 *
 * @property PayPalApiPayoutSenderBatchHeader sender_batch_header
 * @property PayPalApiPayoutItem[] items
 * @property PayPalApiLinks[] links
 */
class Payout extends PayPalResourceModel
{
    
/**
     * The original batch header as provided by the payment sender.
     *
     * @param PayPalApiPayoutSenderBatchHeader $sender_batch_header
     *
     * @return $this
     */
    
public function setSenderBatchHeader($sender_batch_header)
    {
        
$this->sender_batch_header $sender_batch_header;
        return 
$this;
    }

    
/**
     * The original batch header as provided by the payment sender.
     *
     * @return PayPalApiPayoutSenderBatchHeader
     */
    
public function getSenderBatchHeader()
    {
        return 
$this->sender_batch_header;
    }

    
/**
     * An array of payout items (that is, a set of individual payouts).
     *
     * @param PayPalApiPayoutItem[] $items
     *
     * @return $this
     */
    
public function setItems($items)
    {
        
$this->items $items;
        return 
$this;
    }

    
/**
     * An array of payout items (that is, a set of individual payouts).
     *
     * @return PayPalApiPayoutItem[]
     */
    
public function getItems()
    {
        return 
$this->items;
    }

    
/**
     * Append Items to the list.
     *
     * @param PayPalApiPayoutItem $payoutItem
     * @return $this
     */
    
public function addItem($payoutItem)
    {
        if (!
$this->getItems()) {
            return 
$this->setItems(array($payoutItem));
        } else {
            return 
$this->setItems(
                
array_merge($this->getItems(), array($payoutItem))
            );
        }
    }

    
/**
     * Remove Items from the list.
     *
     * @param PayPalApiPayoutItem $payoutItem
     * @return $this
     */
    
public function removeItem($payoutItem)
    {
        return 
$this->setItems(
            
array_diff($this->getItems(), array($payoutItem))
        );
    }

    
/**
     * Create a payout batch resource by passing a sender_batch_header and an items array to the request URI. The sender_batch_header contains payout parameters that describe the handling of a batch resource while the items array conatins payout items.
     *
     * @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 PayoutBatch
     */
    
public function create($params = array(), $apiContext null$restCall null)
    {
        
$params $params $params : array();
        
ArgumentValidator::validate($params'params');
        
$payLoad $this->toJSON();
        
$allowedParams = array(
            
'sync_mode' => 1,
        );
        
$json self::executeCall(
            
"/v1/payments/payouts" "?" http_build_query(array_intersect_key($params$allowedParams)),
            
"POST",
            
$payLoad,
            
null,
            
$apiContext,
            
$restCall
        
);
        
$ret = new PayoutBatch();
        
$ret->fromJson($json);
        return 
$ret;
    }

    
/**
     * You can submit a payout with a synchronous API call, which immediately returns the results of a PayPal payment.
     *
     * @param ApiContext $apiContext
     * @param PayPalRestCall $restCall
     * @return PayoutBatch
     */
    
public function createSynchronous($apiContext null$restCall null)
    {
        
$params = array('sync_mode' => 'true');
        return 
$this->create($params$apiContext$restCall);
    }

    
/**
     * Obtain the status of a specific batch resource by passing the payout batch ID to the request URI. You can issue this call multiple times to get the current status.
     *
     * @param string $payoutBatchId
     * @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 PayoutBatch
     */
    
public static function get($payoutBatchId$apiContext null$restCall null)
    {
        
ArgumentValidator::validate($payoutBatchId'payoutBatchId');
        
$payLoad "";
        
$json self::executeCall(
            
"/v1/payments/payouts/$payoutBatchId",
            
"GET",
            
$payLoad,
            
null,
            
$apiContext,
            
$restCall
        
);
        
$ret = new PayoutBatch();
        
$ret->fromJson($json);
        return 
$ret;
    }

}
Онлайн: 2
Реклама