Skip to content

Instantly share code, notes, and snippets.

@vglebov
Last active October 13, 2015 14:57
Show Gist options
  • Select an option

  • Save vglebov/4213140 to your computer and use it in GitHub Desktop.

Select an option

Save vglebov/4213140 to your computer and use it in GitHub Desktop.
<?php
try {
if (isFormDataSubmitted()) {
$clientId = getSignedInUserId();
if (!$clientId) {
$clientId = apiAddClientAndGetId();
}
addProductToUser($trial_version_product_id, $clientId);
displaySuccessfullMessage();
} else {
if (isUserSignedIn()) {
displayInputForm();
} else {
displayOrderTrialButton();
}
}
} catch (Exception $exception) {
displayException($exception);
}
<?php
try {
if (isUserSignedIn()) {
if (isFormDataSubmitted()) {
$clientId = getSignedInUserId();
addProductToUser($trial_version_product_id, $clientId);
displaySuccessfullMessage();
} else {
displayOrderTrialButton();
}
} else {
if (isFormDataSubmitted()) {
$clientId = apiAddClientAndGetId();
addProductToUser($trial_version_product_id, $clientId);
displaySuccessfullMessage();
} else {
displayInputForm();
}
}
} catch (Exception $exception) {
displayException($exception);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment