Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot implicitly convert type 'Xendit.net.Model.Customer.CustomerResponse' to 'Xendit.net.Model.Customer.Customer' #31

Open
zeffrypfs opened this issue Nov 5, 2024 · 0 comments

Comments

@zeffrypfs
Copy link

Using example code to create invoice in this, got error compile time. This seems like property customer at InvoiceParameter not compatible with CustomerResponse type, although the example using it.

Full log :

Severity	Code	Description	Project	File	Line	Suppression State
Error (active)	CS0029	Cannot implicitly convert type 'Xendit.net.Model.Customer.CustomerResponse' to 'Xendit.net.Model.Customer.Customer'

Reproduce Code :

 // define network client
 HttpClient httpClient = new();
 NetworkClient requestClient = new(httpClient);
 XenditClient _client = new(secretKey, requestClient, baseUrl);
 
var addresses = new Xendit.net.Model.Customer.Address
{
    Country = Country.Indonesia,
    StreetLine1 = "Jalan Makan",
    StreetLine2 = "Kecamatan Kebayoran Baru",
    City = "Jakarta Selatan",
    Province = "Daerah Khusus Ibukota Jakarta",
    PostalCode = "12345",
};

CustomerResponse customer = new CustomerResponse
{
    GivenNames = "John",
    Email = "john@email.com",
    MobileNumber = "+6287774441111",
    Addresses = [addresses],
};

NotificationPreference preference = new NotificationPreference
{
    InvoicePaid = [NotificationType.Email]
};

ItemInvoice item = new ItemInvoice
{
    Name = "shoes",
    Quantity = 1,
    Price = 100,
};

FeeInvoice fee = new FeeInvoice
{
    Type = "name_of_fee_for_internal_reference",
    Value = 200,
};

InvoiceParameter parameter = new()
{
    ExternalId = "external-id",
    Amount = 1000,
    Customer = customer,
    NotificationPreference = preference,
    Items = [item],
    Fees = [fee],
    Currency = Currency.IDR,
};

InvoiceResponse invoice = await _client.Invoice.Create(parameter);
Console.WriteLine(invoice);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant