Giter VIP home page Giter VIP logo

voucherify-dotnet-sdk's People

Contributors

ahordijk avatar awilczek avatar bandraszyk avatar kanclalg avatar kevin-limelife avatar marcinrog avatar mncool avatar nicolasnogueiralimelife avatar patricioo1 avatar rikvandenberg avatar sedzia avatar thespy avatar tpindel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

voucherify-dotnet-sdk's Issues

RedemptionEntries list is always empty in Vouchers.Get

When calling the Vouchers.Get() endpoint the Redemption object shows a RedeemedQuantity of greater than 0 but the RedemptionEntries list is empty. According to Voucherify tech support this is an issue that only happens in this SDK so they asked me to report it here.

image

Expose is_referral_code in Voucher object

The JSON API returns boolean is_referral_code field which is necessary for us to distinguish between discount codes and referral codes.

If such change is not planned in the nearest future,could you please provide a workaround or some other way of obtaining this value.

Creation of SKU that's just been deleted throws Duplicate exception

When I try to get the SKU with api.Products.GetSku("c53dabb5-7945-4e1c-beac-005993311dd5", "10025112"), I get a 404 back when i expect because I ran a delete of this sku earlier (api.Products.DeleteSku("c53dabb5-7945-4e1c-beac-005993311dd5", "10025112")).

But now when try to create the sku again with new data, I'm getting a 'Duplicate resource key' exception. The exceptions details are Sku with source id: 10025112 already exists. Remove resource permanently in order to add next with the same source id. How do I remove the Sku permanently through the dotNET SDK?

ASP.NET Deadlocks when using .Result because of missing ConfigureAwait(false)

Hi All,

I'm creating the issue to outline some of our problems we are having in ASP.NET WebAPI and using the .NET library you have provided. We have the following code:

public VoucherModel GetVoucherAsync(string voucherCode)
{
    Voucher voucher = _api.Vouchers.Get(voucherCode).Result;
    return Mapper.Map<VoucherModel>(voucher);
}

We use .Result here because our code doesn't support asynchronous operations just yet. And this blog outlines and explaines it what is causing the deadlock. To quote:

So, according to it, ASP.NET has a specialized sync context, that only one thread can have. And if you don’t use .ConfigureAwait(false), it tries to restore old context, which belongs to the main thread that is blocked by .Result, hence deadlock...

This issue will not show up in the example because none of those examples are in ASP.NET

I will create an PR to solve this issue. πŸ˜„

Custom error message is not mapped to VoucherifyClientException

Custom error message is not mapped to VoucherifyClientException.

E.g. response:

{
   "code":400,
   "key":"customer_rules_violated",
   "message":"customer does not match validation rules",
   "details":"Referral Code cannot be redeemed because of violated validation rules: val_4Rz40vs2mHXZ",
   "request_id":"v-0c625e154445522451",
   "resource_id":"rf_0c625e15590ee0d561",
   "resource_type":"redemption",
   "error":{
      "message":"Sorry, this code cannot be used by users who have already taken at least one trip."
   }
}

https://support.voucherify.io/article/264-how-can-i-create-custom-errors
From your documentation: The content of the custom error message is going to be returned in the error object under message property.
https://github.com/voucherifyio/voucherify-dotNET-sdk/blob/master/src/Voucherify/Core/Exceptions/VoucherifyClientException.cs

Custom Validation Error support

Make sure that developer using the SDK is able to pass error property for Validation Rules when creating or updating Validation Rule.
Make sure that error property is correctly mapped when developer is using this SDK to get Validation Rule.
Update README file to include information about custom error messages.

More information can be found in documentation under following links:
https://docs.voucherify.io/reference#section-custom-error-messages-with-validation-rules
https://docs.voucherify.io/reference#the-validation-rule-object
https://docs.voucherify.io/reference#create-validation-rules

Customers.List() fails

Error converting value {null} to type 'System.Int64'. Path 'customers[0].summary.orders.total_amount', line 1, position 565.

Should be fixed by #55.

MultiUnits

Add support for new type of discount UNIT with effect ADD_MANY_ITEMS

Loyalties Program support

Add support for new methods related to Loyalty Programs.

Validation namespace:

  • Validate Validation Rules: POST /validation-rules/:rule-id/validation - Docs

Rewards namespace:

  • List: GET /rewards - Docs
  • Create: POST /rewards - Docs
  • Get: GET /rewards/:rewardId - Docs
  • Update: PUT /rewards/:rewardId - Docs
  • Delete: DELETE /rewards/:rewardId - Docs
  • List Assignments: GET /rewards/:rewardId/assignments - Docs
  • Create Assignment: POST /rewards/:rewardId/assignments - Docs
  • Update Assignment: PUT /rewards/:rewardId/assignments/:assignmentId - Docs
  • Delete Assignment: DELETE /rewards/:rewardId/assignments/:assignmentId - Docs

