Last active
April 22, 2016 13:27
-
-
Save matiasgualino/f29687dcc2d45b977476c4c7d27a8105 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| public class PaymentMethodsActivity extends Activity { | |
| private String mMerchantPublicKey; | |
| private String mPaymentTypeSupported; | |
| @Override | |
| protected void onCreate(Bundle savedInstanceState) { | |
| super.onCreate(savedInstanceState); | |
| setContentView(R.layout.activity_payment_methods); | |
| mMerchantPublicKey = this.getIntent().getStringExtra("merchantPublicKey"); | |
| MercadoPago mercadoPago = new MercadoPago.Builder() | |
| .setContext(this) | |
| .setPublicKey(mMerchantPublicKey) | |
| .build(); | |
| getPaymentMethodsAsync(mercadoPago); | |
| } | |
| private void getPaymentMethodsAsync(MercadoPago mercadoPago) { | |
| mercadoPago.getPaymentMethods(new Callback <List<PaymentMethod>>() { | |
| @Override | |
| public void success(List<PaymentMethod> paymentMethods, Response response) { | |
| // Ya tenés la lista de medios de pago! | |
| // Ahora armá tu UI para cada uno de ellos! | |
| } | |
| @Override | |
| public void failure(RetrofitError error) { | |
| // UPS! Algo salió mal. | |
| } | |
| }); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment