UNPKG

yc-types

Version:

TypeScript types and interfaces for YellowCard protobuf definitions

1,312 lines 65.8 kB
"use strict"; // Code generated by protoc-gen-ts_proto. DO NOT EDIT. // versions: // protoc-gen-ts_proto v2.8.3 // protoc v3.21.12 // source: payment.proto Object.defineProperty(exports, "__esModule", { value: true }); exports.PaymentStats = exports.PaymentWebhookRequest = exports.ListPaymentsResponse = exports.AuthorizationInfo = exports.CustomerInfo = exports.VerifyPaymentResponse_MetaEntry = exports.VerifyPaymentResponse = exports.InitializePaymentResponse = exports.InitializePaymentRequest_MetadataEntry = exports.InitializePaymentRequest = exports.Payment_MetadataEntry = exports.Payment = exports.protobufPackage = void 0; /* eslint-disable */ const wire_1 = require("@bufbuild/protobuf/wire"); const common_1 = require("./common"); const struct_1 = require("./google/protobuf/struct"); const timestamp_1 = require("./google/protobuf/timestamp"); exports.protobufPackage = "pb"; function createBasePayment() { return { id: "", reference: "", customerEmail: "", customerPhone: "", customerName: "", amount: 0, currency: "", status: "", paymentMethod: "", paymentType: "", gatewayResponse: "", paystackTransactionId: 0, paystackAccessCode: "", authorizationUrl: "", metadata: {}, paidAt: undefined, createdAt: undefined, updatedAt: undefined, nin: "", passport: "", }; } exports.Payment = { encode(message, writer = new wire_1.BinaryWriter()) { if (message.id !== "") { writer.uint32(10).string(message.id); } if (message.reference !== "") { writer.uint32(18).string(message.reference); } if (message.customerEmail !== "") { writer.uint32(26).string(message.customerEmail); } if (message.customerPhone !== "") { writer.uint32(34).string(message.customerPhone); } if (message.customerName !== "") { writer.uint32(42).string(message.customerName); } if (message.amount !== 0) { writer.uint32(48).int64(message.amount); } if (message.currency !== "") { writer.uint32(58).string(message.currency); } if (message.status !== "") { writer.uint32(66).string(message.status); } if (message.paymentMethod !== "") { writer.uint32(74).string(message.paymentMethod); } if (message.paymentType !== "") { writer.uint32(162).string(message.paymentType); } if (message.gatewayResponse !== "") { writer.uint32(82).string(message.gatewayResponse); } if (message.paystackTransactionId !== 0) { writer.uint32(88).int64(message.paystackTransactionId); } if (message.paystackAccessCode !== "") { writer.uint32(98).string(message.paystackAccessCode); } if (message.authorizationUrl !== "") { writer.uint32(106).string(message.authorizationUrl); } Object.entries(message.metadata).forEach(([key, value]) => { exports.Payment_MetadataEntry.encode({ key: key, value }, writer.uint32(114).fork()).join(); }); if (message.paidAt !== undefined) { timestamp_1.Timestamp.encode(toTimestamp(message.paidAt), writer.uint32(122).fork()).join(); } if (message.createdAt !== undefined) { timestamp_1.Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(130).fork()).join(); } if (message.updatedAt !== undefined) { timestamp_1.Timestamp.encode(toTimestamp(message.updatedAt), writer.uint32(138).fork()).join(); } if (message.nin !== "") { writer.uint32(146).string(message.nin); } if (message.passport !== "") { writer.uint32(154).string(message.passport); } return writer; }, decode(input, length) { const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBasePayment(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.id = reader.string(); continue; } case 2: { if (tag !== 18) { break; } message.reference = reader.string(); continue; } case 3: { if (tag !== 26) { break; } message.customerEmail = reader.string(); continue; } case 4: { if (tag !== 34) { break; } message.customerPhone = reader.string(); continue; } case 5: { if (tag !== 42) { break; } message.customerName = reader.string(); continue; } case 6: { if (tag !== 48) { break; } message.amount = longToNumber(reader.int64()); continue; } case 7: { if (tag !== 58) { break; } message.currency = reader.string(); continue; } case 8: { if (tag !== 66) { break; } message.status = reader.string(); continue; } case 9: { if (tag !== 74) { break; } message.paymentMethod = reader.string(); continue; } case 20: { if (tag !== 162) { break; } message.paymentType = reader.string(); continue; } case 10: { if (tag !== 82) { break; } message.gatewayResponse = reader.string(); continue; } case 11: { if (tag !== 88) { break; } message.paystackTransactionId = longToNumber(reader.int64()); continue; } case 12: { if (tag !== 98) { break; } message.paystackAccessCode = reader.string(); continue; } case 13: { if (tag !== 106) { break; } message.authorizationUrl = reader.string(); continue; } case 14: { if (tag !== 114) { break; } const entry14 = exports.Payment_MetadataEntry.decode(reader, reader.uint32()); if (entry14.value !== undefined) { message.metadata[entry14.key] = entry14.value; } continue; } case 15: { if (tag !== 122) { break; } message.paidAt = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32())); continue; } case 16: { if (tag !== 130) { break; } message.createdAt = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32())); continue; } case 17: { if (tag !== 138) { break; } message.updatedAt = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32())); continue; } case 18: { if (tag !== 146) { break; } message.nin = reader.string(); continue; } case 19: { if (tag !== 154) { break; } message.passport = reader.string(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { id: isSet(object.id) ? globalThis.String(object.id) : "", reference: isSet(object.reference) ? globalThis.String(object.reference) : "", customerEmail: isSet(object.customerEmail) ? globalThis.String(object.customerEmail) : "", customerPhone: isSet(object.customerPhone) ? globalThis.String(object.customerPhone) : "", customerName: isSet(object.customerName) ? globalThis.String(object.customerName) : "", amount: isSet(object.amount) ? globalThis.Number(object.amount) : 0, currency: isSet(object.currency) ? globalThis.String(object.currency) : "", status: isSet(object.status) ? globalThis.String(object.status) : "", paymentMethod: isSet(object.paymentMethod) ? globalThis.String(object.paymentMethod) : "", paymentType: isSet(object.paymentType) ? globalThis.String(object.paymentType) : "", gatewayResponse: isSet(object.gatewayResponse) ? globalThis.String(object.gatewayResponse) : "", paystackTransactionId: isSet(object.paystackTransactionId) ? globalThis.Number(object.paystackTransactionId) : 0, paystackAccessCode: isSet(object.paystackAccessCode) ? globalThis.String(object.paystackAccessCode) : "", authorizationUrl: isSet(object.authorizationUrl) ? globalThis.String(object.authorizationUrl) : "", metadata: isObject(object.metadata) ? Object.entries(object.metadata).reduce((acc, [key, value]) => { acc[key] = String(value); return acc; }, {}) : {}, paidAt: isSet(object.paidAt) ? fromJsonTimestamp(object.paidAt) : undefined, createdAt: isSet(object.createdAt) ? fromJsonTimestamp(object.createdAt) : undefined, updatedAt: isSet(object.updatedAt) ? fromJsonTimestamp(object.updatedAt) : undefined, nin: isSet(object.nin) ? globalThis.String(object.nin) : "", passport: isSet(object.passport) ? globalThis.String(object.passport) : "", }; }, toJSON(message) { const obj = {}; if (message.id !== "") { obj.id = message.id; } if (message.reference !== "") { obj.reference = message.reference; } if (message.customerEmail !== "") { obj.customerEmail = message.customerEmail; } if (message.customerPhone !== "") { obj.customerPhone = message.customerPhone; } if (message.customerName !== "") { obj.customerName = message.customerName; } if (message.amount !== 0) { obj.amount = Math.round(message.amount); } if (message.currency !== "") { obj.currency = message.currency; } if (message.status !== "") { obj.status = message.status; } if (message.paymentMethod !== "") { obj.paymentMethod = message.paymentMethod; } if (message.paymentType !== "") { obj.paymentType = message.paymentType; } if (message.gatewayResponse !== "") { obj.gatewayResponse = message.gatewayResponse; } if (message.paystackTransactionId !== 0) { obj.paystackTransactionId = Math.round(message.paystackTransactionId); } if (message.paystackAccessCode !== "") { obj.paystackAccessCode = message.paystackAccessCode; } if (message.authorizationUrl !== "") { obj.authorizationUrl = message.authorizationUrl; } if (message.metadata) { const entries = Object.entries(message.metadata); if (entries.length > 0) { obj.metadata = {}; entries.forEach(([k, v]) => { obj.metadata[k] = v; }); } } if (message.paidAt !== undefined) { obj.paidAt = message.paidAt.toISOString(); } if (message.createdAt !== undefined) { obj.createdAt = message.createdAt.toISOString(); } if (message.updatedAt !== undefined) { obj.updatedAt = message.updatedAt.toISOString(); } if (message.nin !== "") { obj.nin = message.nin; } if (message.passport !== "") { obj.passport = message.passport; } return obj; }, create(base) { return exports.Payment.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v; const message = createBasePayment(); message.id = (_a = object.id) !== null && _a !== void 0 ? _a : ""; message.reference = (_b = object.reference) !== null && _b !== void 0 ? _b : ""; message.customerEmail = (_c = object.customerEmail) !== null && _c !== void 0 ? _c : ""; message.customerPhone = (_d = object.customerPhone) !== null && _d !== void 0 ? _d : ""; message.customerName = (_e = object.customerName) !== null && _e !== void 0 ? _e : ""; message.amount = (_f = object.amount) !== null && _f !== void 0 ? _f : 0; message.currency = (_g = object.currency) !== null && _g !== void 0 ? _g : ""; message.status = (_h = object.status) !== null && _h !== void 0 ? _h : ""; message.paymentMethod = (_j = object.paymentMethod) !== null && _j !== void 0 ? _j : ""; message.paymentType = (_k = object.paymentType) !== null && _k !== void 0 ? _k : ""; message.gatewayResponse = (_l = object.gatewayResponse) !== null && _l !== void 0 ? _l : ""; message.paystackTransactionId = (_m = object.paystackTransactionId) !== null && _m !== void 0 ? _m : 0; message.paystackAccessCode = (_o = object.paystackAccessCode) !== null && _o !== void 0 ? _o : ""; message.authorizationUrl = (_p = object.authorizationUrl) !== null && _p !== void 0 ? _p : ""; message.metadata = Object.entries((_q = object.metadata) !== null && _q !== void 0 ? _q : {}).reduce((acc, [key, value]) => { if (value !== undefined) { acc[key] = globalThis.String(value); } return acc; }, {}); message.paidAt = (_r = object.paidAt) !== null && _r !== void 0 ? _r : undefined; message.createdAt = (_s = object.createdAt) !== null && _s !== void 0 ? _s : undefined; message.updatedAt = (_t = object.updatedAt) !== null && _t !== void 0 ? _t : undefined; message.nin = (_u = object.nin) !== null && _u !== void 0 ? _u : ""; message.passport = (_v = object.passport) !== null && _v !== void 0 ? _v : ""; return message; }, }; function createBasePayment_MetadataEntry() { return { key: "", value: "" }; } exports.Payment_MetadataEntry = { encode(message, writer = new wire_1.BinaryWriter()) { if (message.key !== "") { writer.uint32(10).string(message.key); } if (message.value !== "") { writer.uint32(18).string(message.value); } return writer; }, decode(input, length) { const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBasePayment_MetadataEntry(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.key = reader.string(); continue; } case 2: { if (tag !== 18) { break; } message.value = reader.string(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { key: isSet(object.key) ? globalThis.String(object.key) : "", value: isSet(object.value) ? globalThis.String(object.value) : "", }; }, toJSON(message) { const obj = {}; if (message.key !== "") { obj.key = message.key; } if (message.value !== "") { obj.value = message.value; } return obj; }, create(base) { return exports.Payment_MetadataEntry.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a, _b; const message = createBasePayment_MetadataEntry(); message.key = (_a = object.key) !== null && _a !== void 0 ? _a : ""; message.value = (_b = object.value) !== null && _b !== void 0 ? _b : ""; return message; }, }; function createBaseInitializePaymentRequest() { return { email: "", phone: "", customerName: "", amount: 0, currency: "", callbackUrl: "", metadata: {}, channels: [], nin: "", passport: "", paymentType: "", }; } exports.InitializePaymentRequest = { encode(message, writer = new wire_1.BinaryWriter()) { if (message.email !== "") { writer.uint32(10).string(message.email); } if (message.phone !== "") { writer.uint32(18).string(message.phone); } if (message.customerName !== "") { writer.uint32(26).string(message.customerName); } if (message.amount !== 0) { writer.uint32(32).int64(message.amount); } if (message.currency !== "") { writer.uint32(42).string(message.currency); } if (message.callbackUrl !== "") { writer.uint32(50).string(message.callbackUrl); } Object.entries(message.metadata).forEach(([key, value]) => { exports.InitializePaymentRequest_MetadataEntry.encode({ key: key, value }, writer.uint32(58).fork()).join(); }); for (const v of message.channels) { writer.uint32(66).string(v); } if (message.nin !== "") { writer.uint32(74).string(message.nin); } if (message.passport !== "") { writer.uint32(82).string(message.passport); } if (message.paymentType !== "") { writer.uint32(90).string(message.paymentType); } return writer; }, decode(input, length) { const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseInitializePaymentRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.email = reader.string(); continue; } case 2: { if (tag !== 18) { break; } message.phone = reader.string(); continue; } case 3: { if (tag !== 26) { break; } message.customerName = reader.string(); continue; } case 4: { if (tag !== 32) { break; } message.amount = longToNumber(reader.int64()); continue; } case 5: { if (tag !== 42) { break; } message.currency = reader.string(); continue; } case 6: { if (tag !== 50) { break; } message.callbackUrl = reader.string(); continue; } case 7: { if (tag !== 58) { break; } const entry7 = exports.InitializePaymentRequest_MetadataEntry.decode(reader, reader.uint32()); if (entry7.value !== undefined) { message.metadata[entry7.key] = entry7.value; } continue; } case 8: { if (tag !== 66) { break; } message.channels.push(reader.string()); continue; } case 9: { if (tag !== 74) { break; } message.nin = reader.string(); continue; } case 10: { if (tag !== 82) { break; } message.passport = reader.string(); continue; } case 11: { if (tag !== 90) { break; } message.paymentType = reader.string(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { email: isSet(object.email) ? globalThis.String(object.email) : "", phone: isSet(object.phone) ? globalThis.String(object.phone) : "", customerName: isSet(object.customerName) ? globalThis.String(object.customerName) : "", amount: isSet(object.amount) ? globalThis.Number(object.amount) : 0, currency: isSet(object.currency) ? globalThis.String(object.currency) : "", callbackUrl: isSet(object.callbackUrl) ? globalThis.String(object.callbackUrl) : "", metadata: isObject(object.metadata) ? Object.entries(object.metadata).reduce((acc, [key, value]) => { acc[key] = String(value); return acc; }, {}) : {}, channels: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.channels) ? object.channels.map((e) => globalThis.String(e)) : [], nin: isSet(object.nin) ? globalThis.String(object.nin) : "", passport: isSet(object.passport) ? globalThis.String(object.passport) : "", paymentType: isSet(object.paymentType) ? globalThis.String(object.paymentType) : "", }; }, toJSON(message) { var _a; const obj = {}; if (message.email !== "") { obj.email = message.email; } if (message.phone !== "") { obj.phone = message.phone; } if (message.customerName !== "") { obj.customerName = message.customerName; } if (message.amount !== 0) { obj.amount = Math.round(message.amount); } if (message.currency !== "") { obj.currency = message.currency; } if (message.callbackUrl !== "") { obj.callbackUrl = message.callbackUrl; } if (message.metadata) { const entries = Object.entries(message.metadata); if (entries.length > 0) { obj.metadata = {}; entries.forEach(([k, v]) => { obj.metadata[k] = v; }); } } if ((_a = message.channels) === null || _a === void 0 ? void 0 : _a.length) { obj.channels = message.channels; } if (message.nin !== "") { obj.nin = message.nin; } if (message.passport !== "") { obj.passport = message.passport; } if (message.paymentType !== "") { obj.paymentType = message.paymentType; } return obj; }, create(base) { return exports.InitializePaymentRequest.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; const message = createBaseInitializePaymentRequest(); message.email = (_a = object.email) !== null && _a !== void 0 ? _a : ""; message.phone = (_b = object.phone) !== null && _b !== void 0 ? _b : ""; message.customerName = (_c = object.customerName) !== null && _c !== void 0 ? _c : ""; message.amount = (_d = object.amount) !== null && _d !== void 0 ? _d : 0; message.currency = (_e = object.currency) !== null && _e !== void 0 ? _e : ""; message.callbackUrl = (_f = object.callbackUrl) !== null && _f !== void 0 ? _f : ""; message.metadata = Object.entries((_g = object.metadata) !== null && _g !== void 0 ? _g : {}).reduce((acc, [key, value]) => { if (value !== undefined) { acc[key] = globalThis.String(value); } return acc; }, {}); message.channels = ((_h = object.channels) === null || _h === void 0 ? void 0 : _h.map((e) => e)) || []; message.nin = (_j = object.nin) !== null && _j !== void 0 ? _j : ""; message.passport = (_k = object.passport) !== null && _k !== void 0 ? _k : ""; message.paymentType = (_l = object.paymentType) !== null && _l !== void 0 ? _l : ""; return message; }, }; function createBaseInitializePaymentRequest_MetadataEntry() { return { key: "", value: "" }; } exports.InitializePaymentRequest_MetadataEntry = { encode(message, writer = new wire_1.BinaryWriter()) { if (message.key !== "") { writer.uint32(10).string(message.key); } if (message.value !== "") { writer.uint32(18).string(message.value); } return writer; }, decode(input, length) { const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseInitializePaymentRequest_MetadataEntry(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.key = reader.string(); continue; } case 2: { if (tag !== 18) { break; } message.value = reader.string(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { key: isSet(object.key) ? globalThis.String(object.key) : "", value: isSet(object.value) ? globalThis.String(object.value) : "", }; }, toJSON(message) { const obj = {}; if (message.key !== "") { obj.key = message.key; } if (message.value !== "") { obj.value = message.value; } return obj; }, create(base) { return exports.InitializePaymentRequest_MetadataEntry.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a, _b; const message = createBaseInitializePaymentRequest_MetadataEntry(); message.key = (_a = object.key) !== null && _a !== void 0 ? _a : ""; message.value = (_b = object.value) !== null && _b !== void 0 ? _b : ""; return message; }, }; function createBaseInitializePaymentResponse() { return { reference: "", authorizationUrl: "", accessCode: "" }; } exports.InitializePaymentResponse = { encode(message, writer = new wire_1.BinaryWriter()) { if (message.reference !== "") { writer.uint32(10).string(message.reference); } if (message.authorizationUrl !== "") { writer.uint32(18).string(message.authorizationUrl); } if (message.accessCode !== "") { writer.uint32(26).string(message.accessCode); } return writer; }, decode(input, length) { const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseInitializePaymentResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.reference = reader.string(); continue; } case 2: { if (tag !== 18) { break; } message.authorizationUrl = reader.string(); continue; } case 3: { if (tag !== 26) { break; } message.accessCode = reader.string(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { reference: isSet(object.reference) ? globalThis.String(object.reference) : "", authorizationUrl: isSet(object.authorizationUrl) ? globalThis.String(object.authorizationUrl) : "", accessCode: isSet(object.accessCode) ? globalThis.String(object.accessCode) : "", }; }, toJSON(message) { const obj = {}; if (message.reference !== "") { obj.reference = message.reference; } if (message.authorizationUrl !== "") { obj.authorizationUrl = message.authorizationUrl; } if (message.accessCode !== "") { obj.accessCode = message.accessCode; } return obj; }, create(base) { return exports.InitializePaymentResponse.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a, _b, _c; const message = createBaseInitializePaymentResponse(); message.reference = (_a = object.reference) !== null && _a !== void 0 ? _a : ""; message.authorizationUrl = (_b = object.authorizationUrl) !== null && _b !== void 0 ? _b : ""; message.accessCode = (_c = object.accessCode) !== null && _c !== void 0 ? _c : ""; return message; }, }; function createBaseVerifyPaymentResponse() { return { reference: "", status: "", amount: 0, currency: "", gatewayResponse: "", paidAt: undefined, channel: "", customer: undefined, meta: {}, authorization: undefined, }; } exports.VerifyPaymentResponse = { encode(message, writer = new wire_1.BinaryWriter()) { if (message.reference !== "") { writer.uint32(10).string(message.reference); } if (message.status !== "") { writer.uint32(18).string(message.status); } if (message.amount !== 0) { writer.uint32(24).int64(message.amount); } if (message.currency !== "") { writer.uint32(34).string(message.currency); } if (message.gatewayResponse !== "") { writer.uint32(42).string(message.gatewayResponse); } if (message.paidAt !== undefined) { timestamp_1.Timestamp.encode(toTimestamp(message.paidAt), writer.uint32(50).fork()).join(); } if (message.channel !== "") { writer.uint32(58).string(message.channel); } if (message.customer !== undefined) { exports.CustomerInfo.encode(message.customer, writer.uint32(66).fork()).join(); } Object.entries(message.meta).forEach(([key, value]) => { exports.VerifyPaymentResponse_MetaEntry.encode({ key: key, value }, writer.uint32(74).fork()).join(); }); if (message.authorization !== undefined) { exports.AuthorizationInfo.encode(message.authorization, writer.uint32(82).fork()).join(); } return writer; }, decode(input, length) { const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseVerifyPaymentResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.reference = reader.string(); continue; } case 2: { if (tag !== 18) { break; } message.status = reader.string(); continue; } case 3: { if (tag !== 24) { break; } message.amount = longToNumber(reader.int64()); continue; } case 4: { if (tag !== 34) { break; } message.currency = reader.string(); continue; } case 5: { if (tag !== 42) { break; } message.gatewayResponse = reader.string(); continue; } case 6: { if (tag !== 50) { break; } message.paidAt = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32())); continue; } case 7: { if (tag !== 58) { break; } message.channel = reader.string(); continue; } case 8: { if (tag !== 66) { break; } message.customer = exports.CustomerInfo.decode(reader, reader.uint32()); continue; } case 9: { if (tag !== 74) { break; } const entry9 = exports.VerifyPaymentResponse_MetaEntry.decode(reader, reader.uint32()); if (entry9.value !== undefined) { message.meta[entry9.key] = entry9.value; } continue; } case 10: { if (tag !== 82) { break; } message.authorization = exports.AuthorizationInfo.decode(reader, reader.uint32()); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { reference: isSet(object.reference) ? globalThis.String(object.reference) : "", status: isSet(object.status) ? globalThis.String(object.status) : "", amount: isSet(object.amount) ? globalThis.Number(object.amount) : 0, currency: isSet(object.currency) ? globalThis.String(object.currency) : "", gatewayResponse: isSet(object.gatewayResponse) ? globalThis.String(object.gatewayResponse) : "", paidAt: isSet(object.paidAt) ? fromJsonTimestamp(object.paidAt) : undefined, channel: isSet(object.channel) ? globalThis.String(object.channel) : "", customer: isSet(object.customer) ? exports.CustomerInfo.fromJSON(object.customer) : undefined, meta: isObject(object.meta) ? Object.entries(object.meta).reduce((acc, [key, value]) => { acc[key] = String(value); return acc; }, {}) : {}, authorization: isSet(object.authorization) ? exports.AuthorizationInfo.fromJSON(object.authorization) : undefined, }; }, toJSON(message) { const obj = {}; if (message.reference !== "") { obj.reference = message.reference; } if (message.status !== "") { obj.status = message.status; } if (message.amount !== 0) { obj.amount = Math.round(message.amount); } if (message.currency !== "") { obj.currency = message.currency; } if (message.gatewayResponse !== "") { obj.gatewayResponse = message.gatewayResponse; } if (message.paidAt !== undefined) { obj.paidAt = message.paidAt.toISOString(); } if (message.channel !== "") { obj.channel = message.channel; } if (message.customer !== undefined) { obj.customer = exports.CustomerInfo.toJSON(message.customer); } if (message.meta) { const entries = Object.entries(message.meta); if (entries.length > 0) { obj.meta = {}; entries.forEach(([k, v]) => { obj.meta[k] = v; }); } } if (message.authorization !== undefined) { obj.authorization = exports.AuthorizationInfo.toJSON(message.authorization); } return obj; }, create(base) { return exports.VerifyPaymentResponse.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a, _b, _c, _d, _e, _f, _g, _h; const message = createBaseVerifyPaymentResponse(); message.reference = (_a = object.reference) !== null && _a !== void 0 ? _a : ""; message.status = (_b = object.status) !== null && _b !== void 0 ? _b : ""; message.amount = (_c = object.amount) !== null && _c !== void 0 ? _c : 0; message.currency = (_d = object.currency) !== null && _d !== void 0 ? _d : ""; message.gatewayResponse = (_e = object.gatewayResponse) !== null && _e !== void 0 ? _e : ""; message.paidAt = (_f = object.paidAt) !== null && _f !== void 0 ? _f : undefined; message.channel = (_g = object.channel) !== null && _g !== void 0 ? _g : ""; message.customer = (object.customer !== undefined && object.customer !== null) ? exports.CustomerInfo.fromPartial(object.customer) : undefined; message.meta = Object.entries((_h = object.meta) !== null && _h !== void 0 ? _h : {}).reduce((acc, [key, value]) => { if (value !== undefined) { acc[key] = globalThis.String(value); } return acc; }, {}); message.authorization = (object.authorization !== undefined && object.authorization !== null) ? exports.AuthorizationInfo.fromPartial(object.authorization) : undefined; return message; }, }; function createBaseVerifyPaymentResponse_MetaEntry() { return { key: "", value: "" }; } exports.VerifyPaymentResponse_MetaEntry = { encode(message, writer = new wire_1.BinaryWriter()) { if (message.key !== "") { writer.uint32(10).string(message.key); } if (message.value !== "") { writer.uint32(18).string(message.value); } return writer; }, decode(input, length) { const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseVerifyPaymentResponse_MetaEntry(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 10) { break; } message.key = reader.string(); continue; } case 2: { if (tag !== 18) { break; } message.value = reader.string(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { key: isSet(object.key) ? globalThis.String(object.key) : "", value: isSet(object.value) ? globalThis.String(object.value) : "", }; }, toJSON(message) { const obj = {}; if (message.key !== "") { obj.key = message.key; } if (message.value !== "") { obj.value = message.value; } return obj; }, create(base) { return exports.VerifyPaymentResponse_MetaEntry.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a, _b; const message = createBaseVerifyPaymentResponse_MetaEntry(); message.key = (_a = object.key) !== null && _a !== void 0 ? _a : ""; message.value = (_b = object.value) !== null && _b !== void 0 ? _b : ""; return message; }, }; function createBaseCustomerInfo() { return { id: 0, fullName: "", email: "", customerCode: "", phone: "" }; } exports.CustomerInfo = { encode(message, writer = new wire_1.BinaryWriter()) { if (message.id !== 0) { writer.uint32(8).int64(message.id); } if (message.fullName !== "") { writer.uint32(18).string(message.fullName); } if (message.email !== "") { writer.uint32(26).string(message.email); } if (message.customerCode !== "") { writer.uint32(34).string(message.customerCode); } if (message.phone !== "") { writer.uint32(42).string(message.phone); } return writer; }, decode(input, length) { const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseCustomerInfo(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 8) { break; } message.id = longToNumber(reader.int64()); continue; } case 2: { if (tag !== 18) { break; } message.fullName = reader.string(); continue; } case 3: { if (tag !== 26) { break; } message.email = reader.string(); continue; } case 4: { if (tag !== 34) { break; } message.customerCode = reader.string(); continue; } case 5: { if (tag !== 42) { break; } message.phone = reader.string(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { id: isSet(object.id) ? globalThis.Number(object.id) : 0, fullName: isSet(object.fullName) ? globalThis.String(object.fullName) : "", email: isSet(object.email) ? globalThis.String(object.email) : "", customerCode: isSet(object.customerCode) ? globalThis.String(object.customerCode) : "", phone: isSet(object.phone) ? globalThis.String(object.phone) : "", }; }, toJSON(message) { const obj = {}; if (message.id !== 0) { obj.id = Math.round(message.id); } if (message.fullName !== "") { obj.fullName = message.fullName; } if (message.email !== "") { obj.email = message.email; } if (message.customerCode !== "") { obj.customerCode = message.customerCode; } if (message.phone !== "") { obj.phone = message.phone; } return obj; }, create(base) { return exports.CustomerInfo.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a, _b, _c, _d, _e; const message = createBaseCustomerInfo(); message.id = (_a = object.id) !== null && _a !== void 0 ? _a : 0; message.fullName = (_b = object.fullName) !== null && _b !== void 0 ? _b : ""; message.email = (_c = object.email) !== null && _c !== void 0 ? _c : ""; message.customerCode = (_d = object.customerCode) !== null && _d !== void 0 ? _d : ""; message.phone = (_e = object.phone) !== null && _e !== void 0 ? _e : ""; return message; }, }; function createBaseAuthorizationInfo() { return { authorizationCode: "", bin: "", last4: "", expMonth: "", expYear: "", channel: "", cardType: "", bank: "", countryCode: "", brand: "", reusable: false, }; } exports.AuthorizationInfo = { encode(message, writer = new wire_1.BinaryWriter()) { if (message.authorizationCode !== "") { writer.uint32(10).string(message.authorizationCode); } if (message.bin !== "") { writer.uint32(18).string(message.bin); } if (message.last4 !== "") { writer.uint32(26).string(message.last4); } if (message.expMonth !== "") { writer.uint32(34).string(message.expMonth); } if (message.expYear !== "") { writer.uint32(42).string(message.expYear); } if (message.channel !== "") { writer.uint32(50).string(message.channel); } if (message.cardType !== "") { writer.uint32(58).string(message.cardType); } if (message.bank !== "") { writer.uint32(66).string(message.bank); } if (message.countryCode !== "") { writer.uint32(74).string(message.countryCode); } if (message.brand !== "") { writer.uint32(82).string(message.brand); } if (message.reusable !== false) { writer.uint32(88).bool(message.reusable); } return writer; }, decode(input, length) { const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input); const end = length === undefined ? reader.len : reader.p