Skip to content

Commit

Permalink
Merge pull request globalpayments#2 from Developer-Experience/ucp-par…
Browse files Browse the repository at this point in the history
…tner-url

correct insertBefore logic
  • Loading branch information
hpsTony authored and GitHub Enterprise committed Jan 24, 2022
2 parents 276ada5 + 15ffc53 commit 6a934f5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 15 deletions.
35 changes: 21 additions & 14 deletions packages/globalpayments-js/examples/heartland.html
Original file line number Diff line number Diff line change
Expand Up @@ -138,28 +138,35 @@ <h2>Drop-in Track reader</h2>
cardExternalTrigger.addEventListener('click', function (e) {
e.preventDefault();

for (var type in cardForm.fields) {
if (type === "submit") {
// manually include submit button
const fields = ['submit'];
const target = cardForm.frames['card-number'];

for (const type in cardForm.frames) {
if (cardForm.frames.hasOwnProperty(type)) {
fields.push(type);
}
}

for (const type in cardForm.frames) {
if (!cardForm.frames.hasOwnProperty(type)) {
continue;
}

var field = cardForm.frames[type];
const frame = cardForm.frames[type];

if (!field) {
if (!frame) {
continue;
}

GlobalPayments.internal.postMessage.post(
{
data: {
fields: cardForm.fields,
target: cardForm.frames["card-number"].id
},
id: field.id,
type: "ui:iframe-field:request-data",
GlobalPayments.internal.postMessage.post({
data: {
fields: fields,
target: target.id
},
field.id
);
id: frame.id,
type: 'ui:iframe-field:request-data'
}, frame.id);
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion packages/globalpayments-js/src/ui/iframe-field/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ export class IframeField extends EventEmitter {
}

if (this.container.hasChildNodes()) {
this.container.insertBefore(this.frame, this.container);
this.container.insertBefore(this.frame, this.container.firstChild);
} else {
this.container.appendChild(this.frame);
}
Expand Down

0 comments on commit 6a934f5

Please sign in to comment.