Skip to content

Commit

Permalink
Fix: Invoke static method statically (#1557)
Browse files Browse the repository at this point in the history
* Fix: Invoke static method statically

* formatting

---------

Co-authored-by: Taylor Otwell <[email protected]>
  • Loading branch information
localheinz and taylorotwell authored Aug 30, 2023
1 parent 635f8b8 commit 7d5c3f8
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 25 deletions.
22 changes: 11 additions & 11 deletions src/Concerns/ManagesCustomer.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function createAsStripeCustomer(array $options = [])
// Here we will create the customer instance on Stripe and store the ID of the
// user from Stripe. This ID will correspond with the Stripe user instances
// and allow us to retrieve users from Stripe later when we need to work.
$customer = $this->stripe()->customers->create($options);
$customer = static::stripe()->customers->create($options);

$this->stripe_id = $customer->id;

Expand All @@ -107,7 +107,7 @@ public function createAsStripeCustomer(array $options = [])
*/
public function updateStripeCustomer(array $options = [])
{
return $this->stripe()->customers->update(
return static::stripe()->customers->update(
$this->stripe_id, $options
);
}
Expand Down Expand Up @@ -137,7 +137,7 @@ public function asStripeCustomer(array $expand = [])
{
$this->assertCustomerExists();

return $this->stripe()->customers->retrieve(
return static::stripe()->customers->retrieve(
$this->stripe_id, ['expand' => $expand]
);
}
Expand Down Expand Up @@ -279,7 +279,7 @@ public function applyPromotionCode($promotionCodeId)
*/
public function findPromotionCode($code, array $options = [])
{
$codes = $this->stripe()->promotionCodes->all(array_merge([
$codes = static::stripe()->promotionCodes->all(array_merge([
'code' => $code,
'limit' => 1,
], $options));
Expand Down Expand Up @@ -338,7 +338,7 @@ public function balanceTransactions($limit = 10, array $options = [])
return new Collection();
}

$transactions = $this->stripe()
$transactions = static::stripe()
->customers
->allBalanceTransactions($this->stripe_id, array_merge(['limit' => $limit], $options));

Expand Down Expand Up @@ -385,7 +385,7 @@ public function applyBalance($amount, $description = null, array $options = [])
{
$this->assertCustomerExists();

$transaction = $this->stripe()
$transaction = static::stripe()
->customers
->createBalanceTransaction($this->stripe_id, array_filter(array_merge([
'amount' => $amount,
Expand Down Expand Up @@ -428,7 +428,7 @@ public function billingPortalUrl($returnUrl = null, array $options = [])
{
$this->assertCustomerExists();

return $this->stripe()->billingPortal->sessions->create(array_merge([
return static::stripe()->billingPortal->sessions->create(array_merge([
'customer' => $this->stripeId(),
'return_url' => $returnUrl ?? route('home'),
], $options))['url'];
Expand Down Expand Up @@ -458,7 +458,7 @@ public function taxIds(array $options = [])
$this->assertCustomerExists();

return new Collection(
$this->stripe()->customers->allTaxIds($this->stripe_id, $options)->data
static::stripe()->customers->allTaxIds($this->stripe_id, $options)->data
);
}

Expand All @@ -472,7 +472,7 @@ public function findTaxId($id)
$this->assertCustomerExists();

try {
return $this->stripe()->customers->retrieveTaxId(
return static::stripe()->customers->retrieveTaxId(
$this->stripe_id, $id, []
);
} catch (StripeInvalidRequestException $exception) {
Expand All @@ -491,7 +491,7 @@ public function createTaxId($type, $value)
{
$this->assertCustomerExists();

return $this->stripe()->customers->createTaxId($this->stripe_id, [
return static::stripe()->customers->createTaxId($this->stripe_id, [
'type' => $type,
'value' => $value,
]);
Expand All @@ -508,7 +508,7 @@ public function deleteTaxId($id)
$this->assertCustomerExists();

try {
$this->stripe()->customers->deleteTaxId($this->stripe_id, $id);
static::stripe()->customers->deleteTaxId($this->stripe_id, $id);
} catch (StripeInvalidRequestException $exception) {
//
}
Expand Down
14 changes: 7 additions & 7 deletions src/Concerns/ManagesInvoices.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function tab($description, $amount, array $options = [])
$options['amount'] = $amount;
}

return $this->stripe()->invoiceItems->create($options);
return static::stripe()->invoiceItems->create($options);
}

/**
Expand Down Expand Up @@ -90,7 +90,7 @@ public function tabPrice($price, $quantity = 1, array $options = [])
'quantity' => $quantity,
], $options);

return $this->stripe()->invoiceItems->create($options);
return static::stripe()->invoiceItems->create($options);
}

/**
Expand Down Expand Up @@ -140,7 +140,7 @@ public function invoice(array $options = [])
return $invoice->chargesAutomatically() ? $invoice->pay($payOptions) : $invoice->send();
} catch (StripeCardException) {
$payment = new Payment(
$this->stripe()->paymentIntents->retrieve(
static::stripe()->paymentIntents->retrieve(
$invoice->asStripeInvoice()->refresh()->payment_intent,
['expand' => ['invoice.subscription']]
)
Expand Down Expand Up @@ -169,7 +169,7 @@ public function createInvoice(array $options = [])
unset($parameters['pending_invoice_items_behavior']);
}

$stripeInvoice = $this->stripe()->invoices->create($parameters);
$stripeInvoice = static::stripe()->invoices->create($parameters);

return new Invoice($this, $stripeInvoice);
}
Expand All @@ -192,7 +192,7 @@ public function upcomingInvoice(array $options = [])
], $options);

try {
$stripeInvoice = $this->stripe()->invoices->upcoming($parameters);
$stripeInvoice = static::stripe()->invoices->upcoming($parameters);

return new Invoice($this, $stripeInvoice, $parameters);
} catch (StripeInvalidRequestException $exception) {
Expand All @@ -211,7 +211,7 @@ public function findInvoice($id)
$stripeInvoice = null;

try {
$stripeInvoice = $this->stripe()->invoices->retrieve($id);
$stripeInvoice = static::stripe()->invoices->retrieve($id);
} catch (StripeInvalidRequestException $exception) {
//
}
Expand Down Expand Up @@ -275,7 +275,7 @@ public function invoices($includePending = false, $parameters = [])

$parameters = array_merge(['limit' => 24], $parameters);

$stripeInvoices = $this->stripe()->invoices->all(
$stripeInvoices = static::stripe()->invoices->all(
['customer' => $this->stripe_id] + $parameters
);

Expand Down
8 changes: 4 additions & 4 deletions src/Concerns/ManagesPaymentMethods.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function createSetupIntent(array $options = [])
$options['customer'] = $this->stripe_id;
}

return $this->stripe()->setupIntents->create($options);
return static::stripe()->setupIntents->create($options);
}

/**
Expand All @@ -36,7 +36,7 @@ public function createSetupIntent(array $options = [])
*/
public function findSetupIntent(string $id, array $params = [], array $options = [])
{
return $this->stripe()->setupIntents->retrieve($id, $params, $options);
return static::stripe()->setupIntents->retrieve($id, $params, $options);
}

/**
Expand Down Expand Up @@ -76,7 +76,7 @@ public function paymentMethods($type = 'card', $parameters = [])
$parameters = array_merge(['limit' => 24], $parameters);

// "type" is temporarily required by Stripe...
$paymentMethods = $this->stripe()->paymentMethods->all(
$paymentMethods = static::stripe()->paymentMethods->all(
['customer' => $this->stripe_id, 'type' => $type] + $parameters
);

Expand Down Expand Up @@ -309,6 +309,6 @@ protected function resolveStripePaymentMethod($paymentMethod)
return $paymentMethod;
}

return $this->stripe()->paymentMethods->retrieve($paymentMethod);
return static::stripe()->paymentMethods->retrieve($paymentMethod);
}
}
6 changes: 3 additions & 3 deletions src/Concerns/PerformsCharges.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function createPayment($amount, array $options = [])
}

return new Payment(
$this->stripe()->paymentIntents->create($options)
static::stripe()->paymentIntents->create($options)
);
}

Expand All @@ -105,7 +105,7 @@ public function findPayment($id)
$stripePaymentIntent = null;

try {
$stripePaymentIntent = $this->stripe()->paymentIntents->retrieve($id);
$stripePaymentIntent = static::stripe()->paymentIntents->retrieve($id);
} catch (StripeInvalidRequestException $exception) {
//
}
Expand All @@ -122,7 +122,7 @@ public function findPayment($id)
*/
public function refund($paymentIntent, array $options = [])
{
return $this->stripe()->refunds->create(
return static::stripe()->refunds->create(
['payment_intent' => $paymentIntent] + $options
);
}
Expand Down

0 comments on commit 7d5c3f8

Please sign in to comment.