implement .env
This commit is contained in:
parent
6d519d96cf
commit
1c1d580a38
27
.env.example
Normal file
27
.env.example
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
# ==============================================
|
||||||
|
# QRIS PAYMENT CONFIGURATION - ENVIRONMENT VARIABLES
|
||||||
|
# ==============================================
|
||||||
|
# Copy this file to .env and fill in the values
|
||||||
|
# ==============================================
|
||||||
|
|
||||||
|
# Midtrans API Configuration
|
||||||
|
MIDTRANS_SANDBOX_AUTH=your_midtrans_sandbox_auth_here
|
||||||
|
MIDTRANS_PRODUCTION_AUTH=your_midtrans_production_auth_here
|
||||||
|
MIDTRANS_CHARGE_URL=https://api.sandbox.midtrans.com/v2/charge
|
||||||
|
MIDTRANS_STATUS_BASE_URL=https://api.sandbox.midtrans.com/v2/
|
||||||
|
MIDTRANS_SIMULATOR_URL=https://simulator.sandbox.midtrans.com/v2/qris/index
|
||||||
|
|
||||||
|
# Backend Configuration
|
||||||
|
BACKEND_BASE_URL=your_backend_base_url_here
|
||||||
|
WEBHOOK_URL=your_webhook_url_here
|
||||||
|
|
||||||
|
# Application Settings
|
||||||
|
MAX_REFRESH_ATTEMPTS=5
|
||||||
|
DEFAULT_QR_EXPIRATION_MINUTES=1
|
||||||
|
|
||||||
|
# ==============================================
|
||||||
|
# INSTRUCTIONS:
|
||||||
|
# 1. Copy this file to .env in the same directory
|
||||||
|
# 2. Fill in the actual values
|
||||||
|
# 3. NEVER commit .env to version control!
|
||||||
|
# ==============================================
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,5 +1,7 @@
|
|||||||
*.iml
|
*.iml
|
||||||
.gradle
|
.gradle
|
||||||
|
.env
|
||||||
|
*.env
|
||||||
/local.properties
|
/local.properties
|
||||||
/.idea/caches
|
/.idea/caches
|
||||||
/.idea/libraries
|
/.idea/libraries
|
||||||
|
@ -42,6 +42,22 @@ android {
|
|||||||
jniLibs.srcDirs = ['libs']
|
jniLibs.srcDirs = ['libs']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
buildFeatures {
|
||||||
|
buildConfig true // Ini yang mengaktifkan fitur BuildConfig
|
||||||
|
}
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
// Tambahkan semua buildConfigField yang dibutuhkan
|
||||||
|
buildConfigField "int", "MAX_REFRESH_ATTEMPTS", "5"
|
||||||
|
buildConfigField "int", "DEFAULT_QR_EXPIRATION_MINUTES", "1"
|
||||||
|
buildConfigField "String", "MIDTRANS_SANDBOX_AUTH", "\"Basic U0ItTWlkLXNlcnZlci1PM2t1bXkwVDl4M1VvYnVvVTc3NW5QbXc=\""
|
||||||
|
buildConfigField "String", "MIDTRANS_PRODUCTION_AUTH", "\"TWlkLXNlcnZlci1sMlZPalotdVlVanpvNnU4VzAtYmF1a2o=\""
|
||||||
|
buildConfigField "String", "MIDTRANS_CHARGE_URL", "\"https://api.sandbox.midtrans.com/v2/charge\""
|
||||||
|
buildConfigField "String", "MIDTRANS_STATUS_BASE_URL", "\"https://api.sandbox.midtrans.com/v2/\""
|
||||||
|
buildConfigField "String", "BACKEND_BASE_URL", "\"https://be-edc.msvc.app\""
|
||||||
|
buildConfigField "String", "WEBHOOK_URL", "\"https://be-edc.msvc.app/webhooks/midtrans\""
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
package com.example.bdkipoc.qris.model;
|
package com.example.bdkipoc.qris.model;
|
||||||
|
import com.example.bdkipoc.BuildConfig;
|
||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -46,17 +47,17 @@ public class QrisTransaction {
|
|||||||
|
|
||||||
// Provider expiration mapping
|
// Provider expiration mapping
|
||||||
private static final Map<String, Integer> PROVIDER_EXPIRATION_MAP = new HashMap<String, Integer>() {{
|
private static final Map<String, Integer> PROVIDER_EXPIRATION_MAP = new HashMap<String, Integer>() {{
|
||||||
put("shopeepay", 1);
|
put("shopeepay", BuildConfig.DEFAULT_QR_EXPIRATION_MINUTES);
|
||||||
put("shopee", 1);
|
put("shopee", BuildConfig.DEFAULT_QR_EXPIRATION_MINUTES);
|
||||||
put("airpay shopee", 1);
|
put("airpay shopee", BuildConfig.DEFAULT_QR_EXPIRATION_MINUTES);
|
||||||
put("gopay", 1);
|
put("gopay", BuildConfig.DEFAULT_QR_EXPIRATION_MINUTES);
|
||||||
put("dana", 1);
|
put("dana", BuildConfig.DEFAULT_QR_EXPIRATION_MINUTES);
|
||||||
put("ovo", 1);
|
put("ovo", BuildConfig.DEFAULT_QR_EXPIRATION_MINUTES);
|
||||||
put("linkaja", 1);
|
put("linkaja", BuildConfig.DEFAULT_QR_EXPIRATION_MINUTES);
|
||||||
put("link aja", 1);
|
put("link aja", BuildConfig.DEFAULT_QR_EXPIRATION_MINUTES);
|
||||||
put("jenius", 1);
|
put("jenius", BuildConfig.DEFAULT_QR_EXPIRATION_MINUTES);
|
||||||
put("qris", 1);
|
put("qris", BuildConfig.DEFAULT_QR_EXPIRATION_MINUTES);
|
||||||
put("others", 1);
|
put("others", BuildConfig.DEFAULT_QR_EXPIRATION_MINUTES);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
// Provider display name mapping
|
// Provider display name mapping
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
package com.example.bdkipoc.qris.network;
|
package com.example.bdkipoc.qris.network;
|
||||||
|
import com.example.bdkipoc.BuildConfig;
|
||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import com.example.bdkipoc.qris.model.QrisRepository;
|
import com.example.bdkipoc.qris.model.QrisRepository;
|
||||||
@ -28,14 +29,14 @@ public class QrisApiService {
|
|||||||
private static final String TAG = "QrisApiService";
|
private static final String TAG = "QrisApiService";
|
||||||
|
|
||||||
// API Endpoints
|
// API Endpoints
|
||||||
private static final String MIDTRANS_SANDBOX_AUTH = "Basic U0ItTWlkLXNlcnZlci1PM2t1bXkwVDl4M1VvYnVvVTc3NW5QbXc=";
|
private static final String MIDTRANS_SANDBOX_AUTH = BuildConfig.MIDTRANS_SANDBOX_AUTH;
|
||||||
private static final String MIDTRANS_PRODUCTION_AUTH = "TWlkLXNlcnZlci1sMlZPalotdVlVanpvNnU4VzAtYmF1a2o=";
|
private static final String MIDTRANS_PRODUCTION_AUTH = BuildConfig.MIDTRANS_PRODUCTION_AUTH;
|
||||||
private static final String MIDTRANS_AUTH = MIDTRANS_SANDBOX_AUTH; // Default to sandbox
|
private static final String MIDTRANS_AUTH = BuildConfig.MIDTRANS_SANDBOX_AUTH;
|
||||||
private static final String MIDTRANS_CHARGE_URL = "https://api.sandbox.midtrans.com/v2/charge";
|
private static final String MIDTRANS_CHARGE_URL = BuildConfig.MIDTRANS_CHARGE_URL;
|
||||||
private static final String MIDTRANS_STATUS_BASE_URL = "https://api.sandbox.midtrans.com/v2/";
|
private static final String MIDTRANS_STATUS_BASE_URL = BuildConfig.MIDTRANS_STATUS_BASE_URL;
|
||||||
|
|
||||||
private String backendBase = "https://be-edc.msvc.app";
|
private String backendBase = BuildConfig.BACKEND_BASE_URL;
|
||||||
private String webhookUrl = "https://be-edc.msvc.app/webhooks/midtrans";
|
private String webhookUrl = BuildConfig.WEBHOOK_URL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate new QR code via Midtrans API
|
* Generate new QR code via Midtrans API
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
package com.example.bdkipoc.qris.presenter;
|
package com.example.bdkipoc.qris.presenter;
|
||||||
|
import com.example.bdkipoc.BuildConfig;
|
||||||
|
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
@ -36,7 +37,7 @@ public class QrisResultPresenter implements QrisResultContract.Presenter {
|
|||||||
private boolean isPaymentMonitorActive = false;
|
private boolean isPaymentMonitorActive = false;
|
||||||
private String lastKnownStatus = "pending";
|
private String lastKnownStatus = "pending";
|
||||||
private int refreshCounter = 0;
|
private int refreshCounter = 0;
|
||||||
private static final int MAX_REFRESH_ATTEMPTS = 5;
|
private static final int MAX_REFRESH_ATTEMPTS = BuildConfig.MAX_REFRESH_ATTEMPTS;
|
||||||
|
|
||||||
public QrisResultPresenter() {
|
public QrisResultPresenter() {
|
||||||
this.repository = QrisRepository.getInstance();
|
this.repository = QrisRepository.getInstance();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user