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

[FEATURE]Plugin development #3

Merged
merged 9 commits into from
Feb 20, 2024
Merged

Conversation

liszkapawel
Copy link
Collaborator

No description provided.

$orderData = $this->prepareOrderData($order, $token);

$model['tokenHash'] = $token->getHash();
$model['statusImoje'] = ImojeApiInterface::NEW_STATUS;
Copy link
Member

Choose a reason for hiding this comment

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

I think it will be better if you move the field names to the common model interface. In other actions you also use these field.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think I should leave it like that - it's kind of standard in payum and this model doesn't have a specific interface

return $orderData;
}

private function createSignature(array $fields, string $serviceKey): string
Copy link
Member

Choose a reason for hiding this comment

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

it can be simple separate service (I'm not sure because I don't know the requirements of the gateway but if someone who is going to use the plugin wants to change these signatures then all they need to do is overwrite this one small service without dependencies)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

moved to SignatureResolver

$serviceKey = $this->api->getServiceKey();

$parts = [];
parse_str(str_replace([';', '='], ['&', '='], $headerSignature), $parts);
Copy link
Member

Choose a reason for hiding this comment

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

you can also move these strings to this common interface

Comment on lines +10 to +11
public const SANDBOX_PAYWALL_URL = 'https://sandbox.paywall.imoje.pl/payment';
public const PRODUCTION_PAYWALL_URL = 'https://paywall.imoje.pl/payment';

Choose a reason for hiding this comment

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

Isn't it better to have it as parameter in case they change something?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think there is not much chance of changing this link and they are not available in the imoje admin panel, so the end user would have to look for it in the API documentation

public function verifyImojeNotification(Request $request): Response
{
if (!$request->getContent()) {
return new Response('', 204);

Choose a reason for hiding this comment

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

Suggested change
return new Response('', 204);
return new Response('', Response::HTTP_NO_CONTENT);

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

changed


$gateway->execute(new Notify($notifyToken));

return new JsonResponse(['status' => 'ok'], 200);

Choose a reason for hiding this comment

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

Suggested change
return new JsonResponse(['status' => 'ok'], 200);
return new JsonResponse(['status' => 'ok']);

You don't need to pass default value of the argument

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

changed

@liszkapawel liszkapawel merged commit 4eadd8f into 1.12 Feb 20, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants