Skip to content

Commit

Permalink
Add some Plan, Price and Product api actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Prometee committed Sep 19, 2023
1 parent 080833c commit 4677052
Show file tree
Hide file tree
Showing 30 changed files with 396 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/Action/Api/Resource/AllPlanAction.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

declare(strict_types=1);

namespace FluxSE\PayumStripe\Action\Api\Resource;

use FluxSE\PayumStripe\Request\Api\Resource\AllInterface;
use FluxSE\PayumStripe\Request\Api\Resource\AllPlan;
use Stripe\Service\AbstractService;
use Stripe\StripeClient;

final class AllPlanAction extends AbstractAllAction
{
public function getStripeService(StripeClient $stripeClient): AbstractService
{
return $stripeClient->plans;
}

public function supportAlso(AllInterface $request): bool
{
return $request instanceof AllPlan;
}
}
23 changes: 23 additions & 0 deletions src/Action/Api/Resource/AllPriceAction.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

declare(strict_types=1);

namespace FluxSE\PayumStripe\Action\Api\Resource;

use FluxSE\PayumStripe\Request\Api\Resource\AllInterface;
use FluxSE\PayumStripe\Request\Api\Resource\AllPrice;
use Stripe\Service\AbstractService;
use Stripe\StripeClient;

final class AllPriceAction extends AbstractAllAction
{
public function getStripeService(StripeClient $stripeClient): AbstractService
{
return $stripeClient->prices;
}

public function supportAlso(AllInterface $request): bool
{
return $request instanceof AllPrice;
}
}
23 changes: 23 additions & 0 deletions src/Action/Api/Resource/AllProductAction.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

declare(strict_types=1);

namespace FluxSE\PayumStripe\Action\Api\Resource;

use FluxSE\PayumStripe\Request\Api\Resource\AllInterface;
use FluxSE\PayumStripe\Request\Api\Resource\AllProduct;
use Stripe\Service\AbstractService;
use Stripe\StripeClient;

final class AllProductAction extends AbstractAllAction
{
public function getStripeService(StripeClient $stripeClient): AbstractService
{
return $stripeClient->products;
}

public function supportAlso(AllInterface $request): bool
{
return $request instanceof AllProduct;
}
}
23 changes: 23 additions & 0 deletions src/Action/Api/Resource/CreatePriceAction.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

declare(strict_types=1);

namespace FluxSE\PayumStripe\Action\Api\Resource;

use FluxSE\PayumStripe\Request\Api\Resource\CreatePrice;
use FluxSE\PayumStripe\Request\Api\Resource\CreateInterface;
use Stripe\Service\AbstractService;
use Stripe\StripeClient;

final class CreatePriceAction extends AbstractCreateAction
{
public function getStripeService(StripeClient $stripeClient): AbstractService
{
return $stripeClient->prices;
}

public function supportAlso(CreateInterface $request): bool
{
return $request instanceof CreatePrice;
}
}
23 changes: 23 additions & 0 deletions src/Action/Api/Resource/CreateProductAction.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

declare(strict_types=1);

namespace FluxSE\PayumStripe\Action\Api\Resource;

use FluxSE\PayumStripe\Request\Api\Resource\CreateProduct;
use FluxSE\PayumStripe\Request\Api\Resource\CreateInterface;
use Stripe\Service\AbstractService;
use Stripe\StripeClient;

final class CreateProductAction extends AbstractCreateAction
{
public function getStripeService(StripeClient $stripeClient): AbstractService
{
return $stripeClient->products;
}

public function supportAlso(CreateInterface $request): bool
{
return $request instanceof CreateProduct;
}
}
23 changes: 23 additions & 0 deletions src/Action/Api/Resource/DeleteProductAction.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

declare(strict_types=1);

namespace FluxSE\PayumStripe\Action\Api\Resource;

use FluxSE\PayumStripe\Request\Api\Resource\DeleteInterface;
use FluxSE\PayumStripe\Request\Api\Resource\DeleteProduct;
use Stripe\Service\AbstractService;
use Stripe\StripeClient;

