Git Product home page Git Product logo

node-barion's People

Contributors

aron123 avatar carnationcrab avatar dependabot[bot] avatar javavista avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

node-barion's Issues

Error with coverage report script

Update of nyc dependency caused the following error, it should be fixed.

Too many non-option arguments: got 8, maximum of 0
[error] "2019-06-26T16:56:40.713Z"  'error from lcovParse: ' 'Failed to parse string'
[error] "2019-06-26T16:56:40.716Z"  'input: ' ''
[error] "2019-06-26T16:56:40.716Z"  'error from convertLcovToCoveralls'
/home/travis/build/aron123/node-barion/node_modules/coveralls/bin/coveralls.js:18
        throw err;
        ^
Failed to parse string

Support of overriding default values in certain requests

Support overrides of instance-level defaults, e.g. we have a Barion instance with prevalidation turned on:

const barion = new Barion({ posKey: 'abc', validateModels: true });

When making a request to API, the methods should work with all of the following signatures (defaults and callback are optional), so the validation can be turned off for the certain API call:

// barion.method(options)
// barion.method(options, defaults)
// barion.method(options, callback)
// barion.method(options, defaults, callback)
barion.getPaymentState({ paymentId: 'abcdefg' }, { validateModels: false }, callback);

Payment Options In Barion web payment page

Hello. This is not an issue. I am just wondering if It is possible to remove all other payment options except the barion wallet in the Responsive Barion Web Payment page. If you help me, I would definitely be grateful. Thanks in advance.
Screen Shot 2022-09-23 at 1 30 00 AM

Update to Joi v16.0.0

The @hapi/joi dependency has to be updated to v16.0.0. This release contains many breaking changes, so refactoring node-barion is necessary in multiple modules.

Release notes of Joi v16 can be found here.

The redirect url is required!

Probably a documentation bug. The parameter is not optional.

When using the default example:

errors:
[ { Title: 'Model Validation Error',
Description: 'The redirect url is required!',
ErrorCode: 'ModelValidationError',
HappenedAt: '2020-04-02T01:54:16.0574019Z',
EndPoint: 'https://api.test.barion.com/v2/Payment/Start' } ] }

Improvement of validation

User input validation should be improved in the following steps:

  • Install Joi as dependency
  • Implement models based on Barion Docs (Calling the API, List of endpoints)
  • Hold the support of case insensitivity
  • Allow unknown fields (for backward compatibility) -> schema.unknown()
  • Add new error type (e.g. BarionModelError)
  • Validate user input based on Joi-schemas before sending the request
    • Make it switchable to run or not, but defaults to true
    • Forbid to override POSKey and Environment when calling methods of Barion instance
  • Plan and implement test of validation
  • Update documentation (Handle errors section, Joi error description)
  • Update Joi to stable version

Migrating to TS: @types/node-barion

Publishing type definitions can be a valuable step towards supporting TypeScript projects completely:

@types/node-barion definitions can be generated with the joi-to-typescript module, more or less automatically from Joi schemas.

User authentication failed.

Hi! I just want to start a payment in the test environment but i get 'User authentication failed.'.

const barion = new Barion({
    POSKey: process.env.BARION_API_KEY,
    Environment: 'test',
    FundingSources: ['Balance'],
    Locale: 'hu-HU',
});

function makeDescription(paymentObject, user) {
    const immediateStandard = {
        PaymentType: 'Immediate',
        Locale: 'hu-HU',
        Currency: 'HUF',
        GuestCheckOut: true,
        FundingSources: ['All'],
        PaymentRequestId: '2024-001',
        RedirectUrl: 'https://testServer.onrender.com/barion/payment-result',
        CallbackUrl: 'https://testServer.onrender.com/barion/barionStatusReport',
        Transactions: [{
            POSTransactionId: new Date().getTime().toLocaleString(),
            Payee: user.email,
            Total: paymentObject.amount + 100 // so the total will be more than 10 huf in all cases for testing
        }]
    };
    return immediateStandard;
}

const orderPayment = makeDescription(paymentObject, user);
barion.startPayment(orderPayment).then(data => {
    console.log("barion data: " + JSON.stringify(data, null, 2));
    res.send(data);
}).catch(err => {
    console.log(err);
    res.send(err);
});

Error i got:

BarionError: Barion request errored out
    at C:\Users\DrRandom\Documents\GitHub\Villszer\Villszer\node_modules\node-barion\lib\fetch-api.js:143:23
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  errors: [
    {
      Title: 'User authentication failed.',
      Description: 'The login information provided is incorrect. There is no such user in the system or the password is incorrect.',
      ErrorCode: 'AuthenticationFailed',
      HappenedAt: '2024-03-19T17:02:43.5302339Z',
      AuthData: null,
      EndPoint: null
    }
  ]
}

POSKey is freshly copyed from test.barion.com from the account of the shop.
What can be the problem?

Use cleaner 3-tier architecture

The module have to be separated in a cleaner way:

  • Presentational layer (currently barion.js) must only get user input, sanitize and validate it with schemas, decide what to do with it, and how to output the answer from business layer,
  • Business layer (currently barion.js and fetch-api.js) must call the data layer, handle its answer (e.g. build an error object), and give back data,
  • Data layer (currently fetch-api.js) must do requests to the remote resource, and output their responses without modification.

Check README for grammar

I'm not native speaker of English, so checking the README for grammatic mistakes (and typos) would be much appreciated.

v2.0.0 notes

Before publishing the next stable release, @hapi/joi dependency have to be updated to 16.x.x stable version (at the moment only RC versions are available, and 15.x.x contains relevant misbehaviors).

Is this repo still maintained?

Hi all!

I'm looking a library to integrate barion to my node.js project.
I'm wondering if this library is still usable and maintaned.

Thank you very much!

Add logging features

Add ability to log outgoing and incoming requests.

Supporting some external logger library (morgan, winston, etc.) can be a great idea.

Separate Readme and API documentation

README is a bit long at the moment. Maybe it is a better approach to separate README (as a generic overview) and API Docs (as a detailed technical documentation, with generated ToC, etc.) to standalone markdown files.

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.