Code overhaul and simplification - #4
Conversation
| currency: "PHP", | ||
| value: "69.00" | ||
| value: "69.00", | ||
| details: amountDetails |
There was a problem hiding this comment.
@andyautida14, mis-aligned tab/space?
There was a problem hiding this comment.
@jgfrancisco I aligned it on my lastest commit.
| code: "pm_belt", | ||
| description: "Medium-sv" | ||
| description: "Medium-sv", | ||
| quantity: "1", |
|
no further comments for me. @haroldcalayan Can you review the merge request? |
|
|
||
| Information about the buyer, items inside the cart, and total amount are needed to create a new checkout. Refer to the tables below for more information. | ||
|
|
||
| ##### Checkout object |
| module.exports.HttpConfig = require('./lib/paymaya/core/HttpConfig'); | ||
| module.exports.HttpConnection = require('./lib/paymaya/core/HttpConnection'); | ||
| module.exports.PaymayaApiError = require('./lib/paymaya/core/PaymayaApiError'); | ||
| module.exports.Address = require('./lib/paymaya/model/checkout/Address'); |
There was a problem hiding this comment.
@haroldcalayan do you have any particular design reason for including this?
|
Hi @jgfrancisco! We have designed this SDK to be same with our PHP SDK: https://github.com/PayMaya/PayMaya-PHP-SDK so developers can easily adapt whenever they want to port with other language. Removing of models can make a big difference. Are there any other reasons of removing them? Since, we can put constructors on models with required fields only so users are not forced to add unnecessary values. |
|
Hi @haroldcalayan, Noted on this. The main issue we encountered was that when we use the models, there are optional fields that are filled up with default values (empty strings) that fails the checkout validation. For our sample demo, we didn't want to delete fields from the models used. But if we use and pass custom object, it would look that we are bypassing the use of the models. So we were proposing the use of custom objects for the creation of the checkout object. Anyway, yes, it would be good if the model constructors provide required fields and have the ability to add optional fields if available cc: @andyautida14 |
@jgfrancisco please review. Thanks