Skip to content
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

paymentUrl null in AlipayApsPayResponse #9

Open
vhortal opened this issue Mar 31, 2022 · 0 comments
Open

paymentUrl null in AlipayApsPayResponse #9

vhortal opened this issue Mar 31, 2022 · 0 comments

Comments

@vhortal
Copy link

vhortal commented Mar 31, 2022

In my tests with v 2.0.5, the response for the pay (Cashier Payment) request (class AlipayApsPayResponse) always contains a null value for the paymentUrl property, although I can see a normalUrl attribute in the JSON returned by the API:
"normalUrl": "https://open-sea.alipayplus.com/api...".

I think the problem is that the class AlipayApsPayResponse does not contain properties for the possible JSON attributes (schemeUrl/applinkUrl/normalUrl, as stated in the docs). The JSON does not contain an attribute matching paymentUrl, and there is no special handling for the paymentUrl property, that should be filled with the contents of schemeUrl/applinkUrl/normalUrl, according to the specified precedence. I was able to fix the problem by subclassing AlipayApsPayResponse and adding the following code:

`
private String schemeUrl;
private String applinkUrl;
private String normalUrl;

// getters and setters omitted

/**
 * https://docs.alipayplus.com/alipayplus/alipayplus/api_acq/pay_cashier?pageVersion=28&_route=SG
 * For priorities of which URL to use to redirect to the wallet side, schemeUrl > applinkUrl > normalUrl.
 *
 * @return
 */
@Override
public String getPaymentUrl() {
    return schemeUrl != null ? schemeUrl :
            applinkUrl != null ? applinkUrl :
                    normalUrl;
}

`

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

No branches or pull requests

1 participant