public static AuthorizeResponse AuthorizeAction(OffAmazonPaymentsServicePropertyCollection propertiesCollection, IOffAmazonPaymentsService service, string orderReferenceId, String orderAmount, int indicator, int authorizationOption) { //initiate the authorization request AuthorizeRequest authRequest = new AuthorizeRequest(); authRequest.AmazonOrderReferenceId = orderReferenceId; authRequest.SellerId = propertiesCollection.MerchantID; Price price = new Price(); //get the ordertotal object from the setOrderReference's response OrderTotal authOrderTotal = new OrderTotal(); price.Amount = orderAmount; price.CurrencyCode = propertiesCollection.CurrencyCode; authRequest.AuthorizationAmount = price; authRequest.AuthorizationReferenceId = orderReferenceId.Replace('-', 'a') + "authRef" + indicator.ToString(); //If Fast Authorization is required, set the transaction timeout in the request to 0. if (authorizationOption == 2) { authRequest.TransactionTimeout = 0; } return(AuthorizeSample.InvokeAuthorize(service, authRequest)); }
//Use a loop to check the status of authorization. Once the status is not "PENDING", skip the loop. public GetAuthorizationDetailsResponse CheckAuthorizationStatus(AuthorizeResponse authResponse) { return(AuthorizeSample.CheckAuthorizationStatus(authResponse.AuthorizeResult.AuthorizationDetails.AmazonAuthorizationId, propertiesCollection, service)); }
//Invoke the Authorize method public AuthorizeResponse AuthorizeAction(SetOrderReferenceDetailsResponse setOrderReferenceDetailsResponse, int authorizationOption) { string orderAmount = setOrderReferenceDetailsResponse.SetOrderReferenceDetailsResult.OrderReferenceDetails.OrderTotal.Amount; return(AuthorizeSample.AuthorizeAction(propertiesCollection, service, orderReferenceId, orderAmount, 0, authorizationOption)); }
//Use a loop to check the status of authorization. Once the status is not "PENDING", skip the loop. public void CheckAuthorizationStatus(AuthorizeResponse authResponse) { AuthorizeSample.CheckAuthorizationStatus(authResponse.AuthorizeResult.AuthorizationDetails.AmazonAuthorizationId, propertiesCollection, service); }
//Invoke the Authorize method public AuthorizeResponse AuthorizeAction(String orderAmount, int id) { return(AuthorizeSample.AuthorizeAction(propertiesCollection, service, this._orderReferenceId, orderAmount, id, 1)); }