Mangopay / mangopay

MANGOPAY API Known Issues
3 stars 2 forks source link

New Api method : Get Transaction #41

Closed tchiotludo closed 7 years ago

tchiotludo commented 7 years ago

For the 3ds integration, the return url contain a transactionId.

But there is no api method to get a transaction by Id. There is also no method to get a transaction for a user.

So we need to use the method : List a User's Transactions with good sort and pagination.

This is really confusing, we need to have a new method :

hobailey commented 7 years ago

Hey @tchiotludo, thanks for bring this up. Could you clarify what you mean by "to get a transaction for a user id" - how would that work/what would it show? Also, can you not just use .../payins/{{TransactionId}}/ since you know it's a payin?

tchiotludo commented 7 years ago

For now, I use this in order to find the transaction :

        $pagination = new Pagination(1, 10);

        $filter = new FilterTransactions();
        $filter->Type = 'PAYIN';

        $sort = new Sorting();
        $sort->AddField('CreationDate', 'DESC');

        $transactions = $api->Users->GetTransactions(
            $userId,
            $pagination,
            $filter,
            $sort
        );

        foreach ($transactions as $transaction) {
            if ($transaction->Id == $transactionId) {
                // Got It !!! 
                break;
            }
        }

It's my way to "to get a transaction for a user id".

For now, I don't store the payIn in my side but I will (for refund). But it wouldn't be useful in our case, since we must rely on session data to get the result of a transaction (for both payin and user) I would prefer to be stateless and be able to handle the request with only parameter given.

Another option will be to add a payin parameter on the returnUrl

hobailey commented 7 years ago

Hmm, I think it would be best for you to have a discussion with our technical support team to double check your options :-) www.mangopay.com/contact

tchiotludo commented 7 years ago

Would like to have a response from sales one day :smile: in order to be in touch with you and don't code the whole blindness :rofl: