Guest User

Untitled

a guest
Nov 16th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. @Override
  2. protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
  3. if (requestCode == RaveConstants.RAVE_REQUEST_CODE && data != null) {
  4. String message = data.getStringExtra("response");
  5. //Handle the payment depending on the status
  6. if (resultCode == RavePayActivity.RESULT_SUCCESS) {
  7. Toast.makeText(this, "Payment successful", Toast.LENGTH_SHORT).show();
  8. checkoutButton.setText("Bought");
  9. checkoutButton.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
  10. checkoutButton.setOnClickListener(new View.OnClickListener() {
  11. @Override
  12. public void onClick(View v) {
  13. Toast.makeText(ProductDetailsActivity.this,
  14. "You have already made payment",
  15. Toast.LENGTH_SHORT).show();
  16. }
  17. });
  18. } else if (resultCode == RavePayActivity.RESULT_ERROR) {
  19. Toast.makeText(this,
  20. "There was an error processing your payment. Please try again.",
  21. Toast.LENGTH_SHORT).show();
  22. } else if (resultCode == RavePayActivity.RESULT_CANCELLED) {
  23. Toast.makeText(this, "Payment cancelled ", Toast.LENGTH_SHORT).show();
  24. }
  25. } else {
  26. super.onActivityResult(requestCode, resultCode, data);
  27. }
  28. }
Add Comment
Please, Sign In to add comment