/// <summary> /// Issues a request for the Payments API public key and returns the response. /// </summary> /// <remarks> /// Will retry the request with a refreshed token if authentication fails. /// </remarks> public static async Task <HttpResponseMessage> GetPublicKey() { var response = await GetPublicKeyInternal(); // If the response failed due to authentication, refresh the Sky API tokens and try again. if (response.StatusCode == HttpStatusCode.Unauthorized) { await SkyApiAuthenticator.RefreshTokens(); response = await GetPublicKeyInternal(); } return(response); }
/// <summary> /// Issues a request for the Payments API to finalize a Checkout transaction and returns the response. /// </summary> /// <remarks> /// Will retry the request with a refreshed token if authentication fails. /// </remarks> public static async Task <HttpResponseMessage> ChargeCheckoutTransaction(decimal amount, string token) { var response = await ChargeCheckoutTransactionInternal(amount, token); // If the response failed due to authentication, refresh the Sky API tokens and try again. if (response.StatusCode == HttpStatusCode.Unauthorized) { await SkyApiAuthenticator.RefreshTokens(); response = await GetPublicKeyInternal(); } return(response); }