Skip to content

Commit

Permalink
Use the constant available inside PaymentIntent class
Browse files Browse the repository at this point in the history
  • Loading branch information
Prometee committed Jun 11, 2024
1 parent 224ad1c commit d135928
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use FluxSE\PayumStripe\Token\TokenHashKeysInterface;
use Stripe\Event;
use Stripe\PaymentIntent;

final class AuthorizedPaymentIntentCanceledAction extends AbstractPaymentIntentAction
{
Expand All @@ -18,7 +19,7 @@ protected function getSupportedEventTypes(): array

protected function getSupportedCaptureMethod(): string
{
return 'manual';
return PaymentIntent::CAPTURE_METHOD_MANUAL;
}

public function getTokenHashMetadataKeyName(): string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use FluxSE\PayumStripe\Token\TokenHashKeysInterface;
use Stripe\Event;
use Stripe\PaymentIntent;

final class AuthorizedPaymentIntentManuallyCanceledAction extends AbstractPaymentIntentAction
{
Expand All @@ -18,7 +19,7 @@ protected function getSupportedEventTypes(): array

protected function getSupportedCaptureMethod(): string
{
return 'manual';
return PaymentIntent::CAPTURE_METHOD_MANUAL;
}

public function getTokenHashMetadataKeyName(): string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use FluxSE\PayumStripe\Token\TokenHashKeysInterface;
use Stripe\Event;
use Stripe\PaymentIntent;

final class AuthorizedPaymentIntentSucceededAction extends AbstractPaymentIntentAction
{
Expand All @@ -18,7 +19,7 @@ protected function getSupportedEventTypes(): array

protected function getSupportedCaptureMethod(): string
{
return 'manual';
return PaymentIntent::CAPTURE_METHOD_MANUAL;
}

public function getTokenHashMetadataKeyName(): string
Expand Down
3 changes: 2 additions & 1 deletion src/Action/Api/WebhookEvent/PaymentIntentCanceledAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace FluxSE\PayumStripe\Action\Api\WebhookEvent;

use Stripe\Event;
use Stripe\PaymentIntent;

final class PaymentIntentCanceledAction extends AbstractPaymentIntentAction
{
Expand All @@ -17,6 +18,6 @@ protected function getSupportedEventTypes(): array

protected function getSupportedCaptureMethod(): string
{
return 'automatic';
return PaymentIntent::CAPTURE_METHOD_AUTOMATIC;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace FluxSE\PayumStripe\Action\Api\WebhookEvent;

use Stripe\Event;
use Stripe\PaymentIntent;

final class PaymentIntentCanceledFromAuthorizeAction extends AbstractPaymentIntentAction
{
Expand All @@ -17,6 +18,6 @@ protected function getSupportedEventTypes(): array

protected function getSupportedCaptureMethod(): string
{
return 'manual';
return PaymentIntent::CAPTURE_METHOD_MANUAL;
}
}
3 changes: 2 additions & 1 deletion src/Action/Api/WebhookEvent/PaymentIntentSucceededAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace FluxSE\PayumStripe\Action\Api\WebhookEvent;

use Stripe\Event;
use Stripe\PaymentIntent;

final class PaymentIntentSucceededAction extends AbstractPaymentIntentAction
{
Expand All @@ -17,6 +18,6 @@ protected function getSupportedEventTypes(): array

protected function getSupportedCaptureMethod(): string
{
return 'automatic';
return PaymentIntent::CAPTURE_METHOD_AUTOMATIC;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace FluxSE\PayumStripe\Action\Api\WebhookEvent;

use Stripe\Event;
use Stripe\PaymentIntent;

final class PaymentIntentSucceededFromAuthorizeAction extends AbstractPaymentIntentAction
{
Expand All @@ -17,6 +18,6 @@ protected function getSupportedEventTypes(): array

protected function getSupportedCaptureMethod(): string
{
return 'manual';
return PaymentIntent::CAPTURE_METHOD_MANUAL;
}
}
3 changes: 2 additions & 1 deletion src/Action/StripeCheckoutSession/AuthorizeAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Payum\Core\Request\Authorize;
use Payum\Core\Request\Generic;
use Payum\Core\Security\TokenInterface;
use Stripe\PaymentIntent;

/**
* For more information about Stripe Authorize payments :.
Expand All @@ -34,7 +35,7 @@ public function embedOnModeData(ArrayObject $model, TokenInterface $token, strin

/** @var array $embeddedModeData */
$embeddedModeData = $model->offsetGet($modeDataKey);
$embeddedModeData['capture_method'] = 'manual';
$embeddedModeData['capture_method'] = PaymentIntent::CAPTURE_METHOD_MANUAL;
$model->offsetSet($modeDataKey, $embeddedModeData);
}

Expand Down
3 changes: 2 additions & 1 deletion src/Action/StripeJs/AuthorizeAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Payum\Core\Request\Authorize;
use Payum\Core\Request\Generic;
use Payum\Core\Security\TokenInterface;
use Stripe\PaymentIntent;

/**
* For more information about Stripe Authorize payments :.
Expand All @@ -19,7 +20,7 @@ final class AuthorizeAction extends CaptureAction
{
public function embedNotifyTokenHash(ArrayObject $model, Generic $request): TokenInterface
{
$model->offsetSet('capture_method', 'manual');
$model->offsetSet('capture_method', PaymentIntent::CAPTURE_METHOD_MANUAL);

return parent::embedNotifyTokenHash($model, $request);
}
Expand Down

0 comments on commit d135928

Please sign in to comment.