sumup / sumup-android-sdk

Sample App for the SumUp Android SDK
Other
105 stars 28 forks source link

SumUpPayment POJO class and Android code should be separated #3

Closed loicortola closed 9 years ago

loicortola commented 9 years ago

Hi guys,

if I may suggest a slight API change in the workflow. From a Java Standpoint, the SumUpPayment class looks like a POJO. Its sole purpose should be holding data and representing your payment entity.

This line brings a high coupling between the android world and the POJO itself...

// start the payment process
sumUpPayment.openPaymentActivity(this);

I am guessing this launches one of SumUp's intents and processes the results before returning back to the activity when done. I wonder if there is another way of doing so. By separating the payment from the activity handling, something like this could be imagined:

SumUp.startPaymentIntent(this, MyCallbackActivity.class, sumUpPayment);
ultrah commented 9 years ago

Implemented as suggested