-
Notifications
You must be signed in to change notification settings - Fork 0
/
SaleZoozCommand.cls
40 lines (32 loc) · 1 KB
/
SaleZoozCommand.cls
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
public class SaleZoozCommand implements IZoozCommand{
public SaleCommandWrapper SaleInfo{get;set;}
public SaleZoozCommand() {
SaleInfo = new SaleCommandWrapper();
}
public String buildCommandBody(){
return JSON.serializePretty(SaleInfo);
}
public SaleZoozCommand setPaymentToken(String paymentToken){
this.SaleInfo.paymentToken = paymentToken;
return this;
}
public SaleZoozCommand setPaymentMethodToken(String paymentMethodToken){
this.SaleInfo.paymentMethod.paymentMethodToken = paymentMethodToken;
return this;
}
public SaleZoozCommand setSaleInfoConfig(SaleCommandWrapper config){
if(config != null)
this.SaleInfo = config;
return this;
}
public class SaleCommandWrapper{
public String command {get; private set;}
public String paymentToken{get;set;}
public ZoozPaymentMethodWrapper paymentMethod {get;set;}
public SaleCommandWrapper(){
command = 'Sale';
paymentMethod = new ZoozPaymentMethodWrapper();
paymentMethod.paymentMethodType = 'CreditCard';
}
}
}