Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated methods #692

Merged
merged 1 commit into from
Aug 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions lib/ApplicationFee.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,6 @@ class ApplicationFee extends ApiResource

const PATH_REFUNDS = '/refunds';

/**
* @param array|null $params
* @param array|string|null $opts
*
* @return ApplicationFee The refunded application fee.
*/
public function refund($params = null, $opts = null)
{
$this->refunds->create($params, $opts);
$this->refresh();
return $this;
}

/**
* @param string|null $id The ID of the application fee on which to create the refund.
* @param array|null $params
Expand Down
73 changes: 0 additions & 73 deletions lib/Charge.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,20 +117,6 @@ class Charge extends ApiResource
const STATUS_PENDING = 'pending';
const STATUS_SUCCEEDED = 'succeeded';

/**
* @param array|null $params
* @param array|string|null $options
*
* @return Charge The refunded charge.
*/
public function refund($params = null, $options = null)
{
$url = $this->instanceUrl() . '/refund';
list($response, $opts) = $this->_request('post', $url, $params, $options);
$this->refreshFrom($response, $opts);
return $this;
}

/**
* @param array|null $params
* @param array|string|null $options
Expand All @@ -144,63 +130,4 @@ public function capture($params = null, $options = null)
$this->refreshFrom($response, $opts);
return $this;
}

/**
* @param array|null $params
* @param array|string|null $options
*
* @deprecated Use the `save` method on the Dispute object
*
* @return array The updated dispute.
*/
public function updateDispute($params = null, $options = null)
{
$url = $this->instanceUrl() . '/dispute';
list($response, $opts) = $this->_request('post', $url, $params, $options);
$this->refreshFrom(['dispute' => $response], $opts, true);
return $this->dispute;
}

/**
* @param array|string|null $options
*
* @deprecated Use the `close` method on the Dispute object
*
* @return Charge The updated charge.
*/
public function closeDispute($options = null)
{
$url = $this->instanceUrl() . '/dispute/close';
list($response, $opts) = $this->_request('post', $url, null, $options);
$this->refreshFrom($response, $opts);
return $this;
}

/**
* @param array|string|null $opts
*
* @return Charge The updated charge.
*/
public function markAsFraudulent($opts = null)
{
$params = ['fraud_details' => ['user_report' => 'fraudulent']];
$url = $this->instanceUrl();
list($response, $opts) = $this->_request('post', $url, $params, $opts);
$this->refreshFrom($response, $opts);
return $this;
}

/**
* @param array|string|null $opts
*
* @return Charge The updated charge.
*/
public function markAsSafe($opts = null)
{
$params = ['fraud_details' => ['user_report' => 'safe']];
$url = $this->instanceUrl();
list($response, $opts) = $this->_request('post', $url, $params, $opts);
$this->refreshFrom($response, $opts);
return $this;
}
}
78 changes: 0 additions & 78 deletions lib/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,84 +65,6 @@ public static function getSavedNestedResources()
const PATH_SOURCES = '/sources';
const PATH_TAX_IDS = '/tax_ids';

/**
* @param array|null $params
*
* @return InvoiceItem The resulting invoice item.
*/
public function addInvoiceItem($params = null)
{
$params = $params ?: [];
$params['customer'] = $this->id;
$ii = InvoiceItem::create($params, $this->_opts);
return $ii;
}

/**
* @param array|null $params
*
* @return array An array of the customer's Invoices.
*/
public function invoices($params = null)
{
$params = $params ?: [];
$params['customer'] = $this->id;
$invoices = Invoice::all($params, $this->_opts);
return $invoices;
}

/**
* @param array|null $params
*
* @return array An array of the customer's InvoiceItems.
*/
public function invoiceItems($params = null)
{
$params = $params ?: [];
$params['customer'] = $this->id;
$iis = InvoiceItem::all($params, $this->_opts);
return $iis;
}

/**
* @param array|null $params
*
* @return array An array of the customer's Charges.
*/
public function charges($params = null)
{
$params = $params ?: [];
$params['customer'] = $this->id;
$charges = Charge::all($params, $this->_opts);
return $charges;
}

/**
* @param array|null $params
*
* @return Subscription The updated subscription.
*/
public function updateSubscription($params = null)
{
$url = $this->instanceUrl() . '/subscription';
list($response, $opts) = $this->_request('post', $url, $params);
$this->refreshFrom(['subscription' => $response], $opts, true);
return $this->subscription;
}

/**
* @param array|null $params
*
* @return Subscription The cancelled subscription.
*/
public function cancelSubscription($params = null)
{
$url = $this->instanceUrl() . '/subscription';
list($response, $opts) = $this->_request('delete', $url, $params);
$this->refreshFrom(['subscription' => $response], $opts, true);
return $this->subscription;
}