Loyalties namespace:

  • List: GET /loyalties - Docs
  • Create: POST /loyalties - Docs
  • Get: GET /loyalties/:campaignId - Docs
  • Update: PUT /loyalties/:campaignId - Docs
  • Delete: DELETE /loyalties/:campaignId - Docs
  • List Reward Assignments: GET /loyalties/:campaignId/rewards - Docs
  • Create Reward Assignment: POST /loyalties/:campaignId/rewards - Docs
  • Update Reward Assignment: PUT /loyalties/:campaignId/rewards/:assignmentId - Docs
  • Delete Reward Assignment: DELETE /loyalties/:campaignId/rewards/:assignmentId - Docs
  • List Earning Rules: GET /loyalties/{campaignId}/earning-rules - Docs
  • Create Earning Rules: POST /loyalties/:campaignId/earning-rules - Docs
  • Update Earning Rules: PUT /loyalties/:campaignId/earning-rules/:earningRuleId - Docs
  • Delete Earning Rules: DELETE /loyalties/:campaignId/earning-rules/:earningRuleId - Docs
  • List Members: GET /loyalties/:campaignId/members - Docs
  • Add Member: POST /loyalties/:campaignId/members - Docs
  • Get Member: GET /loyalties/:campaignId/members/:memberId - Docs
  • Add Points: POST /loyalties/:campaignId/members/:memberId/balance - Docs
  • Redeem Reward: POST /loyalties/:campaignId/members/:memberId/redemption - Docs

Validation.DataModel.ValidationSession doesn't have any properties.

ValidateVoucher will return a ValidationVoucher model, which happens to have a ValidationSession, but no properties are assigned to the model. Is that intended as it is the same as the Voucherify.DataModel.Contexts.ValidationSession.

Validation.DataModel.ValidationSession
https://github.com/voucherifyio/voucherify-dotNET-sdk/blob/master/src/Voucherify/DataModel/ValidationSession.cs

Voucherify.DataModel.Contexts.ValidationSession
https://github.com/voucherifyio/voucherify-dotNET-sdk/blob/master/src/Voucherify/DataModel/Contexts/ValidationSession.cs

Amount field is missing in redemption result

When performing a (partial) redemption. the amount of the redemption is not available in the redemption result. When performing the redemption on a partially depleted gifcard, you will not know for sure the exact redemption amount then.

image

This is a view of the toplevel fields in the redemption result (serialized to json)

Empty Redemption ID is handled incorrectly

Simple code snippet:

using Queries = Voucherify.DataModel.Queries;
using Contexts = Voucherify.DataModel.Contexts;
// ...
var _api = new Voucherify.Api(applicationId, secretKey).WithSSL();
await _api.Redemptions.Rollback("", new Queries.RedemptionRollback(), new Contexts.RedemptionRollback());

This throws VoucherifyError[code=404, key=', message='API endpoint does not exist.', details='']

The reason for that is because the empty string is inserted into the URL as-is, resulting in such URL: https://api.voucherify.io/v1/redemptions//rollback which effectively means https://api.voucherify.io/v1/redemptions/rollback to Voucherify API hence the error.

I suggest checking for non-empty strings in all methods which insert them into URLs.

Make data model object properties settable

To unit test mappings of the voucherify objects to our internal DTO objects, I'd like to be able new up an object and set it's properties. Instead, I have to use a mocking framework to test.

Extended OrderItem model and List All Promotion Tiers methods

The /redemptions endpoint now always returns Voucher.Active as null

According to an email conversation I had with support:

The 'active' field in the response from the list redemptions endpoint will always return a null value due to performance decisions.

Thus, the Voucher.Active property has to be nullable. With the current implementation, it always throws an exception.

Validation of fixed amount vouchers returns wrong DiscountType

When validating a voucher with a fixed discount amount for order items the API returns:

discount: {
  type: "FIXED",
  effect: "APPLY_TO_ITEMS" 
}

But the ValidationVoucher object returns a DiscountType.Amount for the Discount object. This is because the enum is missing a value for FIXED. Also the discount effects are missing, see API documentation for possible values: https://docs.voucherify.io/docs/discount-effects

Next to this issue the ValidationVoucher returns the VoucherSubject class in which the price for the product is missing.
The API returns the fixed price value but the VoucherSubject is missing a property for Price.

applicable_to: {
  data: [{
     object: "product",
     id: "prod_id,
     source_id: "1",
     strict: false,
     price: 1000 }]
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.