give
/
src
/
PaymentGateways
/
Gateways
/
PayPalStandard
/
Actions
/
GenerateDonationFailedPageUrl.php
CreatePayPalStandardPaymentURL.php
3 years ago
GenerateDonationFailedPageUrl.php
4 years ago
GenerateDonationReceiptPageUrl.php
4 years ago
ProcessIpnDonationRefund.php
4 years ago
GenerateDonationFailedPageUrl.php
31 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Give\PaymentGateways\Gateways\PayPalStandard\Actions; |
| 4 | |
| 5 | use Give\Helpers\Form\Utils; |
| 6 | use Give\Session\SessionDonation\DonationAccessor; |
| 7 | |
| 8 | /** |
| 9 | * This class use to generate failed page url. |
| 10 | * |
| 11 | * @since 2.19.0 |
| 12 | */ |
| 13 | class GenerateDonationFailedPageUrl |
| 14 | { |
| 15 | /** |
| 16 | * @since 2.19.0 |
| 17 | * |
| 18 | * @return string |
| 19 | */ |
| 20 | public function __invoke($donationId) |
| 21 | { |
| 22 | $formId = give_get_payment_form_id($donationId); |
| 23 | $isEmbedDonationForm = ! Utils::isLegacyForm($formId); |
| 24 | $donationFormPageUrl = (new DonationAccessor())->get()->formEntry->currentUrl ?: get_permalink($formId); |
| 25 | |
| 26 | return $isEmbedDonationForm ? |
| 27 | Utils::createFailedPageURL($donationFormPageUrl) : |
| 28 | give_get_failed_transaction_uri(); |
| 29 | } |
| 30 | } |
| 31 |