Default Mode

Implementing the Sale Transaction

Step 01 - Create the CoreSale object

Create a CoreSale object with the amount.

For transactions using a card device reader (plugins)

  • CoreSale *sale =[[CoreSale alloc] init];
    sale.amount = [NSNumber numberWithDouble: 2.22];

  • CoreSale *sale =[[CoreSale alloc] init];
    sale.amount = [NSNumber numberWithDouble: 2.22];

  • CoreSale sale = new CoreSale(BigDecimal.valueOf(Double.parseDouble(2.22)));

  • CoreSale sale = new CoreSale(BigDecimal.valueOf(Double.parseDouble(2.22)));

  • CoreSale sale = new CoreSale(Math.Round(12.3, 2, MidpointRounding.ToEven));

  • CoreSale sale = new CoreSale(Math.Round(12.3, 2, MidpointRounding.ToEven));


For keyed transactions

  • CoreSaleKeyed *saleKeyed = [[CoreSaleKeyed alloc] init];
    saleKeyed.amount = [NSNumber numberWithDouble: 12.3];
    saleKeyed.cardCvv = @"111";
    saleKeyed.cardHolderName = @"Test user";
    saleKeyed.cardNumber = @"4111111111111111";
    saleKeyed.cardType= @"VISA";
    saleKeyed.expiryDate = @"1219";

  • CoreSaleKeyed *saleKeyed = [[CoreSaleKeyed alloc] init];
    saleKeyed.amount = [NSNumber numberWithDouble: 12.3];
    saleKeyed.cardCvv = @"111";
    saleKeyed.cardHolderName = @"Test user";
    saleKeyed.cardNumber = @"4111111111111111";
    saleKeyed.cardType= @"VISA";
    saleKeyed.expiryDate = @"1219";

  • CoreSaleKeyed saleKeyed = new CoreSaleKeyed(BigDecimal.valueOf(12.3));
    saleKeyed.setCardHolderName("Test user");
    saleKeyed.setCardNumber("4111111111111111");
    saleKeyed.setCardCvv("123");
    saleKeyed.setCardType("VISA");
    saleKeyed.setExpiryDate("1218");

  • CoreSaleKeyed saleKeyed = new CoreSaleKeyed(BigDecimal.valueOf(12.3));
    saleKeyed.setCardHolderName("Test user");
    saleKeyed.setCardNumber("4111111111111111");
    saleKeyed.setCardCvv("123");
    saleKeyed.setCardType("VISA");
    saleKeyed.setExpiryDate("1218");

  • CoreSaleKeyed saleKeyed = new CoreSaleKeyed(Math.Round(amount, 2, MidpointRounding.ToEven));
    saleRequest.cardHolderName = "Test User";
    saleRequest.cardNumber = "4111111111111111";
    saleRequest.cardCvv = "123";
    saleRequest.cardType = "VISA";
    saleRequest.expiryDate = "1218";

  • CoreSaleKeyed saleKeyed = new CoreSaleKeyed(Math.Round(amount, 2, MidpointRounding.ToEven));
    saleRequest.cardHolderName = "Test User";
    saleRequest.cardNumber = "4111111111111111";
    saleRequest.cardCvv = "123";
    saleRequest.cardType = "VISA";
    saleRequest.expiryDate = "1218";


Make sure onSettingsRetrieved method has been called before processing any transaction.


Step 02 - Send the transaction online

Call the method processSale from the Terminal object, passing the sale (sale or saleKeyed) object as the parameter.

  • [[WTPSTerminal singleton] processSale:sale];

  • [[WTPSTerminal singleton] processSale:sale];

  • AndroidTerminal.getInstance().processSale(sale);

  • JavaTerminal.getInstance().processSale(sale);

  • Terminal.getInstance().ProcessSale(sale);

  • Terminal.getInstance().ProcessSale(sale);


Step 03 - Handle the response

Succesful Response

If the previous steps have been implemented correctly, a response is returned by the method onSaleResponse.

The response argument needs to be handled by your solution so that the correct response code is read. Possible response codes are listed below.

  • A - Approval: Transaction was approved.
  • D - Declined: Transaction was declined.
  • C - Pick Up: Transaction was declined. Type of decline which means that the card has been marked as lost or stolen by the cardholder.
  • R - Referral: Transaction was declined. A referral means that the merchant should call the authorization center because more information is needed regarding the cardholder.

For the transaction to be approved, the response code must be A. Your Solution NEEDS TO VERIFY THE RESPONSE CODE before continuing. Receiving a response doesn't indicate that the transaction was accepted. If declined, for any reason, Your Application probably needs to implement complementary logic to do something else.

  • - (void)onSaleResponse:(CoreSaleResponse*)sale(
       NSLog(@"onSaleResponse");
       NSMutableDictionary* json = [sale getAsJsonObject:sale];
       // Your logic to treat the response
    }

  • - (void)onSaleResponse:(CoreSaleResponse*)sale(
       NSLog(@"onSaleResponse");
       NSMutableDictionary* json = [sale getAsJsonObject:sale];
       // Your logic to treat the response
    }

  • @Override
    public void onSaleResponse(final CoreSaleResponse response) {
       JSONObject result = new JSONObject(response.getAsJsonObject());
       Log.d(TAG, "onSaleResponse ");
       // Your logic to treat the response
    }

  • @Override
    public void onSaleResponse(final CoreSaleResponse response) {
       JSONObject result = new JSONObject(response.getAsJsonObject());
       Log.d(TAG, "onSaleResponse ");
       // Your logic to treat the response
    }

  • void OnSaleResponse(CoreSaleResponse response){
       // Your logic to treat the response
    }

  • void OnSaleResponse(CoreSaleResponse response){
       // Your logic to treat the response
    }


Unsuccessful Response (Error)

If, for any reason, the request doens't go well, the onError method is fired with an error message.

  • - (void) onError:(CoreError)error withDescription:(NSString *)message{
       NSLog(@"onError");
       // Your logic to treat initialisation error
       // Your logic to treat sale transaction execution error
    }

  • - (void) onError:(CoreError)error withDescription:(NSString *)message{
       NSLog(@"onError");
       // Your logic to treat initialisation error
       // Your logic to treat sale transaction execution error
    }

  • @Override
    public void onError(final CoreError error, String message) {
       Log.d(TAG, "onError");
       // Your logic to treat initialisation error
       // Your logic to treat sale transaction execution error
    }

  • @Override
    public void onError(final CoreError error, String message) {
       Log.d(TAG, "onError");
       // Your logic to treat initialisation error
       // Your logic to treat sale transaction execution error
    }

  • void OnError(CoreError error, string message){
       // Your logic to treat initialisation error
       // Your logic to treat sale transaction execution error
    }

  • void OnError(CoreError error, string message){
       // Your logic to treat initialisation error
       // Your logic to treat sale transaction execution error
    }



Implementing the Use of Signature

There are 2 types of transactions that require a signature to be sent with the request.

  • All swiped transactions
  • Chip and signature transactions

If the signature is collected on the paper receipt please set SignatureCollection field of the CoreSale object to “MANUAL”. This property will make sure that onSignatureRequired is not triggered.

To send a signature you need to collect the details and send them via the CoreSignature object.


Step 01 - Get an Instance of CoreSignature.

The CoreSignature object is created and supplied to your application via onSignatureRequired method:

  •  - (void) onSignatureRequired:(CoreSignature*)signature{
       NSLog(@"onSignatureRequired");
       canvas._signature = signature; // Created canvas view with _signature member variable
    }

  •  - (void) onSignatureRequired:(CoreSignature*)signature{
       NSLog(@"onSignatureRequired");
       canvas._signature = signature; // Created canvas view with _signature member variable
    }

  • @Override
    public void onSignatureRequired(final CoreSignature signature) {
       Log.d(TAG, "onSignatureRequired");
       signatureCanvas.setSignature(signature); // View object with signature member variable
    }

  • @Override
    public void onSignatureRequired(final CoreSignature signature) {
       Log.d(TAG, "onSignatureRequired");
       signatureCanvas.setSignature(signature); // View object with signature member variable
    }

  • public void OnSignatureRequired(CoreSignature signature){
        canvas.signature = signature;
    }

  • public void OnSignatureRequired(CoreSignature signature){
        canvas.signature = signature;
    }


You can use the following methods to manipulate the signature object.

  • StartTouch - User has reapplied their finger.
  • MoveTouch - User has moved their finger.
  • UpTouch - The user has lifted their finger.
  • ClearSignature - Clears the signature.
  • SubmitSignature - Submits the signature.

For more details and descriptions on those methods, take a look at the SDK Documentation section.


Step 02 - Populate the CoreSignature object

