Skip to content

Commit

Permalink
Merge pull request #23 from BoltApp/feature/track_order
Browse files Browse the repository at this point in the history
Order tracking feature
  • Loading branch information
johnmccombs1 authored Mar 1, 2022
2 parents 9e022aa + 2cb7e44 commit 2fb33b1
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
4 changes: 3 additions & 1 deletion example/cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,14 @@
?>



<html>
<head>
<title>Bolt php library demo</title>

<?= \BoltPay\Helper::renderBoltTrackScriptTag(); ?>
<?= \BoltPay\Helper::renderBoltConnectScriptTag(); ?>
<?= \BoltPay\Helper::renderBoltAccountScriptTag(); ?>
<style>
* {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
Expand Down Expand Up @@ -167,7 +169,7 @@
</style>
</head>
<body>

<div class="bolt-account-login"></div>
<div class="cart-title">
<h1>SHOPPING CART</h1>
</div>
Expand Down
22 changes: 21 additions & 1 deletion lib/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ public static function getPayByLinkUrl() {
Bolt::$connectProductionBase . "/checkout";
}

/**
* Get the account javascript url to production or sandbox
*/
public static function getAccountJsUrl() {
return Bolt::$isSandboxMode ?
Bolt::$connectSandboxBase . "/account.js" :
Bolt::$connectProductionBase . "/account.js";
}

/**
* Get bolt url
* @return string
Expand Down Expand Up @@ -79,6 +88,17 @@ public static function renderBoltConnectScriptTag($paymentOnlyKey = false) {
</script>';
}


/**
* Get script tag for bolt connect js url
* @return string
*/
public static function renderBoltAccountScriptTag() {
return '<script
id="bolt-account"
type="text/javascript"
src="' . self::getAccountJsUrl() . '"
data-publishable-key="' . \BoltPay\Bolt::$apiPublishableKey . '">
</script>';
}

}

0 comments on commit 2fb33b1

Please sign in to comment.