tes notif backend
This commit is contained in:
parent
40d0fc2402
commit
72b39fd9c8
@ -55,6 +55,7 @@ public class QrisActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
private String transactionId;
|
private String transactionId;
|
||||||
private String transactionUuid;
|
private String transactionUuid;
|
||||||
|
private String transactionDate;
|
||||||
private String referenceId;
|
private String referenceId;
|
||||||
private int amount;
|
private int amount;
|
||||||
private JSONObject midtransResponse;
|
private JSONObject midtransResponse;
|
||||||
@ -118,6 +119,11 @@ public class QrisActivity extends AppCompatActivity {
|
|||||||
initiatePaymentButton.setEnabled(false);
|
initiatePaymentButton.setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getCurrentDateTime() {
|
||||||
|
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss", new java.util.Locale("id", "ID"));
|
||||||
|
return sdf.format(new java.util.Date());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ✅ FRONTEND DEDUPLICATION: Generate unique reference ID with local tracking
|
* ✅ FRONTEND DEDUPLICATION: Generate unique reference ID with local tracking
|
||||||
*/
|
*/
|
||||||
@ -470,6 +476,7 @@ public class QrisActivity extends AppCompatActivity {
|
|||||||
payload.put("status", "INIT");
|
payload.put("status", "INIT");
|
||||||
payload.put("device_id", 1);
|
payload.put("device_id", 1);
|
||||||
payload.put("transaction_uuid", transactionUuid);
|
payload.put("transaction_uuid", transactionUuid);
|
||||||
|
payload.put("transaction_date", getCurrentDateTime());
|
||||||
payload.put("transaction_time_seconds", 0.0);
|
payload.put("transaction_time_seconds", 0.0);
|
||||||
payload.put("device_code", "PB4K252T00021");
|
payload.put("device_code", "PB4K252T00021");
|
||||||
payload.put("merchant_name", "Marcel Panjaitan");
|
payload.put("merchant_name", "Marcel Panjaitan");
|
||||||
|
@ -690,7 +690,7 @@ public class QrisResultActivity extends AppCompatActivity implements QrisResultC
|
|||||||
* Get current date time untuk receipt
|
* Get current date time untuk receipt
|
||||||
*/
|
*/
|
||||||
private String getCurrentDateTime() {
|
private String getCurrentDateTime() {
|
||||||
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("d/M/y H:m:s", new java.util.Locale("id", "ID"));
|
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss", new java.util.Locale("id", "ID"));
|
||||||
return sdf.format(new java.util.Date());
|
return sdf.format(new java.util.Date());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,11 +20,14 @@ import java.io.IOException;
|
|||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
import java.text.NumberFormat;
|
import java.text.NumberFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import com.example.bdkipoc.BuildConfig;
|
||||||
import com.example.bdkipoc.R;
|
import com.example.bdkipoc.R;
|
||||||
|
|
||||||
public class SettlementActivity extends AppCompatActivity {
|
public class SettlementActivity extends AppCompatActivity {
|
||||||
@ -36,8 +39,6 @@ public class SettlementActivity extends AppCompatActivity {
|
|||||||
private List<SettlementItem> settlementList;
|
private List<SettlementItem> settlementList;
|
||||||
private ImageView btnBack;
|
private ImageView btnBack;
|
||||||
|
|
||||||
private String API_URL = "https://be-edc.msvc.app/transactions/performa-chanel-pembayaran?from_date=2025-01-01&to_date=2025-06-04&location_id=0&merchant_id=0";
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@ -50,8 +51,18 @@ public class SettlementActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void fetchApiData() {
|
private void fetchApiData() {
|
||||||
|
// Get current date in yyyy-MM-dd format
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault());
|
||||||
|
String currentDate = sdf.format(new Date());
|
||||||
|
|
||||||
|
// Build API URL with current date and credentials from BuildConfig
|
||||||
|
String apiUrl = BuildConfig.BACKEND_BASE_URL + "/transactions/performa-chanel-pembayaran" +
|
||||||
|
"?from_date=" + currentDate +
|
||||||
|
"&to_date=" + currentDate +
|
||||||
|
"&location_id=0&merchant_id=0";
|
||||||
|
|
||||||
// Execute network call in background thread
|
// Execute network call in background thread
|
||||||
new ApiTask().execute(API_URL);
|
new ApiTask().execute(apiUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processApiData(JSONArray dataArray) {
|
private void processApiData(JSONArray dataArray) {
|
||||||
@ -218,9 +229,6 @@ public class SettlementActivity extends AppCompatActivity {
|
|||||||
return formatter.format(amount);
|
return formatter.format(amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated helper class - no longer needed
|
|
||||||
// private static class ChannelData { ... }
|
|
||||||
|
|
||||||
// AsyncTask for API call
|
// AsyncTask for API call
|
||||||
private class ApiTask extends AsyncTask<String, Void, String> {
|
private class ApiTask extends AsyncTask<String, Void, String> {
|
||||||
@Override
|
@Override
|
||||||
@ -232,6 +240,9 @@ public class SettlementActivity extends AppCompatActivity {
|
|||||||
connection.setConnectTimeout(5000);
|
connection.setConnectTimeout(5000);
|
||||||
connection.setReadTimeout(5000);
|
connection.setReadTimeout(5000);
|
||||||
|
|
||||||
|
// Add authorization header if needed
|
||||||
|
// connection.setRequestProperty("Authorization", BuildConfig.MIDTRANS_SANDBOX_AUTH);
|
||||||
|
|
||||||
int responseCode = connection.getResponseCode();
|
int responseCode = connection.getResponseCode();
|
||||||
if (responseCode == HttpURLConnection.HTTP_OK) {
|
if (responseCode == HttpURLConnection.HTTP_OK) {
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user