Giter Club home page Giter Club logo

youcan-pay-flutter-sdk's People

Contributors

abdelmjid-asouab avatar

Watchers

 avatar

youcan-pay-flutter-sdk's Issues

issus in the package

affter 3ds verrification the pament gona to be succefully and amount is tken from the card but the methode onSuccessfulPayment not call

Adding a proper Dart logger to track events when a request is sent by the client app

Hi,
in many cases in the SDK, there should be some way to give the developer the ability to track and know where exactly something went wrong if an error is thrown, like when sending the request to the Rest API, when a failure or success happens in an internal asynchronous method of the SDK, as an example if the developer did put a wrong public key, or if there is some server ( statusCode 500 ) error, the method call will fail, not all methods are covered with throwing an exception, so the result will be a complete silence for the developer, not knowing what exactly goes wrong.

A logger using dart;developer's log() method will absolutely be helpful in tracking the process, this could be an example of the target result:

// ! Debug Console
// [ YCPay ] Public key and is set.
// [ YCPay ] Card information of CUSTOMER NAME is initialized.
// [ YCPay ] Payment with the card is ready to use.
// [ YCPay ] Starting payment request to the server.
// ...

and so on, the same thing for triggering errors, as an example if the developer did set a publish key that is invalid ( doesn't meet your key generation criteria ), an error log will inform him:

// [ YCPay ] Public key is invalid.

I hope you get the target expectation.

a global configuration for the YCPay instance to offer accesibility in anywhere else in the project

For configuring the YCPay class, it needs to be initialized by the constructor every time when it needed to be used in a class :

YCPay instance = YCPay(/* configs */)

in a Flutter app or just a dart project, implementing many payments in different classes will require the same initialization over and over again.

this could be fixed and avoided but making a global config setter, or a method like setConfig that will require calling it one time to configure the SDK and then offering the whole methods for anywhere else with that config:

void main() {
   YCPay.setConfig(/* configs */);
  // ...
 }

class SomeClass {
  YCPay.oneOfClassMethodsWithTheConfigs();
}

where oneOfClassMethodsWithTheConfigs could be any member of the YCPay.

Including the test cards with factory constructors for a quick testing for the developer

Hi,
The Dart programming language offers a great and convenient feature for the case of testing YouCan pay and test cardsn which is the factory constructors.

After exploring the SDK's code, I can see many ways to improve it, for the sake of the Flutter developer that will improve his experience, one of them is offering the test cards as factory constructors, taking as an example:
image

it would be helpful to use a CardInformation.testCard1() :

factory CardInformation.testCard1() {
    return CardInformation(
      cardHolderName: "SOME TEST NAME HERE",
      cardNumber: "4242424242424242",
      expireDateYear: "24",
      expireDateMonth: "10",
      cvv: "112",
    );
  }

The same thing of other test cards!

and now when using the payWithCard() you can simply call that factory constructor directly in the cardInformation field, without the need of leaving the editor or hardcoding the card values every time.

The package works in sandbox mode, but does not work in production mode

my code:

 await ycPay.payWithCard(
        token: token,
        cardInformation: cardInformation,
        onSuccessfulPayment: (transactionId) {
          onPaymentCompleted(transactionId);
        },
        onFailedPayment: (errorMessage) {
          print(errorMessage);
        },
      );

The error: InvalidResponseException: Error occurred while decoding data
Status code: 422
Response: The payment method field is required.

Solution:
you should add the payment method field in request body like this:
"payment_method[type]": "credit_card"

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.