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

Add Id on PayInRecurringRegistration #565

Merged
merged 1 commit into from
Oct 26, 2022

Conversation

AntoineLemaire
Copy link
Contributor

@AntoineLemaire AntoineLemaire commented Aug 17, 2022

It's not a big issue, but when we fetch a recurringRegistration by his ID $this->mangoPayApi->PayIns->GetRecurringRegistration('1234567');, the result does not have the ID:

image

This could be usefull when we work with a user and we don't know if he already has a recurringRegistration or not, so if not we create it:

public function getOrCreateRecurringRegistration($user): ?PayInRecurringRegistration
{
    $recurringRegistration = null;

    // Verify actual recurringRegistration
    if ($user->getRecurringRegistrationId()) {
        try {
            $recurringRegistration = $this->mangoPayApi->PayIns->GetRecurringRegistration($user->getRecurringRegistrationId());
        }catch (Exception $e) {
        }
    }

    if (null === $recurringRegistration) {
        // Return PayInRecurringRegistrationRequestResponse
        $recurringRegistration = $this->createRecurringRegistration($user);
    }

    return $recurringRegistration;
}

This function either return PayInRecurringRegistrationGet or PayInRecurringRegistrationRequestResponse, which both extends PayInRecurringRegistration, but only PayInRecurringRegistrationRequestResponse has Id

I also removed Status from PayInRecurringRegistrationRequestResponse because it's already present in PayInRecurringRegistration

@AntoineLemaire AntoineLemaire force-pushed the id-payinRecurringRegistration branch from a49c7b7 to 5307989 Compare August 17, 2022 12:34
@AntoineLemaire AntoineLemaire changed the title Add ID on PayInRecurringRegistration Add Id on PayInRecurringRegistration Aug 17, 2022
@AntoineLemaire AntoineLemaire changed the title Add Id on PayInRecurringRegistration Add Id on PayInRecurringRegistration Aug 17, 2022
@AntoineLemaire AntoineLemaire force-pushed the id-payinRecurringRegistration branch from 5307989 to 23955d5 Compare September 5, 2022 09:39
@iulian03
Copy link
Contributor

@AntoineLemaire please update your PR with the latest version of master in order to merge. Thanks!

@AntoineLemaire AntoineLemaire force-pushed the id-payinRecurringRegistration branch from f567a3c to 1eaeaab Compare October 18, 2022 10:32
@AntoineLemaire
Copy link
Contributor Author

@iulian03 done

@iulian03
Copy link
Contributor

@AntoineLemaire we've just merged a PR that should fix all tests. Please update your PR again with the master branch, thanks! Sorry you had to do it twice :)

@AntoineLemaire AntoineLemaire force-pushed the id-payinRecurringRegistration branch from 1eaeaab to f85c84e Compare October 18, 2022 12:13
@AntoineLemaire
Copy link
Contributor Author

Updated

@iulian03 iulian03 merged commit 41153f7 into Mangopay:master Oct 26, 2022
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.

2 participants