| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
die( 'You are not allowed to call this page directly.' ); |
| 4 |
} |
| 5 |
|
| 6 |
class FrmStrpLitePaymentsController { |
| 7 |
|
| 8 |
/** |
| 9 |
* Get the receipt link for a Stripe payment. |
| 10 |
* |
| 11 |
* @param string $receipt |
| 12 |
* |
| 13 |
* @return string |
| 14 |
*/ |
| 15 |
public static function get_receipt_link( $receipt ) { |
| 16 |
$url = 'https://dashboard.stripe.com/'; |
| 17 |
|
| 18 |
if ( str_starts_with( $receipt, 'sub_' ) ) { |
| 19 |
$url .= 'subscriptions/'; |
| 20 |
} elseif ( str_starts_with( $receipt, 'seti_' ) ) { |
| 21 |
$url .= 'setup_intents/'; |
| 22 |
} else { |
| 23 |
$url .= 'payments/'; |
| 24 |
} |
| 25 |
|
| 26 |
$url .= $receipt; |
| 27 |
$link = '<a href="' . esc_url( $url ) . '" target="_blank">'; |
| 28 |
$link .= esc_html( $receipt ); |
| 29 |
return $link . '</a>'; |
| 30 |
} |
| 31 |
} |
| 32 |
|