Bladeren bron

Add Stripe invoice link to test page

Alan Lam 2 jaren geleden
bovenliggende
commit
3419c13cc5
1 gewijzigde bestanden met toevoegingen van 8 en 0 verwijderingen
  1. 8 0
      views/test_verify_form.php

+ 8 - 0
views/test_verify_form.php

@@ -15,6 +15,7 @@
  */
 
 use Carbon\CarbonImmutable;
+use Helpers\StripeHelper;
 
 $config = $template->getConfiguration();
 $values = $test->getValues(true);
@@ -36,6 +37,13 @@ $get_test_details = static function(Test $test) use ($project, $location): array
 	$test_details["Location"] = "<a href=\"/account/locations/$location->id\" target=\"_blank\">" . htmlspecialchars($location->name) . "</a>";
 	$test_details["Address"] = htmlspecialchars($location->getDisplayAddress(["address_1", "address_2", "city", "postal_code"]));
 
+	if($test->stripe_invoice_id) {
+		$stripe_helper = StripeHelper::getInstance();
+		$stripe_invoice = $stripe_helper->createInvoice($test, "0.00");
+
+		$test_details["Stripe Invoice"] = sprintf("<a href=\"%s\" target=\"_blank\">View</a>", htmlspecialchars($stripe_invoice->hosted_invoice_url));
+	}
+
 	if($test->dts_end) {
 		$test_details = array_merge($test_details, [
 			"Duration" => $test->getDisplayDuration(),