mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Fix psalm
This commit is contained in:
parent
0c2edc1ee7
commit
e3351b8822
5 changed files with 38 additions and 7 deletions
|
@ -10,6 +10,7 @@ declare(strict_types=1);
|
|||
namespace WooCommerce\PayPalCommerce\ApiClient\Endpoint;
|
||||
|
||||
use Psr\Log\LoggerInterface;
|
||||
use stdClass;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Authentication\Bearer;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Exception\PayPalApiException;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Exception\RuntimeException;
|
||||
|
@ -135,7 +136,13 @@ class BillingSubscriptions {
|
|||
}
|
||||
}
|
||||
|
||||
public function cancel( string $id ) {
|
||||
/**
|
||||
* Cancels a Subscription.
|
||||
*
|
||||
* @param string $id Subscription ID.
|
||||
* @return void
|
||||
*/
|
||||
public function cancel( string $id ): void {
|
||||
$data = array(
|
||||
'reason' => 'Cancelled by customer',
|
||||
);
|
||||
|
@ -166,7 +173,13 @@ class BillingSubscriptions {
|
|||
}
|
||||
}
|
||||
|
||||
public function subscription(string $id) {
|
||||
/**
|
||||
* Returns a Subscription object from the given ID.
|
||||
*
|
||||
* @param string $id Subscription ID.
|
||||
* @return stdClass
|
||||
*/
|
||||
public function subscription(string $id): stdClass {
|
||||
$bearer = $this->bearer->bearer();
|
||||
$url = trailingslashit( $this->host ) . 'v1/billing/subscriptions/' . $id;
|
||||
$args = array(
|
||||
|
|
|
@ -116,7 +116,14 @@ class CatalogProducts {
|
|||
return $this->product_factory->from_paypal_response($json);
|
||||
}
|
||||
|
||||
public function update(string $id, array $data) {
|
||||
/**
|
||||
* Updates a Product.
|
||||
*
|
||||
* @param string $id Product ID.
|
||||
* @param array $data Data to update.
|
||||
* @return void
|
||||
*/
|
||||
public function update(string $id, array $data): void {
|
||||
$bearer = $this->bearer->bearer();
|
||||
$url = trailingslashit( $this->host ) . 'v1/catalogs/products/' . $id;
|
||||
$args = array(
|
||||
|
@ -144,6 +151,12 @@ class CatalogProducts {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a Product from the given ID.
|
||||
*
|
||||
* @param string $id Product ID.
|
||||
* @return Product
|
||||
*/
|
||||
public function product(string $id): Product {
|
||||
$bearer = $this->bearer->bearer();
|
||||
$url = trailingslashit( $this->host ) . 'v1/catalogs/products/' . $id;
|
||||
|
|
|
@ -85,7 +85,12 @@ class BillingCycle {
|
|||
return $this->total_cycles;
|
||||
}
|
||||
|
||||
public function to_array() {
|
||||
/**
|
||||
* Returns Billing Cycle as array.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function to_array(): array {
|
||||
return array(
|
||||
'frequency' => $this->frequency(),
|
||||
'sequence' => $this->sequence(),
|
||||
|
|
|
@ -52,7 +52,7 @@ class PlanFactory
|
|||
$billing_cycles[] = $this->billing_cycle_factory->from_paypal_response($billing_cycle);
|
||||
}
|
||||
|
||||
$payment_preferences = $this->payment_preferences_factory->from_paypal_response($data->payment_preferences) ?? array();
|
||||
$payment_preferences = $this->payment_preferences_factory->from_paypal_response($data->payment_preferences);
|
||||
|
||||
return new Plan(
|
||||
$data->id,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue