Friends, I have little experience with B4A,
Can anyone help me use this code that refers to the integration with Brazilian payment APP (www.pagseguro.com.br)
integration: http://download.uol.com.br/pagseguro/docs/pagseguro-app2app.pdf
Below is the code that checks whether the PagSeguro application is installed on mobile:
---EXAMPLE CODE-----------------------
This is OK, I made that way I can check if the application is installed.
--MY CODE IN B4A-------------------------
Sub Process_Globals
Code that calls the application and pass the value of the sale, here is what I'm having trouble at the moment, I can CALL the application, but can not pass the values to him.
---EXAMPLE CODE-----------------------
--MY CODE IN B4A-------------------------
Sub ButtonPaymment_Click
Dim My_Intent As Intent
Dim InstalledPackages As PackageManager
My_Intent = InstalledPackages.GetApplicationIntent(PAG_SEGURO_PACKAGE_NAME)
My_Intent.PutExtra(PAG_SEGURO_PACKAGE_NAME, PAG_SEGURO_CLASS_NAME)
My_Intent.PutExtra(FLAG_APP_PAYMENT_VALUE, paymentValue)
My_Intent.PutExtra(REQUEST_CODE, 123)
...
StartActivityForResult(ISMP_Intent)
------------------------
Could someone please help me in any way?
Can anyone help me use this code that refers to the integration with Brazilian payment APP (www.pagseguro.com.br)
integration: http://download.uol.com.br/pagseguro/docs/pagseguro-app2app.pdf
Below is the code that checks whether the PagSeguro application is installed on mobile:
---EXAMPLE CODE-----------------------
private boolean checkIfAppIsInstalled() {
PackageManager pm = getPackageManager();
boolean installed = false;
try {
pm.getPackageInfo(PAG_SEGURO_PACKAGE_NAME, PackageManager.GET_ACTIVITIES);
installed=true;
} catch (PackageManager.NameNotFoundException e) {
installed=false;
}
return installed;
}
------------------------ PackageManager pm = getPackageManager();
boolean installed = false;
try {
pm.getPackageInfo(PAG_SEGURO_PACKAGE_NAME, PackageManager.GET_ACTIVITIES);
installed=true;
} catch (PackageManager.NameNotFoundException e) {
installed=false;
}
return installed;
}
This is OK, I made that way I can check if the application is installed.
--MY CODE IN B4A-------------------------
Sub Process_Globals
Dim PAG_SEGURO_PACKAGE_NAME As String = "br.com.uol.ps"
Dim PAG_SEGURO_CLASS_NAME As String = "br.com.uol.ps.app.MainActivity"
Dim FLAG_APP_PAYMENT_VALUE As String = "FLAG_APP_PAYMENT_VALUE"
Dim REQUEST_CODE As Int = 123
Dim paymentValue As BigDecimal
paymentValue.Initialize("10.99")
...
Sub Activity_Create(FirstTime As Boolean)
Dim pm As PackageManager
Dim packages As List
packages = pm.GetInstalledPackages
For i = 0 To packages.Size - 1
If packages.Get(i) = PAG_SEGURO_PACKAGE_NAME Then
Log("PagSeguro is installed. Package: "&packages.Get(i))
End If
Next
------------------------ Dim PAG_SEGURO_CLASS_NAME As String = "br.com.uol.ps.app.MainActivity"
Dim FLAG_APP_PAYMENT_VALUE As String = "FLAG_APP_PAYMENT_VALUE"
Dim REQUEST_CODE As Int = 123
Dim paymentValue As BigDecimal
paymentValue.Initialize("10.99")
...
Sub Activity_Create(FirstTime As Boolean)
Dim pm As PackageManager
Dim packages As List
packages = pm.GetInstalledPackages
For i = 0 To packages.Size - 1
If packages.Get(i) = PAG_SEGURO_PACKAGE_NAME Then
Log("PagSeguro is installed. Package: "&packages.Get(i))
End If
Next
Code that calls the application and pass the value of the sale, here is what I'm having trouble at the moment, I can CALL the application, but can not pass the values to him.
---EXAMPLE CODE-----------------------
private static final String PAG_SEGURO_PACKAGE_NAME = "br.com.uol.ps";
private static final String PAG_SEGURO_CLASS_NAME = "br.com.uol.ps.app.MainActivity";
private static final String FLAG_APP_PAYMENT_VALUE = "FLAG_APP_PAYMENT_VALUE";
private static final int REQUEST_CODE = 123; // It may be the number of your choice
BigDecimal paymentValue = new BigDecimal(“ 10.99 ”) ;
Intent it = new Intent(Intent.ACTION_MAIN);
it.setClassName(PAG_SEGURO_PACKAGE_NAME, PAG_SEGURO_CLASS_NAME); // Intent will be called.
it.putExtra(FLAG_APP_PAYMENT_VALUE, paymentValue); // Sale Value.
try {
startActivityForResult(it, REQUEST_CODE); // Calls PagSeguro application.
} catch (ActivityNotFoundException e) {
Toast.makeText(getApplicationContext(), "Aplicativo PagSeguro não instalado", Toast.LENGTH_SHORT).show();
}
------------------------ private static final String PAG_SEGURO_CLASS_NAME = "br.com.uol.ps.app.MainActivity";
private static final String FLAG_APP_PAYMENT_VALUE = "FLAG_APP_PAYMENT_VALUE";
private static final int REQUEST_CODE = 123; // It may be the number of your choice
BigDecimal paymentValue = new BigDecimal(“ 10.99 ”) ;
Intent it = new Intent(Intent.ACTION_MAIN);
it.setClassName(PAG_SEGURO_PACKAGE_NAME, PAG_SEGURO_CLASS_NAME); // Intent will be called.
it.putExtra(FLAG_APP_PAYMENT_VALUE, paymentValue); // Sale Value.
try {
startActivityForResult(it, REQUEST_CODE); // Calls PagSeguro application.
} catch (ActivityNotFoundException e) {
Toast.makeText(getApplicationContext(), "Aplicativo PagSeguro não instalado", Toast.LENGTH_SHORT).show();
}
--MY CODE IN B4A-------------------------
Sub ButtonPaymment_Click
Dim My_Intent As Intent
Dim InstalledPackages As PackageManager
My_Intent = InstalledPackages.GetApplicationIntent(PAG_SEGURO_PACKAGE_NAME)
My_Intent.PutExtra(PAG_SEGURO_PACKAGE_NAME, PAG_SEGURO_CLASS_NAME)
My_Intent.PutExtra(FLAG_APP_PAYMENT_VALUE, paymentValue)
My_Intent.PutExtra(REQUEST_CODE, 123)
...
StartActivityForResult(ISMP_Intent)
------------------------
Could someone please help me in any way?