
You are designing logic for a virtual credit card product.
Explain key benefits and drawbacks of virtual credit cards for:
A transaction is described by:
card_number
: a 16-digit string
transaction_id
: an 8-digit string
amount
: integer dollars
Certain attributes are encoded in the digits:
1
⇒ transaction is
online
; if
0
⇒
offline/in-person
.
1
⇒ type is
charge
; if
0
⇒ type is
authorization
.
1
⇒
merchant-bound
; if
0
⇒
not merchant-bound
.
1
⇒ network is
Master
; if
0
⇒
Visa
.
1
⇒
multi-use
; if
0
⇒
one-time-use
.
A transaction is valid if it satisfies the rules for its network:
Visa: valid iff
merchant_bound
AND
multi_use
) OR
online
AND
amount < 100
AND type is NOT
authorization
)
Master: valid iff
amount < 100
AND (online OR offline) AND NOT
merchant_bound
) OR
merchant_bound
AND
amount > 100
)
card_number = "1234567891011111"
transaction_id = "50781100"
amount = 150
Login required