/// <summary> /// Create submit for Purchases /// </summary> /// <param name="submit">submit</param> /// <returns>Purchases</returns> public Purchases submit(Purchases purchases) { purchases.setRequiredFields(new List <string> { DirectDebitConstants.merchantRefNum, DirectDebitConstants.amount, }); purchases.checkRequiredFields(); purchases.setOptionalFields(new List <string> { DirectDebitConstants.customerIp, DirectDebitConstants.dupCheck, DirectDebitConstants.ach, DirectDebitConstants.bacs, DirectDebitConstants.eft, DirectDebitConstants.sepa, DirectDebitConstants.billingDetails, DirectDebitConstants.profile }); Request request = new Request( method: RequestType.POST, uri: this.prepareURI(client.account() + "/purchases"), body: purchases ); dynamic response = this.client.processRequest(request); return(new Purchases(response)); }
/// <summary> /// Create cancel for Purchases /// </summary> /// <param name="cancel">cancel</param> /// <returns>Purchases</returns> public Purchases cancel(Purchases purchases) { purchases.setRequiredFields(new List <string> { DirectDebitConstants.status, DirectDebitConstants.id }); purchases.checkRequiredFields(); purchases.setOptionalFields(new List <string> { DirectDebitConstants.ach, DirectDebitConstants.bacs, DirectDebitConstants.eft, DirectDebitConstants.sepa, }); Request request = new Request( method: RequestType.PUT, uri: this.prepareURI(client.account() + "/purchases/" + purchases.id()), body: purchases ); dynamic response = this.client.processRequest(request); Purchases returnVal = new Purchases(response); returnVal.id(purchases.id()); return(returnVal); }