Skip to content

[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

Merged
merged 8 commits into from
Dec 13, 2019

Conversation

rikterbeek
Copy link
Contributor

…uirerData in the right format to Adyen.

Description

Tested scenarios

Fixed issue:

@coveralls
Copy link

coveralls commented Dec 3, 2019

Coverage Status

Coverage increased (+0.2%) to 24.144% when pulling 0dd1378 on feature/PW-1774 into 179b85b on develop.


import java.lang.reflect.Type;

public class SaleToAcquirerDataModelAdapterSerializer implements JsonSerializer<SaleToAcquirerDataModel> {
Copy link
Contributor

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 ?

Copy link
Contributor Author

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;
Copy link
Contributor

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"

Copy link
Contributor Author

@rikterbeek rikterbeek Dec 5, 2019

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;
Copy link
Contributor

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.

Copy link
Contributor Author

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()));
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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.

@rikterbeek rikterbeek changed the title [WIP][PW-1774]Implement SaleToAcquirerDataModel for sending SaleToAcq… [PW-1774]Implement SaleToAcquirerDataModel for sending SaleToAcq… Dec 5, 2019
@rikterbeek rikterbeek merged commit 10a89ec into develop Dec 13, 2019
@rikterbeek rikterbeek mentioned this pull request Dec 13, 2019
@wboereboom wboereboom deleted the feature/PW-1774 branch October 14, 2022 06:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants