Skip to content

Instantly share code, notes, and snippets.

View WirecardMobileServices's full-sized avatar

WirecardMobileServices WirecardMobileServices

View GitHub Profile
@WirecardMobileServices
WirecardMobileServices / WDePOS-Print-mPOP.swift
Last active July 17, 2020 19:57
Printer Manager - Print mPOP
//End of printing process
let completion: PrintCompletion = { (printStatusOK: Bool, error: Error?) in
//printStatusOK is true if printing ended with OK status
}
let progress: PrinterStateUpdate = { (printProgress: WDPrinterStateUpdate) in
//printProgress - print progress Initialisation | Printing | Finished
}
//Discover active devices
import com.jakewharton.rxrelay2.BehaviorRelay;
import com.jakewharton.rxrelay2.Relay;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Currency;
import java.util.List;
import de.wirecard.epos.model.sale.builder.payment.CardPurchasePayment;
import de.wirecard.epos.model.sale.sales.SaleItem;
import com.jakewharton.rxrelay2.BehaviorRelay;
import com.jakewharton.rxrelay2.Relay;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import de.wirecard.epos.model.sale.builder.PurchaseRequest;
import de.wirecard.epos.model.sale.builder.payment.EftCardPurchasePayment;
import de.wirecard.epos.model.sale.sales.SaleItem;
//build.gradle (Project: ...)
allprojects {
repositories {
maven { url "https://jitpack.io" }
maven { url "https://dl.bintray.com/wirecardmobileservices/Wirecard-ePOS" }
}
}
//build.gradle (Module: ...)
import com.annimon.stream.Collectors;
import com.annimon.stream.Stream;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.Currency;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
@WirecardMobileServices
WirecardMobileServices / WDePOS-Init.swift
Last active March 27, 2020 13:44
AcceptSDK initialization
// Import SDK module
import WDePOS
//End of SDK setup process
let setupCompletion:CurrentUserCompletion = {( currentUser:WDMerchantUser?, cashier:WDMerchantCashier? , error:Error?) in
//Current User is returned upon successful login
//if the Cash Management is enabled and Cashier record exist for the current user then the Cashier is returned also
}
// The SDK is initialized as shared instance so can be accessed
//I - Full Return
// End of Return process
let fullReturnCompletion: SaleUpdateCompletion = { (sale: WDSaleResponse?, error: Error?) in
// sale - refunded sale detail
// error - if encountered during the Refund process
}
let saleReturn: WDSaleRequest! = sale.saleReturn()// Here we created the full Sale Return
// Alternatively you would create the Sale Return consisting only of Items you wish to Return - aka Partial Return. See at the end
// Perform the Refund
//I - QUERY OF SALES
// End of Sale Query process
let completion: SaleQueryResponse! = { (sales: [WDSaleResponse]?, error: Error?) in
// sales list of WDSaleResponse objects
// SaleResponse has all the details of the performed Sale including
// - Transaction details (CARD | COUPON | CASH)
// - Basket details
}
// Query parameters such as paging, order by, sort
//I - QUERY OF SALES
// End of Sale Query process
SaleQueryResponse completion = ^(NSArray <WDSaleResponse *> * _Nullable sales, NSError * _Nullable error){
// sales list of WDSaleResponse objects
// SaleResponse has all the details of the performed Sale including
// - Transaction details (CARD | COUPON | CASH)
// - Basket details
};
// Query parameters such as paging, order by, sort
// End of Send Receipt process
let completion: SendReceiptCompletion = { (recipient: Array?, error: Error?) in
guard error != nil else {
//Failure sending the receipt
return
}
//Receipt sent successfully
}
// Sale manager to generate and send the receipt from the backend to the cardholder