Git Product home page Git Product logo

Comments (6)

janbarasek avatar janbarasek commented on July 20, 2024

I use this validation scheme:

Expect::structure([
	'amount' => Expect::type('float|int')->castTo('float')->required(),
	'currency' => Expect::string()->required(),
	'order_number' => Expect::type('string|int')->castTo('string')->required(),
	'items' => Expect::arrayOf(Expect::structure([
		'name' => Expect::string()->required(),
		'amount' => Expect::type('int|float')->castTo('float')->required(),
		'count' => Expect::int()->default(1),
		'type' => Expect::string(),
		'vat_rate' => Expect::int(),
	])->castTo('array'))->castTo('array'),
	'callback' => Expect::structure([
		'return_url' => Expect::string()->required(),
		'notify_url' => Expect::string()->required(),
	])->castTo('array')->required(),
	'payer' => Expect::structure([
		'default_payment_instrument' => Expect::string()->required(),
		'allowed_payment_instruments' => Expect::arrayOf(Expect::string()),
		'contact' => Expect::structure([
			'first_name' => Expect::string(),
			'last_name' => Expect::string(),
			'email' => Expect::string(),
			'phone_number' => Expect::string(),
			'city' => Expect::string(),
			'street' => Expect::string(),
			'postal_code' => Expect::string(),
			'country_code' => Expect::string(),
		])->castTo('array')->required(),
	])->castTo('array')->required(),
	'lang' => Expect::string()->pattern('[A-Z]{2}'),
	'target' => Expect::structure([
		'type' => Expect::string(),
		'goid' => Expect::float(),
	])->castTo('array'),
	'order_description' => Expect::string(),
	'additional_params' => Expect::arrayOf(Expect::structure([
		'name' => Expect::string()->required(),
		'value' => Expect::mixed(),
	])->castTo('array'))->castTo('array'),
	'eet' => Expect::structure([
		'mena' => Expect::string(),
		'celk_trzba' => Expect::float(),
		'zakl_dan1' => Expect::float(),
		'zakl_nepodl_dph' => Expect::float(),
		'dan1' => Expect::float(),
		'zakl_dan2' => Expect::float(),
		'dan2' => Expect::float(),
		'zakl_dan3' => Expect::float(),
		'dan3' => Expect::float(),
		'urceno_cerp_zuct' => Expect::float(),
		'cerp_zuct' => Expect::float(),
	])->castTo('array'),
	'preauthorization' => Expect::bool(),
])->castTo('array')->otherItems();

from gopay-inline.

PavelJurasek avatar PavelJurasek commented on July 20, 2024

Yeah, being able to statically analysable the configuration would be great, but I'd rather add this to the new version of this package. Are you able to test #63 ?

from gopay-inline.

janbarasek avatar janbarasek commented on July 20, 2024

I implemented full Nette 3 support here with all features and codestyle refactoring: https://github.com/baraja-core/gopay-inline

from gopay-inline.

f3l1x avatar f3l1x commented on July 20, 2024

That's cool @janbarasek, could you please prepare a PR for Nette 3? Without formatting and other things?

from gopay-inline.

janbarasek avatar janbarasek commented on July 20, 2024

@f3l1x No, I implement my custom forked version.

from gopay-inline.

f3l1x avatar f3l1x commented on July 20, 2024

That does not make any sense. It would be much better to work on it together. We are willing to spend our time on it. Just think about it.

from gopay-inline.

Related Issues (20)

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.