-
Notifications
You must be signed in to change notification settings - Fork 140
[PW-1774]Implement SaleToAcquirerDataModel for sending SaleToAcq… #277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…uirerData in the right format to Adyen.
|
||
import java.lang.reflect.Type; | ||
|
||
public class SaleToAcquirerDataModelAdapterSerializer implements JsonSerializer<SaleToAcquirerDataModel> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any specific reason to mention Adapter in name of class ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not particular I will remove the adapter part.
@@ -75,7 +79,8 @@ | |||
* The Sale to acquirer data. | |||
*/ | |||
@XmlElement(name = "SaleToAcquirerData") | |||
protected String saleToAcquirerData; | |||
@JsonAdapter(SaleToAcquirerDataModelAdapterSerializer.class) | |||
protected SaleToAcquirerDataModel saleToAcquirerData; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can skip Model in name of class and keep it SaleToAcquirerData because package name already has "model"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point I agree
@@ -75,7 +79,8 @@ | |||
* The Sale to acquirer data. | |||
*/ | |||
@XmlElement(name = "SaleToAcquirerData") | |||
protected String saleToAcquirerData; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing/changing type saleToAcquirerData field means release won't be backward compatible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct I don't see any other way.
|
||
public String toBase64() { | ||
String json = PRETTY_PRINT_GSON.toJson(this); | ||
return new String(Base64.encodeBase64(json.getBytes())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
json.getBytes may return in null pointer exception.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am wondering when this could happen. this is always an object with application info so it should always contain data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"this" won't be null but it is possible that conversion to json has some problem and returns in empty json string.
…uirerData in the right format to Adyen.
Description
Tested scenarios
Fixed issue: