Last active
April 21, 2016 21:20
-
-
Save matiasgualino/5616274fb64be7580d1e9d36439be928 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 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