public static IQrInfo SetPlainCreditTransfer(this QrInfo qr) { qr.Segments.Add(new QrDataObject("29200016A000000677010111")); qr.CreditTransfer = new CreditTransfer { MerchantPresentedQR = true }; return(qr); }
public static void ValidateWith(this QrInfo qr, QrInfo expected, bool skipChecksum = true) { if (skipChecksum) { qr.Segments.Remove(qr.Segments.FirstOrDefault(it => it.Identifier == QrIdentifier.CRC)); expected.Segments.Remove(expected.Segments.FirstOrDefault(it => it.Identifier == QrIdentifier.CRC)); } qr.Should().BeEquivalentTo(expected); }
public void DefaultDynamicBillPaymentQRMustBeReadable() { var qrCode = PPay.DynamicQR.CreateBillPaymentQrCode(); var actual = sut.Read(qrCode); var expected = new QrInfo() .InitializeDefault(staticQr: false) .SetPlainBillPayment(); actual.ValidateWith(expected); }
public void DefaultStaticCreditTransferQRMustBeReadable() { var qrCode = PPay.StaticQR.CreateCreditTransferQrCode(); var actual = sut.Read(qrCode); var expected = new QrInfo() .InitializeDefault() .SetPlainCreditTransfer(); actual.ValidateWith(expected); }
public static QrInfo InitializeDefault(this QrInfo qr, bool staticQr = true, CurrencyCode currency = CurrencyCode.THB, string country = "TH") { var PointOfInitiationMethod = staticQr ? emv.Static : emv.Dynamic; qr.Segments.Add(new QrDataObject("000201")); qr.Segments.Add(new QrDataObject($"0102{PointOfInitiationMethod}")); qr.Segments.Add(new QrDataObject($"5303{((int)currency).ToString("000")}")); qr.Segments.Add(new QrDataObject($"5802{country}")); return(qr); }
public void DefaultStaticBillPaymentQRMustBeReadable() { var qrCode = PPay.StaticQR.GetBillPaymentQR(); var actual = sut.Read(qrCode); var expected = new QrInfo() .InitializeDefault() .SetPlanBillPayment(); actual.ValidateWith(expected); }
public void DefaultDynamicCreditTransferQRMustBeReadable() { var qrCode = PPay.DynamicQR.GetCreditTransferQR(); var actual = sut.Read(qrCode); var expected = new QrInfo() .InitializeDefault(staticQr: false) .SetPlanCreditTransfer(); actual.ValidateWith(expected); }
public static IQrInfo SetPlainBillPayment(this QrInfo qr) { qr.Segments.Add(new QrDataObject("30200016A000000677010112")); qr.BillPayment = new BillPayment(); return(qr); }
public static QrInfo SetPlanCreditTransfer(this QrInfo qr) { qr.Segments.Add(new QrDataObject("29200016A000000677010111")); qr.CreditTransfer = new CreditTransfer(true); return(qr); }