This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| async function createDiscountedCharge(request) { | |
| const [price, planName] = createCharge(request); | |
| const discountToken = request.cookies.partner_jam_token; | |
| if (discountToken) { | |
| try { | |
| const response = await axios.get(\`https://be-app.partnerjam.com/api/v1/discount-check/?token=\${discountToken}\`); | |
| const { discount } = response.data; | |
| if (discount) { | |
| const discountedPrice = price - price * (discount / 100); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def create_discounted_charge(request): | |
| price, plan_name = create_charge(request) | |
| if discount_token := request.COOKIES.get('partner_jam_token'): | |
| try: | |
| response = requests.get( | |
| "https://be-app.partnerjam.com/api/v1/discount-check/", | |
| params={ | |
| "token": discount_token, | |
| }, | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const axios = require("axios"); | |
| async function installAppView(request) { | |
| // do your logic | |
| const shop = store_shop_data(request); | |
| const appSecret = "<secret>" // obtain this secret in PartnerJam Dashboard in application setup | |
| const token = request.cookies.partner_jam_token; | |
| await axios.post( | |
| "https://be-app.partnerjam.com/webhooks/installation-confirm/", | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def install_app_view(request): | |
| # do your logic | |
| shop = store_shop_data(request) | |
| app_secret = '<secret>' # obtain this secret in the code example in PartnerJam dashboard | |
| token = request.COOKIES.get("partner_jam_token") | |
| requests.post( | |
| "https://be-app.partnerjam.com/webhooks/installation-confirm/", | |
| json={ | |
| "token": token, | |
| "shopify_id": shop.shopify_id, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {% load thumbnail %} | |
| <picture> | |
| <!--[if IE 9]><video style="display: none;"><![endif]--> | |
| {# {% thumbnail image "2000" as im %}#} | |
| <source srcset="{{ image.url }}" media="(min-width: 1000px)"> | |
| {# {% endthumbnail %}#} | |
| {% thumbnail image "1600" as im %} | |
| <source srcset="{{ im.url }}" media="(min-width: 800px)"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @responsiveImageUrl = (image_path) -> | |
| if window.devicePixelRatio > 1 | |
| isRetina = true | |
| else | |
| isRetina = false | |
| width = $(window).width() | |
| height = $(window).height() | |
| url = '/rimage/?image_path=' + image_path + '&width=' + width + '&height=' + height | |
| if isRetina |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from sorl.thumbnail import get_thumbnail | |
| from django.http import HttpResponseRedirect | |
| def responsive_image(request): | |
| image_path = request.GET.get('image_path') | |
| width = int(request.GET.get('width')) | |
| height = int(request.GET.get('height')) | |
| is_retina = bool(request.GET.get('is_retina', False)) | |
| if is_retina: | |
| width *= 2 |