Use a canvas to call the corresponding signature touch method on the user input.

  • - (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
    {
       UITouch *touch = [touches anyObject];
       CGPoint p = [touch locationInView:self];
       [_signature startTouch:p.x andY:p.y];
    }
     
    - (void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
    {
       UITouch *touch = [touches anyObject];
       CGPoint p = [touch locationInView:self];
       [_signature moveTouch:p.x andY:p.y];
    }
     
    - (void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
    {
       [_signature upTouch];
    }

  • - (void)mouseDown:(NSEvent *)event{
        NSPoint click = [self convertPoint: [event locationInWindow] fromView: nil];
        [_path moveToPoint:click];
        [_signature startTouch:click.x andY:click.y];
    }
     
    -(void)mouseUp:(NSEvent *)event{
        [_signature upTouch];
        [self mouseMoved:event];
    }
     
    -(void)mouseDragged:(NSEvent *)event{
        [super mouseDragged: event];
        NSPoint click = [self convertPoint: [event locationInWindow] fromView: nil];
        [_path lineToPoint:click];
        [_signature moveTouch:click.x andY:click.y];
        [self setNeedsDisplay:YES];
    }

  • @Override
    public boolean onTouchEvent(MotionEvent event) {
       float x = event.getX();
       float y = event.getY();
     
       switch (event.getAction()) {
          case MotionEvent.ACTION_DOWN:
             signature.startTouch(x, y);
             break;
          case MotionEvent.ACTION_MOVE:
             signature.moveTouch(x, y);
             break;
          case MotionEvent.ACTION_UP:
             signature.upTouch();
             break;
      }
     
      return true;
    }

  • @Override
    public void mouseDragged(MouseEvent e) {
        points.add(e.getPoint());
        if (signature != null) {
            signature.moveTouch((float) e.getX(), (float) e.getY());
        }
        Graphics g = getGraphics();
        g.drawLine(xPressed, yPressed, e.getX(), e.getY());
     
        xPressed = getX();
        yPressed = e.getY();
        repaint();
    }
     
    @Override
    public void mousePressed(MouseEvent e) {
        points.add(e.getPoint());
        xPressed = xDragged;
        yPressed = yDragged;
        if (signature != null) {
            signature.startTouch((float) e.getX(), (float) e.getY());
        }
        repaint();
    }
     
    @Override
    public void mouseReleased(MouseEvent e) {
        Point emptyPoint = new Point();
        emptyPoint.setLocation(0, 0);
        points.add(emptyPoint);
        if (signature != null) {
            signature.upTouch();
        }
        repaint();
    }

  • private void Form1_MouseDown(object sender, MouseEventArgs e)
    {
        draw = true;
        prevX = e.X;
        prevY = e.Y;
        if (signature != null)
        {
            signature.StartTouch((float)prevX, (float)prevY);
        }
    }
     
    private void Form1_MouseUp(object sender, MouseEventArgs e)
    {
        draw = false;
        if (signature != null)
        {
            signature.UpTouch();
        }
    }
     
    private void Form1_MouseMove(object sender, MouseEventArgs e)
    {
        if (draw)
        {
            currentX = e.X;
            currentY = e.Y;
            using (Graphics graphics = Graphics.FromImage(bitmap))
            {
                graphics.DrawLine(
                new Pen(new SolidBrush(Color.Black), 1), prevX, prevY, currentX, currentY);
            }
            prevX = e.X;
            prevY = e.Y;
            if (signature != null)
            {
                signature.MoveTouch((float)prevX, (float)prevY);
            }
            panel1.Invalidate();
        }
    }
    private void panel1_Paint(object sender, PaintEventArgs e)
    {
        if (bitmap == null)
        {
            bitmap = new Bitmap(panel1.Width, panel1.Height);
        }
        base.OnPaint(e);
        e.Graphics.DrawImage(bitmap, new Point(0, 0));
    }

  • public MainPage(){
        this.InitializeComponent();
        MyCanvas.PointerPressed += MyCanvas_PointerPressed;
        MyCanvas.PointerMoved += MyCanvas_PointerMoved;
        MyCanvas.PointerReleased += MyCanvas_PointerReleased;
        MyCanvas.PointerExited += MyCanvas_PointerReleased;
    }
     
    Windows.UI.Xaml.Shapes.Path _Current;
     
    void MyCanvas_PointerPressed(object sender, PointerRoutedEventArgs e){
        var pointer = e.GetCurrentPoint(MyCanvas);
        if (!pointer.Properties.IsLeftButtonPressed)
            return;
        _Current = new Windows.UI.Xaml.Shapes.Path
        {
            Data = new PathGeometry
            {
                Figures = {
                new PathFigure { StartPoint = pointer.Position,
                Segments = { new PolyLineSegment() } } }
            },
            Stroke = new SolidColorBrush(Colors.Black),
            StrokeThickness = 4d,
        };
        MyCanvas.Children.Add(_Current);
        signature.StartTouch((float)pointer.Position.X, (float)pointer.Position.Y);
    }
     
    void MyCanvas_PointerMoved(object sender, PointerRoutedEventArgs e){
        var pointer = e.GetCurrentPoint(MyCanvas);
        if (!pointer.Properties.IsLeftButtonPressed || _Current == null)
            return;
        var segments = (_Current.Data as PathGeometry).Figures.First().Segments.First() as PolyLineSegment;
        segments.Points.Add(pointer.Position);
        signature.MoveTouch((float)pointer.Position.X, (float)pointer.Position.Y);
    }
     
    void MyCanvas_PointerReleased(object sender, PointerRoutedEventArgs e){
        _Current = null;
        signature.UpTouch();


Step 03 - Send the CoreSignature object

When the signature is completed, submitSignature method should be called to let the SDK know that the user has completed the signature.

  • [[WTPSTerminal singleton] submitSignature:signature];

  • [[WTPSTerminal singleton] submitSignature:signature];

  • AndroidTerminal.getInstance().submitSignature(signature);

  • JavaTerminal.getInstance().submitSignature(signature);

  • Terminal.getInstance().SubmitSignature(signature);

  • Terminal.getInstance().SubmitSignature(signature);


Implementing the Unreferenced Refund Transaction

Step 01 - Create the UnReferenced Refund

Create a CoreUnreferencedRefund object.

  • CoreUnreferencedRefund *refund =[[CoreUnreferencedRefund alloc] init];
    refund.amount = [NSNumber numberWithDouble: 12.3];
    refund.cardCvv = @"111";
    refund.cardHolderName = @"Test user";
    refund.cardNumber = @"4111111111111111";
    refund.cardType= @"VISA";
    refund.expiryDate = @"1219";
    refund.reason=@"reason";

  • CoreUnreferencedRefund *refund =[[CoreUnreferencedRefund alloc] init];
    refund.amount = [NSNumber numberWithDouble: 12.3];
    refund.cardCvv = @"111";
    refund.cardHolderName = @"Test user";
    refund.cardNumber = @"4111111111111111";
    refund.cardType= @"VISA";
    refund.expiryDate = @"1219";
    refund.reason=@"reason";

  • CoreUnreferencedRefund refund = new CoreUnreferencedRefund(BigDecimal.valueOf(12.3).setScale(2, BigDecimal.ROUND_HALF_EVEN));
    refund.setCardCvv("111");
    refund.setCardHolderName("Test user");
    refund.setCardNumber("4111111111111111");
    refund.setCardType("VISA");
    refund.setExpiryDate("1219");
    refund.setReason("reason");

  • CoreUnreferencedRefund refund = new CoreUnreferencedRefund(BigDecimal.valueOf(12.3).setScale(2, BigDecimal.ROUND_HALF_EVEN));
    refund.setCardCvv("111");
    refund.setCardHolderName("Test user");
    refund.setCardNumber("4111111111111111");
    refund.setCardType("VISA");
    refund.setExpiryDate("1219");
    refund.setReason("reason");

  • CoreUnreferencedRefund refundRequest = new CoreUnreferencedRefund(12.5m);
    refundRequest.cardHolderName = "Test User";
    refundRequest.cardNumber = "4444333322221111";
    refundRequest.cardCvv = "123";
    refundRequest.cardType = "VISA";
    refundRequest.expiryDate = "1224";
    refundRequest.reason = "reason";

  • CoreUnreferencedRefund refundRequest = new CoreUnreferencedRefund(Math.Round(12.3, 2, MidpointRounding.ToEven));
    refundRequest.cardHolderName = "Test User";
    refundRequest.cardNumber = "4111111111111111";
    refundRequest.cardCvv = "123";
    refundRequest.cardType = "VISA";
    refundRequest.expiryDate = "1218";
    refundRequest.reason = "reason";

Step 02 - Send the Transaction

Call the method processSale from the Terminal object, passing the sale object as the parameter.

  • [[WTPSTerminal singleton] processUnreferencedRefund:refund];

  • [[WTPSTerminal singleton] processUnreferencedRefund:refund];

  • AndroidTerminal.getInstance().processUnreferencedRefund(refund);

  • JavaTerminal.getInstance().processUnreferencedRefund(refund);

  • Terminal.Instance.ProcessUnreferencedRefund(refundRequest);

  • terminal.ProcessUnreferencedRefund(refundRequest);


Step 03 - Handle the response

Succesful Response

If the previous steps have been implemented correctly, a response is returned by the method onRefundResponse.

The response argument needs to be handled by your solution so that the correct response code is read.

  • - (void)onRefundResponse:(id)refund{
       NSLog(@"onRefundResponse");
       NSMutableDictionary* json =[refund getAsJsonObject:refund];
       // Your logic to treat the response
    }

  • - (void)onRefundResponse:(id)refund{
       NSLog(@"onRefundResponse");
       NSMutableDictionary* json =[refund getAsJsonObject:refund];
       // Your logic to treat the response
    }

  • @Override
    public void onRefundResponse(CoreRefundResponse response) {
       Log.d(TAG, "onRefundResponse ");
       JSONObject result = new JSONObject(response.getAsJsonObject());
       // Your logic to treat the response 
    }

  • @Override
    public void onRefundResponse(CoreRefundResponse response) {
       Log.d(TAG, "onRefundResponse ");
       JSONObject result = new JSONObject(response.getAsJsonObject());
       // Your logic to treat the response 
    }

  • public void OnRefundResponse(CoreRefundResponse response){
       // Your logic to treat the response 
    }

  • public void OnRefundResponse(CoreRefundResponse response){
       // Your logic to treat the response 
    }


Unsuccessful Response (Error)

If, for any reason, the request doens't go well, the onError method is fired with an error message.

  • - (void) onError:(CoreError)error withDescription:(NSString *)message{
       NSLog(@"onError");
       // Your logic to treat initialisation error
       // Your logic to treat sale transaction execution error
       // Your logic to treat unreferenced refund transaction execution error
    }

  • - (void) onError:(CoreError)error withDescription:(NSString *)message{
       NSLog(@"onError");
       // Your logic to treat initialisation error
       // Your logic to treat sale transaction execution error
       // Your logic to treat unreferenced refund transaction execution error
    }

  • @Override
    public void onError(final CoreError error, String message) {
       Log.d(TAG, "onError");
       // Your logic to treat initialisation error
       // Your logic to treat sale transaction execution error
       // Your logic to treat unreferenced refund transaction execution error
    }

  • @Override
    public void onError(final CoreError error, String message) {
       Log.d(TAG, "onError");
       // Your logic to treat initialisation error
       // Your logic to treat sale transaction execution error
       // Your logic to treat unreferenced refund transaction execution error
    }

  • void OnError(CoreError error, string message){
       // Your logic to treat initialisation error
       // Your logic to treat sale transaction execution error
       // Your logic to treat unreferenced refund transaction execution error
    }

  • void OnError(CoreError error, string message){
       // Your logic to treat initialisation error
       // Your logic to treat sale transaction execution error
       // Your logic to treat unreferenced refund transaction execution error
    }


Implementing the Referenced Refund Transaction

Step 01 - Create the Referenced Refund

Create a CoreReferencedRefund object.

  • CoreRefund *refund =[[CoreRefund alloc] init];
    refund.amount = [NSNumber numberWithDouble: [self.amountField.text doubleValue]];
    refund.uniqueRef = @"FYG0UCFLRA";
    refund.reason = @"reason";

  • CoreRefund *refund =[[CoreRefund alloc] init];
    refund.amount = [NSNumber numberWithDouble: [self.amountField.text doubleValue]];
    refund.uniqueRef = @"FYG0UCFLRA";
    refund.reason = @"reason";

  • CoreRefund refund = new CoreRefund(1.12);
    refund.setUniqueRef("B5EOFKJ84W");
    refund.setReason("reason");

  • CoreRefund refund = new CoreRefund(1.12);
    refund.setUniqueRef("B5EOFKJ84W");
    refund.setReason("reason");

  • CoreRefund refundRequest = new CoreRefund(12.5m);
    refundRequest.uniqueRef = "B5FGDSSA"
    refundRequest.reason = "reason";

  • CoreRefund refundRequest = new CoreRefund(Math.Round(12.3, 2, MidpointRounding.ToEven));
    refundRequest.uniqueRef = "B5FGDSSA"
    refundRequest.reason = "reason";


Step 02 - Send the Transaction

Call the method processSale from the Terminal object, passing the sale object as the parameter.

  • [[WTPSTerminal singleton] processRefund:refund];

  • [[WTPSTerminal singleton] processRefund:refund];

  • AndroidTerminal.getInstance().processRefund(refund);

  • JavaTerminal.getInstance().processRefund(refund);

  • Terminal.Instance.ProcessRefund(refundRequest);

  • terminal.ProcessRefund(refundRequest);


Step 03 - Handle the response

Succesful Response

If the previous steps have been implemented correctly, a response is returned by the method onRefundResponse.

The response argument needs to be handled by your solution so that the correct response code is read.

  • - (void)onRefundResponse:(id)refund{
       NSLog(@"onRefundResponse");
       NSMutableDictionary* json =[refund getAsJsonObject:refund];
       // Your logic to treat the response
    }

  • - (void)onRefundResponse:(id)refund{
       NSLog(@"onRefundResponse");
       NSMutableDictionary* json =[refund getAsJsonObject:refund];
       // Your logic to treat the response
    }

  • @Override
    public void onRefundResponse(CoreRefundResponse response) {
       Log.d(TAG, "onRefundResponse ");
       JSONObject result = new JSONObject(response.getAsJsonObject());
       // Your logic to treat the response 
    }

  • @Override public void onRefundResponse(CoreRefundResponse response) {

     Log.d(TAG, "onRefundResponse ");
     JSONObject result = new JSONObject(response.getAsJsonObject());
     // Your logic to treat the response 

    }

     

  • public void OnRefundResponse(CoreRefundResponse response){
       // Your logic to treat the response
    }

  • public void OnRefundResponse(CoreRefundResponse response){
       // Your logic to treat the response
    }


Unsuccessful Response (Error)

If, for any reason, the request doens't go well, the onError method is fired with an error message.

  • - (void) onError:(CoreError)error withDescription:(NSString *)message{
       NSLog(@"onError");
       // Your logic to treat initialisation error
       // Your logic to treat sale transaction execution error
       // Your logic to treat referenced refund transaction execution error
       // Your logic to treat unreferenced refund transaction execution error
    }

  • - (void) onError:(CoreError)error withDescription:(NSString *)message{
       NSLog(@"onError");
       // Your logic to treat initialisation error
       // Your logic to treat sale transaction execution error
       // Your logic to treat referenced refund transaction execution error
       // Your logic to treat unreferenced refund transaction execution error
    }

  • @Override
    public void onError(final CoreError error, String message) {
       Log.d(TAG, "onError");
       // Your logic to treat initialisation error
       // Your logic to treat sale transaction execution error
       // Your logic to treat referenced refund transaction execution error
       // Your logic to treat unreferenced refund transaction execution error
    }

  • @Override
    public void onError(final CoreError error, String message) {
       Log.d(TAG, "onError");
       // Your logic to treat initialisation error
       // Your logic to treat sale transaction execution error
       // Your logic to treat referenced refund transaction execution error
       // Your logic to treat unreferenced refund transaction execution error
    }

  • void OnError(CoreError error, string message){
       // Your logic to treat initialisation error
       // Your logic to treat sale transaction execution error
       // Your logic to treat referenced refund transaction execution error
       // Your logic to treat unreferenced refund transaction execution error
    }

  • void OnError(CoreError error, string message){
       // Your logic to treat initialisation error
       // Your logic to treat sale transaction execution error
       // Your logic to treat referenced refund transaction execution error
       // Your logic to treat unreferenced refund transaction execution error
    }


Implementing the Reporting of Transactions

Step 01 - Create the Request

Create a CoreTransactionFilter object.

  • CoreTransactionFilter filter = [[CoreTransactionFilter alloc] init];
    filter.resultsPerPage = [NSNumber numberWithInteger: 25];
    filter.state = TransactionState.OPEN;
    filter.startDate = @"30-12-2015:13:45:30:123"; (pattern: dd-MM-yyyy:HH:mm:ss:SSS
    filter.endDate = @"30-07-2018:13:45:30:123"; (pattern: dd-MM-yyyy:HH:mm:ss:SSS

  • CoreTransactionFilter filter = [[CoreTransactionFilter alloc] init];
    filter.resultsPerPage = [NSNumber numberWithInteger: 25];
    filter.state = TransactionState.OPEN;
    filter.startDate = @"30-12-2015:13:45:30:123"; (pattern: dd-MM-yyyy:HH:mm:ss:SSS
    filter.endDate = @"30-07-2018:13:45:30:123"; (pattern: dd-MM-yyyy:HH:mm:ss:SSS

  • CoreTransactionFilter filter = new CoreTransactionFilter();
    filter.setItemsPerPage(25);
    filter.setState(CoreTransactionState.ALL);
    filter.setStartDate("31-12-2015:12:45:30:123");
    filter.setEndDate("30-07-2018:12:45:30:123");

  • CoreTransactionFilter filter = new CoreTransactionFilter();
    filter.setItemsPerPage(25);
    filter.setState(CoreTransactionState.ALL);
    filter.setStartDate("31-12-2015:12:45:30:123");
    filter.setEndDate("30-07-2018:12:45:30:123");

  • CoreTransactionFilter filter = new CoreTransactionFilter();
    filter.state = CoreTransactionState.ALL;
    filter.startDate = "31-12-2015:12:45:30:123";
    filter.endDate = "30-08-2018:12:45:30:123";
    filter.resultsPerPage = "25";

  • CoreTransactionFilter filter = new CoreTransactionFilter();
    filter.resultsPerPage = 25;
    filter.state = CoreTransactionState.ALL;
    filter.startDate = "31-12-2015";
    filter.endDate = "30-01-2016";
    terminal.GetTransactions(1, filter);


In case you don't want to apply any filters, just use the first line of the code snippets above.


Step 02 - Send the Request

Then request the transactions.

  • [[WTPSTerminal singleton] getTransactions:1 usingFilter:filter];

  • [[WTPSTerminal singleton] getTransactions:1 usingFilter:filter];

  • AndroidTerminal.getInstance().getTransactions(1, filter);

  • JavaTerminal.getInstance().getTransactions(1, filter);

  • Terminal.Instance.GetTransactions(1, filter);

  • terminal.GetTransactions();


In case you don't want to apply any filters, do not pass any parameters in your request - leave the method call empty.


Step 03 - Handle the response

Succesful Response

If the previous steps have been implemented correctly, a response is returned by the method onTransactionListResponse.

The response argument needs to be handled by your solution so that the correct response code is read.

  • -(void)onTransactionListResponse:(CoreTransactions*)transaction{
       NSLog(@"onTransactionListResponse");
       NSMutableDictionary* json =[transaction getAsJsonObject:transaction];
       // Your logic to treat the response
    }

  • -(void)onTransactionListResponse:(CoreTransactions*)transaction{
       NSLog(@"onTransactionListResponse");
       NSMutableDictionary* json =[transaction getAsJsonObject:transaction];
       // Your logic to treat the response
    }

  • @Override
    public void onTransactionListResponse(CoreTransactions response) {
       Log.d(TAG, "onTransactionListResponse ");
       JSONObject result = new JSONObject(response.getAsJsonObject());
       // Your logic to treat the response 
    }

  • @Override
    public void onTransactionListResponse(CoreTransactions response) {
       Log.d(TAG, "onTransactionListResponse ");
       JSONObject result = new JSONObject(response.getAsJsonObject());
       // Your logic to treat the response 
    }

  • public void OnTransactionListResponse(CoreTransactions response){
       // Your logic to treat the response 
    }

  • public void OnTransactionListResponse(CoreTransactions response){
       // Your logic to treat the response 
    }


Unsuccessful Response (Error)

If, for any reason, the request doens't go well, the onError method is fired with an error message.

  • - (void) onError:(CoreError)error withDescription:(NSString *)message{
       NSLog(@"onError");
       // Your logic to treat initialisation error
       // Your logic to treat sale transaction execution error
       // Your logic to treat referenced refund transaction execution error
       // Your logic to treat unreferenced refund transaction execution error
    }

  • - (void) onError:(CoreError)error withDescription:(NSString *)message{
       NSLog(@"onError");
       // Your logic to treat initialisation error
       // Your logic to treat sale transaction execution error
       // Your logic to treat referenced refund transaction execution error
       // Your logic to treat unreferenced refund transaction execution error
    }

  • @Override
    public void onError(final CoreError error, String message) {
       Log.d(TAG, "onError");
       // Your logic to treat initialisation error
       // Your logic to treat sale transaction execution error
       // Your logic to treat referenced refund transaction execution error
       // Your logic to treat unreferenced refund transaction execution error
    }

  • @Override
    public void onError(final CoreError error, String message) {
       Log.d(TAG, "onError");
       // Your logic to treat initialisation error
       // Your logic to treat sale transaction execution error
       // Your logic to treat referenced refund transaction execution error
       // Your logic to treat referenced unrefund transaction execution error
    }

  • void OnError(CoreError error, string message){
       // Your logic to treat initialisation error
       // Your logic to treat sale transaction execution error
       // Your logic to treat referenced refund transaction execution error
       // Your logic to treat unreferenced refund transaction execution error
    }

  • void OnError(CoreError error, string message){
       // Your logic to treat initialisation error
       // Your logic to treat sale transaction execution error
       // Your logic to treat referenced refund transaction execution error
       // Your logic to treat unreferenced refund transaction execution error
    }



Implementing the Update of a Transaction

Once a transaction is performed, you can, if necessary, update a few of its information, like:

  • The customer's email (String).
  • The customer's mobile (String).
  • The tip provided (CoreTip object).
  • The customer's signature (CoreSignature object).

To do that, you need to know the uniqueRef of the transaction you want to update, and also use your terminal's updateTransaction(CoreUpdate update) method;

  • CoreTip* tip = [[CoreTip alloc] init];
    tip.amount = 15.00;
    tip.percentage = 10.00;
    tip.tipType = "PERCENTAGE";
    tip.uid = "E41KL4LY10C09356D";
     
    CoreUpdate* update = [[CoreUpdate alloc] init];
    update.email = "test@.nosp@m.gmai.nosp@m.l.com";
    update.mobile = @"948348348";
    update.uniqueRef = @"DSSAAGG";
    update.tipAdjustment = tip;
    [[WTPSTerminal singleton] updateTransaction:update];

  • CoreTip* tip = [[CoreTip alloc] init];
    tip.uid = "E41KL4LY10C09356D";
    tip.tipType = "PERCENTAGE";
    tip.percentage = 10.00;
    CoreUpdate* update = [[CoreUpdate alloc] init];
    update.email = "test@.nosp@m.gmai.nosp@m.l.com";
    update.mobile = @"948348348";
    update.uniqueRef = @"DSSAAGG";
    update.tipAdjustment = tip;
    [[WTPSTerminal singleton] updateTransaction:update];

  • CoreTip tip = new CoreTip();
    tip.setTipType(TipType.FIXED_AMOUNT);
    tip.setAmount(BigDecimal.valueOf(Double.parseDouble("12")));
    CoreUpdate update = new CoreUpdate("SDF93GD982");
    update.setTip(tip);
     
    AndroidTerminal.getInstance().updateTransaction(update);

  • CoreTip tip = new CoreTip();
    tip.setTipType(TipType.FIXED_AMOUNT);
    tip.setAmount(BigDecimal.valueOf(Double.parseDouble("12")));
    CoreUpdate update = new CoreUpdate("SDF93GD982");
    update.setTip(tip);
     
    JavaTerminal.getInstance().updateTransaction(update);

  • CoreTip tip = new CoreTip();
    tip.uid = "FK03FS87YH2";
    tip.tipType = "PERCENTAGE";
    tip. percentage = 10.0m;
    CoreUpdate sendReceipt = new CoreUpdate(uniqueRefFromLastTransaction, "test@gmail.com", "0123456789");
    sendReceipt.tipAdjustment = tip;
    Terminal.Instance.UpdateTransaction(sendReceipt);

  • CoreTip tip = new CoreTip();
    tip.uid = "FK03FS87YH2";
    tip.tipType = "PERCENTAGE";
    tip. percentage = 10.0m;
    Terminal terminal = new Terminal(this);
    CoreUpdate sendReceipt = new CoreUpdate(uniqueRefFromLastTransaction, "test@gmail.com", "0123456789");
    sendReceipt.tipAdjustment = tip;
    terminal.UpdateTransaction(sendReceipt);

For more details, access the SDK Documentation, choose your platform and consult its updateTransaction() method and classes CoreTip and CoreUpdate .