/**
* @return Customer The updated customer.
*/
Expand Down
13 changes: 0 additions & 13 deletions lib/Recipient.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,4 @@ class Recipient extends ApiResource
use ApiOperations\Delete;
use ApiOperations\Retrieve;
use ApiOperations\Update;

/**
* @param array|null $params
*
* @return Collection of the Recipient's Transfers
*/
public function transfers($params = null)
{
$params = $params ?: [];
$params['recipient'] = $this->id;
$transfers = Transfer::all($params, $this->_opts);
return $transfers;
}
}
13 changes: 0 additions & 13 deletions lib/Source.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,19 +109,6 @@ public function detach($params = null, $options = null)
}
}

/**
* @param array|null $params
* @param array|string|null $options
*
* @return Source The detached source.
*
* @deprecated Use the `detach` method instead.
*/
public function delete($params = null, $options = null)
{
$this->detach($params, $options);
}

/**
* @param array|null $params
* @param array|string|null $options
Expand Down
11 changes: 0 additions & 11 deletions lib/Transfer.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,6 @@ class Transfer extends ApiResource
const SOURCE_TYPE_CARD = 'card';
const SOURCE_TYPE_FINANCING = 'financing';

/**
* @return TransferReversal The created transfer reversal.
*/
public function reverse($params = null, $opts = null)
{
$url = $this->instanceUrl() . '/reversals';
list($response, $opts) = $this->_request('post', $url, $params, $opts);
$this->refreshFrom($response, $opts);
return $this;
}

/**
* @return Transfer The canceled transfer.
*/
Expand Down
12 changes: 0 additions & 12 deletions tests/Stripe/ApplicationFeeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,6 @@ public function testIsRetrievable()
$this->assertInstanceOf(\Stripe\ApplicationFee::class, $resource);
}

public function testIsRefundable()
{
$fee = ApplicationFee::retrieve(self::TEST_RESOURCE_ID);
$this->expectsRequest(
'post',
'/v1/application_fees/' . $fee->id . '/refunds'
);
$resource = $fee->refund();
$this->assertInstanceOf(\Stripe\ApplicationFee::class, $resource);
$this->assertSame($resource, $fee);
}

public function testCanCreateRefund()
{
$this->expectsRequest(
Expand Down
61 changes: 0 additions & 61 deletions tests/Stripe/ChargeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,6 @@ public function testIsUpdatable()
$this->assertInstanceOf(\Stripe\Charge::class, $resource);
}

public function testCanRefund()
{
$charge = Charge::retrieve(self::TEST_RESOURCE_ID);
$this->expectsRequest(
'post',
'/v1/charges/' . $charge->id . '/refund'
);
$resource = $charge->refund();
$this->assertInstanceOf(\Stripe\Charge::class, $resource);
$this->assertSame($resource, $charge);
}

public function testCanCapture()
{
$charge = Charge::retrieve(self::TEST_RESOURCE_ID);
Expand All @@ -88,53 +76,4 @@ public function testCanCapture()
$this->assertInstanceOf(\Stripe\Charge::class, $resource);
$this->assertSame($resource, $charge);
}

public function testCanUpdateDispute()
{
$charge = Charge::retrieve(self::TEST_RESOURCE_ID);
$this->expectsRequest(
'post',
'/v1/charges/' . $charge->id . '/dispute'
);
$resource = $charge->updateDispute();
$this->assertInstanceOf(\Stripe\Dispute::class, $resource);
}

public function testCanCloseDispute()
{
$charge = Charge::retrieve(self::TEST_RESOURCE_ID);
$this->expectsRequest(
'post',
'/v1/charges/' . $charge->id . '/dispute/close'
);
$resource = $charge->closeDispute();
$this->assertInstanceOf(\Stripe\Charge::class, $resource);
$this->assertSame($resource, $charge);
}

public function testCanMarkAsFraudulent()
{
$charge = Charge::retrieve(self::TEST_RESOURCE_ID);
$this->expectsRequest(
'post',
'/v1/charges/' . $charge->id,
['fraud_details' => ['user_report' => 'fraudulent']]
);
$resource = $charge->markAsFraudulent();
$this->assertInstanceOf(\Stripe\Charge::class, $resource);
$this->assertSame($resource, $charge);
}

public function testCanMarkAsSafe()
{
$charge = Charge::retrieve(self::TEST_RESOURCE_ID);
$this->expectsRequest(
'post',
'/v1/charges/' . $charge->id,
['fraud_details' => ['user_report' => 'safe']]
);
$resource = $charge->markAsSafe();
$this->assertInstanceOf(\Stripe\Charge::class, $resource);
$this->assertSame($resource, $charge);
}
}
Loading