Skip to content

Instantly share code, notes, and snippets.

@matiasgualino
Last active April 21, 2016 21:20
Show Gist options
  • Save matiasgualino/5616274fb64be7580d1e9d36439be928 to your computer and use it in GitHub Desktop.
Save matiasgualino/5616274fb64be7580d1e9d36439be928 to your computer and use it in GitHub Desktop.
public class InstructionsActivity extends AppCompatActivity {
//Params
protected Payment mPayment;
protected String mMerchantPublicKey;
protected PaymentMethod mPaymentMethod;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_instructions);
mPayment = (Payment) getIntent().getExtras().getSerializable("payment");
mMerchantPublicKey = this.getIntent().getStringExtra("merchantPublicKey");
mPaymentMethod = (PaymentMethod) getIntent().getSerializableExtra("paymentMethod");
MercadoPago mercadoPago = new MercadoPago.Builder()
.setContext(this)
.setPublicKey(mMerchantPublicKey)
.build();
getInstructionsAsync(mercadoPago);
}
protected void getInstructionsAsync(MercadoPago mercadoPago) {
mercadoPago.getInstructions(mPayment.getId(), mPaymentMethod.getId(), new Callback<Instruction>() {
@Override
public void success(Instruction instruction, Response response) {
// Listo, aquí ya tienes las instrucciones para
//contarle a tu usuario cómo finalizar el pago.
showInstructions(instruction);
}
@Override
public void failure(RetrofitError error) {
// Ups, ha ocurrido un error.
}
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment