<commit_before>/**
 * Creates a payment credential.
 */
async function createPaymentCredential(windowLocalStorageIdentifier) {
  try {
    const publicKeyCredential = await createCredential(/*setPaymentExtension=*/true);
    console.log(publicKeyCredential);
    window.localStorage.setItem(windowLocalStorageIdentifier,
      arrayBufferToBase64(publicKeyCredential.rawId));
    info(windowLocalStorageIdentifier + ' enrolled: ' + objectToString(
      publicKeyCredential));
  } catch (err) {
    error(err);
  }
}

let gPaymentRequest = null;

// TODO: Show opt out option
async function createPaymentRequest(windowLocalStorageIdentifier) {
  try {
    gPaymentRequest = await createSPCPaymentRequest({
      credentialIds: [base64ToArray(window.localStorage.getItem(windowLocalStorageIdentifier))],
    });
    info('Created PaymentRequest object');
  } catch (e) {
    error(e);
  }
}

async function callCanMakePayment() {
  if (!gPaymentRequest) {
    error('gPaymentRequest is not set');
    return;
  }

  try {
    const cmp = gPaymentRequest.canMakePayment();
    info('Called canMakePayment, result: ' + cmp);
  } catch (e) {
    error(e);
  }
}

async function callHasEnrolledInstrument() {
  if (!gPaymentRequest) {
    error('gPaymentRequest is not set');
    return;
  }

  try {
    const hei = gPaymentRequest.hasEnrolledInstrument();
    info('Called hasEnrolledInstrument, result: ' + hei);
  } catch (e) {
    error(e);
  }
}

async function callShow() {
  if (!gPaymentRequest) {
    error('gPaymentRequest is not set');
    return;
  }

  try {
    const instrumentResponse = await gPaymentRequest.show();
    await instrumentResponse.complete('success')
    console.log(instrumentResponse);
    info('Called show, result: ' + objectToString(instrumentResponse));
  } catch (err) {
    error(err);
  }
}
<commit_msg>bugfix<commit_after>/**
 * Creates a payment credential.
 */
async function createPaymentCredential(windowLocalStorageIdentifier) {
  try {
    const publicKeyCredential = await createCredential(/*setPaymentExtension=*/true);
    console.log(publicKeyCredential);
    window.localStorage.setItem(windowLocalStorageIdentifier,
      arrayBufferToBase64(publicKeyCredential.rawId));
    info(windowLocalStorageIdentifier + ' enrolled: ' + objectToString(
      publicKeyCredential));
  } catch (err) {
    error(err);
  }
}

let gPaymentRequest = null;

// TODO: Show opt out option
async function createPaymentRequest(windowLocalStorageIdentifier) {
  try {
    gPaymentRequest = await createSPCPaymentRequest({
      credentialIds: [base64ToArray(window.localStorage.getItem(windowLocalStorageIdentifier))],
    });
    info('Created PaymentRequest object');
  } catch (e) {
    error(e);
  }
}

async function callCanMakePayment() {
  if (!gPaymentRequest) {
    error('gPaymentRequest is not set');
    return;
  }

  try {
    const cmp = await gPaymentRequest.canMakePayment();
    info('Called canMakePayment, result: ' + cmp);
  } catch (e) {
    error(e);
  }
}

async function callHasEnrolledInstrument() {
  if (!gPaymentRequest) {
    error('gPaymentRequest is not set');
    return;
  }

  try {
    const hei = await gPaymentRequest.hasEnrolledInstrument();
    info('Called hasEnrolledInstrument, result: ' + hei);
  } catch (e) {
    error(e);
  }
}

async function callShow() {
  if (!gPaymentRequest) {
    error('gPaymentRequest is not set');
    return;
  }

  try {
    const instrumentResponse = await gPaymentRequest.show();
    await instrumentResponse.complete('success')
    console.log(instrumentResponse);
    info('Called show, result: ' + objectToString(instrumentResponse));
  } catch (err) {
    error(err);
  }
}

{'fraction_non_alphanumeric': 0.1172956828672278, 'fraction_numerical': 0.0021721422753190334, 'mean_word_length': 4.081379310344827, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2068295', 'n_tokens_mistral': 1102, 'n_tokens_neox': 1101, 'n_words': 228}