WAStoreCreditCard


Seaside-Examples-Store-Model

Comment:

Models credit card information - it has accessors for #name and #number (both strings), and #expiry date.  #validate throws an error if anything is missing, or if the expiry date is in the past.

This is intended to be an abstract class - the subclasses WAStoreMasterCard and WAStoreVisaCard provide further validation.

Hierarchy:

ProtoObject
Object
WAStoreCreditCard

Summary:

instance variables:

expiry name number

methods:

instance class
as yet unclassified no messages

Detail:

instance variables:

expiry
inferredType:
UndefinedObject
name
inferredType:
UndefinedObject
number
inferredType:
UndefinedObject

instance methods:

as yet unclassified
expiry
	
expiry: aDate

	expiry _ aDate
name

	^ name
name: aString

	name _ aString
number

	^ number
number: aString

	number _ aString
validate

	name ifNil: [self error: 'You must provide the name of the credit card owner.'].
	number ifNil: [self error: 'You must provide a credit card number.'].
	expiry ifNil: [self error: 'You must provide an expiry date.'].
	expiry < Date today ifTrue: [self error: 'The expiry date must not be in the past'].
	

class methods:

^top


- made by Dandelion -