Skip to content

Instantly share code, notes, and snippets.

View miguelmontemayor's full-sized avatar

Miguel miguelmontemayor

  • San Francisco, CA
View GitHub Profile
import requests
import logging
import ConfigParser #Python 3 should import configparser
import time
import random
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s')
config = ConfigParser.ConfigParser()
config.read('config.ini')
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.miguelmontemayor.myapplication">
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
@miguelmontemayor
miguelmontemayor / VaultedCard-SecurePay.java
Created May 2, 2017 17:56
Shows how to access the VaultedCard after a successful payment in SecurePay
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == SECURE_PAY_REQUEST_CODE){
if (resultCode == RESULT_OK){
Intent inten = data;
//Once the secure payment activity completes the result and its extras can be worked with
Payment payment = data.getParcelableExtra(Intents.EXTRA_PAYMENT);
VaultedCard vaultedCard = payment.getCardTransaction().getVaultedCard();
Toast.makeText(getApplicationContext(), getString(R.string.payment_successful, payment.getOrder().getId()), Toast.LENGTH_SHORT).show();
} else {
max_attempts = 10
attempts = 0
while attempts < max_attempts:
# Make a request to Clover REST API
response = requests.get(request_url, headers = {"Authorization": "Bearer " + api_token})
# If not rate limited, break out of while loop and continue with the rest of the code
if response.status_code != 429:
break