Addeing tax receipt statement sample (#17)
* Add samples for invoice tax receipt statement
This commit is contained in:
Родитель
a581977147
Коммит
8a435af2d0
|
@ -73,6 +73,8 @@
|
|||
<add key="InvoicePageSize" value="100" />
|
||||
<!-- The default Invoice ID of partner, leave empty to prompt user to enter it -->
|
||||
<add key="DefaultInvoiceId" value="" />
|
||||
<!-- The default Receipt ID of partner's invoice, leave empty to prompt user to enter it -->
|
||||
<add key="DefaultReceiptId" value="" />
|
||||
<!-- The partner MPN ID to use in indirect partner samples, leave empty to prompt user to enter it -->
|
||||
<add key="PartnerMpnId" value="" />
|
||||
<!-- The service request ID to use in service request samples, leave empty to prompt user to enter it -->
|
||||
|
|
|
@ -205,6 +205,17 @@ namespace Microsoft.Store.PartnerCenter.Samples.Configuration
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the configured Receipt ID.
|
||||
/// </summary>
|
||||
public string DefaultReceiptId
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.ConfigurationSection["DefaultReceiptId"];
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the configured partner MPD ID.
|
||||
/// </summary>
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
// -----------------------------------------------------------------------
|
||||
// <copyright file="GetInvoiceTaxReceiptStatement.cs" company="Microsoft">
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
namespace Microsoft.Store.PartnerCenter.Samples.Invoice
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
/// <summary>
|
||||
/// Gets a single partner invoice.
|
||||
/// </summary>
|
||||
public class GetInvoiceTaxReceiptStatement : BasePartnerScenario
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetInvoiceTaxReceiptStatement"/> class.
|
||||
/// </summary>
|
||||
/// <param name="context">The scenario context.</param>
|
||||
public GetInvoiceTaxReceiptStatement(IScenarioContext context) : base("Get partner's tax receipt statement by Id", context)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// executes the get invoice tax receipt scenario.
|
||||
/// </summary>
|
||||
protected override void RunScenario()
|
||||
{
|
||||
var partnerOperations = this.Context.UserPartnerOperations;
|
||||
string invoiceId = this.Context.Configuration.Scenario.DefaultInvoiceId;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(invoiceId))
|
||||
{
|
||||
// prompt the user the enter the invoice ID
|
||||
invoiceId = this.Context.ConsoleHelper.ReadNonEmptyString("Please enter the invoice ID to retrieve ", "The invoice ID can't be empty");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Found Invoice ID: {0} in configuration.", invoiceId);
|
||||
}
|
||||
|
||||
string receiptId = this.Context.Configuration.Scenario.DefaultReceiptId;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(receiptId))
|
||||
{
|
||||
// prompt the user the enter the receipt ID
|
||||
receiptId = this.Context.ConsoleHelper.ReadNonEmptyString("Please enter the receipt ID to retrieve ", "The receipt ID can't be empty");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Found Receipt ID: {0} in configuration.", receiptId);
|
||||
}
|
||||
|
||||
this.Context.ConsoleHelper.StartProgress("Retrieving tax receipt statement");
|
||||
|
||||
// Retrieving invoice
|
||||
var taxReceiptStatement = partnerOperations.Invoices.ById(invoiceId).Receipts.ById(receiptId).Documents.Statement.Get();
|
||||
|
||||
this.Context.ConsoleHelper.StopProgress();
|
||||
this.Context.ConsoleHelper.WriteObject(receiptId, "Receipt Id");
|
||||
this.Context.ConsoleHelper.WriteObject(taxReceiptStatement.Length, "Invoice tax receipt Statement Size");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -411,7 +411,8 @@ namespace Microsoft.Store.PartnerCenter.Samples
|
|||
new GetInvoiceLineItems(context, context.Configuration.Scenario.InvoicePageSize),
|
||||
new GetPagedInvoices(context, context.Configuration.Scenario.InvoicePageSize),
|
||||
new GetInvoiceSummaries(context),
|
||||
new GetInvoiceStatement(context)
|
||||
new GetInvoiceStatement(context),
|
||||
new GetInvoiceTaxReceiptStatement(context)
|
||||
};
|
||||
|
||||
return new AggregatePartnerScenario("Invoice samples", invoiceScenarios, context);
|
||||
|
|
|
@ -170,6 +170,7 @@
|
|||
<Compile Include="Invoice\GetInvoiceLineItems.cs" />
|
||||
<Compile Include="Invoice\GetInvoiceStatement.cs" />
|
||||
<Compile Include="Invoice\GetInvoiceSummaries.cs" />
|
||||
<Compile Include="Invoice\GetInvoiceTaxReceiptStatement.cs" />
|
||||
<Compile Include="Invoice\GetPagedInvoices.cs" />
|
||||
<Compile Include="Offers\GetCustomerOfferCategories.cs" />
|
||||
<Compile Include="Offers\GetCustomerOffers.cs" />
|
||||
|
|
Загрузка…
Ссылка в новой задаче