final class DeleteProductAction extends AbstractDeleteAction
{
public function getStripeService(StripeClient $stripeClient): AbstractService
{
return $stripeClient->products;
}

public function supportAlso(DeleteInterface $request): bool
{
return $request instanceof DeleteProduct;
}
}
23 changes: 23 additions & 0 deletions src/Action/Api/Resource/RetrievePriceAction.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

declare(strict_types=1);

namespace FluxSE\PayumStripe\Action\Api\Resource;

use FluxSE\PayumStripe\Request\Api\Resource\RetrieveInterface;
use FluxSE\PayumStripe\Request\Api\Resource\RetrievePrice;
use Stripe\Service\AbstractService;
use Stripe\StripeClient;

final class RetrievePriceAction extends AbstractRetrieveAction
{
public function getStripeService(StripeClient $stripeClient): AbstractService
{
return $stripeClient->prices;
}

public function supportAlso(RetrieveInterface $request): bool
{
return $request instanceof RetrievePrice;
}
}
23 changes: 23 additions & 0 deletions src/Action/Api/Resource/UpdatePlanAction.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

declare(strict_types=1);

namespace FluxSE\PayumStripe\Action\Api\Resource;

use FluxSE\PayumStripe\Request\Api\Resource\UpdateInterface;
use FluxSE\PayumStripe\Request\Api\Resource\UpdatePlan;
use Stripe\Service\AbstractService;
use Stripe\StripeClient;

final class UpdatePlanAction extends AbstractUpdateAction
{
public function getStripeService(StripeClient $stripeClient): AbstractService
{
return $stripeClient->plans;
}

public function supportAlso(UpdateInterface $request): bool
{
return $request instanceof UpdatePlan;
}
}
23 changes: 23 additions & 0 deletions src/Action/Api/Resource/UpdatePriceAction.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

declare(strict_types=1);

namespace FluxSE\PayumStripe\Action\Api\Resource;

use FluxSE\PayumStripe\Request\Api\Resource\UpdateInterface;
use FluxSE\PayumStripe\Request\Api\Resource\UpdatePrice;
use Stripe\Service\AbstractService;
use Stripe\StripeClient;

final class UpdatePriceAction extends AbstractUpdateAction
{
public function getStripeService(StripeClient $stripeClient): AbstractService
{
return $stripeClient->prices;
}

public function supportAlso(UpdateInterface $request): bool
{
return $request instanceof UpdatePrice;
}
}
23 changes: 23 additions & 0 deletions src/Action/Api/Resource/UpdateProductAction.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

declare(strict_types=1);

namespace FluxSE\PayumStripe\Action\Api\Resource;

use FluxSE\PayumStripe\Request\Api\Resource\UpdateInterface;
use FluxSE\PayumStripe\Request\Api\Resource\UpdateProduct;
use Stripe\Service\AbstractService;
use Stripe\StripeClient;

final class UpdateProductAction extends AbstractUpdateAction
{
public function getStripeService(StripeClient $stripeClient): AbstractService
{
return $stripeClient->products;
}

public function supportAlso(UpdateInterface $request): bool
{
return $request instanceof UpdateProduct;
}
}
9 changes: 9 additions & 0 deletions src/Request/Api/Resource/AllPlan.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

declare(strict_types=1);

namespace FluxSE\PayumStripe\Request\Api\Resource;

final class AllPlan extends AbstractAll
{
}
9 changes: 9 additions & 0 deletions src/Request/Api/Resource/AllPrice.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

declare(strict_types=1);

namespace FluxSE\PayumStripe\Request\Api\Resource;

final class AllPrice extends AbstractAll
{
}
9 changes: 9 additions & 0 deletions src/Request/Api/Resource/AllProduct.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

declare(strict_types=1);

namespace FluxSE\PayumStripe\Request\Api\Resource;

final class AllProduct extends AbstractAll
{
}
9 changes: 9 additions & 0 deletions src/Request/Api/Resource/CreatePrice.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

declare(strict_types=1);

namespace FluxSE\PayumStripe\Request\Api\Resource;

final class CreatePrice extends AbstractCreate
{
}
9 changes: 9 additions & 0 deletions src/Request/Api/Resource/CreateProduct.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

