Skip to content

Instantly share code, notes, and snippets.

View andrew-grischenko's full-sized avatar

Andrew Grischenko andrew-grischenko

  • Werona Labs
View GitHub Profile
@andrew-grischenko
andrew-grischenko / gist:aab6410bfd12657603b13203b2b6f17b
Created February 12, 2024 00:18
PayPal in Power Pages client
<div>
<div id="paypal-button-container" style="width: 350px;"></div>
<p id="result-message"></p>
<!-- Replace the "test" client-id value with your client-id -->
<script src="https://www.paypal.com/sdk/js?client-id=test&currency=USD"></script>
</div>
<script language="JavaScript">
if (window.top != window.self){
window.paypal.Buttons({
async createOrder() {
...
let responseMessage: string = '';
const statusOptions = [ 'All', 'Running', 'Failed', 'Cancelled', 'Succeeded' ];
const NO_FILTER = 0;
var runsList = {
runs: []
};
let runsCount = 0;
@andrew-grischenko
andrew-grischenko / Component.ts
Last active July 27, 2023 15:15
Power Apps PCF - Reset component
...
export class SomeComponent implements ComponentFramework.StandardControl<IInputs, IOutputs> {
private has_been_reset: boolean;
...
public init(context: ComponentFramework.Context<IInputs>, notifyOutputChanged: () => void, state: ComponentFramework.Dictionary, container:HTMLDivElement)
{
this.has_been_reset = false;
...
@andrew-grischenko
andrew-grischenko / Component.ts
Last active March 27, 2020 00:34
Power Apps PCF - On events handling
...
const STATUS_NEW: string = "new";
const STATUS_ERROR: string = "error";
const STATUS_PROCESSING: string = "processing";
const STATUS_COMPLETED: string = "completed";
export class Payments implements ComponentFramework.StandardControl<IInputs, IOutputs> {
...
private transaction_status: string;
private _notifyOutputChanged: () => void;
<div class="wrapper-body">
<div class="container">
<!-- Hidden error message block -->
<div id="error" style="display:none">
<p>There was an error processing your payment, please try again.</p>
</div>
<h2>Make a payment</h2>
<p>Please make a payment of $100 AUD</p>
<!-- Payment confirmation request and form submission script -->
<script>
var urlParams = new URLSearchParams(window.location.search);
var access_code = urlParams.get('AccessCode');
// Request payment confimration from teh payment gateway
$.ajax({
url: "https://paymentrequest2.azurewebsites.net/api/PaymentStatus?transaction=" + access_code,
dataType: 'json',
<div class="wrapper-body">
<div class="container">
<!-- Hidden entity form -->
<div style="display:none">
{% if page.adx_entityform %}
{% entityform id: page.adx_entityform.id %}
{% endif %}
</div>
module.exports = function (context, req) {
context.log('JavaScript HTTP trigger function processed a request.');
var request = require('request');
var transaction = context.req.query.transaction;
request(
{
url : 'https://api.sandbox.ewaypayments.com/Transaction/' + transaction,
auth: {
<!-- Retrieve the payment record submitted on the previous step -->
{% assign payment = entities.cr591_payment["{{ request.params['payment'] }}"] %}
<div class="wrapper-body">
<div class="container">
<h3>Payment successful</h3>
<p>Your payment has been successfully processed, thank you!</p>
<ul>
<li>Reference: {{ payment.cr591_reference }}</li>
<li>Amount: ${{ payment.cr591_amount }}</li>