dolibarr/htdocs/includes/stripe/lib/ApplicationFee.php

107 lines
3.0 KiB
PHP
Raw Normal View History

2017-04-18 05:44:08 +02:00
<?php
namespace Stripe;
/**
* Class ApplicationFee
*
2018-03-06 13:52:56 +01:00
* @property string $id
* @property string $object
* @property string $account
* @property int $amount
* @property int $amount_refunded
* @property string $application
* @property string $balance_transaction
* @property string $charge
* @property int $created
* @property string $currency
* @property bool $livemode
* @property string $originating_transaction
* @property bool $refunded
* @property Collection $refunds
*
2017-04-18 05:44:08 +02:00
* @package Stripe
*/
class ApplicationFee extends ApiResource
{
2018-03-06 13:52:56 +01:00
use ApiOperations\All;
use ApiOperations\NestedResource;
use ApiOperations\Retrieve;
const PATH_REFUNDS = '/refunds';
2017-04-18 05:44:08 +02:00
/**
* This is a special case because the application fee endpoint has an
* underscore in it. The parent `className` function strips underscores.
*
* @return string The name of the class.
*/
public static function className()
{
return 'application_fee';
}
/**
2018-03-06 13:52:56 +01:00
* @param array|null $params
2017-04-18 05:44:08 +02:00
* @param array|string|null $opts
*
2018-03-06 13:52:56 +01:00
* @return ApplicationFee The refunded application fee.
2017-04-18 05:44:08 +02:00
*/
2018-03-06 13:52:56 +01:00
public function refund($params = null, $opts = null)
2017-04-18 05:44:08 +02:00
{
2018-03-06 13:52:56 +01:00
$this->refunds->create($params, $opts);
$this->refresh();
return $this;
2017-04-18 05:44:08 +02:00
}
/**
2018-03-06 13:52:56 +01:00
* @param array|null $id The ID of the application fee on which to create the refund.
2017-04-18 05:44:08 +02:00
* @param array|null $params
2018-03-06 13:52:56 +01:00
* @param array|string|null $opts
2017-04-18 05:44:08 +02:00
*
2018-03-06 13:52:56 +01:00
* @return ApplicationFeeRefund
2017-04-18 05:44:08 +02:00
*/
2018-03-06 13:52:56 +01:00
public static function createRefund($id, $params = null, $opts = null)
2017-04-18 05:44:08 +02:00
{
2018-03-06 13:52:56 +01:00
return self::_createNestedResource($id, static::PATH_REFUNDS, $params, $opts);
2017-04-18 05:44:08 +02:00
}
/**
2018-03-06 13:52:56 +01:00
* @param array|null $id The ID of the application fee to which the refund belongs.
* @param array|null $refundId The ID of the refund to retrieve.
2017-04-18 05:44:08 +02:00
* @param array|null $params
* @param array|string|null $opts
*
2018-03-06 13:52:56 +01:00
* @return ApplicationFeeRefund
2017-04-18 05:44:08 +02:00
*/
2018-03-06 13:52:56 +01:00
public static function retrieveRefund($id, $refundId, $params = null, $opts = null)
2017-04-18 05:44:08 +02:00
{
2018-03-06 13:52:56 +01:00
return self::_retrieveNestedResource($id, static::PATH_REFUNDS, $refundId, $params, $opts);
2017-04-18 05:44:08 +02:00
}
/**
2018-03-06 13:52:56 +01:00
* @param array|null $id The ID of the application fee to which the refund belongs.
* @param array|null $refundId The ID of the refund to update.
2017-04-18 05:44:08 +02:00
* @param array|null $params
* @param array|string|null $opts
*
2018-03-06 13:52:56 +01:00
* @return ApplicationFeeRefund
2017-04-18 05:44:08 +02:00
*/
2018-03-06 13:52:56 +01:00
public static function updateRefund($id, $refundId, $params = null, $opts = null)
2017-04-18 05:44:08 +02:00
{
2018-03-06 13:52:56 +01:00
return self::_updateNestedResource($id, static::PATH_REFUNDS, $refundId, $params, $opts);
}
/**
* @param array|null $id The ID of the application fee on which to retrieve the refunds.
* @param array|null $params
* @param array|string|null $opts
*
* @return ApplicationFeeRefund
*/
public static function allRefunds($id, $params = null, $opts = null)
{
return self::_allNestedResources($id, static::PATH_REFUNDS, $params, $opts);
2017-04-18 05:44:08 +02:00
}
}