Hey all,
TIA
I am trying to write a library that interacts with a REST api that processes payments. I would like to one day release this project so others could use it easily.
I am trying to decide how to structure the parameters required for each type of transaction. Currently I have a client class that has functions like “process_card”. Only that the parameters for this are many; customer details, card details and transaction details (about 12-15 variables in total, most required).
def process_card(self,transactionAmount,transactionCurrency,......etc):
process_card validates input, creates a hash then sends them off the api and returns the response.
Is this the most OOP or pythonic way to do this? Should I instead be passing through parameters as data structures or dictionaries to process_card like and having the validation inside the structs?
def process_card(self, customer_data, card_data, transaction_data):
submitted by /u/sdfghjkl1234
[link] [comments]
r/learnpython Hey all, TIA I am trying to write a library that interacts with a REST api that processes payments. I would like to one day release this project so others could use it easily. I am trying to decide how to structure the parameters required for each type of transaction. Currently I have a client class that has functions like “process_card”. Only that the parameters for this are many; customer details, card details and transaction details (about 12-15 variables in total, most required). def process_card(self,transactionAmount,transactionCurrency,……etc): process_card validates input, creates a hash then sends them off the api and returns the response. Is this the most OOP or pythonic way to do this? Should I instead be passing through parameters as data structures or dictionaries to process_card like and having the validation inside the structs? def process_card(self, customer_data, card_data, transaction_data): submitted by /u/sdfghjkl1234 [link] [comments]
Hey all,
TIA
I am trying to write a library that interacts with a REST api that processes payments. I would like to one day release this project so others could use it easily.
I am trying to decide how to structure the parameters required for each type of transaction. Currently I have a client class that has functions like “process_card”. Only that the parameters for this are many; customer details, card details and transaction details (about 12-15 variables in total, most required).
def process_card(self,transactionAmount,transactionCurrency,......etc):
process_card validates input, creates a hash then sends them off the api and returns the response.
Is this the most OOP or pythonic way to do this? Should I instead be passing through parameters as data structures or dictionaries to process_card like and having the validation inside the structs?
def process_card(self, customer_data, card_data, transaction_data):
submitted by /u/sdfghjkl1234
[link] [comments]