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

support mit payment #35

Merged
merged 2 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 2 additions & 1 deletion src/Action/CaptureAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ private function prepareOrderRequest(Capture $request, TokenInterface $token, Mo
$payMethod,
$model->additionalDescription(),
$model->visibleDescription(),
$model->statementDescription()
$model->statementDescription(),
$model->cardOnFile()?->value
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you have enum use enum on construct and modify toArray() method

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

);
}

Expand Down
11 changes: 11 additions & 0 deletions src/Enum/CardOnFileEnum.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

declare(strict_types=1);

namespace Answear\Payum\PayU\Enum;

enum CardOnFileEnum: string
{
case First = 'FIRST';
case StandardMerchant = 'STANDARD_MERCHANT';
}
1 change: 1 addition & 0 deletions src/Enum/ModelFields.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,5 @@ enum ModelFields
public const REFUND_ID = 'refundId';
public const EXT_REFUND_ID = 'extRefundId';
public const PROPERTIES = 'properties';
public const CARD_ON_FILE = 'cardOnFile';
}
11 changes: 11 additions & 0 deletions src/Model/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Answear\Payum\PayU\Model;

use Answear\Payum\PayU\Enum\CardOnFileEnum;
use Answear\Payum\PayU\Enum\ModelFields;
use Answear\Payum\PayU\Enum\OrderStatus;
use Answear\Payum\PayU\Enum\PayMethodType;
Expand Down Expand Up @@ -177,6 +178,16 @@ public function setCreditCardMaskedNumber(?string $creditCardMaskedNumber): void
$this[ModelFields::CREDIT_CARD_MASKED_NUMBER] = $creditCardMaskedNumber;
}

public function cardOnFile(): ?CardOnFileEnum
{
return CardOnFileEnum::tryFrom($this[ModelFields::CARD_ON_FILE] ?? '');
}

public function setCardOnFile(?CardOnFileEnum $cardOnFileEnum): void
{
$this[ModelFields::CARD_ON_FILE] = $cardOnFileEnum?->value;
}

public function setPayUResponse(Response\OrderCreatedResponse $orderCreatedResponse): void
{
$this[ModelFields::PAYU_RESPONSE] = $orderCreatedResponse->toArray();
Expand Down
Loading