This file contains 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
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') |
This file contains 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
<?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" |
This file contains 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
@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 { |
This file contains 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
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 |