declare(strict_types=1);

namespace FluxSE\PayumStripe\Request\Api\Resource;

final class CreateProduct extends AbstractCreate
{
}
9 changes: 9 additions & 0 deletions src/Request/Api/Resource/DeleteProduct.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

declare(strict_types=1);

namespace FluxSE\PayumStripe\Request\Api\Resource;

final class DeleteProduct extends AbstractDelete
{
}
9 changes: 9 additions & 0 deletions src/Request/Api/Resource/RetrievePrice.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

declare(strict_types=1);

namespace FluxSE\PayumStripe\Request\Api\Resource;

final class RetrievePrice extends AbstractRetrieve
{
}
9 changes: 9 additions & 0 deletions src/Request/Api/Resource/UpdatePlan.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

declare(strict_types=1);

namespace FluxSE\PayumStripe\Request\Api\Resource;

final class UpdatePlan extends AbstractUpdate
{
}
9 changes: 9 additions & 0 deletions src/Request/Api/Resource/UpdatePrice.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

declare(strict_types=1);

namespace FluxSE\PayumStripe\Request\Api\Resource;

final class UpdatePrice extends AbstractUpdate
{
}
9 changes: 9 additions & 0 deletions src/Request/Api/Resource/UpdateProduct.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

declare(strict_types=1);

namespace FluxSE\PayumStripe\Request\Api\Resource;

final class UpdateProduct extends AbstractUpdate
{
}
12 changes: 12 additions & 0 deletions tests/Action/Api/Resource/AllActionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
use FluxSE\PayumStripe\Action\Api\Resource\AllCouponAction;
use FluxSE\PayumStripe\Action\Api\Resource\AllCustomerAction;
use FluxSE\PayumStripe\Action\Api\Resource\AllInvoiceAction;
use FluxSE\PayumStripe\Action\Api\Resource\AllPlanAction;
use FluxSE\PayumStripe\Action\Api\Resource\AllPriceAction;
use FluxSE\PayumStripe\Action\Api\Resource\AllProductAction;
use FluxSE\PayumStripe\Action\Api\Resource\AllResourceActionInterface;
use FluxSE\PayumStripe\Action\Api\Resource\AllSessionAction;
use FluxSE\PayumStripe\Action\Api\Resource\AllTaxRateAction;
Expand All @@ -17,6 +20,9 @@
use FluxSE\PayumStripe\Request\Api\Resource\AllCustomer;
use FluxSE\PayumStripe\Request\Api\Resource\AllInterface;
use FluxSE\PayumStripe\Request\Api\Resource\AllInvoice;
use FluxSE\PayumStripe\Request\Api\Resource\AllPlan;
use FluxSE\PayumStripe\Request\Api\Resource\AllPrice;
use FluxSE\PayumStripe\Request\Api\Resource\AllProduct;
use FluxSE\PayumStripe\Request\Api\Resource\AllSession;
use FluxSE\PayumStripe\Request\Api\Resource\AllTaxRate;
use LogicException;
Expand All @@ -29,6 +35,9 @@
use Stripe\Coupon;
use Stripe\Customer;
use Stripe\Invoice;
use Stripe\Plan;
use Stripe\Price;
use Stripe\Product;
use Stripe\Service\AbstractService;
use Stripe\StripeClient;
use Stripe\TaxRate;
Expand Down Expand Up @@ -142,6 +151,9 @@ public function requestList(): array
[AllCouponAction::class, AllCoupon::class, Coupon::class],
[AllCustomerAction::class, AllCustomer::class, Customer::class],
[AllInvoiceAction::class, AllInvoice::class, Invoice::class],
[AllPlanAction::class, AllPlan::class, Plan::class],
[AllPriceAction::class, AllPrice::class, Price::class],
[AllProductAction::class, AllProduct::class, Product::class],
[AllTaxRateAction::class, AllTaxRate::class, TaxRate::class],
[AllSessionAction::class, AllSession::class, Session::class],
];
Expand Down
Loading

0 comments on commit 4677052

Please sign in to comment.