public void OnRedeemCodeFailed(string response) { try { Response answer = new Response(response); FailReason failReason = answer.GetFailReason(); string code = answer.GetFailedCode(); if (code == null) { throw new NullReferenceException("The returned invalid code is null."); } if (RedeemCodeFailed != null) { RedeemCodeFailed(code, failReason, answer.GetCodeErrorInfos()); } } catch (Exception e) { Logger.Error(true, "onRedeemCodeFailed", e); if (RedeemCodeFailed != null) { RedeemCodeFailed(null, FailReason.UNEXPECTED_ERROR, null); } } }
public void OnRedeemAutomaticOffer(string response) { try { Response answer = new Response(response); // Treat the offer. Offer offer = answer.GetOffer(); if (offer == null) { throw new NullReferenceException("The returned offer is null."); } if (RedeemAutomaticOffer != null) { RedeemAutomaticOffer(offer); } } catch (Exception e) { Logger.Error(true, "onRedeemAutomaticOffer", e); } }
public void OnRestoreSuccess(string response) { try { Response answer = new Response(response); List<Feature> features = answer.GetFeatures(); if (features == null) { throw new NullReferenceException("The returned features are null."); } if (RestoreSuccess != null) { RestoreSuccess(features); } } catch (Exception e) { Logger.Error(true, "onRestoreSuccess", e); if (RestoreFailed != null) { RestoreFailed(FailReason.UNEXPECTED_ERROR); } } }
public void OnRestoreFailed(string response) { try { Response answer = new Response(response); FailReason failReason = answer.GetFailReason(); if (RestoreFailed != null) { RestoreFailed(failReason); } } catch (Exception e) { Logger.Error(true, "onRestoreFailed", e); if (RestoreFailed != null) { RestoreFailed(FailReason.UNEXPECTED_ERROR); } } }
public void OnRedeemURLSuccess(string response) { try { Response answer = new Response(response); // Treat the offer. Offer offer = answer.GetOffer(); if (offer == null) { throw new NullReferenceException("The returned offer is null."); } string code = answer.GetCode(); if (code == null) { throw new NullReferenceException("The returned code is null."); } if (RedeemURLSuccess != null) { RedeemURLSuccess(code, offer); } } catch (Exception e) { Logger.Error(true, "onRedeemURLSuccess", e); if (RedeemURLFailed != null) { RedeemURLFailed(null, FailReason.UNEXPECTED_ERROR, null); } } }
public void OnRedeemURLCodeFound(string response) { try { Response answer = new Response(response); string code = answer.GetCode(); if (code == null) { throw new NullReferenceException("The returned code is null."); } if (RedeemURLCodeFound != null) { RedeemURLCodeFound(code); } } catch (Exception e) { Logger.Error(true, "onRedeemURLCodeFound", e); } }
// ------------------------------------------------------ // Callbacks /** * Batch Bridge internal error */ void onBridgeFailure(string response) { try { Response answer = new Response(response); // TODO: treat the error. answer.GetFailReason(); } catch(Exception e) { Logger.Error(true, "onBridgeFailure", e); } }