Mangopay / mangopay2-php-sdk

PHP SDK for MANGOPAY
https://packagist.org/packages/mangopay/php-sdk-v2
MIT License
122 stars 133 forks source link

Add cards/deactivate endpoint #569

Closed SwiTool closed 2 years ago

SwiTool commented 2 years ago

This endpoint is missing from the library : https://docs.mangopay.com/endpoints/v2/cards#e182_deactivate-a-card

There is not even a proper documentation about this. My users want to delete their cards for security reasons. I cannot find another route in the documentation that explicitly deletes a card.

I saw in another issue that MangoPay does not allow to delete resources, only get/post/patch, but if a user wants his resources deleted, shouldn't they be ?

Thanks

H4wKs commented 2 years ago

Hi,

You can't delete it from MangoPay, only deactivate it. I think this mandatory for them as a PSP, they need to keep logs and a card is associated with payment, same for you. You should just not list to your customer a card that have been deactivated.

If you want more information about this, you should contact MangoPay support.

Cheers,

Marc

SwiTool commented 2 years ago

Hi,

You can't delete it from MangoPay, only deactivate it.

Yeah that is what I wanted to do, but after some research, there is no such possibility with that library. Do you plan to add it soon, or do I have to make a PR ?

Thanks!

H4wKs commented 2 years ago

Hi @SwiTool,

Yeah that is what I wanted to do, but after some research, there is no such possibility with that library. Do you plan to add it soon, or do I have to make a PR ?

Just to be clear, I don't work for MangoPay, I am just a customer and a contributor to the MangoPay PHP SDK.

The problem here is not the library, the delete option simply do not exist at the API level. Like I said, you should bring this up with the support directly, but I don't believe there is going to be such an option anytime soon.

Cheers,

Marc

SwiTool commented 2 years ago

Hey @H4wKs

Just to be clear, I don't work for MangoPay, I am just a customer and a contributor to the MangoPay PHP SDK.

Right 😅

The problem here is not the library, the delete option simply do not exist at the API level

Nah you did not get my point. As the title of this issue mentions, there is a missing deactivate card API in this library.

I don't know the roadmap if there is anyone working on this library, but i'm in a need of that feature so if not planned then I might work on it.

I hope I was clear this time 🥵

H4wKs commented 2 years ago

Hej !

Nah you did not get my point. As the title of this issue mentions, there is a missing deactivate card API in this library. I don't know the roadmap if there is anyone working on this library, but i'm in a need of that feature so if not planned then I might work on it.

I hope I was clear this time 🥵

My bad. So this feature is already available, it's just not really explicit right now. Here is how you should be able to achieve this:

$card = $mangoPayApi->Cards->Get($cardId);
$card->Active = false;
$mangoPayApi->Cards->Update($card);

Where $cardId is the MangoPay card id you want to deactivate.

Be aware that once a card have been deactivated, there is no way to activate it again, you'll need to register a new card.

Cheers,

Marc.

SwiTool commented 2 years ago

Thanks, that was what I needed !