give
/
src
/
PaymentGateways
/
Gateways
/
PayPalStandard
/
Actions
/
GenerateDonationReceiptPageUrl.php
CreatePayPalStandardPaymentURL.php
3 years ago
GenerateDonationFailedPageUrl.php
4 years ago
GenerateDonationReceiptPageUrl.php
4 years ago
ProcessIpnDonationRefund.php
4 years ago
GenerateDonationReceiptPageUrl.php
32 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 receipt page url. |
| 10 | * |
| 11 | * @since 2.19.0 |
| 12 | */ |
| 13 | class GenerateDonationReceiptPageUrl |
| 14 | { |
| 15 | |
| 16 | /** |
| 17 | * @since 2.19.0 |
| 18 | * |
| 19 | * @return string |
| 20 | */ |
| 21 | public function __invoke($donationId) |
| 22 | { |
| 23 | $formId = give_get_payment_form_id($donationId); |
| 24 | $isEmbedDonationForm = ! Utils::isLegacyForm($formId); |
| 25 | $donationFormPageUrl = (new DonationAccessor())->get()->formEntry->currentUrl ?: get_permalink($formId); |
| 26 | |
| 27 | return $isEmbedDonationForm ? |
| 28 | Utils::createSuccessPageURL($donationFormPageUrl) : |
| 29 | give_get_success_page_url(); |
| 30 | } |
| 31 | } |
| 32 |