public static ConfirmBillingAgreementResponse InvokeConfirmBillingAgreement(IOffAmazonPaymentsService service, ConfirmBillingAgreementRequest request) { ConfirmBillingAgreementResponse response = null; try { response = service.ConfirmBillingAgreement(request); Console.WriteLine("Service Response"); Console.WriteLine("============================================================================="); Console.WriteLine(); Console.WriteLine(" ConfirmBillingAgreementResponse"); if (response.IsSetResponseMetadata()) { Console.WriteLine(" ResponseMetadata"); ResponseMetadata responseMetadata = response.ResponseMetadata; if (responseMetadata.IsSetRequestId()) { Console.WriteLine(" RequestId"); Console.WriteLine(" {0}", responseMetadata.RequestId); } } } catch (OffAmazonPaymentsServiceException ex) { PrintException(ex); } return response; }
public static CaptureResponse CaptureAction(OffAmazonPaymentsServicePropertyCollection propertiesCollection, IOffAmazonPaymentsService service, string amazonAuthorizationId, string orderAmount, string orderReferenceId, int indicator, string providerId, string creditAmountString) { //initiate the capture request CaptureRequest captureRequest = new CaptureRequest(); captureRequest.SellerId = propertiesCollection.MerchantID; captureRequest.AmazonAuthorizationId = amazonAuthorizationId; Price price = new Price(); price.Amount = orderAmount; price.CurrencyCode = propertiesCollection.CurrencyCode; captureRequest.CaptureAmount = price; captureRequest.CaptureReferenceId = orderReferenceId.Replace('-', 'c') + "captureRef" + indicator.ToString(); if (!String.IsNullOrEmpty(providerId) && !String.IsNullOrEmpty(creditAmountString)) { ProviderCredit providerCredit = new ProviderCredit(); providerCredit.ProviderId = providerId; Price creditAmount = new Price(); creditAmount.Amount = creditAmountString; creditAmount.CurrencyCode = propertiesCollection.CurrencyCode; providerCredit.CreditAmount = creditAmount; ProviderCreditList providerCreditList = new ProviderCreditList(); providerCreditList.member = new List <ProviderCredit>(); providerCreditList.member.Add(providerCredit); captureRequest.ProviderCreditList = providerCreditList; } return(CaptureSample.InvokeCapture(service, captureRequest)); }
public static RefundResponse RefundAction(IOffAmazonPaymentsService service, OffAmazonPaymentsServicePropertyCollection propertiesCollection, Random rng, string amazonCaptureID, string refundAmount, string providerId, string creditReversalAmountString) { //Initiate the Refund request, including SellerId, CaptureId, RefundReferenceId and RefundAmount RefundRequest request = new RefundRequest(); request.SellerId = propertiesCollection.MerchantID; request.AmazonCaptureId = amazonCaptureID; request.RefundReferenceId = amazonCaptureID.Replace("-", "") + "r" + rng.Next(1, 1000).ToString(); //assign the refundAmount to the refund request Price price = new Price(); price.Amount = refundAmount; price.CurrencyCode = propertiesCollection.CurrencyCode; request.RefundAmount = price; if (!String.IsNullOrEmpty(providerId) && !String.IsNullOrEmpty(creditReversalAmountString)) { ProviderCreditReversal providerCreditReversal = new ProviderCreditReversal(); providerCreditReversal.ProviderId = providerId; Price creditReversalAmount = new Price(); creditReversalAmount.Amount = creditReversalAmountString; creditReversalAmount.CurrencyCode = propertiesCollection.CurrencyCode; providerCreditReversal.CreditReversalAmount = creditReversalAmount; ProviderCreditReversalList providerCreditReversalList = new ProviderCreditReversalList(); providerCreditReversalList.member = new List <ProviderCreditReversal>(); providerCreditReversalList.member.Add(providerCreditReversal); request.ProviderCreditReversalList = providerCreditReversalList; } return(RefundSample.InvokeRefund(service, request)); }
/// <summary> /// Create a new instance of the Service Refund sample class /// </summary> public OffAmazonPaymentsServiceRefund() { // Instantiate the Merchant propertiesCollection object which contains required parameters for creating a Marketplace Payment Service this._propertiesCollection = OffAmazonPaymentsServicePropertyCollection.getInstance(); this._service = new OffAmazonPaymentsServiceClient(this._propertiesCollection); this._rng = new Random(); }
public static CaptureResponse CaptureAction(OffAmazonPaymentsServicePropertyCollection propertiesCollection, IOffAmazonPaymentsService service, string amazonAuthorizationId, string orderAmount, string orderReferenceId, int indicator, string providerId, string creditAmountString) { //initiate the capture request CaptureRequest captureRequest = new CaptureRequest(); captureRequest.SellerId = propertiesCollection.MerchantID; captureRequest.AmazonAuthorizationId = amazonAuthorizationId; Price price = new Price(); price.Amount = orderAmount; price.CurrencyCode = propertiesCollection.CurrencyCode; captureRequest.CaptureAmount = price; captureRequest.CaptureReferenceId = orderReferenceId.Replace('-', 'c') + "captureRef" + indicator.ToString(); if (!String.IsNullOrEmpty(providerId) && !String.IsNullOrEmpty(creditAmountString)) { ProviderCredit providerCredit = new ProviderCredit(); providerCredit.ProviderId= providerId; Price creditAmount = new Price(); creditAmount.Amount = creditAmountString; creditAmount.CurrencyCode = propertiesCollection.CurrencyCode; providerCredit.CreditAmount= creditAmount; ProviderCreditList providerCreditList = new ProviderCreditList(); providerCreditList.member = new List<ProviderCredit>(); providerCreditList.member.Add(providerCredit); captureRequest.ProviderCreditList = providerCreditList; } return CaptureSample.InvokeCapture(service, captureRequest); }
public static GetOrderReferenceDetailsResponse GetOrderReferenceDetails(OffAmazonPaymentsServicePropertyCollection propertiesCollection, IOffAmazonPaymentsService service, string orderReferenceId, string addressConsentToken, TextWriter buffer) { GetOrderReferenceDetailsResponse response = InvokeGetOrderReferenceDetails(propertiesCollection, service, orderReferenceId, addressConsentToken); printOrderReferenceDetailsResponseToBuffer(response, buffer); return response; }
public static CloseAuthorizationResponse InvokeCloseAuthorization(IOffAmazonPaymentsService service, CloseAuthorizationRequest request) { CloseAuthorizationResponse response = null; try { response = service.CloseAuthorization(request); Console.WriteLine("Service Response"); Console.WriteLine("============================================================================="); Console.WriteLine(); Console.WriteLine(" CloseAuthorizationResponse"); if (response.IsSetResponseMetadata()) { Console.WriteLine(" ResponseMetadata"); ResponseMetadata responseMetadata = response.ResponseMetadata; if (responseMetadata.IsSetRequestId()) { Console.WriteLine(" RequestId"); Console.WriteLine(" {0}", responseMetadata.RequestId); } } Console.WriteLine(); } catch (OffAmazonPaymentsServiceException ex) { PrintException(ex); } return response; }
public static GetAuthorizationDetailsResponse GetAuthorizationDetails(IOffAmazonPaymentsService service, GetAuthorizationDetailsRequest request, TextWriter buffer) { GetAuthorizationDetailsResponse response = GetAuthorizationDetails(service, request); printGetAuthorizationDetailsResponseToBuffer(response, buffer); return(response); }
private static GetAuthorizationDetailsResponse GetAuthorizationDetails(IOffAmazonPaymentsService service, GetAuthorizationDetailsRequest request) { GetAuthorizationDetailsResponse response = null; response = service.GetAuthorizationDetails(request); return(response); }
public static CloseBillingAgreementResponse InvokeCloseBillingAgreement(IOffAmazonPaymentsService service, CloseBillingAgreementRequest request) { CloseBillingAgreementResponse response = null; try { response = service.CloseBillingAgreement(request); Console.WriteLine("Service Response"); Console.WriteLine("============================================================================="); Console.WriteLine(); Console.WriteLine(" CloseBillingAgreementResponse"); if (response.IsSetResponseMetadata()) { Console.WriteLine(" ResponseMetadata"); ResponseMetadata responseMetadata = response.ResponseMetadata; if (responseMetadata.IsSetRequestId()) { Console.WriteLine(" RequestId"); Console.WriteLine(" {0}", responseMetadata.RequestId); } } } catch (OffAmazonPaymentsServiceException ex) { PrintException(ex); } return(response); }
//Use a loop to check the status of authorization. Once the status is not "PENDING", skip the loop. public static GetAuthorizationDetailsResponse CheckAuthorizationStatus(string amazonAuthorizationId, OffAmazonPaymentsServicePropertyCollection propertiesCollection, IOffAmazonPaymentsService service) { //used to check if the authorization is time-out TimeSpan startTime = DateTime.Now.TimeOfDay; GetAuthorizationDetailsRequest authDetailRequest = new GetAuthorizationDetailsRequest(); authDetailRequest.SellerId = propertiesCollection.MerchantID; authDetailRequest.AmazonAuthorizationId = amazonAuthorizationId; GetAuthorizationDetailsResponse getAuthResponse = GetAuthorizationDetailsSample.InvokeGetAuthorizationDetails(service, authDetailRequest); while (getAuthResponse.IsSetGetAuthorizationDetailsResult() && getAuthResponse.GetAuthorizationDetailsResult.AuthorizationDetails.AuthorizationStatus.State.Equals(PaymentStatus.PENDING)) { if (DateTime.Now.TimeOfDay.Milliseconds - startTime.Milliseconds > 60000) { throw new OffAmazonPaymentsServiceException("The authorization is time-out."); } System.Threading.Thread.Sleep(8000); Console.WriteLine("Waiting until the Authorization Status becomes OPEN"); getAuthResponse = GetAuthorizationDetailsSample.InvokeGetAuthorizationDetails(service, authDetailRequest); } return(getAuthResponse); }
public static GetProviderCreditReversalDetailsResponse GetProviderCreditReversalDetails( IOffAmazonPaymentsService service, OffAmazonPaymentsServicePropertyCollection propertiesCollection, string providerCreditReversalId) { GetProviderCreditReversalDetailsRequest getProviderCreditReversalDetailsRequest = new GetProviderCreditReversalDetailsRequest(); getProviderCreditReversalDetailsRequest.AmazonProviderCreditReversalId = providerCreditReversalId; getProviderCreditReversalDetailsRequest.SellerId = propertiesCollection.MerchantID; return GetProviderCreditReversalDetailsSample.InvokeGetProviderCreditReversalDetails(service, getProviderCreditReversalDetailsRequest); }
public static GetCaptureDetailsResponse GetCaptureDetails(OffAmazonPaymentsServicePropertyCollection propertiesCollection, IOffAmazonPaymentsService service, string amazonCaptureId) { GetCaptureDetailsRequest getCaptureDetailsRequest = new GetCaptureDetailsRequest(); getCaptureDetailsRequest.AmazonCaptureId = amazonCaptureId; getCaptureDetailsRequest.SellerId = propertiesCollection.MerchantID; return GetCaptureDetailsSample.InvokeGetCaptureDetails(service, getCaptureDetailsRequest); }
public static GetOrderReferenceDetailsResponse GetOrderReferenceDetails(OffAmazonPaymentsServicePropertyCollection propertiesCollection, IOffAmazonPaymentsService service, string orderReferenceId, string addressConsentToken, TextWriter buffer) { GetOrderReferenceDetailsResponse response = InvokeGetOrderReferenceDetails(propertiesCollection, service, orderReferenceId, addressConsentToken); printOrderReferenceDetailsResponseToBuffer(response, buffer); return(response); }
public static GetRefundDetailsResponse GetRefundDetails(IOffAmazonPaymentsService service, OffAmazonPaymentsServicePropertyCollection propertiesCollection, string amazonRefundId) { GetRefundDetailsRequest request = new GetRefundDetailsRequest(); request.SellerId = propertiesCollection.MerchantID; request.AmazonRefundId = amazonRefundId; return(GetRefundDetailsSample.InvokeGetRefundDetails(service, request)); }
public static ConfirmBillingAgreementResponse ConfirmBillingAgreement(OffAmazonPaymentsServicePropertyCollection propertiesCollection, IOffAmazonPaymentsService service, string billingAgreementId) { ConfirmBillingAgreementRequest request = new ConfirmBillingAgreementRequest(); request.AmazonBillingAgreementId = billingAgreementId; request.SellerId = propertiesCollection.MerchantID; return InvokeConfirmBillingAgreement(service, request); }
public static GetCaptureDetailsResponse GetCaptureDetails(OffAmazonPaymentsServicePropertyCollection propertiesCollection, IOffAmazonPaymentsService service, string amazonCaptureId) { GetCaptureDetailsRequest getCaptureDetailsRequest = new GetCaptureDetailsRequest(); getCaptureDetailsRequest.AmazonCaptureId = amazonCaptureId; getCaptureDetailsRequest.SellerId = propertiesCollection.MerchantID; return(GetCaptureDetailsSample.InvokeGetCaptureDetails(service, getCaptureDetailsRequest)); }
public static GetBillingAgreementDetailsResponse GetBillingAgreementDetails(OffAmazonPaymentsServicePropertyCollection propertiesCollection, IOffAmazonPaymentsService service, string billingAgreementId) { GetBillingAgreementDetailsRequest request = new GetBillingAgreementDetailsRequest(); request.AmazonBillingAgreementId = billingAgreementId; request.SellerId = propertiesCollection.MerchantID; return(InvokeGetBillingAgreementDetails(service, request)); }
public static ConfirmOrderReferenceResponse ConfirmOrderReferenceObject(OffAmazonPaymentsServicePropertyCollection propertiesCollection, IOffAmazonPaymentsService service, string orderReferenceId) { ConfirmOrderReferenceRequest confirmOrderRequest = new ConfirmOrderReferenceRequest(); confirmOrderRequest.SellerId = propertiesCollection.MerchantID; confirmOrderRequest.AmazonOrderReferenceId = orderReferenceId; return ConfirmOrderReferenceSample.InvokeConfirmOrderReference(service, confirmOrderRequest); }
public static CloseOrderReferenceResponse CloseOrderReference(OffAmazonPaymentsServicePropertyCollection propertiesCollection, IOffAmazonPaymentsService service, string orderReferenceId) { CloseOrderReferenceRequest request = new CloseOrderReferenceRequest(); request.AmazonOrderReferenceId = orderReferenceId; request.SellerId = propertiesCollection.MerchantID; return CloseOrderReferenceSample.InvokeCloseOrderReference(service, request); }
public static CloseBillingAgreementResponse CloseBillingAgreement(OffAmazonPaymentsServicePropertyCollection propertiesCollection, IOffAmazonPaymentsService service, string billingAgreementId) { CloseBillingAgreementRequest request = new CloseBillingAgreementRequest(); request.AmazonBillingAgreementId = billingAgreementId; request.SellerId = propertiesCollection.MerchantID; return(InvokeCloseBillingAgreement(service, request)); }
public static CloseOrderReferenceResponse CloseOrderReference(OffAmazonPaymentsServicePropertyCollection propertiesCollection, IOffAmazonPaymentsService service, string orderReferenceId) { CloseOrderReferenceRequest request = new CloseOrderReferenceRequest(); request.AmazonOrderReferenceId = orderReferenceId; request.SellerId = propertiesCollection.MerchantID; return(CloseOrderReferenceSample.InvokeCloseOrderReference(service, request)); }
public static ConfirmOrderReferenceResponse ConfirmOrderReferenceObject(OffAmazonPaymentsServicePropertyCollection propertiesCollection, IOffAmazonPaymentsService service, string orderReferenceId) { ConfirmOrderReferenceRequest confirmOrderRequest = new ConfirmOrderReferenceRequest(); confirmOrderRequest.SellerId = propertiesCollection.MerchantID; confirmOrderRequest.AmazonOrderReferenceId = orderReferenceId; return(ConfirmOrderReferenceSample.InvokeConfirmOrderReference(service, confirmOrderRequest)); }
private static GetOrderReferenceDetailsResponse InvokeGetOrderReferenceDetails(OffAmazonPaymentsServicePropertyCollection propertiesCollection, IOffAmazonPaymentsService service, string orderReferenceId, string addressConsentToken) { GetOrderReferenceDetailsRequest getOrderRequest = new GetOrderReferenceDetailsRequest(); getOrderRequest.SellerId = propertiesCollection.MerchantID; getOrderRequest.AmazonOrderReferenceId = orderReferenceId; getOrderRequest.AddressConsentToken = addressConsentToken; GetOrderReferenceDetailsResponse response = service.GetOrderReferenceDetails(getOrderRequest); return response; }
public OffAmazonPaymentsServiceCancellation() { /************************************************************************ * Instantiate the Merchant propertiesCollection object which contains required parameters for creating a Marketplace Payment Service ***********************************************************************/ propertiesCollection = OffAmazonPaymentsServicePropertyCollection.getInstance(); /************************************************************************ * Instantiate Implementation of Marketplace Payment Service ***********************************************************************/ service = new OffAmazonPaymentsServiceClient(propertiesCollection); }
/// <summary> /// Create a new instance of the class, using the order reference /// identifer as the basis for all service requests /// </summary> /// <param name="amazonOrderReferenceId">An order reference identifier for a draft order, obtained from the /// OffAmazonPayments widgets</param> public OffAmazonPaymentsServiceMultipleShipment(string amazonOrderReferenceId) { this.OrderList = new Dictionary<string, OrderItem>(); ConstructOrders(); // Instantiate the Merchant propertiesCollection object which contains // required parameters for creating a Marketplace Payment Service propertiesCollection = new OffAmazonPaymentsServicePropertyCollection(); service = new OffAmazonPaymentsServiceClient(propertiesCollection); this._orderReferenceId = amazonOrderReferenceId; }
/// <summary> /// Create a new instance of the class, using the order reference /// identifer as the basis for all service requests /// </summary> /// <param name="amazonOrderReferenceId">An order reference identifier for a draft order, obtained from the /// OffAmazonPayments widgets</param> public OffAmazonPaymentsServiceMultipleShipment(string amazonOrderReferenceId) { this.OrderList = new Dictionary <string, OrderItem>(); ConstructOrders(); // Instantiate the Merchant propertiesCollection object which contains // required parameters for creating a Marketplace Payment Service propertiesCollection = new OffAmazonPaymentsServicePropertyCollection(); service = new OffAmazonPaymentsServiceClient(propertiesCollection); this._orderReferenceId = amazonOrderReferenceId; }
public OffAmazonPaymentsServiceSimpleCheckout(String oroId) { /************************************************************************ * Instantiate the Merchant propertiesCollection object which contains required parameters for creating a Marketplace Payment Service ***********************************************************************/ propertiesCollection = OffAmazonPaymentsServicePropertyCollection.getInstance(); /************************************************************************ * Instantiate Implementation of Marketplace Payment Service ***********************************************************************/ service = new OffAmazonPaymentsServiceClient(propertiesCollection); this.orderReferenceId = oroId; }
public OffAmazonPaymentsServiceProviderCheckout(String oroId) { /************************************************************************ * Instantiate the Merchant propertiesCollection object which contains required parameters for creating a Marketplace Payment Service ***********************************************************************/ propertiesCollection = OffAmazonPaymentsServicePropertyCollection.getInstance(); /************************************************************************ * Instantiate Implementation of Marketplace Payment Service ***********************************************************************/ service = new OffAmazonPaymentsServiceClient(propertiesCollection); this.orderReferenceId = oroId; }
public static AuthorizeOnBillingAgreementResponse AuthorizeOnBillingAgreement(OffAmazonPaymentsServicePropertyCollection propertiesCollection, IOffAmazonPaymentsService service, string billingAgreementId, String authAmount, int indicator, bool captureNow) { AuthorizeOnBillingAgreementRequest request = new AuthorizeOnBillingAgreementRequest(); request.AmazonBillingAgreementId = billingAgreementId; request.SellerId = propertiesCollection.MerchantID; Price price = new Price(); price.Amount = authAmount; price.CurrencyCode = propertiesCollection.CurrencyCode; request.AuthorizationAmount = price; request.CaptureNow = captureNow; request.AuthorizationReferenceId = billingAgreementId.Replace('-', 'a') + "authRef" + indicator.ToString(); return InvokeAuthorizeOnBillingAgreement(service, request); }
public static ProviderCreditSummaryList CheckCaptureForProviderCreditSummaryList(string amazonCaptureId, OffAmazonPaymentsServicePropertyCollection propertiesCollection, IOffAmazonPaymentsService service) { //used to check if the ProviderCreditSummaryList is available TimeSpan startTime = DateTime.Now.TimeOfDay; GetCaptureDetailsResponse getCaptureDetailsResponse = GetCaptureDetailsSample.GetCaptureDetails(propertiesCollection, service, amazonCaptureId); while (getCaptureDetailsResponse.IsSetGetCaptureDetailsResult() && (!getCaptureDetailsResponse.GetCaptureDetailsResult.CaptureDetails.IsSetProviderCreditSummaryList() || getCaptureDetailsResponse.GetCaptureDetailsResult.CaptureDetails.ProviderCreditSummaryList.member.Count < 1)) { if (DateTime.Now.TimeOfDay.Milliseconds - startTime.Milliseconds > 60000) throw new OffAmazonPaymentsServiceException("The ProviderCreditSummaryList not found."); System.Threading.Thread.Sleep(8000); Console.WriteLine("Waiting until ProviderCreditSummaryList is found in GetCaptureDetailsResponse"); getCaptureDetailsResponse = GetCaptureDetailsSample.GetCaptureDetails(propertiesCollection, service, amazonCaptureId); } return getCaptureDetailsResponse.GetCaptureDetailsResult.CaptureDetails.ProviderCreditSummaryList; }
public static SetOrderReferenceDetailsResponse SetOrderReferenceDetails(OffAmazonPaymentsServicePropertyCollection propertiesCollection, IOffAmazonPaymentsService service, string orderReferenceId, string orderAmount) { SetOrderReferenceDetailsRequest setOrderRequest = new SetOrderReferenceDetailsRequest(); setOrderRequest.SellerId = propertiesCollection.MerchantID; setOrderRequest.AmazonOrderReferenceId = orderReferenceId; //setup the currency and amount as an ordertotal object OrderReferenceAttributes attributes = new OrderReferenceAttributes(); OrderTotal orderTotal = new OrderTotal(); orderTotal.Amount = orderAmount; orderTotal.CurrencyCode = propertiesCollection.CurrencyCode; attributes.OrderTotal = orderTotal; setOrderRequest.OrderReferenceAttributes = attributes; return(SetOrderReferenceDetailsSample.InvokeSetOrderReferenceDetails(service, setOrderRequest)); }
public static ReverseProviderCreditResponse ReverseProviderCreditAction(IOffAmazonPaymentsService service, OffAmazonPaymentsServicePropertyCollection propertiesCollection, Random rng, string amazonProviderCreditId, string creditReversalAmount) { //Initiate the ReverseProviderCredit request, including SellerId, AmazonProviderCreditId, CreditReversalReferenceId and CreditReversalAmount ReverseProviderCreditRequest request = new ReverseProviderCreditRequest(); request.SellerId = propertiesCollection.MerchantID; request.AmazonProviderCreditId = amazonProviderCreditId; request.CreditReversalReferenceId = amazonProviderCreditId.Replace("-", "") + "r" + rng.Next(1, 1000).ToString(); //assign the ReverseProviderCreditAmount to the ReverseProviderCredit request Price price = new Price(); price.Amount = creditReversalAmount; price.CurrencyCode = propertiesCollection.CurrencyCode; request.CreditReversalAmount = price; return(ReverseProviderCreditSample.InvokeReverseProviderCredit(service, request)); }
public static SetBillingAgreementDetailsResponse SetBillingAgreementDetails(OffAmazonPaymentsServicePropertyCollection propertiesCollection, IOffAmazonPaymentsService service, string billingAgreementId, string sellerBillingAgreementId, string customNote, string storeName, string sellerNote) { SetBillingAgreementDetailsRequest request = new SetBillingAgreementDetailsRequest(); request.AmazonBillingAgreementId = billingAgreementId; request.SellerId = propertiesCollection.MerchantID; BillingAgreementAttributes attr = new BillingAgreementAttributes(); attr.SellerNote = sellerNote; SellerBillingAgreementAttributes sellerAttr = new SellerBillingAgreementAttributes(); sellerAttr.SellerBillingAgreementId = sellerBillingAgreementId; sellerAttr.CustomInformation = customNote; sellerAttr.StoreName = storeName; attr.SellerBillingAgreementAttributes = sellerAttr; request.BillingAgreementAttributes = attr; return(InvokeSetBillingAgreementDetails(service, request)); }
public static GetRefundDetailsResponse CheckRefundStatus(string amazonRefundId, IOffAmazonPaymentsService service, OffAmazonPaymentsServicePropertyCollection propertiesCollection) { //used to check if the refund is time-out TimeSpan startTime = DateTime.Now.TimeOfDay; GetRefundDetailsRequest refundDetailRequest = new GetRefundDetailsRequest(); refundDetailRequest.SellerId = propertiesCollection.MerchantID; refundDetailRequest.AmazonRefundId = amazonRefundId; GetRefundDetailsResponse getRefundDetailsResponse = GetRefundDetailsSample.InvokeGetRefundDetails(service, refundDetailRequest); while (getRefundDetailsResponse.IsSetGetRefundDetailsResult() && getRefundDetailsResponse.GetRefundDetailsResult.RefundDetails.RefundStatus.State.Equals(PaymentStatus.PENDING)) { if (DateTime.Now.TimeOfDay.Milliseconds - startTime.Milliseconds > 60000) throw new OffAmazonPaymentsServiceException("The refund has timed-out."); System.Threading.Thread.Sleep(8000); Console.WriteLine("Waiting until the Refund Status changes from PENDING"); getRefundDetailsResponse = GetRefundDetailsSample.InvokeGetRefundDetails(service, refundDetailRequest); } return getRefundDetailsResponse; }
//Use a loop to check the status of authorization. Once the status is not "PENDING", skip the loop. public static GetAuthorizationDetailsResponse CheckAuthorizationStatus(string amazonAuthorizationId, OffAmazonPaymentsServicePropertyCollection propertiesCollection, IOffAmazonPaymentsService service) { //used to check if the authorization is time-out TimeSpan startTime = DateTime.Now.TimeOfDay; GetAuthorizationDetailsRequest authDetailRequest = new GetAuthorizationDetailsRequest(); authDetailRequest.SellerId = propertiesCollection.MerchantID; authDetailRequest.AmazonAuthorizationId = amazonAuthorizationId; GetAuthorizationDetailsResponse getAuthResponse = GetAuthorizationDetailsSample.InvokeGetAuthorizationDetails(service, authDetailRequest); while (getAuthResponse.IsSetGetAuthorizationDetailsResult() && getAuthResponse.GetAuthorizationDetailsResult.AuthorizationDetails.AuthorizationStatus.State.Equals(PaymentStatus.PENDING)) { if (DateTime.Now.TimeOfDay.Milliseconds - startTime.Milliseconds > 60000) throw new OffAmazonPaymentsServiceException("The authorization is time-out."); System.Threading.Thread.Sleep(8000); Console.WriteLine("Waiting until the Authorization Status becomes OPEN"); getAuthResponse = GetAuthorizationDetailsSample.InvokeGetAuthorizationDetails(service, authDetailRequest); } return getAuthResponse; }
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); }
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)); }
public static ValidateBillingAgreementResponse InvokeValidateBillingAgreement(IOffAmazonPaymentsService service, ValidateBillingAgreementRequest request) { ValidateBillingAgreementResponse response = null; try { response = service.ValidateBillingAgreement(request); Console.WriteLine("Service Response"); Console.WriteLine("============================================================================="); Console.WriteLine(); Console.WriteLine(" ValidateBillingAgreementResponse"); if (response.IsSetValidateBillingAgreementResult()) { Console.WriteLine(" ValidateBillingAgreementResult"); ValidateBillingAgreementResult validateBillingAgreementResult = response.ValidateBillingAgreementResult; if (validateBillingAgreementResult.IsSetValidationResult()) { Console.WriteLine(" ValidationResult"); Console.WriteLine(" {0}", validateBillingAgreementResult.ValidationResult); } if (validateBillingAgreementResult.IsSetFailureReasonCode()) { Console.WriteLine(" FailureReasonCode"); Console.WriteLine(" {0}", validateBillingAgreementResult.FailureReasonCode); } if (validateBillingAgreementResult.IsSetBillingAgreementStatus()) { Console.WriteLine(" BillingAgreementStatus"); BillingAgreementStatus billingAgreementStatus = validateBillingAgreementResult.BillingAgreementStatus; if (billingAgreementStatus.IsSetState()) { Console.WriteLine(" State"); Console.WriteLine(" {0}", billingAgreementStatus.State); } if (billingAgreementStatus.IsSetLastUpdatedTimestamp()) { Console.WriteLine(" LastUpdatedTimestamp"); Console.WriteLine(" {0}", billingAgreementStatus.LastUpdatedTimestamp); } if (billingAgreementStatus.IsSetReasonCode()) { Console.WriteLine(" ReasonCode"); Console.WriteLine(" {0}", billingAgreementStatus.ReasonCode); } if (billingAgreementStatus.IsSetReasonDescription()) { Console.WriteLine(" ReasonDescription"); Console.WriteLine(" {0}", billingAgreementStatus.ReasonDescription); } } } if (response.IsSetResponseMetadata()) { Console.WriteLine(" ResponseMetadata"); ResponseMetadata responseMetadata = response.ResponseMetadata; if (responseMetadata.IsSetRequestId()) { Console.WriteLine(" RequestId"); Console.WriteLine(" {0}", responseMetadata.RequestId); } } } catch (OffAmazonPaymentsServiceException ex) { PrintException(ex); } return response; }
public static GetRefundDetailsResponse CheckRefundStatus(string amazonRefundId, IOffAmazonPaymentsService service, OffAmazonPaymentsServicePropertyCollection propertiesCollection) { //used to check if the refund is time-out TimeSpan startTime = DateTime.Now.TimeOfDay; GetRefundDetailsRequest refundDetailRequest = new GetRefundDetailsRequest(); refundDetailRequest.SellerId = propertiesCollection.MerchantID; refundDetailRequest.AmazonRefundId = amazonRefundId; GetRefundDetailsResponse getRefundDetailsResponse = GetRefundDetailsSample.InvokeGetRefundDetails(service, refundDetailRequest); while (getRefundDetailsResponse.IsSetGetRefundDetailsResult() && getRefundDetailsResponse.GetRefundDetailsResult.RefundDetails.RefundStatus.State.Equals(PaymentStatus.PENDING)) { if (DateTime.Now.TimeOfDay.Milliseconds - startTime.Milliseconds > 60000) { throw new OffAmazonPaymentsServiceException("The refund has timed-out."); } System.Threading.Thread.Sleep(8000); Console.WriteLine("Waiting until the Refund Status changes from PENDING"); getRefundDetailsResponse = GetRefundDetailsSample.InvokeGetRefundDetails(service, refundDetailRequest); } return(getRefundDetailsResponse); }
public static RefundResponse InvokeRefund(IOffAmazonPaymentsService service, RefundRequest request) { RefundResponse response = null; try { response = service.Refund(request); Console.WriteLine("Service Response"); Console.WriteLine("============================================================================="); Console.WriteLine(); Console.WriteLine(" RefundResponse"); if (response.IsSetRefundResult()) { Console.WriteLine(" RefundResult"); RefundResult refundResult = response.RefundResult; if (refundResult.IsSetRefundDetails()) { Console.WriteLine(" RefundDetails"); RefundDetails refundDetails = refundResult.RefundDetails; if (refundDetails.IsSetAmazonRefundId()) { Console.WriteLine(" AmazonRefundId"); Console.WriteLine(" {0}", refundDetails.AmazonRefundId); } if (refundDetails.IsSetRefundReferenceId()) { Console.WriteLine(" RefundReferenceId"); Console.WriteLine(" {0}", refundDetails.RefundReferenceId); } if (refundDetails.IsSetSellerRefundNote()) { Console.WriteLine(" SellerRefundNote"); Console.WriteLine(" {0}", refundDetails.SellerRefundNote); } if (refundDetails.IsSetRefundType()) { Console.WriteLine(" RefundType"); Console.WriteLine(" {0}", refundDetails.RefundType); } if (refundDetails.IsSetFeeRefunded()) { Console.WriteLine(" FeeRefunded"); Price feeRefunded = refundDetails.FeeRefunded; if (feeRefunded.IsSetAmount()) { Console.WriteLine(" Amount"); Console.WriteLine(" {0}", feeRefunded.Amount); } if (feeRefunded.IsSetCurrencyCode()) { Console.WriteLine(" CurrencyCode"); Console.WriteLine(" {0}", feeRefunded.CurrencyCode); } } if (refundDetails.IsSetCreationTimestamp()) { Console.WriteLine(" CreationTimestamp"); Console.WriteLine(" {0}", refundDetails.CreationTimestamp); } if (refundDetails.IsSetProviderCreditReversalSummaryList()) { foreach (ProviderCreditReversalSummary providerCreditReversalSummary in refundDetails.ProviderCreditReversalSummaryList.member) { if (providerCreditReversalSummary.IsSetProviderCreditReversalId()) { Console.WriteLine(" ProviderCreditReversalId"); Console.WriteLine(" {0}", providerCreditReversalSummary.ProviderCreditReversalId); } if (providerCreditReversalSummary.IsSetProviderId()) { Console.WriteLine(" ProviderId"); Console.WriteLine(" {0}", providerCreditReversalSummary.ProviderId); } } } if (refundDetails.IsSetRefundStatus()) { Console.WriteLine(" RefundStatus"); Status refundStatus = refundDetails.RefundStatus; if (refundStatus.IsSetState()) { Console.WriteLine(" State"); Console.WriteLine(" {0}", refundStatus.State); } if (refundStatus.IsSetLastUpdateTimestamp()) { Console.WriteLine(" LastUpdateTimestamp"); Console.WriteLine(" {0}", refundStatus.LastUpdateTimestamp); } if (refundStatus.IsSetReasonCode()) { Console.WriteLine(" ReasonCode"); Console.WriteLine(" {0}", refundStatus.ReasonCode); } if (refundStatus.IsSetReasonDescription()) { Console.WriteLine(" ReasonDescription"); Console.WriteLine(" {0}", refundStatus.ReasonDescription); } } } } if (response.IsSetResponseMetadata()) { Console.WriteLine(" ResponseMetadata"); ResponseMetadata responseMetadata = response.ResponseMetadata; if (responseMetadata.IsSetRequestId()) { Console.WriteLine(" RequestId"); Console.WriteLine(" {0}", responseMetadata.RequestId); } } } catch (OffAmazonPaymentsServiceException ex) { PrintException(ex); } return(response); }
public static ReverseProviderCreditResponse InvokeReverseProviderCredit(IOffAmazonPaymentsService service, ReverseProviderCreditRequest request) { ReverseProviderCreditResponse response = null; try { response = service.ReverseProviderCredit(request); Console.WriteLine("Service Response"); Console.WriteLine("============================================================================="); Console.WriteLine(); Console.WriteLine(" ReverseProviderCreditResponse"); if (response.IsSetReverseProviderCreditResult()) { Console.WriteLine(" ReverseProviderCreditResult"); ReverseProviderCreditResult ReverseProviderCreditResult = response.ReverseProviderCreditResult; if (ReverseProviderCreditResult.IsSetProviderCreditReversalDetails()) { Console.WriteLine(" ReverseProviderCreditDetails"); ProviderCreditReversalDetails ReverseProviderCreditDetails = ReverseProviderCreditResult.ProviderCreditReversalDetails; if (ReverseProviderCreditDetails.IsSetAmazonProviderCreditReversalId()) { Console.WriteLine(" AmazonProviderCreditReversalId"); Console.WriteLine(" {0}", ReverseProviderCreditDetails.AmazonProviderCreditReversalId); } if (ReverseProviderCreditDetails.IsSetCreditReversalReferenceId()) { Console.WriteLine(" CreditReversalReferenceId"); Console.WriteLine(" {0}", ReverseProviderCreditDetails.CreditReversalReferenceId); } if (ReverseProviderCreditDetails.IsSetCreditReversalNote()) { Console.WriteLine(" CreditReversalNote"); Console.WriteLine(" {0}", ReverseProviderCreditDetails.CreditReversalNote); } if (ReverseProviderCreditDetails.IsSetCreationTimestamp()) { Console.WriteLine(" CreationTimestamp"); Console.WriteLine(" {0}", ReverseProviderCreditDetails.CreationTimestamp); } if (ReverseProviderCreditDetails.IsSetCreditReversalStatus()) { Console.WriteLine(" CreditReversalStatus"); Status ReverseProviderCreditStatus = ReverseProviderCreditDetails.CreditReversalStatus; if (ReverseProviderCreditStatus.IsSetState()) { Console.WriteLine(" State"); Console.WriteLine(" {0}", ReverseProviderCreditStatus.State); } if (ReverseProviderCreditStatus.IsSetLastUpdateTimestamp()) { Console.WriteLine(" LastUpdateTimestamp"); Console.WriteLine(" {0}", ReverseProviderCreditStatus.LastUpdateTimestamp); } if (ReverseProviderCreditStatus.IsSetReasonCode()) { Console.WriteLine(" ReasonCode"); Console.WriteLine(" {0}", ReverseProviderCreditStatus.ReasonCode); } if (ReverseProviderCreditStatus.IsSetReasonDescription()) { Console.WriteLine(" ReasonDescription"); Console.WriteLine(" {0}", ReverseProviderCreditStatus.ReasonDescription); } } if (ReverseProviderCreditDetails.IsSetSellerId()) { Console.WriteLine(" SellerId"); Console.WriteLine(" {0}", ReverseProviderCreditDetails.SellerId); } if (ReverseProviderCreditDetails.IsSetProviderId()) { Console.WriteLine(" ProviderId"); Console.WriteLine(" {0}", ReverseProviderCreditDetails.ProviderId); } } } if (response.IsSetResponseMetadata()) { Console.WriteLine(" ResponseMetadata"); ResponseMetadata responseMetadata = response.ResponseMetadata; if (responseMetadata.IsSetRequestId()) { Console.WriteLine(" RequestId"); Console.WriteLine(" {0}", responseMetadata.RequestId); } } } catch (OffAmazonPaymentsServiceException ex) { PrintException(ex); } return response; }
public OffAmazonPaymentsServiceAutomaticPaymentsSimpleCheckout(string billingAgreementId) { propertiesCollection = OffAmazonPaymentsServicePropertyCollection.getInstance(); service = new OffAmazonPaymentsServiceClient(propertiesCollection); this.billingAgreementId = billingAgreementId; }
private static GetAuthorizationDetailsResponse GetAuthorizationDetails(IOffAmazonPaymentsService service, GetAuthorizationDetailsRequest request) { GetAuthorizationDetailsResponse response = null; response = service.GetAuthorizationDetails(request); return response; }
public static ReverseProviderCreditResponse ReverseProviderCreditAction(IOffAmazonPaymentsService service, OffAmazonPaymentsServicePropertyCollection propertiesCollection, Random rng, string amazonProviderCreditId, string creditReversalAmount) { //Initiate the ReverseProviderCredit request, including SellerId, AmazonProviderCreditId, CreditReversalReferenceId and CreditReversalAmount ReverseProviderCreditRequest request = new ReverseProviderCreditRequest(); request.SellerId = propertiesCollection.MerchantID; request.AmazonProviderCreditId = amazonProviderCreditId; request.CreditReversalReferenceId = amazonProviderCreditId.Replace("-", "") + "r" + rng.Next(1, 1000).ToString(); //assign the ReverseProviderCreditAmount to the ReverseProviderCredit request Price price = new Price(); price.Amount = creditReversalAmount; price.CurrencyCode = propertiesCollection.CurrencyCode; request.CreditReversalAmount = price; return ReverseProviderCreditSample.InvokeReverseProviderCredit(service, request); }
public static GetAuthorizationDetailsResponse GetAuthorizationDetails(IOffAmazonPaymentsService service, GetAuthorizationDetailsRequest request, TextWriter buffer) { GetAuthorizationDetailsResponse response = GetAuthorizationDetails(service, request); printGetAuthorizationDetailsResponseToBuffer(response, buffer); return response; }
public static GetAuthorizationDetailsResponse InvokeGetAuthorizationDetails(IOffAmazonPaymentsService service, GetAuthorizationDetailsRequest request) { return GetAuthorizationDetails(service, request, Console.Out); }
public static SetBillingAgreementDetailsResponse InvokeSetBillingAgreementDetails(IOffAmazonPaymentsService service, SetBillingAgreementDetailsRequest request) { SetBillingAgreementDetailsResponse response = null; try { response = service.SetBillingAgreementDetails(request); Console.WriteLine("Service Response"); Console.WriteLine("============================================================================="); Console.WriteLine(); Console.WriteLine(" SetBillingAgreementDetailsResponse"); if (response.IsSetSetBillingAgreementDetailsResult()) { Console.WriteLine(" SetBillingAgreementDetailsResult"); SetBillingAgreementDetailsResult setBillingAgreementDetailsResult = response.SetBillingAgreementDetailsResult; if (setBillingAgreementDetailsResult.IsSetBillingAgreementDetails()) { Console.WriteLine(" BillingAgreementDetails"); BillingAgreementDetails billingAgreementDetails = setBillingAgreementDetailsResult.BillingAgreementDetails; if (billingAgreementDetails.IsSetAmazonBillingAgreementId()) { Console.WriteLine(" AmazonBillingAgreementId"); Console.WriteLine(" {0}", billingAgreementDetails.AmazonBillingAgreementId); } if (billingAgreementDetails.IsSetBillingAgreementLimits()) { Console.WriteLine(" BillingAgreementLimits"); BillingAgreementLimits billingAgreementLimits = billingAgreementDetails.BillingAgreementLimits; if (billingAgreementLimits.IsSetAmountLimitPerTimePeriod()) { Console.WriteLine(" AmountLimitPerTimePeriod"); Price amountLimitPerTimePeriod = billingAgreementLimits.AmountLimitPerTimePeriod; if (amountLimitPerTimePeriod.IsSetAmount()) { Console.WriteLine(" Amount"); Console.WriteLine(" {0}", amountLimitPerTimePeriod.Amount); } if (amountLimitPerTimePeriod.IsSetCurrencyCode()) { Console.WriteLine(" CurrencyCode"); Console.WriteLine(" {0}", amountLimitPerTimePeriod.CurrencyCode); } } if (billingAgreementLimits.IsSetTimePeriodStartDate()) { Console.WriteLine(" TimePeriodStartDate"); Console.WriteLine(" {0}", billingAgreementLimits.TimePeriodStartDate); } if (billingAgreementLimits.IsSetTimePeriodEndDate()) { Console.WriteLine(" TimePeriodEndDate"); Console.WriteLine(" {0}", billingAgreementLimits.TimePeriodEndDate); } if (billingAgreementLimits.IsSetCurrentRemainingBalance()) { Console.WriteLine(" CurrentRemainingBalance"); Price currentRemainingBalance = billingAgreementLimits.CurrentRemainingBalance; if (currentRemainingBalance.IsSetAmount()) { Console.WriteLine(" Amount"); Console.WriteLine(" {0}", currentRemainingBalance.Amount); } if (currentRemainingBalance.IsSetCurrencyCode()) { Console.WriteLine(" CurrencyCode"); Console.WriteLine(" {0}", currentRemainingBalance.CurrencyCode); } } } if (billingAgreementDetails.IsSetBuyer()) { Console.WriteLine(" Buyer"); Buyer buyer = billingAgreementDetails.Buyer; if (buyer.IsSetName()) { Console.WriteLine(" Name"); Console.WriteLine(" {0}", buyer.Name); } if (buyer.IsSetEmail()) { Console.WriteLine(" Email"); Console.WriteLine(" {0}", buyer.Email); } if (buyer.IsSetPhone()) { Console.WriteLine(" Phone"); Console.WriteLine(" {0}", buyer.Phone); } } if (billingAgreementDetails.IsSetSellerNote()) { Console.WriteLine(" SellerNote"); Console.WriteLine(" {0}", billingAgreementDetails.SellerNote); } if (billingAgreementDetails.IsSetPlatformId()) { Console.WriteLine(" PlatformId"); Console.WriteLine(" {0}", billingAgreementDetails.PlatformId); } if (billingAgreementDetails.IsSetDestination()) { Console.WriteLine(" Destination"); Destination destination = billingAgreementDetails.Destination; if (destination.IsSetDestinationType()) { Console.WriteLine(" DestinationType"); Console.WriteLine(" {0}", destination.DestinationType); } if (destination.IsSetPhysicalDestination()) { Console.WriteLine(" PhysicalDestination"); Address physicalDestination = destination.PhysicalDestination; if (physicalDestination.IsSetName()) { Console.WriteLine(" Name"); Console.WriteLine(" {0}", physicalDestination.Name); } if (physicalDestination.IsSetAddressLine1()) { Console.WriteLine(" AddressLine1"); Console.WriteLine(" {0}", physicalDestination.AddressLine1); } if (physicalDestination.IsSetAddressLine2()) { Console.WriteLine(" AddressLine2"); Console.WriteLine(" {0}", physicalDestination.AddressLine2); } if (physicalDestination.IsSetAddressLine3()) { Console.WriteLine(" AddressLine3"); Console.WriteLine(" {0}", physicalDestination.AddressLine3); } if (physicalDestination.IsSetCity()) { Console.WriteLine(" City"); Console.WriteLine(" {0}", physicalDestination.City); } if (physicalDestination.IsSetCounty()) { Console.WriteLine(" County"); Console.WriteLine(" {0}", physicalDestination.County); } if (physicalDestination.IsSetDistrict()) { Console.WriteLine(" District"); Console.WriteLine(" {0}", physicalDestination.District); } if (physicalDestination.IsSetStateOrRegion()) { Console.WriteLine(" StateOrRegion"); Console.WriteLine(" {0}", physicalDestination.StateOrRegion); } if (physicalDestination.IsSetPostalCode()) { Console.WriteLine(" PostalCode"); Console.WriteLine(" {0}", physicalDestination.PostalCode); } if (physicalDestination.IsSetCountryCode()) { Console.WriteLine(" CountryCode"); Console.WriteLine(" {0}", physicalDestination.CountryCode); } if (physicalDestination.IsSetPhone()) { Console.WriteLine(" Phone"); Console.WriteLine(" {0}", physicalDestination.Phone); } } } if (billingAgreementDetails.IsSetBillingAddress()) { Console.WriteLine(" BillingAddress"); BillingAddress billingAddress = billingAgreementDetails.BillingAddress; if (billingAddress.IsSetAddressType()) { Console.WriteLine(" AddressType"); Console.WriteLine(" {0}", billingAddress.AddressType); } if (billingAddress.IsSetPhysicalAddress()) { Console.WriteLine(" PhysicalAddress"); Address physicalAddress = billingAddress.PhysicalAddress; if (physicalAddress.IsSetName()) { Console.WriteLine(" Name"); Console.WriteLine(" {0}", physicalAddress.Name); } if (physicalAddress.IsSetAddressLine1()) { Console.WriteLine(" AddressLine1"); Console.WriteLine(" {0}", physicalAddress.AddressLine1); } if (physicalAddress.IsSetAddressLine2()) { Console.WriteLine(" AddressLine2"); Console.WriteLine(" {0}", physicalAddress.AddressLine2); } if (physicalAddress.IsSetAddressLine3()) { Console.WriteLine(" AddressLine3"); Console.WriteLine(" {0}", physicalAddress.AddressLine3); } if (physicalAddress.IsSetCity()) { Console.WriteLine(" City"); Console.WriteLine(" {0}", physicalAddress.City); } if (physicalAddress.IsSetCounty()) { Console.WriteLine(" County"); Console.WriteLine(" {0}", physicalAddress.County); } if (physicalAddress.IsSetDistrict()) { Console.WriteLine(" District"); Console.WriteLine(" {0}", physicalAddress.District); } if (physicalAddress.IsSetStateOrRegion()) { Console.WriteLine(" StateOrRegion"); Console.WriteLine(" {0}", physicalAddress.StateOrRegion); } if (physicalAddress.IsSetPostalCode()) { Console.WriteLine(" PostalCode"); Console.WriteLine(" {0}", physicalAddress.PostalCode); } if (physicalAddress.IsSetCountryCode()) { Console.WriteLine(" CountryCode"); Console.WriteLine(" {0}", physicalAddress.CountryCode); } if (physicalAddress.IsSetPhone()) { Console.WriteLine(" Phone"); Console.WriteLine(" {0}", physicalAddress.Phone); } } } if (billingAgreementDetails.IsSetReleaseEnvironment()) { Console.WriteLine(" ReleaseEnvironment"); Console.WriteLine(" {0}", billingAgreementDetails.ReleaseEnvironment); } if (billingAgreementDetails.IsSetSellerBillingAgreementAttributes()) { Console.WriteLine(" SellerBillingAgreementAttributes"); SellerBillingAgreementAttributes sellerBillingAgreementAttributes = billingAgreementDetails.SellerBillingAgreementAttributes; if (sellerBillingAgreementAttributes.IsSetSellerBillingAgreementId()) { Console.WriteLine(" SellerBillingAgreementId"); Console.WriteLine(" {0}", sellerBillingAgreementAttributes.SellerBillingAgreementId); } if (sellerBillingAgreementAttributes.IsSetStoreName()) { Console.WriteLine(" StoreName"); Console.WriteLine(" {0}", sellerBillingAgreementAttributes.StoreName); } if (sellerBillingAgreementAttributes.IsSetCustomInformation()) { Console.WriteLine(" CustomInformation"); Console.WriteLine(" {0}", sellerBillingAgreementAttributes.CustomInformation); } } if (billingAgreementDetails.IsSetBillingAgreementStatus()) { Console.WriteLine(" BillingAgreementStatus"); BillingAgreementStatus billingAgreementStatus = billingAgreementDetails.BillingAgreementStatus; if (billingAgreementStatus.IsSetState()) { Console.WriteLine(" State"); Console.WriteLine(" {0}", billingAgreementStatus.State); } if (billingAgreementStatus.IsSetLastUpdatedTimestamp()) { Console.WriteLine(" LastUpdatedTimestamp"); Console.WriteLine(" {0}", billingAgreementStatus.LastUpdatedTimestamp); } if (billingAgreementStatus.IsSetReasonCode()) { Console.WriteLine(" ReasonCode"); Console.WriteLine(" {0}", billingAgreementStatus.ReasonCode); } if (billingAgreementStatus.IsSetReasonDescription()) { Console.WriteLine(" ReasonDescription"); Console.WriteLine(" {0}", billingAgreementStatus.ReasonDescription); } } if (billingAgreementDetails.IsSetConstraints()) { Console.WriteLine(" Constraints"); Constraints constraints = billingAgreementDetails.Constraints; List<Constraint> constraintList = constraints.Constraint; foreach (Constraint constraint in constraintList) { Console.WriteLine(" Constraint"); if (constraint.IsSetConstraintID()) { Console.WriteLine(" ConstraintID"); Console.WriteLine(" {0}", constraint.ConstraintID); } if (constraint.IsSetDescription()) { Console.WriteLine(" Description"); Console.WriteLine(" {0}", constraint.Description); } } } if (billingAgreementDetails.IsSetCreationTimestamp()) { Console.WriteLine(" CreationTimestamp"); Console.WriteLine(" {0}", billingAgreementDetails.CreationTimestamp); } if (billingAgreementDetails.IsSetExpirationTimestamp()) { Console.WriteLine(" ExpirationTimestamp"); Console.WriteLine(" {0}", billingAgreementDetails.ExpirationTimestamp); } if (billingAgreementDetails.IsSetBillingAgreementConsent()) { Console.WriteLine(" BillingAgreementConsent"); Console.WriteLine(" {0}", billingAgreementDetails.BillingAgreementConsent); } } } if (response.IsSetResponseMetadata()) { Console.WriteLine(" ResponseMetadata"); ResponseMetadata responseMetadata = response.ResponseMetadata; if (responseMetadata.IsSetRequestId()) { Console.WriteLine(" RequestId"); Console.WriteLine(" {0}", responseMetadata.RequestId); } } } catch (OffAmazonPaymentsServiceException ex) { PrintException(ex); } return response; }
public static AuthorizeOnBillingAgreementResponse InvokeAuthorizeOnBillingAgreement(IOffAmazonPaymentsService service, AuthorizeOnBillingAgreementRequest request) { AuthorizeOnBillingAgreementResponse response = null; try { response = service.AuthorizeOnBillingAgreement(request); Console.WriteLine("Service Response"); Console.WriteLine("============================================================================="); Console.WriteLine(); Console.WriteLine(" AuthorizeOnBillingAgreementResponse"); if (response.IsSetAuthorizeOnBillingAgreementResult()) { Console.WriteLine(" AuthorizeOnBillingAgreementResult"); AuthorizeOnBillingAgreementResult authorizeOnBillingAgreementResult = response.AuthorizeOnBillingAgreementResult; if (authorizeOnBillingAgreementResult.IsSetAuthorizationDetails()) { Console.WriteLine(" AuthorizationDetails"); AuthorizationDetails authorizationDetails = authorizeOnBillingAgreementResult.AuthorizationDetails; if (authorizationDetails.IsSetAmazonAuthorizationId()) { Console.WriteLine(" AmazonAuthorizationId"); Console.WriteLine(" {0}", authorizationDetails.AmazonAuthorizationId); } if (authorizationDetails.IsSetAuthorizationReferenceId()) { Console.WriteLine(" AuthorizationReferenceId"); Console.WriteLine(" {0}", authorizationDetails.AuthorizationReferenceId); } if (authorizationDetails.IsSetAuthorizationBillingAddress()) { Console.WriteLine(" AuthorizationBillingAddress"); Address authorizationBillingAddress = authorizationDetails.AuthorizationBillingAddress; if (authorizationBillingAddress.IsSetName()) { Console.WriteLine(" Name"); Console.WriteLine(" {0}", authorizationBillingAddress.Name); } if (authorizationBillingAddress.IsSetAddressLine1()) { Console.WriteLine(" AddressLine1"); Console.WriteLine(" {0}", authorizationBillingAddress.AddressLine1); } if (authorizationBillingAddress.IsSetAddressLine2()) { Console.WriteLine(" AddressLine2"); Console.WriteLine(" {0}", authorizationBillingAddress.AddressLine2); } if (authorizationBillingAddress.IsSetAddressLine3()) { Console.WriteLine(" AddressLine3"); Console.WriteLine(" {0}", authorizationBillingAddress.AddressLine3); } if (authorizationBillingAddress.IsSetCity()) { Console.WriteLine(" City"); Console.WriteLine(" {0}", authorizationBillingAddress.City); } if (authorizationBillingAddress.IsSetCounty()) { Console.WriteLine(" County"); Console.WriteLine(" {0}", authorizationBillingAddress.County); } if (authorizationBillingAddress.IsSetDistrict()) { Console.WriteLine(" District"); Console.WriteLine(" {0}", authorizationBillingAddress.District); } if (authorizationBillingAddress.IsSetStateOrRegion()) { Console.WriteLine(" StateOrRegion"); Console.WriteLine(" {0}", authorizationBillingAddress.StateOrRegion); } if (authorizationBillingAddress.IsSetPostalCode()) { Console.WriteLine(" PostalCode"); Console.WriteLine(" {0}", authorizationBillingAddress.PostalCode); } if (authorizationBillingAddress.IsSetCountryCode()) { Console.WriteLine(" CountryCode"); Console.WriteLine(" {0}", authorizationBillingAddress.CountryCode); } if (authorizationBillingAddress.IsSetPhone()) { Console.WriteLine(" Phone"); Console.WriteLine(" {0}", authorizationBillingAddress.Phone); } } if (authorizationDetails.IsSetSellerAuthorizationNote()) { Console.WriteLine(" SellerAuthorizationNote"); Console.WriteLine(" {0}", authorizationDetails.SellerAuthorizationNote); } if (authorizationDetails.IsSetAuthorizationAmount()) { Console.WriteLine(" AuthorizationAmount"); Price authorizationAmount = authorizationDetails.AuthorizationAmount; if (authorizationAmount.IsSetAmount()) { Console.WriteLine(" Amount"); Console.WriteLine(" {0}", authorizationAmount.Amount); } if (authorizationAmount.IsSetCurrencyCode()) { Console.WriteLine(" CurrencyCode"); Console.WriteLine(" {0}", authorizationAmount.CurrencyCode); } } if (authorizationDetails.IsSetCapturedAmount()) { Console.WriteLine(" CapturedAmount"); Price capturedAmount = authorizationDetails.CapturedAmount; if (capturedAmount.IsSetAmount()) { Console.WriteLine(" Amount"); Console.WriteLine(" {0}", capturedAmount.Amount); } if (capturedAmount.IsSetCurrencyCode()) { Console.WriteLine(" CurrencyCode"); Console.WriteLine(" {0}", capturedAmount.CurrencyCode); } } if (authorizationDetails.IsSetAuthorizationFee()) { Console.WriteLine(" AuthorizationFee"); Price authorizationFee = authorizationDetails.AuthorizationFee; if (authorizationFee.IsSetAmount()) { Console.WriteLine(" Amount"); Console.WriteLine(" {0}", authorizationFee.Amount); } if (authorizationFee.IsSetCurrencyCode()) { Console.WriteLine(" CurrencyCode"); Console.WriteLine(" {0}", authorizationFee.CurrencyCode); } } if (authorizationDetails.IsSetIdList()) { Console.WriteLine(" IdList"); IdList idList = authorizationDetails.IdList; List <String> memberList = idList.member; foreach (String member in memberList) { Console.WriteLine(" member"); Console.WriteLine(" {0}", member); } } if (authorizationDetails.IsSetCreationTimestamp()) { Console.WriteLine(" CreationTimestamp"); Console.WriteLine(" {0}", authorizationDetails.CreationTimestamp); } if (authorizationDetails.IsSetExpirationTimestamp()) { Console.WriteLine(" ExpirationTimestamp"); Console.WriteLine(" {0}", authorizationDetails.ExpirationTimestamp); } if (authorizationDetails.IsSetAuthorizationStatus()) { Console.WriteLine(" AuthorizationStatus"); Status authorizationStatus = authorizationDetails.AuthorizationStatus; if (authorizationStatus.IsSetState()) { Console.WriteLine(" State"); Console.WriteLine(" {0}", authorizationStatus.State); } if (authorizationStatus.IsSetLastUpdateTimestamp()) { Console.WriteLine(" LastUpdateTimestamp"); Console.WriteLine(" {0}", authorizationStatus.LastUpdateTimestamp); } if (authorizationStatus.IsSetReasonCode()) { Console.WriteLine(" ReasonCode"); Console.WriteLine(" {0}", authorizationStatus.ReasonCode); } if (authorizationStatus.IsSetReasonDescription()) { Console.WriteLine(" ReasonDescription"); Console.WriteLine(" {0}", authorizationStatus.ReasonDescription); } } if (authorizationDetails.IsSetOrderItemCategories()) { Console.WriteLine(" OrderItemCategories"); OrderItemCategories orderItemCategories = authorizationDetails.OrderItemCategories; List <String> orderItemCategoryList = orderItemCategories.OrderItemCategory; foreach (String orderItemCategory in orderItemCategoryList) { Console.WriteLine(" OrderItemCategory"); Console.WriteLine(" {0}", orderItemCategory); } } if (authorizationDetails.IsSetCaptureNow()) { Console.WriteLine(" CaptureNow"); Console.WriteLine(" {0}", authorizationDetails.CaptureNow); } if (authorizationDetails.IsSetSoftDescriptor()) { Console.WriteLine(" SoftDescriptor"); Console.WriteLine(" {0}", authorizationDetails.SoftDescriptor); } if (authorizationDetails.IsSetAddressVerificationCode()) { Console.WriteLine(" AddressVerificationCode"); Console.WriteLine(" {0}", authorizationDetails.AddressVerificationCode); } } if (authorizeOnBillingAgreementResult.IsSetAmazonOrderReferenceId()) { Console.WriteLine(" AmazonOrderReferenceId"); Console.WriteLine(" {0}", authorizeOnBillingAgreementResult.AmazonOrderReferenceId); } } if (response.IsSetResponseMetadata()) { Console.WriteLine(" ResponseMetadata"); ResponseMetadata responseMetadata = response.ResponseMetadata; if (responseMetadata.IsSetRequestId()) { Console.WriteLine(" RequestId"); Console.WriteLine(" {0}", responseMetadata.RequestId); } } } catch (OffAmazonPaymentsServiceException ex) { PrintException(ex); } return(response); }
private static GetOrderReferenceDetailsResponse InvokeGetOrderReferenceDetails(OffAmazonPaymentsServicePropertyCollection propertiesCollection, IOffAmazonPaymentsService service, string orderReferenceId, string addressConsentToken) { GetOrderReferenceDetailsRequest getOrderRequest = new GetOrderReferenceDetailsRequest(); getOrderRequest.SellerId = propertiesCollection.MerchantID; getOrderRequest.AmazonOrderReferenceId = orderReferenceId; getOrderRequest.AddressConsentToken = addressConsentToken; GetOrderReferenceDetailsResponse response = service.GetOrderReferenceDetails(getOrderRequest); return(response); }
public static CreateOrderReferenceForIdResponse InvokeCreateOrderReferenceForId(IOffAmazonPaymentsService service, CreateOrderReferenceForIdRequest request) { CreateOrderReferenceForIdResponse response = null; try { response = service.CreateOrderReferenceForId(request); Console.WriteLine("Service Response"); Console.WriteLine("============================================================================="); Console.WriteLine(); Console.WriteLine(" CreateOrderReferenceForIdResponse"); if (response.IsSetCreateOrderReferenceForIdResult()) { Console.WriteLine(" CreateOrderReferenceForIdResult"); CreateOrderReferenceForIdResult createOrderReferenceForIdResult = response.CreateOrderReferenceForIdResult; if (createOrderReferenceForIdResult.IsSetOrderReferenceDetails()) { Console.WriteLine(" OrderReferenceDetails"); OrderReferenceDetails orderReferenceDetails = createOrderReferenceForIdResult.OrderReferenceDetails; if (orderReferenceDetails.IsSetAmazonOrderReferenceId()) { Console.WriteLine(" AmazonOrderReferenceId"); Console.WriteLine(" {0}", orderReferenceDetails.AmazonOrderReferenceId); } if (orderReferenceDetails.IsSetBuyer()) { Console.WriteLine(" Buyer"); Buyer buyer = orderReferenceDetails.Buyer; if (buyer.IsSetName()) { Console.WriteLine(" Name"); Console.WriteLine(" {0}", buyer.Name); } if (buyer.IsSetEmail()) { Console.WriteLine(" Email"); Console.WriteLine(" {0}", buyer.Email); } if (buyer.IsSetPhone()) { Console.WriteLine(" Phone"); Console.WriteLine(" {0}", buyer.Phone); } } if (orderReferenceDetails.IsSetOrderTotal()) { Console.WriteLine(" OrderTotal"); OrderTotal orderTotal = orderReferenceDetails.OrderTotal; if (orderTotal.IsSetCurrencyCode()) { Console.WriteLine(" CurrencyCode"); Console.WriteLine(" {0}", orderTotal.CurrencyCode); } if (orderTotal.IsSetAmount()) { Console.WriteLine(" Amount"); Console.WriteLine(" {0}", orderTotal.Amount); } } if (orderReferenceDetails.IsSetSellerNote()) { Console.WriteLine(" SellerNote"); Console.WriteLine(" {0}", orderReferenceDetails.SellerNote); } if (orderReferenceDetails.IsSetPlatformId()) { Console.WriteLine(" PlatformId"); Console.WriteLine(" {0}", orderReferenceDetails.PlatformId); } if (orderReferenceDetails.IsSetDestination()) { Console.WriteLine(" Destination"); Destination destination = orderReferenceDetails.Destination; if (destination.IsSetDestinationType()) { Console.WriteLine(" DestinationType"); Console.WriteLine(" {0}", destination.DestinationType); } if (destination.IsSetPhysicalDestination()) { Console.WriteLine(" PhysicalDestination"); Address physicalDestination = destination.PhysicalDestination; if (physicalDestination.IsSetName()) { Console.WriteLine(" Name"); Console.WriteLine(" {0}", physicalDestination.Name); } if (physicalDestination.IsSetAddressLine1()) { Console.WriteLine(" AddressLine1"); Console.WriteLine(" {0}", physicalDestination.AddressLine1); } if (physicalDestination.IsSetAddressLine2()) { Console.WriteLine(" AddressLine2"); Console.WriteLine(" {0}", physicalDestination.AddressLine2); } if (physicalDestination.IsSetAddressLine3()) { Console.WriteLine(" AddressLine3"); Console.WriteLine(" {0}", physicalDestination.AddressLine3); } if (physicalDestination.IsSetCity()) { Console.WriteLine(" City"); Console.WriteLine(" {0}", physicalDestination.City); } if (physicalDestination.IsSetCounty()) { Console.WriteLine(" County"); Console.WriteLine(" {0}", physicalDestination.County); } if (physicalDestination.IsSetDistrict()) { Console.WriteLine(" District"); Console.WriteLine(" {0}", physicalDestination.District); } if (physicalDestination.IsSetStateOrRegion()) { Console.WriteLine(" StateOrRegion"); Console.WriteLine(" {0}", physicalDestination.StateOrRegion); } if (physicalDestination.IsSetPostalCode()) { Console.WriteLine(" PostalCode"); Console.WriteLine(" {0}", physicalDestination.PostalCode); } if (physicalDestination.IsSetCountryCode()) { Console.WriteLine(" CountryCode"); Console.WriteLine(" {0}", physicalDestination.CountryCode); } if (physicalDestination.IsSetPhone()) { Console.WriteLine(" Phone"); Console.WriteLine(" {0}", physicalDestination.Phone); } } } if (orderReferenceDetails.IsSetBillingAddress()) { Console.WriteLine(" BillingAddress"); BillingAddress billingAddress = orderReferenceDetails.BillingAddress; if (billingAddress.IsSetAddressType()) { Console.WriteLine(" AddressType"); Console.WriteLine(" {0}", billingAddress.AddressType); } if (billingAddress.IsSetPhysicalAddress()) { Console.WriteLine(" PhysicalAddress"); Address physicalAddress = billingAddress.PhysicalAddress; if (physicalAddress.IsSetName()) { Console.WriteLine(" Name"); Console.WriteLine(" {0}", physicalAddress.Name); } if (physicalAddress.IsSetAddressLine1()) { Console.WriteLine(" AddressLine1"); Console.WriteLine(" {0}", physicalAddress.AddressLine1); } if (physicalAddress.IsSetAddressLine2()) { Console.WriteLine(" AddressLine2"); Console.WriteLine(" {0}", physicalAddress.AddressLine2); } if (physicalAddress.IsSetAddressLine3()) { Console.WriteLine(" AddressLine3"); Console.WriteLine(" {0}", physicalAddress.AddressLine3); } if (physicalAddress.IsSetCity()) { Console.WriteLine(" City"); Console.WriteLine(" {0}", physicalAddress.City); } if (physicalAddress.IsSetCounty()) { Console.WriteLine(" County"); Console.WriteLine(" {0}", physicalAddress.County); } if (physicalAddress.IsSetDistrict()) { Console.WriteLine(" District"); Console.WriteLine(" {0}", physicalAddress.District); } if (physicalAddress.IsSetStateOrRegion()) { Console.WriteLine(" StateOrRegion"); Console.WriteLine(" {0}", physicalAddress.StateOrRegion); } if (physicalAddress.IsSetPostalCode()) { Console.WriteLine(" PostalCode"); Console.WriteLine(" {0}", physicalAddress.PostalCode); } if (physicalAddress.IsSetCountryCode()) { Console.WriteLine(" CountryCode"); Console.WriteLine(" {0}", physicalAddress.CountryCode); } if (physicalAddress.IsSetPhone()) { Console.WriteLine(" Phone"); Console.WriteLine(" {0}", physicalAddress.Phone); } } } if (orderReferenceDetails.IsSetReleaseEnvironment()) { Console.WriteLine(" ReleaseEnvironment"); Console.WriteLine(" {0}", orderReferenceDetails.ReleaseEnvironment); } if (orderReferenceDetails.IsSetSellerOrderAttributes()) { Console.WriteLine(" SellerOrderAttributes"); SellerOrderAttributes sellerOrderAttributes = orderReferenceDetails.SellerOrderAttributes; if (sellerOrderAttributes.IsSetSellerOrderId()) { Console.WriteLine(" SellerOrderId"); Console.WriteLine(" {0}", sellerOrderAttributes.SellerOrderId); } if (sellerOrderAttributes.IsSetStoreName()) { Console.WriteLine(" StoreName"); Console.WriteLine(" {0}", sellerOrderAttributes.StoreName); } if (sellerOrderAttributes.IsSetOrderItemCategories()) { Console.WriteLine(" OrderItemCategories"); OrderItemCategories orderItemCategories = sellerOrderAttributes.OrderItemCategories; List <String> orderItemCategoryList = orderItemCategories.OrderItemCategory; foreach (String orderItemCategory in orderItemCategoryList) { Console.WriteLine(" OrderItemCategory"); Console.WriteLine(" {0}", orderItemCategory); } } if (sellerOrderAttributes.IsSetCustomInformation()) { Console.WriteLine(" CustomInformation"); Console.WriteLine(" {0}", sellerOrderAttributes.CustomInformation); } } if (orderReferenceDetails.IsSetOrderReferenceStatus()) { Console.WriteLine(" OrderReferenceStatus"); OrderReferenceStatus orderReferenceStatus = orderReferenceDetails.OrderReferenceStatus; if (orderReferenceStatus.IsSetState()) { Console.WriteLine(" State"); Console.WriteLine(" {0}", orderReferenceStatus.State); } if (orderReferenceStatus.IsSetLastUpdateTimestamp()) { Console.WriteLine(" LastUpdateTimestamp"); Console.WriteLine(" {0}", orderReferenceStatus.LastUpdateTimestamp); } if (orderReferenceStatus.IsSetReasonCode()) { Console.WriteLine(" ReasonCode"); Console.WriteLine(" {0}", orderReferenceStatus.ReasonCode); } if (orderReferenceStatus.IsSetReasonDescription()) { Console.WriteLine(" ReasonDescription"); Console.WriteLine(" {0}", orderReferenceStatus.ReasonDescription); } } if (orderReferenceDetails.IsSetConstraints()) { Console.WriteLine(" Constraints"); Constraints constraints = orderReferenceDetails.Constraints; List <Constraint> constraintList = constraints.Constraint; foreach (Constraint constraint in constraintList) { Console.WriteLine(" Constraint"); if (constraint.IsSetConstraintID()) { Console.WriteLine(" ConstraintID"); Console.WriteLine(" {0}", constraint.ConstraintID); } if (constraint.IsSetDescription()) { Console.WriteLine(" Description"); Console.WriteLine(" {0}", constraint.Description); } } } if (orderReferenceDetails.IsSetCreationTimestamp()) { Console.WriteLine(" CreationTimestamp"); Console.WriteLine(" {0}", orderReferenceDetails.CreationTimestamp); } if (orderReferenceDetails.IsSetExpirationTimestamp()) { Console.WriteLine(" ExpirationTimestamp"); Console.WriteLine(" {0}", orderReferenceDetails.ExpirationTimestamp); } if (orderReferenceDetails.IsSetParentDetails()) { Console.WriteLine(" ParentDetails"); ParentDetails parentDetails = orderReferenceDetails.ParentDetails; if (parentDetails.IsSetId()) { Console.WriteLine(" Id"); Console.WriteLine(" {0}", parentDetails.Id); } if (parentDetails.IsSetType()) { Console.WriteLine(" Type"); Console.WriteLine(" {0}", parentDetails.Type); } } if (orderReferenceDetails.IsSetIdList()) { Console.WriteLine(" IdList"); IdList idList = orderReferenceDetails.IdList; List <String> memberList = idList.member; foreach (String member in memberList) { Console.WriteLine(" member"); Console.WriteLine(" {0}", member); } } } } if (response.IsSetResponseMetadata()) { Console.WriteLine(" ResponseMetadata"); ResponseMetadata responseMetadata = response.ResponseMetadata; if (responseMetadata.IsSetRequestId()) { Console.WriteLine(" RequestId"); Console.WriteLine(" {0}", responseMetadata.RequestId); } } } catch (OffAmazonPaymentsServiceException ex) { PrintException(ex); } return(response); }
public static ProviderCreditSummaryList CheckCaptureForProviderCreditSummaryList(string amazonCaptureId, OffAmazonPaymentsServicePropertyCollection propertiesCollection, IOffAmazonPaymentsService service) { //used to check if the ProviderCreditSummaryList is available TimeSpan startTime = DateTime.Now.TimeOfDay; GetCaptureDetailsResponse getCaptureDetailsResponse = GetCaptureDetailsSample.GetCaptureDetails(propertiesCollection, service, amazonCaptureId); while (getCaptureDetailsResponse.IsSetGetCaptureDetailsResult() && (!getCaptureDetailsResponse.GetCaptureDetailsResult.CaptureDetails.IsSetProviderCreditSummaryList() || getCaptureDetailsResponse.GetCaptureDetailsResult.CaptureDetails.ProviderCreditSummaryList.member.Count < 1)) { if (DateTime.Now.TimeOfDay.Milliseconds - startTime.Milliseconds > 60000) { throw new OffAmazonPaymentsServiceException("The ProviderCreditSummaryList not found."); } System.Threading.Thread.Sleep(8000); Console.WriteLine("Waiting until ProviderCreditSummaryList is found in GetCaptureDetailsResponse"); getCaptureDetailsResponse = GetCaptureDetailsSample.GetCaptureDetails(propertiesCollection, service, amazonCaptureId); } return(getCaptureDetailsResponse.GetCaptureDetailsResult.CaptureDetails.ProviderCreditSummaryList); }
public static AuthorizeOnBillingAgreementResponse AuthorizeOnBillingAgreement(OffAmazonPaymentsServicePropertyCollection propertiesCollection, IOffAmazonPaymentsService service, string billingAgreementId, String authAmount, int indicator, bool captureNow) { AuthorizeOnBillingAgreementRequest request = new AuthorizeOnBillingAgreementRequest(); request.AmazonBillingAgreementId = billingAgreementId; request.SellerId = propertiesCollection.MerchantID; Price price = new Price(); price.Amount = authAmount; price.CurrencyCode = propertiesCollection.CurrencyCode; request.AuthorizationAmount = price; request.CaptureNow = captureNow; request.AuthorizationReferenceId = billingAgreementId.Replace('-', 'a') + "authRef" + indicator.ToString(); return(InvokeAuthorizeOnBillingAgreement(service, request)); }
public static SetBillingAgreementDetailsResponse SetBillingAgreementDetails(OffAmazonPaymentsServicePropertyCollection propertiesCollection, IOffAmazonPaymentsService service, string billingAgreementId, string sellerBillingAgreementId, string customNote, string storeName, string sellerNote) { SetBillingAgreementDetailsRequest request = new SetBillingAgreementDetailsRequest(); request.AmazonBillingAgreementId = billingAgreementId; request.SellerId = propertiesCollection.MerchantID; BillingAgreementAttributes attr = new BillingAgreementAttributes(); attr.SellerNote = sellerNote; SellerBillingAgreementAttributes sellerAttr = new SellerBillingAgreementAttributes(); sellerAttr.SellerBillingAgreementId = sellerBillingAgreementId; sellerAttr.CustomInformation = customNote; sellerAttr.StoreName = storeName; attr.SellerBillingAgreementAttributes = sellerAttr; request.BillingAgreementAttributes = attr; return InvokeSetBillingAgreementDetails(service, request); }
public static AuthorizeOnBillingAgreementResponse InvokeAuthorizeOnBillingAgreement(IOffAmazonPaymentsService service, AuthorizeOnBillingAgreementRequest request) { AuthorizeOnBillingAgreementResponse response = null; try { response = service.AuthorizeOnBillingAgreement(request); Console.WriteLine("Service Response"); Console.WriteLine("============================================================================="); Console.WriteLine(); Console.WriteLine(" AuthorizeOnBillingAgreementResponse"); if (response.IsSetAuthorizeOnBillingAgreementResult()) { Console.WriteLine(" AuthorizeOnBillingAgreementResult"); AuthorizeOnBillingAgreementResult authorizeOnBillingAgreementResult = response.AuthorizeOnBillingAgreementResult; if (authorizeOnBillingAgreementResult.IsSetAuthorizationDetails()) { Console.WriteLine(" AuthorizationDetails"); AuthorizationDetails authorizationDetails = authorizeOnBillingAgreementResult.AuthorizationDetails; if (authorizationDetails.IsSetAmazonAuthorizationId()) { Console.WriteLine(" AmazonAuthorizationId"); Console.WriteLine(" {0}", authorizationDetails.AmazonAuthorizationId); } if (authorizationDetails.IsSetAuthorizationReferenceId()) { Console.WriteLine(" AuthorizationReferenceId"); Console.WriteLine(" {0}", authorizationDetails.AuthorizationReferenceId); } if (authorizationDetails.IsSetAuthorizationBillingAddress()) { Console.WriteLine(" AuthorizationBillingAddress"); Address authorizationBillingAddress = authorizationDetails.AuthorizationBillingAddress; if (authorizationBillingAddress.IsSetName()) { Console.WriteLine(" Name"); Console.WriteLine(" {0}", authorizationBillingAddress.Name); } if (authorizationBillingAddress.IsSetAddressLine1()) { Console.WriteLine(" AddressLine1"); Console.WriteLine(" {0}", authorizationBillingAddress.AddressLine1); } if (authorizationBillingAddress.IsSetAddressLine2()) { Console.WriteLine(" AddressLine2"); Console.WriteLine(" {0}", authorizationBillingAddress.AddressLine2); } if (authorizationBillingAddress.IsSetAddressLine3()) { Console.WriteLine(" AddressLine3"); Console.WriteLine(" {0}", authorizationBillingAddress.AddressLine3); } if (authorizationBillingAddress.IsSetCity()) { Console.WriteLine(" City"); Console.WriteLine(" {0}", authorizationBillingAddress.City); } if (authorizationBillingAddress.IsSetCounty()) { Console.WriteLine(" County"); Console.WriteLine(" {0}", authorizationBillingAddress.County); } if (authorizationBillingAddress.IsSetDistrict()) { Console.WriteLine(" District"); Console.WriteLine(" {0}", authorizationBillingAddress.District); } if (authorizationBillingAddress.IsSetStateOrRegion()) { Console.WriteLine(" StateOrRegion"); Console.WriteLine(" {0}", authorizationBillingAddress.StateOrRegion); } if (authorizationBillingAddress.IsSetPostalCode()) { Console.WriteLine(" PostalCode"); Console.WriteLine(" {0}", authorizationBillingAddress.PostalCode); } if (authorizationBillingAddress.IsSetCountryCode()) { Console.WriteLine(" CountryCode"); Console.WriteLine(" {0}", authorizationBillingAddress.CountryCode); } if (authorizationBillingAddress.IsSetPhone()) { Console.WriteLine(" Phone"); Console.WriteLine(" {0}", authorizationBillingAddress.Phone); } } if (authorizationDetails.IsSetSellerAuthorizationNote()) { Console.WriteLine(" SellerAuthorizationNote"); Console.WriteLine(" {0}", authorizationDetails.SellerAuthorizationNote); } if (authorizationDetails.IsSetAuthorizationAmount()) { Console.WriteLine(" AuthorizationAmount"); Price authorizationAmount = authorizationDetails.AuthorizationAmount; if (authorizationAmount.IsSetAmount()) { Console.WriteLine(" Amount"); Console.WriteLine(" {0}", authorizationAmount.Amount); } if (authorizationAmount.IsSetCurrencyCode()) { Console.WriteLine(" CurrencyCode"); Console.WriteLine(" {0}", authorizationAmount.CurrencyCode); } } if (authorizationDetails.IsSetCapturedAmount()) { Console.WriteLine(" CapturedAmount"); Price capturedAmount = authorizationDetails.CapturedAmount; if (capturedAmount.IsSetAmount()) { Console.WriteLine(" Amount"); Console.WriteLine(" {0}", capturedAmount.Amount); } if (capturedAmount.IsSetCurrencyCode()) { Console.WriteLine(" CurrencyCode"); Console.WriteLine(" {0}", capturedAmount.CurrencyCode); } } if (authorizationDetails.IsSetAuthorizationFee()) { Console.WriteLine(" AuthorizationFee"); Price authorizationFee = authorizationDetails.AuthorizationFee; if (authorizationFee.IsSetAmount()) { Console.WriteLine(" Amount"); Console.WriteLine(" {0}", authorizationFee.Amount); } if (authorizationFee.IsSetCurrencyCode()) { Console.WriteLine(" CurrencyCode"); Console.WriteLine(" {0}", authorizationFee.CurrencyCode); } } if (authorizationDetails.IsSetIdList()) { Console.WriteLine(" IdList"); IdList idList = authorizationDetails.IdList; List<String> memberList = idList.member; foreach (String member in memberList) { Console.WriteLine(" member"); Console.WriteLine(" {0}", member); } } if (authorizationDetails.IsSetCreationTimestamp()) { Console.WriteLine(" CreationTimestamp"); Console.WriteLine(" {0}", authorizationDetails.CreationTimestamp); } if (authorizationDetails.IsSetExpirationTimestamp()) { Console.WriteLine(" ExpirationTimestamp"); Console.WriteLine(" {0}", authorizationDetails.ExpirationTimestamp); } if (authorizationDetails.IsSetAuthorizationStatus()) { Console.WriteLine(" AuthorizationStatus"); Status authorizationStatus = authorizationDetails.AuthorizationStatus; if (authorizationStatus.IsSetState()) { Console.WriteLine(" State"); Console.WriteLine(" {0}", authorizationStatus.State); } if (authorizationStatus.IsSetLastUpdateTimestamp()) { Console.WriteLine(" LastUpdateTimestamp"); Console.WriteLine(" {0}", authorizationStatus.LastUpdateTimestamp); } if (authorizationStatus.IsSetReasonCode()) { Console.WriteLine(" ReasonCode"); Console.WriteLine(" {0}", authorizationStatus.ReasonCode); } if (authorizationStatus.IsSetReasonDescription()) { Console.WriteLine(" ReasonDescription"); Console.WriteLine(" {0}", authorizationStatus.ReasonDescription); } } if (authorizationDetails.IsSetOrderItemCategories()) { Console.WriteLine(" OrderItemCategories"); OrderItemCategories orderItemCategories = authorizationDetails.OrderItemCategories; List<String> orderItemCategoryList = orderItemCategories.OrderItemCategory; foreach (String orderItemCategory in orderItemCategoryList) { Console.WriteLine(" OrderItemCategory"); Console.WriteLine(" {0}", orderItemCategory); } } if (authorizationDetails.IsSetCaptureNow()) { Console.WriteLine(" CaptureNow"); Console.WriteLine(" {0}", authorizationDetails.CaptureNow); } if (authorizationDetails.IsSetSoftDescriptor()) { Console.WriteLine(" SoftDescriptor"); Console.WriteLine(" {0}", authorizationDetails.SoftDescriptor); } if (authorizationDetails.IsSetAddressVerificationCode()) { Console.WriteLine(" AddressVerificationCode"); Console.WriteLine(" {0}", authorizationDetails.AddressVerificationCode); } } if (authorizeOnBillingAgreementResult.IsSetAmazonOrderReferenceId()) { Console.WriteLine(" AmazonOrderReferenceId"); Console.WriteLine(" {0}", authorizeOnBillingAgreementResult.AmazonOrderReferenceId); } } if (response.IsSetResponseMetadata()) { Console.WriteLine(" ResponseMetadata"); ResponseMetadata responseMetadata = response.ResponseMetadata; if (responseMetadata.IsSetRequestId()) { Console.WriteLine(" RequestId"); Console.WriteLine(" {0}", responseMetadata.RequestId); } } } catch (OffAmazonPaymentsServiceException ex) { PrintException(ex); } return response; }
public static GetOrderReferenceDetailsResponse GetOrderReferenceDetails(OffAmazonPaymentsServicePropertyCollection propertiesCollection, IOffAmazonPaymentsService service, string orderReferenceId, string addressConsentToken) { return GetOrderReferenceDetails(propertiesCollection, service, orderReferenceId, addressConsentToken, Console.Out); }
public static CaptureResponse InvokeCapture(IOffAmazonPaymentsService service, CaptureRequest request) { CaptureResponse response = null; try { response = service.Capture(request); Console.WriteLine("Service Response"); Console.WriteLine("============================================================================="); Console.WriteLine(); Console.WriteLine(" CaptureResponse"); if (response.IsSetCaptureResult()) { Console.WriteLine(" CaptureResult"); CaptureResult captureResult = response.CaptureResult; if (captureResult.IsSetCaptureDetails()) { Console.WriteLine(" CaptureDetails"); CaptureDetails captureDetails = captureResult.CaptureDetails; if (captureDetails.IsSetAmazonCaptureId()) { Console.WriteLine(" AmazonCaptureId"); Console.WriteLine(" {0}", captureDetails.AmazonCaptureId); } if (captureDetails.IsSetCaptureReferenceId()) { Console.WriteLine(" CaptureReferenceId"); Console.WriteLine(" {0}", captureDetails.CaptureReferenceId); } if (captureDetails.IsSetSellerCaptureNote()) { Console.WriteLine(" SellerCaptureNote"); Console.WriteLine(" {0}", captureDetails.SellerCaptureNote); } if (captureDetails.IsSetCaptureAmount()) { Console.WriteLine(" CaptureAmount"); Price captureAmount = captureDetails.CaptureAmount; if (captureAmount.IsSetAmount()) { Console.WriteLine(" Amount"); Console.WriteLine(" {0}", captureAmount.Amount); } if (captureAmount.IsSetCurrencyCode()) { Console.WriteLine(" CurrencyCode"); Console.WriteLine(" {0}", captureAmount.CurrencyCode); } } if (captureDetails.IsSetRefundedAmount()) { Console.WriteLine(" RefundedAmount"); Price refundedAmount = captureDetails.RefundedAmount; if (refundedAmount.IsSetAmount()) { Console.WriteLine(" Amount"); Console.WriteLine(" {0}", refundedAmount.Amount); } if (refundedAmount.IsSetCurrencyCode()) { Console.WriteLine(" CurrencyCode"); Console.WriteLine(" {0}", refundedAmount.CurrencyCode); } } if (captureDetails.IsSetCaptureFee()) { Console.WriteLine(" CaptureFee"); Price captureFee = captureDetails.CaptureFee; if (captureFee.IsSetAmount()) { Console.WriteLine(" Amount"); Console.WriteLine(" {0}", captureFee.Amount); } if (captureFee.IsSetCurrencyCode()) { Console.WriteLine(" CurrencyCode"); Console.WriteLine(" {0}", captureFee.CurrencyCode); } } if (captureDetails.IsSetCreationTimestamp()) { Console.WriteLine(" CreationTimestamp"); Console.WriteLine(" {0}", captureDetails.CreationTimestamp); } if (captureDetails.IsSetProviderCreditSummaryList()) { Console.WriteLine(" ProviderCreditSummaryList"); foreach (ProviderCreditSummary providerCreditSummary in captureDetails.ProviderCreditSummaryList.member) { if (providerCreditSummary.IsSetProviderCreditId()) { Console.WriteLine(" ProviderCreditId"); Console.WriteLine(" {0}", providerCreditSummary.ProviderCreditId); } if (providerCreditSummary.IsSetProviderId()) { Console.WriteLine(" ProviderId"); Console.WriteLine(" {0}", providerCreditSummary.ProviderId); } } } if (captureDetails.IsSetCaptureStatus()) { Console.WriteLine(" CaptureStatus"); Status captureStatus = captureDetails.CaptureStatus; if (captureStatus.IsSetState()) { Console.WriteLine(" State"); Console.WriteLine(" {0}", captureStatus.State); } if (captureStatus.IsSetLastUpdateTimestamp()) { Console.WriteLine(" LastUpdateTimestamp"); Console.WriteLine(" {0}", captureStatus.LastUpdateTimestamp); } if (captureStatus.IsSetReasonCode()) { Console.WriteLine(" ReasonCode"); Console.WriteLine(" {0}", captureStatus.ReasonCode); } if (captureStatus.IsSetReasonDescription()) { Console.WriteLine(" ReasonDescription"); Console.WriteLine(" {0}", captureStatus.ReasonDescription); } } } } if (response.IsSetResponseMetadata()) { Console.WriteLine(" ResponseMetadata"); ResponseMetadata responseMetadata = response.ResponseMetadata; if (responseMetadata.IsSetRequestId()) { Console.WriteLine(" RequestId"); Console.WriteLine(" {0}", responseMetadata.RequestId); } } Console.WriteLine(); } catch (OffAmazonPaymentsServiceException ex) { PrintException(ex); } return(response); }
public static GetOrderReferenceDetailsResponse GetOrderReferenceDetails(OffAmazonPaymentsServicePropertyCollection propertiesCollection, IOffAmazonPaymentsService service, string orderReferenceId, string addressConsentToken) { return(GetOrderReferenceDetails(propertiesCollection, service, orderReferenceId, addressConsentToken, Console.Out)); }